← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~pkunal-parmar/ubuntu-calendar-app/SettingToAccountSetup into lp:ubuntu-calendar-app

 

Kunal Parmar has proposed merging lp:~pkunal-parmar/ubuntu-calendar-app/SettingToAccountSetup into lp:ubuntu-calendar-app.

Commit message:
Resolves Bug #1437031 [
The app should allow the user to create a online account without go to system settings]

Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)

For more details, see:
https://code.launchpad.net/~pkunal-parmar/ubuntu-calendar-app/SettingToAccountSetup/+merge/254478

Resolves Bug #1437031 [
The app should allow the user to create a online account without go to system settings]
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~pkunal-parmar/ubuntu-calendar-app/SettingToAccountSetup into lp:ubuntu-calendar-app.
=== modified file 'CalendarChoicePopup.qml'
--- CalendarChoicePopup.qml	2014-11-08 11:26:37 +0000
+++ CalendarChoicePopup.qml	2015-03-28 11:36:08 +0000
@@ -61,22 +61,18 @@
     ListView {
         id: calendarsList
         anchors.fill: parent
-        footer: Item {
-            id: footer
-            anchors.horizontalCenter: parent.horizontalCenter
-            width: aadCalendar.width
-            Button {
-                id:aadCalendar
-                text: i18n.tr("Add new Calendar")
-                anchors.top :parent.top
-                anchors.topMargin:units.gu(2)
-                color: UbuntuColors.green
-                onClicked: {
-                    Qt.openUrlExternally("settings:///online-accounts")
-                }
+        footer: CalendarListButtonDelegate {
+            id: importFromGoogleButton
 
+            visible: (onlineAccountHelper.status === Loader.Ready)
+            expandIcon: true
+            iconSource: "image://theme/google"
+            labelText: i18n.tr("Add online Calendar")
+            onClicked: {
+                onlineAccountHelper.item.setupExec()
             }
         }
+
         model : root.model.getCollections();
         delegate: ListItem.Standard {
             id: delegateComp
@@ -137,5 +133,15 @@
         }
     }
 
+    Loader {
+        id: onlineAccountHelper
+
+        // if running on test mode does not load online account modules
+        property string sourceFile: Qt.resolvedUrl("OnlineAccountsHelper.qml")
+
+        anchors.fill: parent
+        asynchronous: true
+        source: sourceFile
+    }
 }
 

=== added file 'CalendarListButtonDelegate.qml'
--- CalendarListButtonDelegate.qml	1970-01-01 00:00:00 +0000
+++ CalendarListButtonDelegate.qml	2015-03-28 11:36:08 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2012-2015 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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.0
+import Ubuntu.Components 1.1
+
+Item {
+   id: root
+
+   property string iconSource
+   property alias labelText: name.text
+   property bool expandIcon: false
+   property bool showContents: true
+
+   signal clicked()
+
+   anchors {
+       left: parent.left
+       right: parent.right
+   }
+   height: visible ? units.gu(8) : 0
+
+   Rectangle {
+       anchors.fill: parent
+       color: Theme.palette.selected.background
+       opacity: addNewCalendarButtonArea.pressed ?  1.0 : 0.0
+   }
+
+   UbuntuShape {
+       id: uShape
+
+       anchors {
+           left: parent.left
+           top: parent.top
+           bottom: parent.bottom
+           margins: units.gu(1)
+       }
+       width: height
+       radius: "medium"
+       color: Theme.palette.normal.overlay
+       image: Image {
+           source: root.expandIcon ? root.iconSource : ""
+       }
+       Image {
+           anchors.centerIn: parent
+           source: root.expandIcon ? "" : root.iconSource
+           visible: !root.expandIcon
+           width: units.gu(2)
+           height: units.gu(2)
+       }
+       visible: root.showContents
+   }
+
+   Label {
+       id: name
+
+       anchors {
+           left: uShape.right
+           leftMargin: units.gu(2)
+           verticalCenter: parent.verticalCenter
+           right: parent.right
+           rightMargin: units.gu(2)
+       }
+       color: UbuntuColors.lightAubergine
+       elide: Text.ElideRight
+       visible: root.showContents
+   }
+
+   MouseArea {
+       id: addNewCalendarButtonArea
+
+       anchors.fill: parent
+       onClicked: root.clicked()
+       visible: root.showContents
+   }
+}

=== added file 'OnlineAccountsDummy.qml'
--- OnlineAccountsDummy.qml	1970-01-01 00:00:00 +0000
+++ OnlineAccountsDummy.qml	2015-03-28 11:36:08 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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.2
+
+Item {
+    id: root
+
+    property bool running: false
+
+    function setupExec() {
+        root.running = true
+    }
+}

=== added file 'OnlineAccountsHelper.qml'
--- OnlineAccountsHelper.qml	1970-01-01 00:00:00 +0000
+++ OnlineAccountsHelper.qml	2015-03-28 11:36:08 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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.2
+import Ubuntu.Components 1.1
+import Ubuntu.OnlineAccounts 0.1
+import Ubuntu.OnlineAccounts.Client 0.1
+
+Item {
+    id: root
+
+    property bool running: false
+
+    function setupExec(){
+        if (!root.running) {
+            root.running = true
+            setup.exec()
+        }
+    }
+
+    Setup {
+        id: setup
+        applicationId: "com.ubuntu.calendar_calendar"
+        providerId: "google"
+        onFinished: {
+            root.running = false
+        }
+    }
+}

=== modified file 'click/calendar.apparmor'
--- click/calendar.apparmor	2014-09-25 15:05:45 +0000
+++ click/calendar.apparmor	2015-03-28 11:36:08 +0000
@@ -2,7 +2,8 @@
     "policy_groups": [
         "calendar",
         "networking",
-        "contacts"
+        "contacts",
+        "accounts"
     ],
     "policy_version": 1.2
-}
\ No newline at end of file
+}


Follow ups