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

Proposed by Arthur Mello
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 781
Merged at revision: 780
Proposed branch: lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610
Merge into: lp:ubuntu-calendar-app
Diff against target: 304 lines (+94/-21)
7 files modified
EventActions.qml (+3/-3)
NewEvent.qml (+4/-4)
NewEventBottomEdge.qml (+2/-0)
PageWithBottomEdge.qml (+1/-0)
RemindersModel.qml (+5/-3)
SettingsPage.qml (+70/-11)
calendar.qml (+9/-0)
To merge this branch: bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing
Renato Araujo Oliveira Filho (community) Approve
Review via email: mp+288969@code.launchpad.net

Commit message

Add support to set a default reminder value time from settings page

Description of the change

Add support to set a default reminder value time from settings page

To post a comment you must log in.
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Chekc my inline comments. I have some suggestion how to implement it in a better way.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

code looks good.
Works as expected.

review: Approve
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

agenda view still not using the configured value.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

works nice.

review: Approve
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https://code.launchpad.net/~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1554610/+merge/288969/+edit-commit-message

review: Needs Fixing (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Added commit message to fix failed autolanding.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'EventActions.qml'
2--- EventActions.qml 2016-03-04 16:10:56 +0000
3+++ EventActions.qml 2016-03-14 20:38:42 +0000
4@@ -19,6 +19,7 @@
5 import QtQuick 2.4
6 import Ubuntu.Components 1.3
7 import Ubuntu.SyncMonitor 0.1
8+import Qt.labs.settings 1.0
9
10 Item {
11 id: actionPool
12@@ -26,6 +27,7 @@
13 property alias showCalendarAction: _showCalendarAction
14 property alias syncCalendarAction: _syncCalendarAction
15 property alias settingsAction: _settingsAction
16+ property Settings settings
17 readonly property bool syncInProgress: (syncMonitor.state === "syncing")
18
19 Action {
20@@ -62,8 +64,6 @@
21 name: "calendarsbutton"
22 iconName: "settings"
23 text: i18n.tr("Settings")
24- onTriggered: {
25- pageStack.push(Qt.resolvedUrl("Settings.qml"));
26- }
27+ onTriggered: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"),{"settings": actionPool.settings});
28 }
29 }
30
31=== modified file 'NewEvent.qml'
32--- NewEvent.qml 2016-03-07 17:57:04 +0000
33+++ NewEvent.qml 2016-03-14 20:38:42 +0000
34@@ -42,6 +42,8 @@
35
36 property var startDate;
37 property var endDate;
38+ //default reminder time = 15 min
39+ property int reminderValue: 900;
40
41 property alias scrollY: flickable.contentY
42 property bool isEdit: false
43@@ -245,13 +247,11 @@
44
45 VisualReminder{
46 id: visualReminder
47- //default reminder time = 15 min
48- secondsBeforeStart: 900
49+ secondsBeforeStart: root.reminderValue
50 }
51 AudibleReminder{
52 id: audibleReminder
53- //default reminder time = 15 min
54- secondsBeforeStart: 900
55+ secondsBeforeStart: root.reminderValue
56 }
57
58 function getDaysOfWeek(){
59
60=== modified file 'NewEventBottomEdge.qml'
61--- NewEventBottomEdge.qml 2016-03-07 17:57:04 +0000
62+++ NewEventBottomEdge.qml 2016-03-14 20:38:42 +0000
63@@ -26,6 +26,7 @@
64 property var pageStack: null
65 property var eventModel: null
66 property var date: new Date()
67+ property int reminderValue
68
69 // WORKAROUND: BottomEdge component loads the page async while draging it
70 // this cause a very bad visual.
71@@ -93,6 +94,7 @@
72
73 implicitWidth: bottomEdge.width
74 implicitHeight: bottomEdge.height
75+ reminderValue: bottomEdge.reminderValue
76 model: bottomEdge.eventModel
77 date: bottomEdge.date
78 enabled: bottomEdge.status === BottomEdge.Committed
79
80=== modified file 'PageWithBottomEdge.qml'
81--- PageWithBottomEdge.qml 2016-03-07 17:57:04 +0000
82+++ PageWithBottomEdge.qml 2016-03-14 20:38:42 +0000
83@@ -23,6 +23,7 @@
84
85 property alias model: bottomEdge.eventModel
86 property alias createEventAt: bottomEdge.date
87+ property alias reminderValue: bottomEdge.reminderValue
88 property bool bootomEdgeEnabled: bottomEdge.enabled
89
90 signal bottomEdgeCommitStarted()
91
92=== modified file 'RemindersModel.qml'
93--- RemindersModel.qml 2016-01-25 13:20:32 +0000
94+++ RemindersModel.qml 2016-03-14 20:38:42 +0000
95@@ -20,9 +20,10 @@
96
97 ListModel {
98 id: reminderModel
99- Component.onCompleted: initialise()
100-
101- function initialise() {
102+
103+ signal loaded()
104+
105+ Component.onCompleted: {
106 reminderModel.append({ "label": i18n.tr("No Reminder"), "value": -1 })
107 // TRANSLATORS: this refers to when a reminder should be shown as a notification
108 // in the indicators. "On Event" means that it will be shown right at the time
109@@ -37,6 +38,7 @@
110 reminderModel.append({ "label": i18n.tr("2 days"), "value": 172800 })
111 reminderModel.append({ "label": i18n.tr("1 week"), "value": 604800 })
112 reminderModel.append({ "label": i18n.tr("2 weeks"), "value": 1209600 })
113+ reminderModel.loaded()
114 }
115 }
116
117
118=== renamed file 'Settings.qml' => 'SettingsPage.qml'
119--- Settings.qml 2016-03-02 19:55:52 +0000
120+++ SettingsPage.qml 2016-03-14 20:38:42 +0000
121@@ -18,11 +18,28 @@
122
123 import QtQuick 2.4
124 import Ubuntu.Components 1.3
125+import Qt.labs.settings 1.0
126
127 Page {
128 id: settingsPage
129 objectName: "settings"
130
131+ property Settings settings: undefined
132+
133+ Binding {
134+ target: settingsPage.settings
135+ property: "showWeekNumber"
136+ value: weekCheckBox.checked
137+ when: settings
138+ }
139+
140+ Binding {
141+ target: settingsPage.settings
142+ property: "showLunarCalendar"
143+ value: lunarCalCheckBox.checked
144+ when: settings
145+ }
146+
147 visible: false
148
149 header: PageHeader {
150@@ -30,15 +47,12 @@
151 leadingActionBar.actions: Action {
152 text: i18n.tr("Back")
153 iconName: "back"
154- onTriggered: {
155- pop()
156- }
157+ onTriggered: pop()
158 }
159 }
160
161- Component.onCompleted: {
162- weekCheckBox.checked = mainView.displayWeekNumber
163- lunarCalCheckBox.checked = mainView.displayLunarCalendar
164+ RemindersModel {
165+ id: remindersModel
166 }
167
168 Column {
169@@ -57,9 +71,7 @@
170 id: weekCheckBox
171 objectName: "weekCheckBox"
172 SlotsLayout.position: SlotsLayout.Last
173- onCheckedChanged: {
174- mainView.displayWeekNumber = weekCheckBox.checked
175- }
176+ checked: settings ? settings.showWeekNumber : false
177 }
178 }
179 }
180@@ -73,8 +85,55 @@
181 id: lunarCalCheckBox
182 objectName: "lunarCalCheckbox"
183 SlotsLayout.position: SlotsLayout.Last
184- onCheckedChanged: {
185- mainView.displayLunarCalendar = lunarCalCheckBox.checked
186+ checked: settings ? settings.showLunarCalendar : false
187+ }
188+ }
189+ }
190+
191+ ListItem {
192+ id: defaultReminderItem
193+
194+ visible: defaultReminderOptionSelector.model && defaultReminderOptionSelector.model.count > 0
195+ height: visible ? defaultReminderLayout.height + divider.height : 0
196+
197+ Connections {
198+ target: remindersModel
199+ onLoaded: {
200+ if (!defaultReminderOptionSelector.model) {
201+ return
202+ }
203+
204+ for (var i=0; i<defaultReminderOptionSelector.model.count; ++i) {
205+ var reminder = defaultReminderOptionSelector.model.get(i)
206+ if (reminder.value === settings.reminderDefaultValue) {
207+ defaultReminderOptionSelector.selectedIndex = i
208+ return
209+ }
210+ }
211+
212+ defaultReminderOptionSelector.selectedIndex = 0
213+ }
214+ }
215+
216+ SlotsLayout {
217+ id: defaultReminderLayout
218+
219+ mainSlot: Item {
220+ height: defaultReminderOptionSelector.height
221+
222+ OptionSelector {
223+ id: defaultReminderOptionSelector
224+
225+ text: i18n.tr("Default reminder")
226+ model: remindersModel
227+ containerHeight: itemHeight * 4
228+
229+ delegate: OptionSelectorDelegate {
230+ text: label
231+ height: units.gu(4)
232+ }
233+
234+ onDelegateClicked: settings.reminderDefaultValue = model.get(index).value
235 }
236 }
237 }
238
239=== modified file 'calendar.qml'
240--- calendar.qml 2016-03-07 15:58:43 +0000
241+++ calendar.qml 2016-03-14 20:38:42 +0000
242@@ -28,6 +28,7 @@
243
244 property bool displayWeekNumber: false;
245 property bool displayLunarCalendar: false;
246+ property int reminderDefaultValue: 900;
247 readonly property bool syncInProgress: commonHeaderActions.syncInProgress
248
249 // Work-around until this branch lands:
250@@ -259,12 +260,15 @@
251
252 EventActions {
253 id: commonHeaderActions
254+ settings: settings
255 }
256
257 Settings {
258 id: settings
259 property alias defaultViewIndex: tabs.selectedTabIndex
260 property alias showWeekNumber: mainView.displayWeekNumber
261+ property alias showLunarCalendar: mainView.displayLunarCalendar
262+ property alias reminderDefaultValue: mainView.reminderDefaultValue
263 }
264
265 Tabs{
266@@ -570,6 +574,7 @@
267 YearView {
268 readonly property bool tabSelected: tabs.selectedTabIndex === yearTab.index
269
270+ reminderValue: mainView.reminderDefaultValue
271 model: eventModel.isReady ? eventModel : null
272 bootomEdgeEnabled: tabSelected
273 displayLunarCalendar: mainView.displayLunarCalendar
274@@ -603,6 +608,7 @@
275 MonthView {
276 readonly property bool tabSelected: tabs.selectedTabIndex === monthTab.index
277
278+ reminderValue: mainView.reminderDefaultValue
279 model: eventModel.isReady ? eventModel : null
280 bootomEdgeEnabled: tabSelected
281 displayLunarCalendar: mainView.displayLunarCalendar
282@@ -640,6 +646,7 @@
283 WeekView {
284 readonly property bool tabSelected: tabs.selectedTab === weekTab
285
286+ reminderValue: mainView.reminderDefaultValue
287 model: eventModel.isReady ? eventModel : null
288 bootomEdgeEnabled: tabSelected
289 displayLunarCalendar: mainView.displayLunarCalendar
290@@ -687,6 +694,7 @@
291 DayView {
292 readonly property bool tabSelected: tabs.selectedTabIndex === dayTab.index
293
294+ reminderValue: mainView.reminderDefaultValue
295 model: eventModel.isReady ? eventModel : null
296 bootomEdgeEnabled: tabSelected
297 displayLunarCalendar: mainView.displayLunarCalendar
298@@ -724,6 +732,7 @@
299 id: agendaViewComp
300
301 AgendaView {
302+ reminderValue: mainView.reminderDefaultValue
303 model: eventModel.isReady ? eventModel : null
304 bootomEdgeEnabled: tabs.selectedTabIndex === agendaTab.index
305

Subscribers

People subscribed via source and target branches

to status/vote changes: