← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

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

Commit message:
Refactor on the EventReminder option selector page
Change EventRepetition page to show all options when OptionSelector is expanded

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1564398 in Ubuntu Calendar App: "[Calendar] When editing an event repeater and reminder options are not consistent"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1564398

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

Refactor on the EventReminder option selector page
Change EventRepetition page to show all options when OptionSelector is expanded

This is not a complete solution for bug #1564398 but implements some changes to reduce the issue
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1564398 into lp:ubuntu-calendar-app.
=== removed file 'EventReminder.qml'
--- EventReminder.qml	2016-03-21 19:45:40 +0000
+++ EventReminder.qml	1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2014 Canonical Ltd
- *
- * This file is part of Ubuntu Calendar App
- *
- * Ubuntu Calendar App is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Ubuntu Calendar App is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-import QtQuick 2.4
-import Ubuntu.Components 1.3
-import Ubuntu.Components.ListItems 1.0 as ListItem
-
-Page{
-    id:root
-    objectName: "eventReminder"
-
-    property var audibleReminder: null
-    property var reminderModel: null
-    property var eventTitle: null
-    property int reminderTime: -1
-
-    signal reminderTimeUpdated(int value);
-
-    visible: false
-    flickable: null
-    title: i18n.tr("Reminder")
-
-    head.backAction: Action{
-        iconName:"back"
-        onTriggered:{
-            reminderTimeUpdated(reminderTime)
-            pop();
-        }
-    }
-    Scrollbar{
-        id:scrollList
-        flickableItem: _pageFlickable
-        anchors.fill :parent
-    }
-    Flickable {
-        id: _pageFlickable
-
-
-        clip: true
-        anchors.fill: parent
-        contentHeight: _reminders.itemHeight * reminderModel.count + units.gu(2)
-        ListItem.ItemSelector {
-            id: _reminders
-            expanded: true
-            model: reminderModel
-            delegate: selectorDelegate
-            selectedIndex: reminderModel.get
-            onSelectedIndexChanged: {
-                root.reminderTime = reminderModel.get(selectedIndex).value
-            }
-
-            Component.onCompleted: {
-                for(var i=0; i<reminderModel.count; i++) {
-                    if (root.reminderTime === reminderModel.get(i).value){
-                        _reminders.selectedIndex = i
-                        return;
-                    }
-                }
-            }
-        }
-        Component {
-            id: selectorDelegate
-            OptionSelectorDelegate { text: label; }
-        }
-
-    }
-}

=== modified file 'EventRepetition.qml'
--- EventRepetition.qml	2016-03-22 20:09:08 +0000
+++ EventRepetition.qml	2016-04-01 15:16:48 +0000
@@ -165,7 +165,7 @@
             }
 
             model: Defines.recurrenceLabel
-            containerHeight: itemHeight * 4
+            containerHeight: itemHeight * model.length
             onExpandedChanged: Qt.inputMethod.hide();
         }
 

=== modified file 'NewEvent.qml'
--- NewEvent.qml	2016-03-28 20:56:13 +0000
+++ NewEvent.qml	2016-04-01 15:16:48 +0000
@@ -736,15 +736,25 @@
 
                 onClicked:{
                     var stack = pageStack
-                    if (!stack)
+                    if (!stack) {
                         stack = bottomEdgePageStack
-
-                    var reminderPick = stack.push(Qt.resolvedUrl("EventReminder.qml"),
-                                                   {"reminderTime": root.reminderValue,
-                                                    "reminderModel": reminderModel,
-                                                    "eventTitle": titleEdit.text})
-                    reminderPick.reminderTimeUpdated.connect(function(value) {
-                        root.reminderValue = value
+                    }
+
+                    var reminderSelectedIndex = 0
+                    if (eventReminder.reminderValue !== -1) {
+                        for (var i=0; i<reminderModel.count; ++i) {
+                            if (reminderModel.get(i).value === eventReminder.reminderValue) {
+                                reminderSelectedIndex = i
+                            }
+                        }
+                    }
+
+                    var reminderPick = stack.push(Qt.resolvedUrl("OptionSelectorPage.qml"),
+                                                   {"title": i18n.tr("Reminder"),
+                                                    "model": reminderModel,
+                                                    "selectedIndex": reminderSelectedIndex})
+                    reminderPick.selectedIndexChanged.connect(function() {
+                        root.reminderValue = reminderModel.get(reminderPick.selectedIndex).value
                     })
                 }
             }

=== added file 'OptionSelectorPage.qml'
--- OptionSelectorPage.qml	1970-01-01 00:00:00 +0000
+++ OptionSelectorPage.qml	2016-04-01 15:16:48 +0000
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2016 Canonical Ltd
+ *                                                                      
+ * This file is part of Ubuntu Calendar App                             
+ *                                                                      
+ * Ubuntu Calendar App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as    
+ * published by the Free Software Foundation.
+ * 
+ * Ubuntu Calendar App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License    
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
+import QtQuick 2.4                                                      
+import Ubuntu.Components 1.3                                            
+import Ubuntu.Components.ListItems 1.0 as ListItem                     
+
+Page { 
+    id: optionSelectorPage                                            
+
+    property alias title: pageHeader.title
+    property alias model: optionsList.model
+    property alias selectedIndex: optionsList.selectedIndex
+
+    header: PageHeader {
+        id: pageHeader
+        flickable: optionSelectorPageFlickable
+    }
+
+    Flickable {
+        id: optionSelectorPageFlickable
+        anchors.fill: parent
+        contentHeight: optionsList.height
+
+        ListItem.ItemSelector {
+            id: optionsList
+
+            expanded: true
+            delegate: selectorDelegate
+        }
+    }
+
+    Component {
+        id: selectorDelegate
+        OptionSelectorDelegate { text: label }
+    }
+}


Follow ups