← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

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

Commit message:
Add dialog popup warning user that one writable calendar must be always selected

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1476501 in Ubuntu Calendar App: "Long click creates event in disabled calendar"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1476501

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

Add dialog popup warning user that one writable calendar must be always selected
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1476501 into lp:ubuntu-calendar-app.
=== modified file 'CalendarChoicePopup.qml'
--- CalendarChoicePopup.qml	2016-03-02 19:55:52 +0000
+++ CalendarChoicePopup.qml	2016-03-22 12:31:26 +0000
@@ -106,6 +106,15 @@
                     checked: modelData.extendedMetaData("collection-selected")
                     enabled: !calendarChoicePage.isInEditMode
                     onCheckedChanged: {
+                        if (!checkBox.checked && modelData.extendedMetaData("collection-readonly") === false) {
+                           var collections = calendarChoicePage.model.getWritableAndSelectedCollections();
+                           if (collections.length == 1) {
+                               PopupUtils.open(singleWritableDialogComponent);
+                               checkBox.checked = true;
+                               return;
+                           }
+                        }
+
                         modelData.setExtendedMetaData("collection-selected",checkBox.checked)
                         var collection = calendarChoicePage.model.collection(modelData.collectionId);
                         calendarChoicePage.model.saveCollection(collection);
@@ -149,5 +158,17 @@
         asynchronous: true
         source: sourceFile
     }
+
+    Component {
+        id: singleWritableDialogComponent 
+        Dialog {
+            id: singleWritableDialog
+            title: i18n.tr("Unable to deselect")
+            text: i18n.tr("In order to create new events you must have at least one writable calendar selected")
+            Button {
+                text: i18n.tr("Ok")	
+                onClicked: PopupUtils.close(singleWritableDialog)
+            }
+        }
+    }
 }
-


Follow ups