← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~pkunal-parmar/ubuntu-calendar-app/MonthHighlight into lp:ubuntu-calendar-app

 

Kunal Parmar has proposed merging lp:~pkunal-parmar/ubuntu-calendar-app/MonthHighlight into lp:ubuntu-calendar-app.

Commit message:
Resolves #1432640
First tap set the highlight and then react to tap

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)

For more details, see:
https://code.launchpad.net/~pkunal-parmar/ubuntu-calendar-app/MonthHighlight/+merge/259323

Resolves #1432640
First tap set the highlight and then react to tap
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~pkunal-parmar/ubuntu-calendar-app/MonthHighlight into lp:ubuntu-calendar-app.
=== modified file 'MonthComponent.qml'
--- MonthComponent.qml	2015-03-05 21:59:16 +0000
+++ MonthComponent.qml	2015-05-17 02:24:48 +0000
@@ -111,6 +111,8 @@
 
         property int dateFontSize: FontUtils.sizeToPixels(root.dateLabelFontSize)
         property int dayFontSize: FontUtils.sizeToPixels(root.dayLabelFontSize)
+
+        property int selectedIndex: 0
     }
 
     Column{
@@ -216,6 +218,14 @@
 
             isToday: intern.todayDate == date && intern.isCurMonthTodayMonth
 
+            onIsTodayChanged: {
+                if( isToday ) {
+                    intern.selectedIndex = index
+                }
+            }
+
+            isSelected: intern.selectedIndex == index
+
             width: parent.dayWidth
             height: parent.dayHeight
             fontSize: intern.dateFontSize

=== modified file 'MonthComponentDateDelegate.qml'
--- MonthComponentDateDelegate.qml	2014-11-29 09:40:53 +0000
+++ MonthComponentDateDelegate.qml	2015-05-17 02:24:48 +0000
@@ -1,7 +1,7 @@
 import QtQuick 2.0
 import Ubuntu.Components 1.1
 
-Item{
+Rectangle{
     id: dateRootItem
 
     property int date;
@@ -10,6 +10,12 @@
     property bool showEvent;
     property alias fontSize: dateLabel.font.pixelSize
 
+    property bool isSelected: false
+
+    border.width: isSelected ? units.gu(0.3) : 0
+    border.color: UbuntuColors.orange
+    color: "transparent"
+
     Loader {
         sourceComponent: isToday && isCurrentMonth ? highLightComp : undefined
         onSourceComponentChanged: {
@@ -73,16 +79,20 @@
             pageStack.push(Qt.resolvedUrl("NewEvent.qml"), {"date":selectedDate, "model":eventModel});
         }
         onClicked: {
-            var selectedDate = new Date(intern.monthStartYear,
-                                        intern.monthStartMonth,
-                                        intern.monthStartDate + index, 0, 0, 0, 0)
-            //If monthView is clicked then open selected DayView
-            if ( isYearView === false ) {
-                root.dateSelected(selectedDate);
-            }
-            //If yearView is clicked then open selected MonthView
-            else {
-                root.monthSelected(selectedDate);
+            if( isSelected ) {
+                var selectedDate = new Date(intern.monthStartYear,
+                                            intern.monthStartMonth,
+                                            intern.monthStartDate + index, 0, 0, 0, 0)
+                //If monthView is clicked then open selected DayView
+                if ( isYearView === false ) {
+                    root.dateSelected(selectedDate);
+                }
+                //If yearView is clicked then open selected MonthView
+                else {
+                    root.monthSelected(selectedDate);
+                }
+            } else {
+                intern.selectedIndex = index
             }
         }
     }


Follow ups