← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610 into lp:ubuntu-calendar-app

 

Arthur Mello has proposed merging lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610 into lp:ubuntu-calendar-app.

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1554610 in Ubuntu Calendar App: "Need setting for default reminder time"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1554610

For more details, see:
https://code.launchpad.net/~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610/+merge/288969

Add support to set a default reminder value time from settings page
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610 into lp:ubuntu-calendar-app.
=== modified file 'EventActions.qml'
--- EventActions.qml	2016-03-04 16:10:56 +0000
+++ EventActions.qml	2016-03-14 19:04:24 +0000
@@ -26,8 +26,16 @@
     property alias showCalendarAction: _showCalendarAction
     property alias syncCalendarAction: _syncCalendarAction
     property alias settingsAction: _settingsAction
+    property alias displayLunarCalendar: settingsPage.displayLunarCalendar
+    property alias displayWeekNumber: settingsPage.displayWeekNumber
+    property alias reminderDefaultValue: settingsPage.reminderDefaultValue
     readonly property bool syncInProgress: (syncMonitor.state === "syncing")
 
+    Settings {
+        id: settingsPage
+        onBackRequested: pageStack.pop()
+    }
+
     Action {
         id: _syncCalendarAction
         objectName: "syncbutton"
@@ -62,8 +70,6 @@
         name: "calendarsbutton"
         iconName: "settings"
         text: i18n.tr("Settings")
-        onTriggered: {
-            pageStack.push(Qt.resolvedUrl("Settings.qml"));
-        }
+        onTriggered: pageStack.push(settingsPage);
     }
 }

=== modified file 'NewEvent.qml'
--- NewEvent.qml	2016-03-07 17:57:04 +0000
+++ NewEvent.qml	2016-03-14 19:04:24 +0000
@@ -42,6 +42,8 @@
 
     property var startDate;
     property var endDate;
+    //default reminder time = 15 min
+    property int reminderValue;
 
     property alias scrollY: flickable.contentY
     property bool isEdit: false
@@ -245,13 +247,11 @@
 
     VisualReminder{
         id: visualReminder
-        //default reminder time = 15 min
-        secondsBeforeStart: 900
+        secondsBeforeStart: root.reminderValue
     }
     AudibleReminder{
         id: audibleReminder
-        //default reminder time = 15 min
-        secondsBeforeStart: 900
+        secondsBeforeStart: root.reminderValue
     }
 
     function getDaysOfWeek(){

=== modified file 'NewEventBottomEdge.qml'
--- NewEventBottomEdge.qml	2016-03-07 17:57:04 +0000
+++ NewEventBottomEdge.qml	2016-03-14 19:04:24 +0000
@@ -26,6 +26,7 @@
     property var pageStack: null
     property var eventModel: null
     property var date: new Date()
+    property int reminderValue
 
     // WORKAROUND: BottomEdge component loads the page async while draging it
     // this cause a very bad visual.
@@ -93,6 +94,7 @@
 
             implicitWidth: bottomEdge.width
             implicitHeight: bottomEdge.height
+            reminderValue: bottomEdge.reminderValue
             model: bottomEdge.eventModel
             date: bottomEdge.date
             enabled: bottomEdge.status === BottomEdge.Committed

=== modified file 'PageWithBottomEdge.qml'
--- PageWithBottomEdge.qml	2016-03-07 17:57:04 +0000
+++ PageWithBottomEdge.qml	2016-03-14 19:04:24 +0000
@@ -23,6 +23,7 @@
 
     property alias model: bottomEdge.eventModel
     property alias createEventAt: bottomEdge.date
+    property alias reminderValue: bottomEdge.reminderValue
     property bool bootomEdgeEnabled: bottomEdge.enabled
 
     signal bottomEdgeCommitStarted()

=== modified file 'RemindersModel.qml'
--- RemindersModel.qml	2016-01-25 13:20:32 +0000
+++ RemindersModel.qml	2016-03-14 19:04:24 +0000
@@ -20,9 +20,10 @@
 
 ListModel {
     id: reminderModel
-    Component.onCompleted: initialise()
-
-    function initialise() {
+
+    signal loaded()
+
+    Component.onCompleted: {
         reminderModel.append({ "label": i18n.tr("No Reminder"), "value": -1 })
         // TRANSLATORS: this refers to when a reminder should be shown as a notification
         // in the indicators. "On Event" means that it will be shown right at the time
@@ -37,6 +38,7 @@
         reminderModel.append({ "label": i18n.tr("2 days"), "value": 172800 })
         reminderModel.append({ "label": i18n.tr("1 week"), "value": 604800 })
         reminderModel.append({ "label": i18n.tr("2 weeks"), "value": 1209600 })
+        reminderModel.loaded()
     }
 }
 

=== modified file 'Settings.qml'
--- Settings.qml	2016-03-02 19:55:52 +0000
+++ Settings.qml	2016-03-14 19:04:24 +0000
@@ -23,6 +23,12 @@
     id: settingsPage
     objectName: "settings"
 
+    signal backRequested()
+
+    property alias displayWeekNumber: weekCheckBox.checked
+    property alias displayLunarCalendar: lunarCalCheckBox.checked
+    property int reminderDefaultValue: -1
+
     visible: false
 
     header: PageHeader {
@@ -30,15 +36,12 @@
         leadingActionBar.actions: Action {
             text: i18n.tr("Back")
             iconName: "back"
-            onTriggered: {
-                pop()
-            }
+            onTriggered: settingsPage.backRequested()
         }
     }
 
-    Component.onCompleted: {
-        weekCheckBox.checked = mainView.displayWeekNumber
-        lunarCalCheckBox.checked = mainView.displayLunarCalendar
+    RemindersModel {
+        id: remindersModel
     }
 
     Column {
@@ -57,9 +60,6 @@
                     id: weekCheckBox
                     objectName: "weekCheckBox"
                     SlotsLayout.position: SlotsLayout.Last
-                    onCheckedChanged: {
-                        mainView.displayWeekNumber = weekCheckBox.checked
-                    }
                 }
             }
         }
@@ -73,8 +73,54 @@
                     id: lunarCalCheckBox
                     objectName: "lunarCalCheckbox"
                     SlotsLayout.position: SlotsLayout.Last
-                    onCheckedChanged: {
-                        mainView.displayLunarCalendar = lunarCalCheckBox.checked
+                }
+            }
+        }
+
+        ListItem {
+            id: defaultReminderItem
+
+            visible: defaultReminderOptionSelector.model && defaultReminderOptionSelector.model.count > 0
+            height: visible ? defaultReminderLayout.height + divider.height : 0
+
+            Connections {
+                target: remindersModel
+                onLoaded: {
+                    if (!defaultReminderOptionSelector.model) {
+                        return
+                    }
+
+                    for (var i=0; i<defaultReminderOptionSelector.model.count; ++i) {
+                        var reminder = defaultReminderOptionSelector.model.get(i)
+                        if (reminder.value === settingsPage.reminderDefaultValue) {
+                            defaultReminderOptionSelector.selectedIndex = i
+                            return
+                        }
+                    }
+
+                    defaultReminderOptionSelector.selectedIndex = 0
+                }
+            }
+
+            SlotsLayout {
+                id: defaultReminderLayout
+
+                mainSlot: Item {
+                    height: defaultReminderOptionSelector.height
+
+                    OptionSelector {
+                        id: defaultReminderOptionSelector
+
+                        text: i18n.tr("Default reminder")
+                        model: remindersModel
+                        containerHeight: itemHeight * 4
+
+                        delegate: OptionSelectorDelegate {
+                            text: label
+                            height: units.gu(4)
+                        }
+
+                       onDelegateClicked: settingsPage.reminderDefaultValue = model.get(index).value
                     }
                 }
             }

=== modified file 'calendar.qml'
--- calendar.qml	2016-03-07 15:58:43 +0000
+++ calendar.qml	2016-03-14 19:04:24 +0000
@@ -28,6 +28,7 @@
 
     property bool displayWeekNumber: false;
     property bool displayLunarCalendar: false;
+    property int reminderDefaultValue: 900;
     readonly property bool syncInProgress: commonHeaderActions.syncInProgress
 
     // Work-around until this branch lands:
@@ -259,12 +260,22 @@
 
         EventActions {
             id: commonHeaderActions
+
+            displayWeekNumber: mainView.displayWeekNumber
+            displayLunarCalendar: mainView.displayLunarCalendar
+            reminderDefaultValue: mainView.reminderDefaultValue
+
+            onDisplayWeekNumberChanged: mainView.displayWeekNumber = displayWeekNumber
+            onDisplayLunarCalendarChanged: mainView.displayLunarCalendar = displayLunarCalendar
+            onReminderDefaultValueChanged: mainView.reminderDefaultValue = reminderDefaultValue 
         }
 
         Settings {
             id: settings
             property alias defaultViewIndex: tabs.selectedTabIndex
             property alias showWeekNumber: mainView.displayWeekNumber
+            property alias showLunarCalendar: mainView.displayLunarCalendar
+            property alias reminderDefaultValue: mainView.reminderDefaultValue
         }
 
         Tabs{
@@ -570,6 +581,7 @@
         YearView {
             readonly property bool tabSelected: tabs.selectedTabIndex === yearTab.index
 
+            reminderValue: mainView.reminderDefaultValue
             model: eventModel.isReady ? eventModel : null
             bootomEdgeEnabled: tabSelected
             displayLunarCalendar: mainView.displayLunarCalendar
@@ -603,6 +615,7 @@
         MonthView {
             readonly property bool tabSelected: tabs.selectedTabIndex === monthTab.index
 
+            reminderValue: mainView.reminderDefaultValue
             model: eventModel.isReady ? eventModel : null
             bootomEdgeEnabled: tabSelected
             displayLunarCalendar: mainView.displayLunarCalendar
@@ -640,6 +653,7 @@
         WeekView {
             readonly property bool tabSelected: tabs.selectedTab === weekTab
 
+            reminderValue: mainView.reminderDefaultValue
             model: eventModel.isReady ? eventModel : null
             bootomEdgeEnabled: tabSelected
             displayLunarCalendar: mainView.displayLunarCalendar
@@ -687,6 +701,7 @@
         DayView {
             readonly property bool tabSelected: tabs.selectedTabIndex === dayTab.index
 
+            reminderValue: mainView.reminderDefaultValue
             model: eventModel.isReady ? eventModel : null
             bootomEdgeEnabled: tabSelected
             displayLunarCalendar: mainView.displayLunarCalendar


Follow ups