Merge lp:~nik90/ubuntu-clock-app/fix-alarm-locale into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 197
Merged at revision: 191
Proposed branch: lp:~nik90/ubuntu-clock-app/fix-alarm-locale
Merge into: lp:ubuntu-clock-app
Diff against target: 233 lines (+39/-48)
9 files modified
app/alarm/AlarmDelegate.qml (+1/-1)
app/alarm/AlarmRepeat.qml (+21/-36)
app/alarm/EditAlarmPage.qml (+2/-2)
app/clock/ClockPage.qml (+1/-1)
app/clock/MainClock.qml (+1/-1)
app/ubuntu-clock-app.qml (+1/-1)
debian/changelog (+1/-0)
po/com.ubuntu.clock.pot (+5/-5)
tests/unit/tst_alarmRepeat.qml (+6/-1)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/fix-alarm-locale
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Clock Developers Pending
Review via email: mp+247242@code.launchpad.net

Commit message

Fixes the alarms repeat days-of-week picker to respect user locale

Description of the change

Fixes the alarms repeat days-of-week picker to respect user locale and also updates the copyright year to 2015 for the files that were edited this year.

Previously, the alarm days of the week were hardcoded from Mon-Sun...however this was bad since it did not respect the user locale. In this MP, I generate the alarm days of the week using Qt.locale() which provides info such as the first day of the week.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
194. By Nekhelesh Ramananthan

Readjusted code formatting to max 80 columns

195. By Nekhelesh Ramananthan

Updated copyright year to 2015 in the files that were changed this year

196. By Nekhelesh Ramananthan

Converted while loop into for loop

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
197. By Nekhelesh Ramananthan

Empty commit to kick jenkins

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmDelegate.qml'
2--- app/alarm/AlarmDelegate.qml 2015-01-21 21:15:10 +0000
3+++ app/alarm/AlarmDelegate.qml 2015-01-22 00:26:25 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2014 Canonical Ltd
7+ * Copyright (C) 2014-2015 Canonical Ltd
8 *
9 * This file is part of Ubuntu Clock App
10 *
11
12=== modified file 'app/alarm/AlarmRepeat.qml'
13--- app/alarm/AlarmRepeat.qml 2014-09-18 10:23:40 +0000
14+++ app/alarm/AlarmRepeat.qml 2015-01-22 00:26:25 +0000
15@@ -1,5 +1,5 @@
16 /*
17- * Copyright (C) 2014 Canonical Ltd
18+ * Copyright (C) 2014-2015 Canonical Ltd
19 *
20 * This file is part of Ubuntu Clock App
21 *
22@@ -27,6 +27,9 @@
23 // Property to set the alarm days of the week in the edit alarm page
24 property var alarm
25
26+ // Property to hold the alarm utils functions passed from edit alarm page
27+ property var alarmUtils
28+
29 visible: false
30 title: i18n.tr("Repeat")
31
32@@ -76,40 +79,22 @@
33
34 ListModel {
35 id: daysModel
36-
37- ListElement {
38- day: "1"
39- flag: Alarm.Monday
40- }
41-
42- ListElement {
43- day: "2"
44- flag: Alarm.Tuesday
45- }
46-
47- ListElement {
48- day: "3"
49- flag: Alarm.Wednesday
50- }
51-
52- ListElement {
53- day: "4"
54- flag: Alarm.Thursday
55- }
56-
57- ListElement {
58- day: "5"
59- flag: Alarm.Friday
60- }
61-
62- ListElement {
63- day: "6"
64- flag: Alarm.Saturday
65- }
66-
67- ListElement {
68- day: "0"
69- flag: Alarm.Sunday
70+ Component.onCompleted: initialise()
71+
72+ // Function to generate the days of the week based on the user locale
73+ function initialise() {
74+ // Get the first day of the week based on the user locale
75+ var j = Qt.locale().firstDayOfWeek
76+
77+ // Set first item on the list to be the first day of the week
78+ daysModel.append({ "day": Qt.locale().standaloneDayName(j, Locale.LongFormat),
79+ "flag": alarmUtils.get_alarm_day(j) })
80+
81+ // Retrieve the rest of the alarms days of the week
82+ for (var i=1; i<=6; i++) {
83+ daysModel.append({ "day": Qt.locale().standaloneDayName((j+i)%7, Locale.LongFormat),
84+ "flag": alarmUtils.get_alarm_day((j+i)%7) })
85+ }
86 }
87 }
88
89@@ -141,7 +126,7 @@
90 }
91
92 color: UbuntuColors.midAubergine
93- text: Qt.locale().standaloneDayName(day, Locale.LongFormat)
94+ text: day
95 }
96
97 control: CheckBox {
98
99=== modified file 'app/alarm/EditAlarmPage.qml'
100--- app/alarm/EditAlarmPage.qml 2014-10-16 19:03:51 +0000
101+++ app/alarm/EditAlarmPage.qml 2015-01-22 00:26:25 +0000
102@@ -1,5 +1,5 @@
103 /*
104- * Copyright (C) 2014 Canonical Ltd
105+ * Copyright (C) 2014-2015 Canonical Ltd
106 *
107 * This file is part of Ubuntu Clock App
108 *
109@@ -292,7 +292,7 @@
110 text: i18n.tr("Repeat")
111 subText: alarmUtils.format_day_string(_alarm.daysOfWeek, _alarm.type)
112 onClicked: pageStack.push(Qt.resolvedUrl("AlarmRepeat.qml"),
113- {"alarm": _alarm})
114+ {"alarm": _alarm, "alarmUtils": alarmUtils})
115 }
116
117 SubtitledListItem {
118
119=== modified file 'app/clock/ClockPage.qml'
120--- app/clock/ClockPage.qml 2015-01-21 02:32:40 +0000
121+++ app/clock/ClockPage.qml 2015-01-22 00:26:25 +0000
122@@ -1,5 +1,5 @@
123 /*
124- * Copyright (C) 2014 Canonical Ltd
125+ * Copyright (C) 2014-2015 Canonical Ltd
126 *
127 * This file is part of Ubuntu Clock App
128 *
129
130=== modified file 'app/clock/MainClock.qml'
131--- app/clock/MainClock.qml 2015-01-21 02:32:40 +0000
132+++ app/clock/MainClock.qml 2015-01-22 00:26:25 +0000
133@@ -1,5 +1,5 @@
134 /*
135- * Copyright (C) 2014 Canonical Ltd
136+ * Copyright (C) 2014-2015 Canonical Ltd
137 *
138 * This file is part of Ubuntu Clock App
139 *
140
141=== modified file 'app/ubuntu-clock-app.qml'
142--- app/ubuntu-clock-app.qml 2015-01-21 02:32:40 +0000
143+++ app/ubuntu-clock-app.qml 2015-01-22 00:26:25 +0000
144@@ -1,5 +1,5 @@
145 /*
146- * Copyright (C) 2014 Canonical Ltd
147+ * Copyright (C) 2014-2015 Canonical Ltd
148 *
149 * This file is part of Ubuntu Clock App
150 *
151
152=== modified file 'debian/changelog'
153--- debian/changelog 2015-01-21 21:15:10 +0000
154+++ debian/changelog 2015-01-22 00:26:25 +0000
155@@ -6,6 +6,7 @@
156 * Fixed the incorrect overriding of alarm delegate model value.
157 * Fixed qml tests broken in vivid due to listitem behaviour change.
158 * OneTime alarms are not automatically dismissed after they are triggered (LP: #1362341)
159+ * Fixed Day-of-Week picker in alarms not respecting user locale (LP: #1372545)
160
161 [Brendan Donegan]
162 * Fixed AP failure by waiting for the bottom edge tip visible property to be true
163
164=== modified file 'po/com.ubuntu.clock.pot'
165--- po/com.ubuntu.clock.pot 2014-11-17 16:11:18 +0000
166+++ po/com.ubuntu.clock.pot 2015-01-22 00:26:25 +0000
167@@ -8,7 +8,7 @@
168 msgstr ""
169 "Project-Id-Version: \n"
170 "Report-Msgid-Bugs-To: \n"
171-"POT-Creation-Date: 2014-11-17 17:05+0100\n"
172+"POT-Creation-Date: 2015-01-22 01:14+0100\n"
173 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
174 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
175 "Language-Team: LANGUAGE <LL@li.org>\n"
176@@ -44,7 +44,7 @@
177 msgid "Select None"
178 msgstr ""
179
180-#: ../app/alarm/AlarmPage.qml:89 ../app/alarm/AlarmRepeat.qml:35
181+#: ../app/alarm/AlarmPage.qml:89 ../app/alarm/AlarmRepeat.qml:38
182 msgid "Select All"
183 msgstr ""
184
185@@ -56,7 +56,7 @@
186 msgid "Tap the + icon to add an alarm"
187 msgstr ""
188
189-#: ../app/alarm/AlarmRepeat.qml:31 ../app/alarm/EditAlarmPage.qml:292
190+#: ../app/alarm/AlarmRepeat.qml:34 ../app/alarm/EditAlarmPage.qml:292
191 msgid "Repeat"
192 msgstr ""
193
194@@ -154,11 +154,11 @@
195 msgid "Delete alarm"
196 msgstr ""
197
198-#: ../app/clock/ClockPage.qml:268
199+#: ../app/clock/ClockPage.qml:271
200 msgid "Location Service Error!"
201 msgstr ""
202
203-#: ../app/clock/ClockPage.qml:270
204+#: ../app/clock/ClockPage.qml:273
205 msgid "Retrieving location..."
206 msgstr ""
207
208
209=== modified file 'tests/unit/tst_alarmRepeat.qml'
210--- tests/unit/tst_alarmRepeat.qml 2015-01-21 00:17:07 +0000
211+++ tests/unit/tst_alarmRepeat.qml 2015-01-22 00:26:25 +0000
212@@ -1,5 +1,5 @@
213 /*
214- * Copyright (C) 2014 Canonical Ltd
215+ * Copyright (C) 2014-2015 Canonical Ltd
216 *
217 * This file is part of Ubuntu Clock App
218 *
219@@ -33,10 +33,15 @@
220 id: _alarm
221 }
222
223+ AlarmUtils {
224+ id: _alarmUtils
225+ }
226+
227 Component {
228 id: alarmRepeatPage
229 AlarmRepeat {
230 alarm: _alarm
231+ alarmUtils: _alarmUtils
232 }
233 }
234

Subscribers

People subscribed via source and target branches