← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~etherpulse/ubuntu-clock-app/switch_alarm_supress_edit into lp:ubuntu-clock-app

 

Eran Uzan has proposed merging lp:~etherpulse/ubuntu-clock-app/switch_alarm_supress_edit into lp:ubuntu-clock-app.

Requested reviews:
  Ubuntu Clock Developers (ubuntu-clock-dev)
Related bugs:
  Bug #1518892 in Ubuntu Clock App: "[clock] Switching alarm on/off"
  https://bugs.launchpad.net/ubuntu-clock-app/+bug/1518892

For more details, see:
https://code.launchpad.net/~etherpulse/ubuntu-clock-app/switch_alarm_supress_edit/+merge/313481

An alternate fix for lp:1518892 to prevent  going to the alarm edit page when trying to switch the alarm on/off by increasing the clickable area of the switch
-- 
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~etherpulse/ubuntu-clock-app/switch_alarm_supress_edit into lp:ubuntu-clock-app.
=== modified file 'app/alarm/AlarmDelegate.qml'
--- app/alarm/AlarmDelegate.qml	2016-03-03 00:28:40 +0000
+++ app/alarm/AlarmDelegate.qml	2016-12-17 00:21:20 +0000
@@ -78,52 +78,69 @@
         summary.textSize: Label.Medium
         summary.objectName: "alarmOccurrence"
 
-        Switch {
-            id: alarmStatus
-            objectName: "listAlarmStatus"
-
-            anchors.verticalCenter: parent.verticalCenter
-            checked: model.enabled && (model.status === Alarm.Ready)
-            onCheckedChanged: {
-                if (checked !== model.enabled) {
-                    /*
-                     Calculate the alarm time if it is a one-time alarm.
-                     Repeating alarms do this automatically.
-                    */
-                    if(type === Alarm.OneTime) {
-                        var date = new Date()
-                        date.setHours(model.date.getHours(), model.date.getMinutes(), 0)
-
-                        model.daysOfWeek = Alarm.AutoDetect
-                        if (date < new Date()) {
-                            var tomorrow = new Date()
-                            tomorrow.setDate(tomorrow.getDate() + 1)
-                            model.daysOfWeek = alarmUtils.get_alarm_day(tomorrow.getDay())
-                        }
-                        model.date = date
-
-                    }
-                    model.enabled = checked
-                    model.save()
-                }
-            }
-
-            Connections {
-                target: model
-                onStatusChanged: {
-                    /*
-                    Update switch value only when the alarm save() operation
-                    is complete to avoid switching it back.
-                     */
-                    if (model.status === Alarm.Ready) {
-                        alarmStatus.checked = model.enabled;
-
-                        if (!alarmStatus.checked && type === Alarm.Repeating) {
-                            alarmOccurrence = alarmUtils.format_day_string(daysOfWeek, type)
-                        }
-                    }
-                }
-            }
+        MouseArea {
+            /**
+              Provide a larger click area then the actual alaram status switch
+             */
+            width: units.gu(6)
+            height: units.gu(6)
+
+            preventStealing: true
+
+            onClicked: {
+                alarmStatus.checked = !alarmStatus.checked;
+            }
+
+            Switch {
+
+                id: alarmStatus
+                anchors.top: parent.top
+                anchors.right : parent.right
+                objectName: "listAlarmStatus"
+
+                checked: model.enabled && (model.status === Alarm.Ready)
+                onCheckedChanged: {
+                    if (checked !== model.enabled) {
+                        /*
+                         Calculate the alarm time if it is a one-time alarm.
+                         Repeating alarms do this automatically.
+                        */
+                        if(type === Alarm.OneTime) {
+                            var date = new Date()
+                            date.setHours(model.date.getHours(), model.date.getMinutes(), 0)
+
+                            model.daysOfWeek = Alarm.AutoDetect
+                            if (date < new Date()) {
+                                var tomorrow = new Date()
+                                tomorrow.setDate(tomorrow.getDate() + 1)
+                                model.daysOfWeek = alarmUtils.get_alarm_day(tomorrow.getDay())
+                            }
+                            model.date = date
+
+                        }
+                        model.enabled = checked
+                        model.save()
+                    }
+                }
+
+                Connections {
+                    target: model
+                    onStatusChanged: {
+                        /*
+                        Update switch value only when the alarm save() operation
+                        is complete to avoid switching it back.
+                         */
+                        if (model.status === Alarm.Ready) {
+                            alarmStatus.checked = model.enabled;
+
+                            if (!alarmStatus.checked && type === Alarm.Repeating) {
+                                alarmOccurrence = alarmUtils.format_day_string(daysOfWeek, type)
+                            }
+                        }
+                    }
+                }
+            }
+
         }
     }
 


References