Merge lp:~mardy/reminders-app/new-api into lp:reminders-app

Proposed by Michael Zanetti
Status: Needs review
Proposed branch: lp:~mardy/reminders-app/new-api
Merge into: lp:reminders-app
Diff against target: 408 lines (+97/-89)
8 files modified
CMakeLists.txt (+4/-0)
com.ubuntu.reminders_reminders.accounts.in (+8/-0)
debian/control (+5/-6)
manifest.json.in (+2/-4)
src/account-plugin/CMakeLists.txt (+5/-0)
src/account-plugin/com.ubuntu.reminders_evernote-account-plugin.accounts.in (+22/-0)
src/app/qml/Reminders.qml (+44/-62)
src/app/qml/ui/AccountSelectorPage.qml (+7/-17)
To merge this branch: bzr merge lp:~mardy/reminders-app/new-api
Reviewer Review Type Date Requested Status
David Planella Needs Information
Jenkins Bot continuous-integration Needs Fixing
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Review via email: mp+271505@code.launchpad.net

Commit message

Use the new Online Accounts API and hook format

Description of the change

Use the new Online Accounts API and hook format

Note that I've also added ubuntu-system-settings-online-accounts to the debian/control file as a dependency. In fact, even without these changes, that package was indeed needed if one wanted to create an Evernote account from inside the application. I'm not sure whether not listing it as a dependency was an omission or a deliberate choice (it might indeed be a deliberate choice, given that u-s-s-o-a is tricky to get to work on the unity7 dekstop and brings in a lot of unwanted packages like the Ubuntu Touch system settings) -- but with the new API, having that package is essential to get the Online Accounts functionality working at all.

Please let me know if the added dependency is acceptable; if it isn't, we might remove it along with the qml-module-ubuntu-onlineaccounts2 dependency and put all the Online Accounts functionality behind a Loader element, so that we disable the Evernote integration if the needed packages are not installed.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:496
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mardy/reminders-app/new-api/+merge/271505/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/784/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/206/console

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/784/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

Thanks Michael for creating the MP. I didn't create it myself because this is still in a very early stage.
However, I'm happy to have some feedback on it, especially about the future of the .deb version. Do you intend to keep it?

The reason why I'm asking this, is because with the new Online Accounts hook, the .application, .service and .provider files are no longer necessary: they are automatically generated by the hook processor. However, if you want reminders-app to continue to live as a .deb as well, then we cannot remove these files (unless, maybe, we run the hook processor as part of the .deb build process -- sounds weird but it should work).

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:497
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mardy/reminders-app/new-api/+merge/271505/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/785/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/207/console

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/785/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:498
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mardy/reminders-app/new-api/+merge/271505/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/786/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/208/console

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/786/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:499
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mardy/reminders-app/new-api/+merge/271505/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/791/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/213/console

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/791/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:500
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mardy/reminders-app/new-api/+merge/271505/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/792/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/reminders-app-vivid-amd64-ci/214/console

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/792/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:500
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mardy/reminders-app/new-api/+merge/271505/+edit-commit-message

https://core-apps-jenkins.ubuntu.com/job/reminders-app-ci/24/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-update-mp/107/console

Click here to trigger a rebuild:
https://core-apps-jenkins.ubuntu.com/job/reminders-app-ci/24/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Mardy: Is this still desired/required?

Revision history for this message
Alberto Mardegan (mardy) wrote :

> Mardy: Is this still desired/required?

Yes, but it cannot be merged yet, there are yet changes to be made on apparmor for this new API to work (bug #1512667).
Note that I didn't propose this MP myself. This MP should either be deleted or set to WIP.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Bug #1512667 seems to have been fixed right now. Are we in a position to land this branch?

review: Needs Information
Revision history for this message
Alberto Mardegan (mardy) wrote :

Please read carefully this MP's description, as there's a problem with the deb version (I've tested the click and it seems to work fine).

Let me know how to proceed.

Unmerged revisions

508. By Alberto Mardegan

Update debian dependencies

507. By Alberto Mardegan

restore application file

506. By Alberto Mardegan

re-revert

505. By Alberto Mardegan

fix hook

504. By Alberto Mardegan

revert

503. By Alberto Mardegan

Fix service names

502. By Alberto Mardegan

Update plugin hook

501. By Alberto Mardegan

from trunk

500. By Alberto Mardegan

Set hostname as setting

499. By Alberto Mardegan

Accounts are always enabled

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-11-02 20:26:37 +0000
3+++ CMakeLists.txt 2016-03-08 07:11:08 +0000
4@@ -19,6 +19,7 @@
5 set(APP_NAME reminders)
6 set(DESKTOP_FILE "${PROJECT_NAME}.desktop")
7 set(APPLICATION_FILE "${PROJECT_NAME}_${APP_NAME}.application")
8+set(APPLICATION_ACCOUNTS_FILE "${PROJECT_NAME}_${APP_NAME}.accounts")
9 set(ICON ${APP_NAME}.png)
10 set(AUTOPILOT_DIR reminders)
11 set(APP_HARDCODE reminders)
12@@ -115,6 +116,9 @@
13 configure_file(${APPLICATION_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_FILE})
14 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_FILE} DESTINATION ${APPLICATION_DIR})
15
16+configure_file(${APPLICATION_ACCOUNTS_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_ACCOUNTS_FILE})
17+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_ACCOUNTS_FILE} DESTINATION ${APPLICATION_DIR})
18+
19 add_subdirectory(po)
20 add_subdirectory(tests)
21 add_subdirectory(3rdParty)
22
23=== added file 'com.ubuntu.reminders_reminders.accounts.in'
24--- com.ubuntu.reminders_reminders.accounts.in 1970-01-01 00:00:00 +0000
25+++ com.ubuntu.reminders_reminders.accounts.in 2016-03-08 07:11:08 +0000
26@@ -0,0 +1,8 @@
27+{
28+ "services": [
29+ {
30+ "provider": "@PROJECT_NAME@_evernote-account-plugin_evernote",
31+ "description": "Synchronize your notes with Evernote"
32+ }
33+ ]
34+}
35
36=== modified file 'debian/control'
37--- debian/control 2016-01-29 09:57:34 +0000
38+++ debian/control 2016-03-08 07:11:08 +0000
39@@ -14,11 +14,10 @@
40 qml-module-qttest,
41 qml-module-qt-labs-settings,
42 qml-module-ubuntu-connectivity,
43+ qml-module-ubuntu-onlineaccounts2,
44 qt5-default,
45- qtdeclarative5-accounts-plugin,
46 qtdeclarative5-dev,
47 qtdeclarative5-dev-tools,
48- qtdeclarative5-online-accounts-client0.1 (>= 0.3+14.10.20140506),
49 qtdeclarative5-quicklayouts-plugin,
50 qtdeclarative5-ubuntu-content1,
51 qtdeclarative5-ubuntu-push-plugin,
52@@ -35,16 +34,16 @@
53 Depends: account-plugin-evernote,
54 liboxideqt-qmlplugin,
55 qml-module-ubuntu-connectivity,
56- qtdeclarative5-accounts-plugin,
57+ qml-module-ubuntu-onlineaccounts2,
58 qtdeclarative5-evernote0.1,
59 qtdeclarative5-localstorage-plugin,
60- qtdeclarative5-online-accounts-client0.1 (>= 0.3+14.10.20140506),
61 qtdeclarative5-qtquick2-plugin,
62 qtdeclarative5-quicklayouts-plugin,
63 qtdeclarative5-ubuntu-push-plugin,
64 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
65 signon-plugin-oauth2 (>= 0.19-0~57~),
66 suru-icon-theme | ubuntu-mobile-icons,
67+ ubuntu-system-settings-online-accounts,
68 ${misc:Depends},
69 ${shlibs:Depends}
70 Description: Notes application
71@@ -59,7 +58,7 @@
72 Package: account-plugin-evernote
73 Architecture: any
74 Depends: libaccount-plugin-generic-oauth,
75- qtdeclarative5-online-accounts-client0.1,
76+ qml-module-ubuntu-onlineaccounts,
77 ${misc:Depends},
78 ${shlibs:Depends}
79 Description: Allow Ubuntu applications to access Evernote accounts
80@@ -70,7 +69,7 @@
81 Architecture: any
82 Depends: account-plugin-evernote,
83 libaccount-plugin-generic-oauth,
84- qtdeclarative5-online-accounts-client0.1,
85+ qml-module-ubuntu-onlineaccounts,
86 ${misc:Depends},
87 ${shlibs:Depends}
88 Description: Allow Ubuntu applications to access Evernote sandbox accounts
89
90=== modified file 'manifest.json.in'
91--- manifest.json.in 2015-10-24 09:59:39 +0000
92+++ manifest.json.in 2016-03-08 07:11:08 +0000
93@@ -4,16 +4,14 @@
94 "architecture": "@CLICK_ARCH@",
95 "hooks": {
96 "reminders": {
97- "account-application": "com.ubuntu.reminders_reminders.application",
98- "account-service": "@ACCOUNT_SERVICE_DIR@/com.ubuntu.reminders_reminders.service",
99+ "accounts": "com.ubuntu.reminders_reminders.accounts",
100 "apparmor": "reminders.apparmor",
101 "desktop": "com.ubuntu.reminders.desktop",
102 "urls": "reminders.url-dispatcher",
103 "content-hub": "reminders-contenthub.json"
104 },
105 "evernote-account-plugin": {
106- "account-qml-plugin": "@ACCOUNT_QML_PLUGIN_DIR@/evernote",
107- "account-provider": "@ACCOUNT_PROVIDER_DIR@/com.ubuntu.reminders_evernote-account-plugin.provider"
108+ "accounts": "com.ubuntu.reminders_evernote-account-plugin.accounts"
109 },
110 "pushHelper": {
111 "apparmor": "push-helper.apparmor",
112
113=== modified file 'src/account-plugin/CMakeLists.txt'
114--- src/account-plugin/CMakeLists.txt 2014-09-24 15:02:10 +0000
115+++ src/account-plugin/CMakeLists.txt 2016-03-08 07:11:08 +0000
116@@ -25,6 +25,7 @@
117 set(PROVIDER_FILE data/providers/${EVERNOTE_PROVIDER_ID}.provider)
118 set(SERVICE_FILE data/services/${EVERNOTE_SERVICE_ID}.service)
119 set(QML_PLUGIN_FILE qml/${account_name}/Main.qml)
120+ set(PLUGIN_ACCOUNTS_FILE com.ubuntu.reminders_evernote-account-plugin.accounts)
121
122 install(FILES ${ICON_FILE} DESTINATION ${ACCOUNT_ICON_DIR})
123
124@@ -40,6 +41,10 @@
125 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QML_PLUGIN_FILE}
126 DESTINATION ${ACCOUNT_QML_PLUGIN_DIR}/${EVERNOTE_ACCOUNT_NAME})
127
128+ configure_file(${PLUGIN_ACCOUNTS_FILE}.in
129+ ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_ACCOUNTS_FILE})
130+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_ACCOUNTS_FILE}
131+ DESTINATION ${CMAKE_INSTALL_PREFIX})
132 endfunction()
133
134 # Build and install the files for the production plugin
135
136=== added file 'src/account-plugin/com.ubuntu.reminders_evernote-account-plugin.accounts.in'
137--- src/account-plugin/com.ubuntu.reminders_evernote-account-plugin.accounts.in 1970-01-01 00:00:00 +0000
138+++ src/account-plugin/com.ubuntu.reminders_evernote-account-plugin.accounts.in 2016-03-08 07:11:08 +0000
139@@ -0,0 +1,22 @@
140+{
141+ "plugin": {
142+ "provider": "evernote",
143+ "name": "@EVERNOTE_ACCOUNT_DISPLAY_NAME@",
144+ "icon": "@EVERNOTE_ICON_NAME@",
145+ "qml": "@ACCOUNT_QML_PLUGIN_DIR@/evernote",
146+ "auth": {
147+ "oauth2/HMAC-SHA1": {
148+ "RequestEndpoint": "https://@EVERNOTE_HOSTNAME@/oauth",
149+ "TokenEndpoint": "https://@EVERNOTE_HOSTNAME@/oauth",
150+ "AuthorizationEndpoint": "https://@EVERNOTE_HOSTNAME@/OAuth.action",
151+ "Callback": "https://wiki.ubuntu.com/",
152+ "ConsumerKey": "@EVERNOTE_CONSUMER_KEY@",
153+ "ConsumerSecret": "@EVERNOTE_CONSUMER_SECRET@",
154+ "HostName": "@EVERNOTE_HOSTNAME@"
155+ }
156+ },
157+ "settings": {
158+ "HostName": "@EVERNOTE_HOSTNAME@"
159+ }
160+ }
161+}
162
163=== modified file 'src/app/qml/Reminders.qml'
164--- src/app/qml/Reminders.qml 2015-11-20 11:11:49 +0000
165+++ src/app/qml/Reminders.qml 2016-03-08 07:11:08 +0000
166@@ -23,8 +23,7 @@
167 import Ubuntu.Components.ListItems 1.3
168 import Ubuntu.Connectivity 1.0
169 import Evernote 0.1
170-import Ubuntu.OnlineAccounts 0.1
171-import Ubuntu.OnlineAccounts.Client 0.1
172+import Ubuntu.OnlineAccounts 2.0
173 import Ubuntu.PushNotifications 0.1
174 import Ubuntu.Content 1.0
175 import com.canonical.Oxide 1.5
176@@ -127,9 +126,8 @@
177 backgroundColor: "#dddddd"
178
179 function openAccountPage() {
180- var unauthorizedAccounts = allAccounts.count - accounts.count > 0 ? true : false
181- var accountPage = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml")), { accounts: accounts, unauthorizedAccounts: unauthorizedAccounts, oaSetup: setup });
182- accountPage.accountSelected.connect(function(username, handle) { accountService.startAuthentication(username, handle); pagestack.pop(); root.accountPage = null });
183+ var accountPage = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml")), { accounts: accounts });
184+ accountPage.accountSelected.connect(function(username, account) { root.startAuthentication(username, account); pagestack.pop(); root.accountPage = null });
185 }
186
187 function displayNote(note, conflictMode) {
188@@ -208,7 +206,7 @@
189 function doLogin() {
190 var accountName = preferences.accountName;
191 if (accountName == "@local") {
192- accountService.startAuthentication("@local", null);
193+ root.startAuthentication("@local", null);
194 return;
195 }
196
197@@ -218,7 +216,7 @@
198 for (i = 0; i < accounts.count; i++) {
199 if (accounts.get(i, "displayName") == accountName) {
200 print("Account", accountName, "still valid in Online Accounts.");
201- accountService.startAuthentication(accounts.get(i, "displayName"), accounts.get(i, "accountServiceHandle"));
202+ root.startAuthentication(accounts.get(i, "displayName"), accounts.get(i, "account"));
203 return;
204 }
205 }
206@@ -231,7 +229,7 @@
207 break;
208 case 1:
209 print("Connecting to account", accounts.get(0, "displayName"), "as there is only one account available");
210- accountService.startAuthentication(accounts.get(0, "displayName"), accounts.get(0, "accountServiceHandle"));
211+ root.startAuthentication(accounts.get(0, "displayName"), accounts.get(0, "account"));
212 break;
213 default:
214 print("There are multiple accounts. Allowing user to select one.");
215@@ -396,53 +394,42 @@
216 }
217 }
218
219- AccountServiceModel {
220+ AccountModel {
221 id: accounts
222 applicationId: "com.ubuntu.reminders_reminders"
223 }
224
225- AccountServiceModel {
226- id: allAccounts
227- applicationId: "com.ubuntu.reminders_reminders"
228- service: useSandbox ? "evernote-sandbox" : "evernote"
229- includeDisabled: true
230- }
231-
232- AccountService {
233- id: accountService
234- function startAuthentication(username, objectHandle) {
235- //Load the cache
236- EvernoteConnection.disconnectFromEvernote();
237- EvernoteConnection.token = "";
238- NotesStore.username = username;
239- preferences.accountName = username;
240- if (username === "@local" && !preferences.haveLocalUser) {
241- NotesStore.createNotebook(i18n.tr("Default notebook"));
242- preferences.haveLocalUser = true;
243- }
244-
245- if (objectHandle === null) {
246- return;
247- }
248-
249- accountService.objectHandle = objectHandle;
250- // FIXME: workaround for lp:1351041. We'd normally set the hostname
251- // under onAuthenticated, but it seems that now returns empty parameters
252- EvernoteConnection.hostname = accountService.authData.parameters["HostName"];
253- authenticate(null);
254- }
255-
256- onAuthenticated: {
257- EvernoteConnection.token = reply.AccessToken;
258- print("token is:", EvernoteConnection.token)
259- print("NetworkingStatus.online:", NetworkingStatus.Online)
260- if (NetworkingStatus.Online) {
261- EvernoteConnection.connectToEvernote();
262- }
263- }
264- onAuthenticationError: {
265- console.log("Authentication failed, code " + error.code)
266- }
267+ function startAuthentication(username, account) {
268+ //Load the cache
269+ EvernoteConnection.disconnectFromEvernote();
270+ EvernoteConnection.token = "";
271+ NotesStore.username = username;
272+ preferences.accountName = username;
273+ if (username === "@local" && !preferences.haveLocalUser) {
274+ NotesStore.createNotebook(i18n.tr("Default notebook"));
275+ preferences.haveLocalUser = true;
276+ }
277+
278+ if (account === null) {
279+ return;
280+ }
281+
282+ // FIXME: workaround for lp:1351041. We'd normally set the hostname
283+ // under onAuthenticated, but it seems that now returns empty parameters
284+ EvernoteConnection.hostname = account.settings["HostName"];
285+ account.authenticationReply.connect(function(reply) {
286+ if ("errorCode" in reply) {
287+ console.log("Authentication failed, code " + reply.errorCode)
288+ } else {
289+ EvernoteConnection.token = reply.AccessToken;
290+ print("token is:", EvernoteConnection.token)
291+ print("NetworkingStatus.online:", NetworkingStatus.Online)
292+ if (NetworkingStatus.Online) {
293+ EvernoteConnection.connectToEvernote();
294+ }
295+ }
296+ })
297+ account.authenticate(null);
298 }
299
300 Component.onCompleted: {
301@@ -653,10 +640,8 @@
302
303 page: AccountSelectorPage {
304 accounts: accounts
305- unauthorizedAccounts: true
306- oaSetup: setup
307 onAccountSelected: {
308- accountService.startAuthentication(username, handle)
309+ root.startAuthentication(username, account)
310 rootTabs.selectedTabIndex = 0;
311 }
312 }
313@@ -700,12 +685,6 @@
314 }
315 }
316
317- Setup {
318- id: setup
319- applicationId: "com.ubuntu.reminders_reminders"
320- providerId: useSandbox ? "com.ubuntu.reminders_evernote-account-plugin-sandbox" : "com.ubuntu.reminders_evernote-account-plugin"
321- }
322-
323 Component {
324 id: noAccountDialog
325 Dialog {
326@@ -733,7 +712,7 @@
327 color: UbuntuColors.red
328 onClicked: {
329 PopupUtils.close(noAccount)
330- accountService.startAuthentication("@local", null);
331+ root.startAuthentication("@local", null);
332 }
333 Layout.fillWidth: true
334 }
335@@ -741,7 +720,10 @@
336 objectName: "openAccountButton"
337 text: i18n.tr("Yes")
338 color: UbuntuColors.green
339- onClicked: setup.exec()
340+ onClicked: {
341+ var service = "com.ubuntu.reminders_reminders_com.ubuntu.reminders_evernote-account-plugin"
342+ accounts.requestAccess(service, {})
343+ }
344 Layout.fillWidth: true
345 }
346 }
347
348=== modified file 'src/app/qml/ui/AccountSelectorPage.qml'
349--- src/app/qml/ui/AccountSelectorPage.qml 2015-09-15 14:50:55 +0000
350+++ src/app/qml/ui/AccountSelectorPage.qml 2016-03-08 07:11:08 +0000
351@@ -19,8 +19,7 @@
352 import QtQuick 2.4
353 import Ubuntu.Components 1.3
354 import Ubuntu.Components.ListItems 1.3
355-import Ubuntu.OnlineAccounts 0.1
356-import Ubuntu.OnlineAccounts.Client 0.1
357+import Ubuntu.OnlineAccounts 2.0
358 import Evernote 0.1
359
360 Page {
361@@ -29,10 +28,8 @@
362 title: i18n.tr("Select account")
363
364 property alias accounts: optionSelector.model
365- property bool unauthorizedAccounts
366- property var oaSetup: null
367
368- signal accountSelected(string username, var handle)
369+ signal accountSelected(string username, var account)
370
371
372 Column {
373@@ -64,23 +61,13 @@
374
375 MouseArea {
376 anchors.fill: parent
377- onClicked: {
378- if (model.enabled) {
379- root.accountSelected(displayName, accountServiceHandle)
380- }
381- else {
382- console.log('authorize')
383- }
384- }
385+ onClicked: root.accountSelected(displayName, account)
386 }
387
388 Component.onCompleted: {
389 if (displayName == preferences.accountName) {
390 optionSelector.selectedIndex = index;
391 }
392- if (!model.enabled) {
393- text = i18n.tr("%1 - Tap to authorize").arg(text)
394- }
395 }
396 }
397 }
398@@ -90,7 +77,10 @@
399 width: parent.width - units.gu(2)
400 text: i18n.tr("Add new account")
401 color: UbuntuColors.orange
402- onClicked: root.oaSetup.exec()
403+ onClicked: {
404+ var service = "com.ubuntu.reminders_reminders_com.ubuntu.reminders_evernote-account-plugin"
405+ accounts.requestAccess(service, {})
406+ }
407 }
408 }
409

Subscribers

People subscribed via source and target branches