Merge lp:~mardy/ubuntu-system-settings-online-accounts/prompt-1544919 into lp:ubuntu-system-settings-online-accounts

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 343
Merged at revision: 335
Proposed branch: lp:~mardy/ubuntu-system-settings-online-accounts/prompt-1544919
Merge into: lp:ubuntu-system-settings-online-accounts
Diff against target: 251 lines (+130/-18)
6 files modified
online-accounts-ui/qml/AuthorizationPage.qml (+42/-2)
plugins/OnlineAccountsPlugin/application-manager.cpp (+10/-0)
plugins/module/ServiceItem.qml (+10/-12)
plugins/module/ServiceItemBase.qml (+52/-0)
plugins/module/module.pro (+1/-0)
tests/online-accounts-ui/qml/tst_AuthorizationPage.qml (+15/-4)
To merge this branch: bzr merge lp:~mardy/ubuntu-system-settings-online-accounts/prompt-1544919
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Online Accounts Pending
Review via email: mp+286021@code.launchpad.net

Commit message

Update authorisation prompt

Show the application icon and package ID in the permission prompt, according to the design at https://wiki.ubuntu.com/OnlineAccounts#phone-settings

Also, show the application package ID in the System Settings applet, under each application name.

Description of the change

Update authorisation prompt

Show the application icon and package ID in the permission prompt, according to the design at https://wiki.ubuntu.com/OnlineAccounts#phone-settings

Also, show the application package ID in the System Settings applet, under each application name.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
337. By Alberto Mardegan

Update prompt

338. By Alberto Mardegan

Icon->Image

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
339. By Alberto Mardegan

Make shape affect icon

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
340. By Alberto Mardegan

margins

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
341. By Alberto Mardegan

Use proportional shape

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
342. By Alberto Mardegan

increase size

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
343. By Alberto Mardegan

Rervert size to 8gu

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'online-accounts-ui/qml/AuthorizationPage.qml'
2--- online-accounts-ui/qml/AuthorizationPage.qml 2015-10-22 08:33:20 +0000
3+++ online-accounts-ui/qml/AuthorizationPage.qml 2016-02-18 09:29:50 +0000
4@@ -36,16 +36,55 @@
5 id: topColumn
6 anchors.left: parent.left
7 anchors.right: parent.right
8+ anchors.top: parent.top
9 anchors.margins: units.gu(1)
10 spacing: units.gu(1)
11
12+ ProportionalShape {
13+ id: iconShape
14+ anchors.horizontalCenter: parent.horizontalCenter
15+ aspect: UbuntuShape.DropShadow
16+ width: units.gu(8)
17+ source: Image {
18+ sourceSize.width: iconShape.width
19+ sourceSize.height: iconShape.height
20+ source: application.icon.indexOf("/") === 0 ?
21+ "file://" + application.icon : "image://theme/" + application.icon
22+ }
23+ }
24+
25+ Column {
26+ anchors { left: parent.left; right: parent.right; margins: units.gu(1) }
27+
28+ Label {
29+ objectName: "appLabel"
30+ anchors.left: parent.left
31+ anchors.right: parent.right
32+ horizontalAlignment: Text.AlignHCenter
33+ elide: Text.ElideRight
34+ text: application.displayName
35+ wrapMode: Text.Wrap
36+ maximumLineCount: 2
37+ }
38+ Label {
39+ objectName: "pkgLabel"
40+ anchors.left: parent.left
41+ anchors.right: parent.right
42+ horizontalAlignment: Text.AlignHCenter
43+ color: theme.palette.normal.backgroundText
44+ elide: Text.ElideMiddle
45+ text: application.displayId
46+ }
47+ }
48+
49 Label {
50 objectName: "msgLabel"
51 anchors.left: parent.left
52 anchors.right: parent.right
53- text: i18n.tr("%1 wants to access your %2 account").
54- arg(application.displayName).arg(provider.displayName);
55+ text: i18n.tr("wants to access your %2 account").
56+ arg(provider.displayName);
57 wrapMode: Text.WordWrap
58+ horizontalAlignment: Text.AlignHCenter
59 }
60
61 Label {
62@@ -84,6 +123,7 @@
63 objectName: "allowButton"
64 anchors.left: parent.left
65 anchors.right: parent.right
66+ color: UbuntuColors.green
67 text: i18n.tr("Allow")
68 onClicked: root.allowed(root.model.get(accountSelector.selectedIndex, "accountId"))
69 }
70
71=== modified file 'plugins/OnlineAccountsPlugin/application-manager.cpp'
72--- plugins/OnlineAccountsPlugin/application-manager.cpp 2015-09-24 12:58:34 +0000
73+++ plugins/OnlineAccountsPlugin/application-manager.cpp 2016-02-18 09:29:50 +0000
74@@ -42,6 +42,7 @@
75 bool applicationMatchesProfile(const Accounts::Application &application,
76 const QString &profile) const;
77 static QString stripVersion(const QString &appId);
78+ static QString displayId(const QString &appId);
79 };
80 } // namespace
81
82@@ -103,6 +104,14 @@
83 return components.join('_');
84 }
85
86+QString ApplicationManagerPrivate::displayId(const QString &appId)
87+{
88+ QStringList components = appId.split('_').mid(0, 2);
89+ if (components.count() != 2) return appId;
90+
91+ return components.join('/');
92+}
93+
94 ApplicationManager *ApplicationManager::instance()
95 {
96 if (!m_instance) {
97@@ -156,6 +165,7 @@
98
99 QVariantMap app;
100 app.insert(QStringLiteral("id"), applicationId);
101+ app.insert(QStringLiteral("displayId"), d->displayId(applicationId));
102 app.insert(QStringLiteral("displayName"), application.displayName());
103 app.insert(QStringLiteral("icon"), application.iconName());
104 /* The applicationMatchesProfile() test above ensures that either the peer
105
106=== modified file 'plugins/module/ServiceItem.qml'
107--- plugins/module/ServiceItem.qml 2015-10-22 08:33:20 +0000
108+++ plugins/module/ServiceItem.qml 2016-02-18 09:29:50 +0000
109@@ -18,7 +18,6 @@
110
111 import QtQuick 2.0
112 import Ubuntu.Components 1.3
113-import Ubuntu.Components.ListItems 1.3 as ListItem
114 import Ubuntu.OnlineAccounts 0.1
115
116 Column {
117@@ -40,21 +39,20 @@
118 service: accountService.service.id
119 }
120
121- delegate: ListItem.Standard {
122+ delegate: ServiceItemBase {
123 text: model.displayName ? model.displayName : model.applicationId
124+ subText: ApplicationManager.applicationInfo(model.applicationId, "unconfined").displayId
125 iconSource: model.iconName.indexOf("/") === 0 ?
126 model.iconName : "image://theme/" + model.iconName
127- control: Switch {
128- checked: accountService.serviceEnabled
129- onCheckedChanged: {
130- if (checked != accountService.serviceEnabled) {
131- if (checked) {
132- applicationAdded(model.applicationId)
133- } else {
134- applicationRemoved(model.applicationId)
135- }
136- accountService.updateServiceEnabled(checked)
137+ checked: accountService.serviceEnabled
138+ onCheckedChanged: {
139+ if (checked != accountService.serviceEnabled) {
140+ if (checked) {
141+ applicationAdded(model.applicationId)
142+ } else {
143+ applicationRemoved(model.applicationId)
144 }
145+ accountService.updateServiceEnabled(checked)
146 }
147 }
148 }
149
150=== added file 'plugins/module/ServiceItemBase.qml'
151--- plugins/module/ServiceItemBase.qml 1970-01-01 00:00:00 +0000
152+++ plugins/module/ServiceItemBase.qml 2016-02-18 09:29:50 +0000
153@@ -0,0 +1,52 @@
154+/*
155+ * Copyright (C) 2016 Canonical Ltd.
156+ *
157+ * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
158+ *
159+ * This program is free software: you can redistribute it and/or modify it
160+ * under the terms of the GNU General Public License version 3, as published
161+ * by the Free Software Foundation.
162+ *
163+ * This program is distributed in the hope that it will be useful, but
164+ * WITHOUT ANY WARRANTY; without even the implied warranties of
165+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
166+ * PURPOSE. See the GNU General Public License for more details.
167+ *
168+ * You should have received a copy of the GNU General Public License along
169+ * with this program. If not, see <http://www.gnu.org/licenses/>.
170+ */
171+
172+import QtQuick 2.0
173+import Ubuntu.Components 1.3
174+import Ubuntu.Components.ListItems 1.3 as ListItem
175+
176+ListItem.Base {
177+ property alias checked: control.checked
178+ property alias text: label.text
179+ property alias subText: subLabel.text
180+
181+ Item {
182+ anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter }
183+ height: childrenRect.height + label.anchors.topMargin + subLabel.anchors.bottomMargin
184+
185+ Label {
186+ id: label
187+ anchors { left: parent.left; right: control.left; top: parent.top }
188+ elide: Text.ElideRight
189+ color: theme.palette.selected.backgroundText
190+ }
191+
192+ Label {
193+ id: subLabel
194+ anchors { left: parent.left; right: control.left; top: label.bottom }
195+ color: theme.palette.normal.backgroundText
196+ elide: Text.ElideRight
197+ textSize: Label.Small
198+ }
199+
200+ Switch {
201+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
202+ id: control
203+ }
204+ }
205+}
206
207=== modified file 'plugins/module/module.pro'
208--- plugins/module/module.pro 2015-09-29 12:13:17 +0000
209+++ plugins/module/module.pro 2016-02-18 09:29:50 +0000
210@@ -41,6 +41,7 @@
211 Options.qml \
212 RemovalConfirmation.qml \
213 ServiceItem.qml \
214+ ServiceItemBase.qml \
215 ServiceSwitches.qml \
216 StandardAnimation.qml \
217 WebView.qml
218
219=== modified file 'tests/online-accounts-ui/qml/tst_AuthorizationPage.qml'
220--- tests/online-accounts-ui/qml/tst_AuthorizationPage.qml 2015-04-27 15:07:47 +0000
221+++ tests/online-accounts-ui/qml/tst_AuthorizationPage.qml 2016-02-18 09:29:50 +0000
222@@ -87,14 +87,25 @@
223 function test_1_one_account() {
224 createAccount("My account")
225 var page = createPage({
226- "application": { "displayName": "My app" },
227+ "application": {
228+ "displayName": "My app",
229+ "displayId": "com.ubuntu/MyApp",
230+ },
231 "provider": { "displayName": "My provider" }
232 })
233 verify(page != null)
234
235- var label = findChild(page, "msgLabel")
236- verify(label != null)
237- compare(label.text, "My app wants to access your My provider account")
238+ var label = findChild(page, "appLabel")
239+ verify(label != null)
240+ compare(label.text, "My app")
241+
242+ label = findChild(page, "pkgLabel")
243+ verify(label != null)
244+ compare(label.text, "com.ubuntu/MyApp")
245+
246+ label = findChild(page, "msgLabel")
247+ verify(label != null)
248+ compare(label.text, "wants to access your My provider account")
249
250 var accountLabel = findChild(page, "accountLabel")
251 verify(accountLabel != null)

Subscribers

People subscribed via source and target branches