Merge lp:~rpadovani/reminders-app/multipleAccounts into lp:reminders-app
- multipleAccounts
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Zanetti | ||||
Approved revision: | 267 | ||||
Merged at revision: | 291 | ||||
Proposed branch: | lp:~rpadovani/reminders-app/multipleAccounts | ||||
Merge into: | lp:reminders-app | ||||
Diff against target: |
249 lines (+79/-36) 9 files modified
3rdParty/libthrift/transport/TSSLSocket.cpp (+5/-3) src/app/qml/reminders.qml (+8/-1) src/app/qml/ui/AccountSelectorPage.qml (+44/-22) src/app/qml/ui/NotebooksPage.qml (+1/-1) src/app/qml/ui/NotesPage.qml (+1/-1) src/app/qml/ui/RemindersPage.qml (+1/-1) src/plugin/Evernote/evernoteconnection.cpp (+3/-0) src/plugin/Evernote/notesstore.cpp (+14/-7) src/plugin/Evernote/notesstore.h (+2/-0) |
||||
To merge this branch: | bzr merge lp:~rpadovani/reminders-app/multipleAccounts | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Zanetti (community) | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
David Planella | Needs Fixing | ||
Review via email: mp+237682@code.launchpad.net |
Commit message
Fixed change accounts page
Description of the change
Implemented new change accounts page as discussed during lasts meetings.
When you change account you don't see account name due https:/
For the same reason, autologin doesn't work
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
David Planella (dpm) wrote : | # |
Thanks Riccardo!
After testing this on the emulator, I've observed a few things:
- Nice work with the Accounts action on the toolbar.
- Switching accounts seems to freeze the app. I'm not sure if it's an issue with the app or the emulator
- I added my first account with reminders, closed the app and the second one via System settings, and it then showed me a message about the account needing authorization. Functionally, this demonstrates that it works, but the placement of the message might be a bit confusing, as it seems it refers to the account I had already authorized. I would suggest to do the following changes:
http://
In summary, have an option selector, and when the unauthorized account is tapped, then the authorization dialog should pop up, rather than using the "Add account" for two different and unrelated purposes.
Riccardo Padovani (rpadovani) wrote : | # |
Hey David,
thanks for your test and your suggestions.
So, I implemented the page as you suggested, but I have your same problem on Unity 7: when you choose an account, it freezes the app. I set this branch WIP until I understand what's going on.
David Planella (dpm) wrote : | # |
So I've tested again on the emulator: switching accounts freezes the app. On a device with rtm image 81, it won't even add any accounts (*). Not sure what's going on, as with trunk adding accounts does work.
(*) when clicking to add an account, I get a full-screen blank page.
Riccardo Padovani (rpadovani) wrote : | # |
I did last modifications to UI, I'm investigating on freeze
David Planella (dpm) wrote : | # |
Thanks! The branch has now conflicts, so it needs merging trunk into it.
Also, if adding an UbuntuShape complicates the code, then we can perhaps leave it out. The reason I suggested it was because I thought we could use a standard OptionSelector. Would it not be possible at all?
Riccardo Padovani (rpadovani) wrote : | # |
On Sun, Oct 12, 2014 at 06:24:38AM -0000, David Planella wrote:
>
> Review: Needs Fixing
>
> Thanks! The branch has now conflicts, so it needs merging trunk into it.
Thanks for the notice. I merged with trunk.
> Also, if adding an UbuntuShape complicates the code, then we can perhaps leave it out. The reason I suggested it was because I thought we could use a standard OptionSelector. Would it not be possible at all?
Well, you can see the code, do you think is too much complicate?
Anyway, there is no (simple? I think all is possible...) way to use
OptionSelector right now, because we need to add a different delegate for
unknown account.
So, ListView has property footer, and we can use that, but OptionSelector has
nothing like this, you can use only one type of delegate for all things in the
model.
Or we change our approach to the unknown account (like the first I had) and we
can use OptionSelector for the regular accounts, or this is the simplest way I
found to implement UbuntuShape.
Let me know!
David Planella (dpm) wrote : | # |
After the conversation on IRC, if that makes things easier for the implementation, I'd suggest this new sketch http://
The point is to separate the authorized from unauthorized accounts. I'm not too worried if the unauthorized accounts can be authorized individually in a list or if there is a single button to authorize them all in system settings.
Riccardo Padovani (rpadovani) wrote : | # |
Aha. I read the documentation and I found a way to implement your first mockup - only the UI for now, I'm working on the backend
Riccardo Padovani (rpadovani) wrote : | # |
This is ready to be reviewed now
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:266
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : | # |
one inline comment
- 267. By Riccardo Padovani
-
Better implementation of a string
Riccardo Padovani (rpadovani) wrote : | # |
Done
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:267
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : | # |
let's get this in. thanks
David Planella (dpm) wrote : | # |
For some reason, when testing trunk I can't see any action to switch accounts.
Michael Zanetti (mzanetti) wrote : | # |
Weird thing: It works fine on the desktop for me, but not on the phone. I think it's a difference in behavior of OA.
Preview Diff
1 | === modified file '3rdParty/libthrift/transport/TSSLSocket.cpp' | |||
2 | --- 3rdParty/libthrift/transport/TSSLSocket.cpp 2013-11-21 23:30:15 +0000 | |||
3 | +++ 3rdParty/libthrift/transport/TSSLSocket.cpp 2014-10-24 13:44:56 +0000 | |||
4 | @@ -143,9 +143,11 @@ | |||
5 | 143 | void TSSLSocket::close() { | 143 | void TSSLSocket::close() { |
6 | 144 | if (ssl_ != NULL) { | 144 | if (ssl_ != NULL) { |
7 | 145 | int rc = SSL_shutdown(ssl_); | 145 | int rc = SSL_shutdown(ssl_); |
11 | 146 | if (rc == 0) { | 146 | // FIXME: this freezes the app when switching account, check if it's needed |
12 | 147 | rc = SSL_shutdown(ssl_); | 147 | // when upgrade evernote sdk |
13 | 148 | } | 148 | // if (rc == 0) { |
14 | 149 | // rc = SSL_shutdown(ssl_); | ||
15 | 150 | // } | ||
16 | 149 | if (rc < 0) { | 151 | if (rc < 0) { |
17 | 150 | int errno_copy = errno; | 152 | int errno_copy = errno; |
18 | 151 | string errors; | 153 | string errors; |
19 | 152 | 154 | ||
20 | === modified file 'src/app/qml/reminders.qml' | |||
21 | --- src/app/qml/reminders.qml 2014-10-10 14:15:04 +0000 | |||
22 | +++ src/app/qml/reminders.qml 2014-10-24 13:44:56 +0000 | |||
23 | @@ -57,11 +57,12 @@ | |||
24 | 57 | property var accountPage; | 57 | property var accountPage; |
25 | 58 | 58 | ||
26 | 59 | function openAccountPage(isChangingAccount) { | 59 | function openAccountPage(isChangingAccount) { |
27 | 60 | var unauthorizedAccounts = allAccounts.count - accounts.count > 0 ? true : false | ||
28 | 60 | if (accountPage) { | 61 | if (accountPage) { |
29 | 61 | accountPage.destroy(100) | 62 | accountPage.destroy(100) |
30 | 62 | } | 63 | } |
31 | 63 | var component = Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml")); | 64 | var component = Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml")); |
33 | 64 | accountPage = component.createObject(root, {accounts: accounts, isChangingAccount: isChangingAccount}); | 65 | accountPage = component.createObject(root, { accounts: allAccounts, isChangingAccount: isChangingAccount, unauthorizedAccounts: unauthorizedAccounts }); |
34 | 65 | accountPage.accountSelected.connect(function(handle) { accountService.objectHandle = handle; pagestack.pop(); root.accountPage = null }); | 66 | accountPage.accountSelected.connect(function(handle) { accountService.objectHandle = handle; pagestack.pop(); root.accountPage = null }); |
35 | 66 | pagestack.push(accountPage); | 67 | pagestack.push(accountPage); |
36 | 67 | } | 68 | } |
37 | @@ -134,6 +135,12 @@ | |||
38 | 134 | applicationId: "com.ubuntu.reminders_reminders" | 135 | applicationId: "com.ubuntu.reminders_reminders" |
39 | 135 | } | 136 | } |
40 | 136 | 137 | ||
41 | 138 | AccountServiceModel { | ||
42 | 139 | id: allAccounts | ||
43 | 140 | service: useSandbox ? "evernote-sandbox" : "evernote" | ||
44 | 141 | includeDisabled: true | ||
45 | 142 | } | ||
46 | 143 | |||
47 | 137 | AccountService { | 144 | AccountService { |
48 | 138 | id: accountService | 145 | id: accountService |
49 | 139 | onObjectHandleChanged: { | 146 | onObjectHandleChanged: { |
50 | 140 | 147 | ||
51 | === modified file 'src/app/qml/ui/AccountSelectorPage.qml' | |||
52 | --- src/app/qml/ui/AccountSelectorPage.qml 2014-09-23 12:39:27 +0000 | |||
53 | +++ src/app/qml/ui/AccountSelectorPage.qml 2014-10-24 13:44:56 +0000 | |||
54 | @@ -28,8 +28,9 @@ | |||
55 | 28 | objectName: "Accountselectorpage" | 28 | objectName: "Accountselectorpage" |
56 | 29 | title: i18n.tr("Select Evernote account") | 29 | title: i18n.tr("Select Evernote account") |
57 | 30 | 30 | ||
59 | 31 | property alias accounts: listView.model | 31 | property alias accounts: optionSelector.model |
60 | 32 | property bool isChangingAccount | 32 | property bool isChangingAccount |
61 | 33 | property bool unauthorizedAccounts | ||
62 | 33 | 34 | ||
63 | 34 | signal accountSelected(var handle) | 35 | signal accountSelected(var handle) |
64 | 35 | 36 | ||
65 | @@ -41,33 +42,54 @@ | |||
66 | 41 | 42 | ||
67 | 42 | Column { | 43 | Column { |
68 | 43 | anchors { fill: parent; margins: units.gu(2) } | 44 | anchors { fill: parent; margins: units.gu(2) } |
70 | 44 | spacing: units.gu(1) | 45 | spacing: units.gu(2) |
71 | 45 | 46 | ||
74 | 46 | ListView { | 47 | OptionSelector { |
75 | 47 | id: listView | 48 | id: optionSelector |
76 | 48 | width: parent.width | 49 | width: parent.width |
80 | 49 | height: units.gu(10) | 50 | expanded: true |
78 | 50 | model: accounts | ||
79 | 51 | currentIndex: -1 | ||
81 | 52 | 51 | ||
82 | 53 | delegate: Standard { | 52 | delegate: Standard { |
83 | 54 | objectName: "EvernoteAccount" | 53 | objectName: "EvernoteAccount" |
84 | 55 | text: displayName | 54 | text: displayName |
85 | 55 | showDivider: index + 1 !== accounts.count | ||
86 | 56 | |||
87 | 56 | MouseArea { | 57 | MouseArea { |
88 | 57 | anchors.fill: parent | 58 | anchors.fill: parent |
104 | 58 | onClicked: root.accountSelected(accountServiceHandle) | 59 | onClicked: { |
105 | 59 | } | 60 | if (model.enabled) { |
106 | 60 | } | 61 | root.accountSelected(accountServiceHandle) |
107 | 61 | 62 | } | |
108 | 62 | footer: Button { | 63 | else { |
109 | 63 | text: i18n.tr("Add account") | 64 | console.log('authorize') |
110 | 64 | onClicked: setup.exec() | 65 | } |
111 | 65 | } | 66 | } |
112 | 66 | } | 67 | } |
113 | 67 | } | 68 | |
114 | 68 | 69 | Component.onCompleted: { | |
115 | 69 | tools: ToolbarItems { | 70 | if (isChangingAccount && displayName == preferences.accountName) { |
116 | 70 | locked: !isChangingAccount | 71 | optionSelector.selectedIndex = index; |
117 | 71 | opened: isChangingAccount | 72 | } |
118 | 72 | } | 73 | if (!model.enabled) { |
119 | 74 | text = i18n.tr("%1 - Tap to authorize").arg(text) | ||
120 | 75 | } | ||
121 | 76 | } | ||
122 | 77 | } | ||
123 | 78 | } | ||
124 | 79 | |||
125 | 80 | Button { | ||
126 | 81 | anchors.horizontalCenter: parent.horizontalCenter | ||
127 | 82 | width: parent.width - units.gu(2) | ||
128 | 83 | text: i18n.tr("Add new account") | ||
129 | 84 | color: UbuntuColors.orange | ||
130 | 85 | onClicked: setup.exec() | ||
131 | 86 | } | ||
132 | 87 | } | ||
133 | 88 | |||
134 | 89 | head.backAction: Action { | ||
135 | 90 | visible: isChangingAccount | ||
136 | 91 | iconName: "back" | ||
137 | 92 | text: i18n.tr("Back") | ||
138 | 93 | onTriggered: { pagestack.pop(); } | ||
139 | 94 | } | ||
140 | 73 | } | 95 | } |
141 | 74 | 96 | ||
142 | === modified file 'src/app/qml/ui/NotebooksPage.qml' | |||
143 | --- src/app/qml/ui/NotebooksPage.qml 2014-09-23 12:39:27 +0000 | |||
144 | +++ src/app/qml/ui/NotebooksPage.qml 2014-10-24 13:44:56 +0000 | |||
145 | @@ -72,7 +72,7 @@ | |||
146 | 72 | action: Action { | 72 | action: Action { |
147 | 73 | text: i18n.tr("Accounts") | 73 | text: i18n.tr("Accounts") |
148 | 74 | iconName: "contacts-app-symbolic" | 74 | iconName: "contacts-app-symbolic" |
150 | 75 | visible: accounts.count > 1 | 75 | visible: allAccounts.count > 1 |
151 | 76 | onTriggered: { | 76 | onTriggered: { |
152 | 77 | openAccountPage(true); | 77 | openAccountPage(true); |
153 | 78 | } | 78 | } |
154 | 79 | 79 | ||
155 | === modified file 'src/app/qml/ui/NotesPage.qml' | |||
156 | --- src/app/qml/ui/NotesPage.qml 2014-10-20 15:02:09 +0000 | |||
157 | +++ src/app/qml/ui/NotesPage.qml 2014-10-24 13:44:56 +0000 | |||
158 | @@ -97,7 +97,7 @@ | |||
159 | 97 | action: Action { | 97 | action: Action { |
160 | 98 | text: i18n.tr("Accounts") | 98 | text: i18n.tr("Accounts") |
161 | 99 | iconName: "contacts-app-symbolic" | 99 | iconName: "contacts-app-symbolic" |
163 | 100 | visible: accounts.count > 1 | 100 | visible: allAccounts.count > 1 |
164 | 101 | onTriggered: { | 101 | onTriggered: { |
165 | 102 | openAccountPage(true); | 102 | openAccountPage(true); |
166 | 103 | } | 103 | } |
167 | 104 | 104 | ||
168 | === modified file 'src/app/qml/ui/RemindersPage.qml' | |||
169 | --- src/app/qml/ui/RemindersPage.qml 2014-10-15 10:24:28 +0000 | |||
170 | +++ src/app/qml/ui/RemindersPage.qml 2014-10-24 13:44:56 +0000 | |||
171 | @@ -43,7 +43,7 @@ | |||
172 | 43 | action: Action { | 43 | action: Action { |
173 | 44 | text: i18n.tr("Accounts") | 44 | text: i18n.tr("Accounts") |
174 | 45 | iconName: "contacts-app-symbolic" | 45 | iconName: "contacts-app-symbolic" |
176 | 46 | visible: accounts.count > 1 | 46 | visible: allAccounts.count > 1 |
177 | 47 | onTriggered: { | 47 | onTriggered: { |
178 | 48 | openAccountPage(true); | 48 | openAccountPage(true); |
179 | 49 | } | 49 | } |
180 | 50 | 50 | ||
181 | === modified file 'src/plugin/Evernote/evernoteconnection.cpp' | |||
182 | --- src/plugin/Evernote/evernoteconnection.cpp 2014-09-19 21:31:39 +0000 | |||
183 | +++ src/plugin/Evernote/evernoteconnection.cpp 2014-10-24 13:44:56 +0000 | |||
184 | @@ -169,6 +169,9 @@ | |||
185 | 169 | m_token = token; | 169 | m_token = token; |
186 | 170 | emit tokenChanged(); | 170 | emit tokenChanged(); |
187 | 171 | 171 | ||
188 | 172 | qDeleteAll(m_jobQueue); | ||
189 | 173 | m_jobQueue.clear(); | ||
190 | 174 | |||
191 | 172 | connectToEvernote(); | 175 | connectToEvernote(); |
192 | 173 | } | 176 | } |
193 | 174 | } | 177 | } |
194 | 175 | 178 | ||
195 | === modified file 'src/plugin/Evernote/notesstore.cpp' | |||
196 | --- src/plugin/Evernote/notesstore.cpp 2014-10-09 17:24:22 +0000 | |||
197 | +++ src/plugin/Evernote/notesstore.cpp 2014-10-24 13:44:56 +0000 | |||
198 | @@ -53,6 +53,7 @@ | |||
199 | 53 | connect(EvernoteConnection::instance(), &EvernoteConnection::isConnectedChanged, this, &NotesStore::refreshNotebooks); | 53 | connect(EvernoteConnection::instance(), &EvernoteConnection::isConnectedChanged, this, &NotesStore::refreshNotebooks); |
200 | 54 | connect(EvernoteConnection::instance(), SIGNAL(isConnectedChanged()), this, SLOT(refreshNotes())); | 54 | connect(EvernoteConnection::instance(), SIGNAL(isConnectedChanged()), this, SLOT(refreshNotes())); |
201 | 55 | connect(EvernoteConnection::instance(), &EvernoteConnection::isConnectedChanged, this, &NotesStore::refreshTags); | 55 | connect(EvernoteConnection::instance(), &EvernoteConnection::isConnectedChanged, this, &NotesStore::refreshTags); |
202 | 56 | connect(EvernoteConnection::instance(), &EvernoteConnection::tokenChanged, this, &NotesStore::clear); | ||
203 | 56 | 57 | ||
204 | 57 | qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList"); | 58 | qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList"); |
205 | 58 | qRegisterMetaType<evernote::edam::Note>("evernote::edam::Note"); | 59 | qRegisterMetaType<evernote::edam::Note>("evernote::edam::Note"); |
206 | @@ -334,13 +335,7 @@ | |||
207 | 334 | void NotesStore::refreshNotes(const QString &filterNotebookGuid) | 335 | void NotesStore::refreshNotes(const QString &filterNotebookGuid) |
208 | 335 | { | 336 | { |
209 | 336 | if (EvernoteConnection::instance()->token().isEmpty()) { | 337 | if (EvernoteConnection::instance()->token().isEmpty()) { |
217 | 337 | beginResetModel(); | 338 | clear(); |
211 | 338 | foreach (Note *note, m_notes) { | ||
212 | 339 | emit noteRemoved(note->guid(), note->notebookGuid()); | ||
213 | 340 | note->deleteLater(); | ||
214 | 341 | } | ||
215 | 342 | m_notes.clear(); | ||
216 | 343 | endResetModel(); | ||
218 | 344 | emit countChanged(); | 339 | emit countChanged(); |
219 | 345 | } else { | 340 | } else { |
220 | 346 | m_loading = true; | 341 | m_loading = true; |
221 | @@ -782,3 +777,15 @@ | |||
222 | 782 | int idx = m_notes.indexOf(note); | 777 | int idx = m_notes.indexOf(note); |
223 | 783 | emit dataChanged(index(idx), index(idx)); | 778 | emit dataChanged(index(idx), index(idx)); |
224 | 784 | } | 779 | } |
225 | 780 | |||
226 | 781 | void NotesStore::clear() | ||
227 | 782 | { | ||
228 | 783 | beginResetModel(); | ||
229 | 784 | foreach (Note *note, m_notes) { | ||
230 | 785 | emit noteRemoved(note->guid(), note->notebookGuid()); | ||
231 | 786 | note->deleteLater(); | ||
232 | 787 | } | ||
233 | 788 | m_notes.clear(); | ||
234 | 789 | m_notesHash.clear(); | ||
235 | 790 | endResetModel(); | ||
236 | 791 | } | ||
237 | 785 | 792 | ||
238 | === modified file 'src/plugin/Evernote/notesstore.h' | |||
239 | --- src/plugin/Evernote/notesstore.h 2014-10-09 00:08:52 +0000 | |||
240 | +++ src/plugin/Evernote/notesstore.h 2014-10-24 13:44:56 +0000 | |||
241 | @@ -162,6 +162,8 @@ | |||
242 | 162 | void saveTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage); | 162 | void saveTagJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage); |
243 | 163 | 163 | ||
244 | 164 | void emitDataChanged(); | 164 | void emitDataChanged(); |
245 | 165 | void clear(); | ||
246 | 166 | |||
247 | 165 | private: | 167 | private: |
248 | 166 | explicit NotesStore(QObject *parent = 0); | 168 | explicit NotesStore(QObject *parent = 0); |
249 | 167 | static NotesStore *s_instance; | 169 | static NotesStore *s_instance; |
PASSED: Continuous integration, rev:259 91.189. 93.70:8080/ job/reminders- app-ci/ 543/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 779 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 779/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/reminders- app-utopic- amd64-ci/ 239
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/reminders- app-ci/ 543/rebuild
http://