Merge lp:~mzanetti/reminders-app/init-account-rework into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 49
Merged at revision: 51
Proposed branch: lp:~mzanetti/reminders-app/init-account-rework
Merge into: lp:reminders-app
Diff against target: 126 lines (+39/-25)
3 files modified
debian/control (+1/-1)
src/app/qml/reminders.qml (+32/-2)
src/app/qml/ui/AccountSelectorPage.qml (+6/-22)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/init-account-rework
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+204228@code.launchpad.net

Commit message

Only load the AccountSelectorPage if there are more than 1 accounts available.

To post a comment you must log in.
46. By Michael Zanetti

revert unneeded change

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

update deps

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

+ property alias accounts: listView.model

You didn't add

id: listView

to listView in AccountSelectorPage.qml, so if there are 2 accounts there is an error:

QQmlComponent: Component is not ready
file:///home/rpadovani/Documents/ubuntu/touch/core-apps/init-account-rework-build/src/app/qml/reminders.qml:80: TypeError: Cannot read property 'accountSelected' of null

review: Needs Fixing
48. By Michael Zanetti

fix invalid alias reference

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> + property alias accounts: listView.model
>
> You didn't add
>
> id: listView
>
> to listView in AccountSelectorPage.qml, so if there are 2 accounts there is an
> error:
>
> QQmlComponent: Component is not ready
> file:///home/rpadovani/Documents/ubuntu/touch/core-apps/init-account-rework-
> build/src/app/qml/reminders.qml:80: TypeError: Cannot read property
> 'accountSelected' of null

fixed

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

resolve conflicts

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Looks good to me! Good work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-01-30 12:53:13 +0000
3+++ debian/control 2014-02-05 09:33:17 +0000
4@@ -19,7 +19,7 @@
5 Architecture: any
6 Depends: ${misc:Depends},
7 account-plugin-evernote,
8- qmlscene,
9+ qtdeclarative5-accounts-plugin,
10 qtdeclarative5-evernote0.1,
11 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
12 qtdeclarative5-localstorage-plugin,
13
14=== modified file 'src/app/qml/reminders.qml'
15--- src/app/qml/reminders.qml 2014-01-27 13:00:41 +0000
16+++ src/app/qml/reminders.qml 2014-02-05 09:33:17 +0000
17@@ -21,12 +21,14 @@
18 //import "components"
19 import "ui"
20 import Evernote 0.1
21+import Ubuntu.OnlineAccounts 0.1
22
23 /*!
24 \brief MainView with a Label and Button elements.
25 */
26
27 MainView {
28+ id: root
29 // objectName for functional testing purposes (autopilot-qt5)
30 objectName: "mainView"
31
32@@ -45,10 +47,38 @@
33 // Temporary background color. This can be changed to other suitable backgrounds when we get official mockup designs
34 backgroundColor: UbuntuColors.coolGrey
35
36+ AccountServiceModel {
37+ id: accounts
38+ service: "evernote"
39+ }
40+
41+ AccountService {
42+ id: accountService
43+ onObjectHandleChanged: authenticate(null);
44+ onAuthenticated: {
45+ console.log("Access token is " + reply.AccessToken)
46+ EvernoteConnection.token = reply.AccessToken;
47+ }
48+ onAuthenticationError: {
49+ console.log("Authentication failed, code " + error.code)
50+ }
51+ }
52+
53 Component.onCompleted: {
54 pagestack.push(rootTabs)
55- if (EvernoteConnection.token.length === 0) {
56- pagestack.push(Qt.resolvedUrl("ui/AccountSelectorPage.qml"));
57+ print("got accounts:", accounts.count)
58+ switch (accounts.count) {
59+ case 0:
60+ print("No account available! Please setup an account in the system settings");
61+ break;
62+ case 1:
63+ accountService.objectHandle = accounts.get(0, "accountServiceHandle");
64+ break;
65+ default:
66+ var component = Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml"));
67+ var page = component.createObject(root, {accounts: accounts});
68+ page.accountSelected.connect(function(handle) { accountService.objectHandle = handle; pagestack.pop(); });
69+ pagestack.push(page);
70 }
71 }
72
73
74=== modified file 'src/app/qml/ui/AccountSelectorPage.qml'
75--- src/app/qml/ui/AccountSelectorPage.qml 2014-01-27 13:00:41 +0000
76+++ src/app/qml/ui/AccountSelectorPage.qml 2014-02-05 09:33:17 +0000
77@@ -26,43 +26,27 @@
78 id: root
79 title: "Select Evernote account"
80
81- AccountServiceModel {
82- id: accounts
83- // Use the Evernote service
84- service: "evernote"
85- }
86+ property alias accounts: listView.model
87+
88+ signal accountSelected(var handle)
89
90 Column {
91 anchors { fill: parent; margins: units.gu(2) }
92 spacing: units.gu(1)
93
94 ListView {
95+ id: listView
96 width: parent.width
97 height: units.gu(10)
98 model: accounts
99+
100 delegate: Standard {
101 text: displayName
102-
103- // FIXME: remove this Item wrapper once Ubuntu ListItems are fixed to hold non-visual items
104- Item {
105- AccountService {
106- id: accountService
107- objectHandle: accountServiceHandle
108- // Print the access token on the console
109- onAuthenticated: {
110- console.log("Access token is " + reply.AccessToken)
111- EvernoteConnection.token = reply.AccessToken;
112- pagestack.pop();
113- }
114- onAuthenticationError: { console.log("Authentication failed, code " + error.code) }
115- }
116- }
117 MouseArea {
118 anchors.fill: parent
119- onClicked: accountService.authenticate(null)
120+ onClicked: root.accountSelected(accountServiceHandle)
121 }
122 }
123 }
124-
125 }
126 }

Subscribers

People subscribed via source and target branches