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
=== modified file 'debian/control'
--- debian/control 2014-01-30 12:53:13 +0000
+++ debian/control 2014-02-05 09:33:17 +0000
@@ -19,7 +19,7 @@
19Architecture: any19Architecture: any
20Depends: ${misc:Depends},20Depends: ${misc:Depends},
21 account-plugin-evernote,21 account-plugin-evernote,
22 qmlscene,22 qtdeclarative5-accounts-plugin,
23 qtdeclarative5-evernote0.1,23 qtdeclarative5-evernote0.1,
24 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,24 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
25 qtdeclarative5-localstorage-plugin,25 qtdeclarative5-localstorage-plugin,
2626
=== modified file 'src/app/qml/reminders.qml'
--- src/app/qml/reminders.qml 2014-01-27 13:00:41 +0000
+++ src/app/qml/reminders.qml 2014-02-05 09:33:17 +0000
@@ -21,12 +21,14 @@
21//import "components"21//import "components"
22import "ui"22import "ui"
23import Evernote 0.123import Evernote 0.1
24import Ubuntu.OnlineAccounts 0.1
2425
25/*!26/*!
26 \brief MainView with a Label and Button elements.27 \brief MainView with a Label and Button elements.
27*/28*/
2829
29MainView {30MainView {
31 id: root
30 // objectName for functional testing purposes (autopilot-qt5)32 // objectName for functional testing purposes (autopilot-qt5)
31 objectName: "mainView"33 objectName: "mainView"
3234
@@ -45,10 +47,38 @@
45 // Temporary background color. This can be changed to other suitable backgrounds when we get official mockup designs47 // Temporary background color. This can be changed to other suitable backgrounds when we get official mockup designs
46 backgroundColor: UbuntuColors.coolGrey48 backgroundColor: UbuntuColors.coolGrey
4749
50 AccountServiceModel {
51 id: accounts
52 service: "evernote"
53 }
54
55 AccountService {
56 id: accountService
57 onObjectHandleChanged: authenticate(null);
58 onAuthenticated: {
59 console.log("Access token is " + reply.AccessToken)
60 EvernoteConnection.token = reply.AccessToken;
61 }
62 onAuthenticationError: {
63 console.log("Authentication failed, code " + error.code)
64 }
65 }
66
48 Component.onCompleted: {67 Component.onCompleted: {
49 pagestack.push(rootTabs)68 pagestack.push(rootTabs)
50 if (EvernoteConnection.token.length === 0) {69 print("got accounts:", accounts.count)
51 pagestack.push(Qt.resolvedUrl("ui/AccountSelectorPage.qml"));70 switch (accounts.count) {
71 case 0:
72 print("No account available! Please setup an account in the system settings");
73 break;
74 case 1:
75 accountService.objectHandle = accounts.get(0, "accountServiceHandle");
76 break;
77 default:
78 var component = Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml"));
79 var page = component.createObject(root, {accounts: accounts});
80 page.accountSelected.connect(function(handle) { accountService.objectHandle = handle; pagestack.pop(); });
81 pagestack.push(page);
52 }82 }
53 }83 }
5484
5585
=== modified file 'src/app/qml/ui/AccountSelectorPage.qml'
--- src/app/qml/ui/AccountSelectorPage.qml 2014-01-27 13:00:41 +0000
+++ src/app/qml/ui/AccountSelectorPage.qml 2014-02-05 09:33:17 +0000
@@ -26,43 +26,27 @@
26 id: root26 id: root
27 title: "Select Evernote account"27 title: "Select Evernote account"
2828
29 AccountServiceModel {29 property alias accounts: listView.model
30 id: accounts30
31 // Use the Evernote service31 signal accountSelected(var handle)
32 service: "evernote"
33 }
3432
35 Column {33 Column {
36 anchors { fill: parent; margins: units.gu(2) }34 anchors { fill: parent; margins: units.gu(2) }
37 spacing: units.gu(1)35 spacing: units.gu(1)
3836
39 ListView {37 ListView {
38 id: listView
40 width: parent.width39 width: parent.width
41 height: units.gu(10)40 height: units.gu(10)
42 model: accounts41 model: accounts
42
43 delegate: Standard {43 delegate: Standard {
44 text: displayName44 text: displayName
45
46 // FIXME: remove this Item wrapper once Ubuntu ListItems are fixed to hold non-visual items
47 Item {
48 AccountService {
49 id: accountService
50 objectHandle: accountServiceHandle
51 // Print the access token on the console
52 onAuthenticated: {
53 console.log("Access token is " + reply.AccessToken)
54 EvernoteConnection.token = reply.AccessToken;
55 pagestack.pop();
56 }
57 onAuthenticationError: { console.log("Authentication failed, code " + error.code) }
58 }
59 }
60 MouseArea {45 MouseArea {
61 anchors.fill: parent46 anchors.fill: parent
62 onClicked: accountService.authenticate(null)47 onClicked: root.accountSelected(accountServiceHandle)
63 }48 }
64 }49 }
65 }50 }
66
67 }51 }
68}52}

Subscribers

People subscribed via source and target branches