← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mihirsoni/ubuntu-calendar-app/1464457 into lp:ubuntu-calendar-app

 

Mihir Soni has proposed merging lp:~mihirsoni/ubuntu-calendar-app/1464457 into lp:ubuntu-calendar-app.

Commit message:
Fixed bug #1464457

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1464457 in Ubuntu Calendar App: "Delete an event from the Edit Event view"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1464457

For more details, see:
https://code.launchpad.net/~mihirsoni/ubuntu-calendar-app/1464457/+merge/263185

Fixed bug #1464457
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~mihirsoni/ubuntu-calendar-app/1464457 into lp:ubuntu-calendar-app.
=== modified file 'EventDetails.qml'
--- EventDetails.qml	2015-06-18 15:45:50 +0000
+++ EventDetails.qml	2015-06-27 17:59:28 +0000
@@ -171,6 +171,10 @@
         pageStack.currentPage.eventAdded.connect( function(event){
             pageStack.pop();
         })
+        //When event deleted from the Edit mode
+        pageStack.currentPage.eventDeleted.connect(function(eventId){
+            pageStack.pop();
+        })
     }
 
     Keys.onEscapePressed: {
@@ -185,19 +189,6 @@
 
     head.actions: [
         Action {
-            text: i18n.tr("Delete");
-            objectName: "delete"
-            iconName: "delete"
-            onTriggered: {
-                var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteConfirmationDialog.qml"),root,{"event": event});
-                dialog.deleteEvent.connect( function(eventId){
-                    model.removeItem(eventId);
-                    pageStack.pop();
-                });
-            }
-        },
-
-        Action {
             text: i18n.tr("Edit");
             objectName: "edit"
             iconName: "edit";

=== modified file 'NewEvent.qml'
--- NewEvent.qml	2015-06-23 15:59:08 +0000
+++ NewEvent.qml	2015-06-27 17:59:28 +0000
@@ -45,6 +45,7 @@
     flickable: null
 
     signal eventAdded(var event);
+    signal eventDeleted(var event);
 
     onStartDateChanged: {
         startDateTimeInput.dateTime = startDate;
@@ -62,14 +63,28 @@
         endDateTimeInput.dateTime = endDate;
     }
 
-    head.actions: Action {
-        iconName: "ok"
-        objectName: "save"
-        text: i18n.tr("Save")
-        enabled: !!titleEdit.text.trim()
-        onTriggered: saveToQtPim();
-    }
-
+    head.actions: [
+        Action {
+            text: i18n.tr("Delete");
+            objectName: "delete"
+            iconName: "delete"
+            visible : isEdit
+            onTriggered: {
+                var dialog = PopupUtils.open(Qt.resolvedUrl("DeleteConfirmationDialog.qml"),root,{"event": event});
+                dialog.deleteEvent.connect( function(eventId){
+                    model.removeItem(eventId);
+                    pageStack.pop();
+                    root.eventDeleted(eventId);
+                });
+            }
+        },
+        Action {
+            iconName: "ok"
+            objectName: "save"
+            text: i18n.tr("Save")
+            enabled: !!titleEdit.text.trim()
+            onTriggered: saveToQtPim();
+        }]
     Component.onCompleted: {
         //If current date is setted by an argument we don't have to change it.
         if(typeof(date) === 'undefined'){

=== modified file 'tests/autopilot/calendar_app/__init__.py'
--- tests/autopilot/calendar_app/__init__.py	2015-05-22 14:32:00 +0000
+++ tests/autopilot/calendar_app/__init__.py	2015-06-27 17:59:28 +0000
@@ -962,8 +962,9 @@
         """
         root = self.get_root_instance()
         header = root.select_single(MainView).get_header()
+        header.click_action_button('edit')
+        root.wait_select_single(NewEvent, objectName='newEventPage')
         header.click_action_button('delete')
-
         delete_confirmation_dialog = root.wait_select_single(
             DeleteConfirmationDialog, objectName='deleteConfirmationDialog')
         delete_confirmation_dialog.confirm_deletion()


References