← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~renatofilho/ubuntu-calendar-app/account-name-and-calendars into lp:ubuntu-calendar-app

 

Renato Araujo Oliveira Filho has proposed merging lp:~renatofilho/ubuntu-calendar-app/account-name-and-calendars into lp:ubuntu-calendar-app with lp:~renatofilho/ubuntu-calendar-app/fix-model-update-after-save as a prerequisite.

Commit message:
Show the account name as subtitle for calendars.

Requested reviews:
  Kunal Parmar (pkunal-parmar)
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration

For more details, see:
https://code.launchpad.net/~renatofilho/ubuntu-calendar-app/account-name-and-calendars/+merge/297113
-- 
Your team Ubuntu Calendar Developers is subscribed to branch lp:ubuntu-calendar-app.
=== modified file 'CalendarChoicePopup.qml'
--- CalendarChoicePopup.qml	2016-03-22 12:29:05 +0000
+++ CalendarChoicePopup.qml	2016-06-10 21:19:19 +0000
@@ -21,6 +21,7 @@
 import Ubuntu.Components 1.3
 import Ubuntu.SyncMonitor 0.1
 import Ubuntu.Components.Popups 1.3
+import Ubuntu.OnlineAccounts 0.1
 
 Page {
     id: calendarChoicePage
@@ -29,6 +30,15 @@
     property var model
     signal collectionUpdated()
 
+    function accountFromId(accountId)
+    {
+        if (accountId && accountId >= 0) {
+            return Manager.loadAccount(accountId)
+        }
+
+        return null
+    }
+
     visible: false
     header: PageHeader {
         title: i18n.tr("Calendars")
@@ -96,7 +106,13 @@
             ListItemLayout {
                 id: calendarsListLayout
 
+                Account {
+                    id: delegateAccount
+                    objectHandle: calendarChoicePage.accountFromId(modelData.extendedMetaData("collection-account-id"))
+                }
+
                 title.text: modelData.name
+                subtitle.text: delegateAccount.objectHandle ? delegateAccount.displayName : ""
                 title.objectName: "calendarName"
 
                 CheckBox {

=== modified file 'EventActions.qml'
--- EventActions.qml	2016-03-16 20:35:07 +0000
+++ EventActions.qml	2016-06-10 21:19:19 +0000
@@ -28,7 +28,7 @@
     property alias syncCalendarAction: _syncCalendarAction
     property alias settingsAction: _settingsAction
     property Settings settings
-    readonly property bool syncInProgress: (syncMonitor.state === "syncing")
+    readonly property bool syncInProgress: (syncMonitor.state !== "") && (syncMonitor.state !== "idle")
 
     Action {
         id: _syncCalendarAction
@@ -38,7 +38,7 @@
         // Currently ,there is no way we can increase width of action menu currently.
         text: enabled ? i18n.tr("Sync") : i18n.tr("Syncing")
         onTriggered: syncMonitor.sync(["calendar"])
-        enabled: !syncInProgress
+        enabled: !actionPool.syncInProgress
         visible: syncMonitor.enabledServices ? syncMonitor.serviceIsEnabled("calendar") : false
     }
 

=== modified file 'EventBubble.qml'
--- EventBubble.qml	2016-04-06 18:46:29 +0000
+++ EventBubble.qml	2016-06-10 21:19:19 +0000
@@ -98,8 +98,8 @@
 
                 }
             } else {
-                // Past events: As per accepted events, but at 75% transparency.
-                infoBubble.backgroundOpacity = 0.25
+                // Past events: As per accepted events, but at 60% transparency.
+                infoBubble.backgroundOpacity = 0.4
             }
         }
     }
@@ -219,8 +219,12 @@
         }
 
         onPressAndHold: {
-            isLiveEditing = true;
-            infoBubble.z += 1;
+            if (event && model && model.collectionIsReadOnlyFromId(event.collectionId)) {
+                console.debug("Read-only event can not be dragged")
+            } else {
+                isLiveEditing = true;
+                infoBubble.z += 1;
+            }
         }
     }
 }

=== modified file 'EventListModel.qml'
--- EventListModel.qml	2016-06-10 21:19:19 +0000
+++ EventListModel.qml	2016-06-10 21:19:19 +0000
@@ -72,6 +72,24 @@
         }
     }
 
+    function collectionIsReadOnlyFromId(collectionId)
+    {
+        if (collectionId === "")
+            return false
+
+        var cal = eventModel.collection(collectionId)
+        return collectionIsReadOnly(cal)
+    }
+
+    function collectionIsReadOnly(collection)
+    {
+        if (!collection)
+            return false
+
+        return collection.extendedMetaData("collection-readonly") === true ||
+               collection.extendedMetaData("collection-sync-readonly") === true
+    }
+
     function getCollections(){
         var cals = [];
         var collections = eventModel.collections;
@@ -91,7 +109,7 @@
             var cal = collections[i];
             if( cal.extendedMetaData("collection-type") === "Calendar" &&
                     cal.extendedMetaData("collection-selected") === true &&
-                    cal.extendedMetaData("collection-readonly") === false) {
+                    !collectionIsReadOnly(cal)) {
                 cals.push(cal);
             }
         }
@@ -103,8 +121,8 @@
         var collections = eventModel.collections;
         for(var i = 0 ; i < collections.length ; ++i) {
             var cal = collections[i];
-            if( cal.extendedMetaData("collection-type") === "Calendar" &&
-                    cal.extendedMetaData("collection-readonly") === false ) {
+            if (cal.extendedMetaData("collection-type") === "Calendar" &&
+                !collectionIsReadOnly(cal)) {
                 cals.push(cal);
             }
         }