Merge lp:~nik90/ubuntu-clock-app/implement-alarm-status into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 55
Merged at revision: 62
Proposed branch: lp:~nik90/ubuntu-clock-app/implement-alarm-status
Merge into: lp:ubuntu-clock-app
Diff against target: 55 lines (+27/-7)
2 files modified
app/alarm/AlarmDelegate.qml (+23/-7)
debian/changelog (+4/-0)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/implement-alarm-status
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Zsombor Egri (community) Approve
Ubuntu Clock Developers Pending
Review via email: mp+231519@code.launchpad.net

Commit message

Fixes the looping issue with regards to the alarm status toggling.

Description of the change

Fixes the looping issue with regards to the alarm status toggling.

To post a comment you must log in.
54. By Nekhelesh Ramananthan

Removed left over variable

Revision history for this message
Zsombor Egri (zsombi) wrote :

A small comment inline, no more. Good to go.

review: Approve
55. By Nekhelesh Ramananthan

Improved comment

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

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 2014-08-10 17:11:14 +0000
3+++ app/alarm/AlarmDelegate.qml 2014-08-20 08:22:44 +0000
4@@ -82,14 +82,30 @@
5 verticalCenter: parent.verticalCenter
6 }
7
8- checked: enabled
9+ onCheckedChanged: {
10+ if (checked !== model.enabled) {
11+ model.enabled = checked
12+ model.save()
13+ }
14+ }
15+
16+ Connections {
17+ target: model
18+ onStatusChanged: {
19+ /*
20+ Update switch value only when the alarm save() operation
21+ is complete to avoid switching it back.
22+ */
23+ if (model.status === Alarm.Ready) {
24+ alarmStatus.checked = model.enabled;
25+ }
26+ }
27+ }
28
29 /*
30- #TODO: Add the ability to enable/disable alarms using the
31- switch. At the moment it only shows the alarm status.
32- This was postponed since a similar implementation in the
33- old clock app caused it to loop. So if user clicks on the
34- switch, it disables and then re-enables the alarm again.
35- */
36+ Assign switch value only once at startup. After this, the switch will
37+ be updated after the alarm save() operations only.
38+ */
39+ Component.onCompleted: alarmStatus.checked = model.enabled
40 }
41 }
42
43=== modified file 'debian/changelog'
44--- debian/changelog 2014-08-19 20:25:21 +0000
45+++ debian/changelog 2014-08-20 08:22:44 +0000
46@@ -13,6 +13,10 @@
47 * Added support to play alarm sound preview when selecting them in the alarm
48 sound page. (LP: #1355410)
49
50+ [Zsombor Egri]
51+ * Fixed alarm status toggle being reverted immediately (LP: #1272337)
52+ * Deleting an alarm causing the others to activate (if they were disabled) (LP: #1358315)
53+
54 [David Planella]
55 * Added internationalization support (LP: #1354522)
56

Subscribers

People subscribed via source and target branches