Merge lp:~mzanetti/reminders-app/create-notebook into lp:reminders-app
- create-notebook
- Merge into trunk
Proposed by
Michael Zanetti
Status: | Merged |
---|---|
Approved by: | Michael Zanetti |
Approved revision: | 21 |
Merged at revision: | 18 |
Proposed branch: | lp:~mzanetti/reminders-app/create-notebook |
Merge into: | lp:reminders-app |
Prerequisite: | lp:~mzanetti/reminders-app/add-reminders |
Diff against target: |
391 lines (+243/-4) 10 files modified
src/app/qml/ui/NotebooksPage.qml (+10/-0) src/app/qml/ui/NotesPage.qml (+1/-1) src/plugin/Evernote/Evernote.pro (+6/-2) src/plugin/Evernote/jobs/createnotebookjob.cpp (+41/-0) src/plugin/Evernote/jobs/createnotebookjob.h (+46/-0) src/plugin/Evernote/jobs/evernotejob.cpp (+10/-1) src/plugin/Evernote/jobs/expungenotebookjob.cpp (+39/-0) src/plugin/Evernote/jobs/expungenotebookjob.h (+43/-0) src/plugin/Evernote/notesstore.cpp (+42/-0) src/plugin/Evernote/notesstore.h (+5/-0) |
To merge this branch: | bzr merge lp:~mzanetti/reminders-app/create-notebook |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jordan Keyes | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+198841@code.launchpad.net |
Commit message
Added createNotebook to plugin API.
Description of the change
Added createNotebook to plugin API.
I've also added expungeNote, however, with the current API key we aren't allowed to call that.
To post a comment you must log in.
- 21. By Michael Zanetti
-
add copyright headers
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
Jordan Keyes (jkeyes0) wrote : | # |
Create notebook option seems to work here, at least as far as creating a new notebook named "new notebook" :)
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/app/qml/ui/NotebooksPage.qml' | |||
2 | --- src/app/qml/ui/NotebooksPage.qml 2013-11-26 17:18:33 +0000 | |||
3 | +++ src/app/qml/ui/NotebooksPage.qml 2013-12-12 22:46:16 +0000 | |||
4 | @@ -30,6 +30,16 @@ | |||
5 | 30 | } | 30 | } |
6 | 31 | } | 31 | } |
7 | 32 | 32 | ||
8 | 33 | tools: ToolbarItems { | ||
9 | 34 | ToolbarButton { | ||
10 | 35 | text: "add notebook" | ||
11 | 36 | enabled: notes.filterNotebookGuid.length > 0 | ||
12 | 37 | onTriggered: { | ||
13 | 38 | NotesStore.createNotebook("new notebook"); | ||
14 | 39 | } | ||
15 | 40 | } | ||
16 | 41 | } | ||
17 | 42 | |||
18 | 33 | Notebooks { | 43 | Notebooks { |
19 | 34 | id: notebooks | 44 | id: notebooks |
20 | 35 | } | 45 | } |
21 | 36 | 46 | ||
22 | === modified file 'src/app/qml/ui/NotesPage.qml' | |||
23 | --- src/app/qml/ui/NotesPage.qml 2013-12-12 22:46:16 +0000 | |||
24 | +++ src/app/qml/ui/NotesPage.qml 2013-12-12 22:46:16 +0000 | |||
25 | @@ -62,7 +62,7 @@ | |||
26 | 62 | } | 62 | } |
27 | 63 | 63 | ||
28 | 64 | onPressAndHold: { | 64 | onPressAndHold: { |
30 | 65 | notes.note(guid).remove(); | 65 | NotesStore.deleteNote(guid); |
31 | 66 | } | 66 | } |
32 | 67 | } | 67 | } |
33 | 68 | } | 68 | } |
34 | 69 | 69 | ||
35 | === modified file 'src/plugin/Evernote/Evernote.pro' | |||
36 | --- src/plugin/Evernote/Evernote.pro 2013-12-12 22:46:16 +0000 | |||
37 | +++ src/plugin/Evernote/Evernote.pro 2013-12-12 22:46:16 +0000 | |||
38 | @@ -27,7 +27,9 @@ | |||
39 | 27 | evernoteconnection.cpp \ | 27 | evernoteconnection.cpp \ |
40 | 28 | jobs/userstorejob.cpp \ | 28 | jobs/userstorejob.cpp \ |
41 | 29 | jobs/notesstorejob.cpp \ | 29 | jobs/notesstorejob.cpp \ |
43 | 30 | jobs/fetchusernamejob.cpp | 30 | jobs/fetchusernamejob.cpp \ |
44 | 31 | jobs/createnotebookjob.cpp \ | ||
45 | 32 | jobs/expungenotebookjob.cpp | ||
46 | 31 | 33 | ||
47 | 32 | HEADERS += evernoteplugin.h \ | 34 | HEADERS += evernoteplugin.h \ |
48 | 33 | notesstore.h \ | 35 | notesstore.h \ |
49 | @@ -47,7 +49,9 @@ | |||
50 | 47 | evernoteconnection.h \ | 49 | evernoteconnection.h \ |
51 | 48 | jobs/userstorejob.h \ | 50 | jobs/userstorejob.h \ |
52 | 49 | jobs/notesstorejob.h \ | 51 | jobs/notesstorejob.h \ |
54 | 50 | jobs/fetchusernamejob.h | 52 | jobs/fetchusernamejob.h \ |
55 | 53 | jobs/createnotebookjob.h \ | ||
56 | 54 | jobs/expungenotebookjob.h | ||
57 | 51 | 55 | ||
58 | 52 | message(building in $$OUT_PWD) | 56 | message(building in $$OUT_PWD) |
59 | 53 | LIBS += -L$$OUT_PWD/../../../3rdParty/evernote-sdk-cpp/ -L$$OUT_PWD/../../../3rdParty/libthrift/ -levernote-sdk-cpp -llibthrift -lssl -lcrypto | 57 | LIBS += -L$$OUT_PWD/../../../3rdParty/evernote-sdk-cpp/ -L$$OUT_PWD/../../../3rdParty/libthrift/ -levernote-sdk-cpp -llibthrift -lssl -lcrypto |
60 | 54 | 58 | ||
61 | === added file 'src/plugin/Evernote/jobs/createnotebookjob.cpp' | |||
62 | --- src/plugin/Evernote/jobs/createnotebookjob.cpp 1970-01-01 00:00:00 +0000 | |||
63 | +++ src/plugin/Evernote/jobs/createnotebookjob.cpp 2013-12-12 22:46:16 +0000 | |||
64 | @@ -0,0 +1,41 @@ | |||
65 | 1 | /* | ||
66 | 2 | * Copyright: 2013 Canonical, Ltd | ||
67 | 3 | * | ||
68 | 4 | * This file is part of reminders-app | ||
69 | 5 | * | ||
70 | 6 | * reminders-app is free software: you can redistribute it and/or modify | ||
71 | 7 | * it under the terms of the GNU General Public License as published by | ||
72 | 8 | * the Free Software Foundation; version 3. | ||
73 | 9 | * | ||
74 | 10 | * reminders-app is distributed in the hope that it will be useful, | ||
75 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
76 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
77 | 13 | * GNU General Public License for more details. | ||
78 | 14 | * | ||
79 | 15 | * You should have received a copy of the GNU General Public License | ||
80 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
81 | 17 | * | ||
82 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
83 | 19 | */ | ||
84 | 20 | |||
85 | 21 | #include "createnotebookjob.h" | ||
86 | 22 | |||
87 | 23 | #include <QDebug> | ||
88 | 24 | |||
89 | 25 | CreateNotebookJob::CreateNotebookJob(const QString &name, QObject *parent) : | ||
90 | 26 | NotesStoreJob(parent), | ||
91 | 27 | m_name(name) | ||
92 | 28 | { | ||
93 | 29 | } | ||
94 | 30 | |||
95 | 31 | void CreateNotebookJob::startJob() | ||
96 | 32 | { | ||
97 | 33 | m_result.name = m_name.toStdString(); | ||
98 | 34 | m_result.__isset.name = true; | ||
99 | 35 | client()->createNotebook(m_result, token().toStdString(), m_result); | ||
100 | 36 | } | ||
101 | 37 | |||
102 | 38 | void CreateNotebookJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage) | ||
103 | 39 | { | ||
104 | 40 | emit jobDone(errorCode, errorMessage, m_result); | ||
105 | 41 | } | ||
106 | 0 | 42 | ||
107 | === added file 'src/plugin/Evernote/jobs/createnotebookjob.h' | |||
108 | --- src/plugin/Evernote/jobs/createnotebookjob.h 1970-01-01 00:00:00 +0000 | |||
109 | +++ src/plugin/Evernote/jobs/createnotebookjob.h 2013-12-12 22:46:16 +0000 | |||
110 | @@ -0,0 +1,46 @@ | |||
111 | 1 | /* | ||
112 | 2 | * Copyright: 2013 Canonical, Ltd | ||
113 | 3 | * | ||
114 | 4 | * This file is part of reminders-app | ||
115 | 5 | * | ||
116 | 6 | * reminders-app is free software: you can redistribute it and/or modify | ||
117 | 7 | * it under the terms of the GNU General Public License as published by | ||
118 | 8 | * the Free Software Foundation; version 3. | ||
119 | 9 | * | ||
120 | 10 | * reminders-app is distributed in the hope that it will be useful, | ||
121 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
122 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
123 | 13 | * GNU General Public License for more details. | ||
124 | 14 | * | ||
125 | 15 | * You should have received a copy of the GNU General Public License | ||
126 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
127 | 17 | * | ||
128 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
129 | 19 | */ | ||
130 | 20 | |||
131 | 21 | #ifndef CREATENOTEBOOKJOB_H | ||
132 | 22 | #define CREATENOTEBOOKJOB_H | ||
133 | 23 | |||
134 | 24 | #include "notesstorejob.h" | ||
135 | 25 | |||
136 | 26 | class CreateNotebookJob : public NotesStoreJob | ||
137 | 27 | { | ||
138 | 28 | Q_OBJECT | ||
139 | 29 | public: | ||
140 | 30 | explicit CreateNotebookJob(const QString &name, QObject *parent = 0); | ||
141 | 31 | |||
142 | 32 | virtual void startJob() override; | ||
143 | 33 | |||
144 | 34 | signals: | ||
145 | 35 | void jobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result); | ||
146 | 36 | |||
147 | 37 | private slots: | ||
148 | 38 | void emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage); | ||
149 | 39 | |||
150 | 40 | private: | ||
151 | 41 | QString m_name; | ||
152 | 42 | |||
153 | 43 | evernote::edam::Notebook m_result; | ||
154 | 44 | }; | ||
155 | 45 | |||
156 | 46 | #endif // CREATENOTEBOOKJOB_H | ||
157 | 0 | 47 | ||
158 | === modified file 'src/plugin/Evernote/jobs/evernotejob.cpp' | |||
159 | --- src/plugin/Evernote/jobs/evernotejob.cpp 2013-12-12 22:46:16 +0000 | |||
160 | +++ src/plugin/Evernote/jobs/evernotejob.cpp 2013-12-12 22:46:16 +0000 | |||
161 | @@ -55,7 +55,6 @@ | |||
162 | 55 | 55 | ||
163 | 56 | try { | 56 | try { |
164 | 57 | startJob(); | 57 | startJob(); |
165 | 58 | |||
166 | 59 | } catch (const TTransportException & e) { | 58 | } catch (const TTransportException & e) { |
167 | 60 | 59 | ||
168 | 61 | // The connection broke down. libthrift + evernote servers seem to be quite flaky | 60 | // The connection broke down. libthrift + evernote servers seem to be quite flaky |
169 | @@ -68,19 +67,29 @@ | |||
170 | 68 | // Giving up... the connection seems to be down for real. | 67 | // Giving up... the connection seems to be down for real. |
171 | 69 | qWarning() << "Cannot reestablish connection:" << e.what(); | 68 | qWarning() << "Cannot reestablish connection:" << e.what(); |
172 | 70 | emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what()); | 69 | emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what()); |
173 | 70 | } catch (const TApplicationException &e) { | ||
174 | 71 | qWarning() << "Cannot reestablish connection:" << e.what(); | ||
175 | 72 | emitJobDone(EvernoteConnection::ErrorCodeConnectionLost, e.what()); | ||
176 | 71 | } catch (const evernote::edam::EDAMUserException &e) { | 73 | } catch (const evernote::edam::EDAMUserException &e) { |
177 | 74 | qWarning() << "EDAMUserException" << e.what(); | ||
178 | 72 | emitJobDone(EvernoteConnection::ErrorCodeUserException, e.what()); | 75 | emitJobDone(EvernoteConnection::ErrorCodeUserException, e.what()); |
179 | 73 | } catch (const evernote::edam::EDAMSystemException &e) { | 76 | } catch (const evernote::edam::EDAMSystemException &e) { |
180 | 77 | qWarning() << "EDAMSystemException" << e.what(); | ||
181 | 74 | emitJobDone(EvernoteConnection::ErrorCodeSystemException, e.what()); | 78 | emitJobDone(EvernoteConnection::ErrorCodeSystemException, e.what()); |
182 | 75 | } catch (const evernote::edam::EDAMNotFoundException &e) { | 79 | } catch (const evernote::edam::EDAMNotFoundException &e) { |
183 | 80 | qWarning() << "EDAMNotFoundException" << e.what(); | ||
184 | 76 | emitJobDone(EvernoteConnection::ErrorCodeNotFoundExcpetion, e.what()); | 81 | emitJobDone(EvernoteConnection::ErrorCodeNotFoundExcpetion, e.what()); |
185 | 77 | } | 82 | } |
186 | 78 | 83 | ||
187 | 84 | |||
188 | 79 | } catch (const evernote::edam::EDAMUserException &e) { | 85 | } catch (const evernote::edam::EDAMUserException &e) { |
189 | 86 | qWarning() << "EDAMUserException" << e.what(); | ||
190 | 80 | emitJobDone(EvernoteConnection::ErrorCodeUserException, e.what()); | 87 | emitJobDone(EvernoteConnection::ErrorCodeUserException, e.what()); |
191 | 81 | } catch (const evernote::edam::EDAMSystemException &e) { | 88 | } catch (const evernote::edam::EDAMSystemException &e) { |
192 | 89 | qWarning() << "EDAMSystemException" << e.what(); | ||
193 | 82 | emitJobDone(EvernoteConnection::ErrorCodeSystemException, e.what()); | 90 | emitJobDone(EvernoteConnection::ErrorCodeSystemException, e.what()); |
194 | 83 | } catch (const evernote::edam::EDAMNotFoundException &e) { | 91 | } catch (const evernote::edam::EDAMNotFoundException &e) { |
195 | 92 | qWarning() << "EDAMNotFoundException" << e.what(); | ||
196 | 84 | emitJobDone(EvernoteConnection::ErrorCodeNotFoundExcpetion, e.what()); | 93 | emitJobDone(EvernoteConnection::ErrorCodeNotFoundExcpetion, e.what()); |
197 | 85 | } | 94 | } |
198 | 86 | 95 | ||
199 | 87 | 96 | ||
200 | === added file 'src/plugin/Evernote/jobs/expungenotebookjob.cpp' | |||
201 | --- src/plugin/Evernote/jobs/expungenotebookjob.cpp 1970-01-01 00:00:00 +0000 | |||
202 | +++ src/plugin/Evernote/jobs/expungenotebookjob.cpp 2013-12-12 22:46:16 +0000 | |||
203 | @@ -0,0 +1,39 @@ | |||
204 | 1 | /* | ||
205 | 2 | * Copyright: 2013 Canonical, Ltd | ||
206 | 3 | * | ||
207 | 4 | * This file is part of reminders-app | ||
208 | 5 | * | ||
209 | 6 | * reminders-app is free software: you can redistribute it and/or modify | ||
210 | 7 | * it under the terms of the GNU General Public License as published by | ||
211 | 8 | * the Free Software Foundation; version 3. | ||
212 | 9 | * | ||
213 | 10 | * reminders-app is distributed in the hope that it will be useful, | ||
214 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
215 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
216 | 13 | * GNU General Public License for more details. | ||
217 | 14 | * | ||
218 | 15 | * You should have received a copy of the GNU General Public License | ||
219 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
220 | 17 | * | ||
221 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
222 | 19 | */ | ||
223 | 20 | |||
224 | 21 | #include "expungenotebookjob.h" | ||
225 | 22 | |||
226 | 23 | #include <QDebug> | ||
227 | 24 | |||
228 | 25 | ExpungeNotebookJob::ExpungeNotebookJob(const QString &guid, QObject *parent) : | ||
229 | 26 | NotesStoreJob(parent), | ||
230 | 27 | m_guid(guid) | ||
231 | 28 | { | ||
232 | 29 | } | ||
233 | 30 | |||
234 | 31 | void ExpungeNotebookJob::startJob() | ||
235 | 32 | { | ||
236 | 33 | client()->expungeNotebook(token().toStdString(), m_guid.toStdString()); | ||
237 | 34 | } | ||
238 | 35 | |||
239 | 36 | void ExpungeNotebookJob::emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage) | ||
240 | 37 | { | ||
241 | 38 | emit jobDone(errorCode, errorMessage, m_guid); | ||
242 | 39 | } | ||
243 | 0 | 40 | ||
244 | === added file 'src/plugin/Evernote/jobs/expungenotebookjob.h' | |||
245 | --- src/plugin/Evernote/jobs/expungenotebookjob.h 1970-01-01 00:00:00 +0000 | |||
246 | +++ src/plugin/Evernote/jobs/expungenotebookjob.h 2013-12-12 22:46:16 +0000 | |||
247 | @@ -0,0 +1,43 @@ | |||
248 | 1 | /* | ||
249 | 2 | * Copyright: 2013 Canonical, Ltd | ||
250 | 3 | * | ||
251 | 4 | * This file is part of reminders-app | ||
252 | 5 | * | ||
253 | 6 | * reminders-app is free software: you can redistribute it and/or modify | ||
254 | 7 | * it under the terms of the GNU General Public License as published by | ||
255 | 8 | * the Free Software Foundation; version 3. | ||
256 | 9 | * | ||
257 | 10 | * reminders-app is distributed in the hope that it will be useful, | ||
258 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
259 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
260 | 13 | * GNU General Public License for more details. | ||
261 | 14 | * | ||
262 | 15 | * You should have received a copy of the GNU General Public License | ||
263 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
264 | 17 | * | ||
265 | 18 | * Authors: Michael Zanetti <michael.zanetti@canonical.com> | ||
266 | 19 | */ | ||
267 | 20 | |||
268 | 21 | #ifndef DELETENOTEBOOKJOB_H | ||
269 | 22 | #define DELETENOTEBOOKJOB_H | ||
270 | 23 | |||
271 | 24 | #include "notesstorejob.h" | ||
272 | 25 | |||
273 | 26 | class ExpungeNotebookJob : public NotesStoreJob | ||
274 | 27 | { | ||
275 | 28 | Q_OBJECT | ||
276 | 29 | public: | ||
277 | 30 | explicit ExpungeNotebookJob(const QString &guid, QObject *parent = 0); | ||
278 | 31 | |||
279 | 32 | signals: | ||
280 | 33 | void jobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid); | ||
281 | 34 | |||
282 | 35 | private slots: | ||
283 | 36 | void startJob(); | ||
284 | 37 | void emitJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage); | ||
285 | 38 | |||
286 | 39 | private: | ||
287 | 40 | QString m_guid; | ||
288 | 41 | }; | ||
289 | 42 | |||
290 | 43 | #endif // DELETENOTEBOOKJOB_H | ||
291 | 0 | 44 | ||
292 | === modified file 'src/plugin/Evernote/notesstore.cpp' | |||
293 | --- src/plugin/Evernote/notesstore.cpp 2013-12-12 22:46:16 +0000 | |||
294 | +++ src/plugin/Evernote/notesstore.cpp 2013-12-12 22:46:16 +0000 | |||
295 | @@ -31,6 +31,8 @@ | |||
296 | 31 | #include "jobs/createnotejob.h" | 31 | #include "jobs/createnotejob.h" |
297 | 32 | #include "jobs/savenotejob.h" | 32 | #include "jobs/savenotejob.h" |
298 | 33 | #include "jobs/deletenotejob.h" | 33 | #include "jobs/deletenotejob.h" |
299 | 34 | #include "jobs/createnotebookjob.h" | ||
300 | 35 | #include "jobs/expungenotebookjob.h" | ||
301 | 34 | 36 | ||
302 | 35 | #include <QDebug> | 37 | #include <QDebug> |
303 | 36 | 38 | ||
304 | @@ -46,6 +48,7 @@ | |||
305 | 46 | qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList"); | 48 | qRegisterMetaType<evernote::edam::NotesMetadataList>("evernote::edam::NotesMetadataList"); |
306 | 47 | qRegisterMetaType<evernote::edam::Note>("evernote::edam::Note"); | 49 | qRegisterMetaType<evernote::edam::Note>("evernote::edam::Note"); |
307 | 48 | qRegisterMetaType<std::vector<evernote::edam::Notebook> >("std::vector<evernote::edam::Notebook>"); | 50 | qRegisterMetaType<std::vector<evernote::edam::Notebook> >("std::vector<evernote::edam::Notebook>"); |
308 | 51 | qRegisterMetaType<evernote::edam::Notebook>("evernote::edam::Notebook"); | ||
309 | 49 | 52 | ||
310 | 50 | } | 53 | } |
311 | 51 | 54 | ||
312 | @@ -124,6 +127,20 @@ | |||
313 | 124 | return m_notebooksHash.value(guid); | 127 | return m_notebooksHash.value(guid); |
314 | 125 | } | 128 | } |
315 | 126 | 129 | ||
316 | 130 | void NotesStore::createNotebook(const QString &name) | ||
317 | 131 | { | ||
318 | 132 | CreateNotebookJob *job = new CreateNotebookJob(name); | ||
319 | 133 | connect(job, &CreateNotebookJob::jobDone, this, &NotesStore::createNotebookJobDone); | ||
320 | 134 | EvernoteConnection::instance()->enqueue(job); | ||
321 | 135 | } | ||
322 | 136 | |||
323 | 137 | void NotesStore::expungeNotebook(const QString &guid) | ||
324 | 138 | { | ||
325 | 139 | ExpungeNotebookJob *job = new ExpungeNotebookJob(guid); | ||
326 | 140 | connect(job, &ExpungeNotebookJob::jobDone, this, &NotesStore::expungeNotebookJobDone); | ||
327 | 141 | EvernoteConnection::instance()->enqueue(job); | ||
328 | 142 | } | ||
329 | 143 | |||
330 | 127 | void NotesStore::refreshNotes(const QString &filterNotebookGuid) | 144 | void NotesStore::refreshNotes(const QString &filterNotebookGuid) |
331 | 128 | { | 145 | { |
332 | 129 | FetchNotesJob *job = new FetchNotesJob(filterNotebookGuid); | 146 | FetchNotesJob *job = new FetchNotesJob(filterNotebookGuid); |
333 | @@ -316,3 +333,28 @@ | |||
334 | 316 | m_notesHash.take(guid)->deleteLater(); | 333 | m_notesHash.take(guid)->deleteLater(); |
335 | 317 | endRemoveRows(); | 334 | endRemoveRows(); |
336 | 318 | } | 335 | } |
337 | 336 | |||
338 | 337 | void NotesStore::createNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result) | ||
339 | 338 | { | ||
340 | 339 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | ||
341 | 340 | qWarning() << "Error creating notebook:" << errorMessage; | ||
342 | 341 | return; | ||
343 | 342 | } | ||
344 | 343 | Notebook *notebook = new Notebook(QString::fromStdString(result.guid)); | ||
345 | 344 | notebook->setName(QString::fromStdString(result.name)); | ||
346 | 345 | m_notebooks.append(notebook); | ||
347 | 346 | m_notebooksHash.insert(notebook->guid(), notebook); | ||
348 | 347 | emit notebookAdded(notebook->guid()); | ||
349 | 348 | } | ||
350 | 349 | |||
351 | 350 | void NotesStore::expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid) | ||
352 | 351 | { | ||
353 | 352 | if (errorCode != EvernoteConnection::ErrorCodeNoError) { | ||
354 | 353 | qWarning() << "Error expunging notebook:" << errorMessage; | ||
355 | 354 | return; | ||
356 | 355 | } | ||
357 | 356 | emit notebookRemoved(guid); | ||
358 | 357 | Notebook *notebook = m_notebooksHash.take(guid); | ||
359 | 358 | m_notebooks.removeAll(notebook); | ||
360 | 359 | notebook->deleteLater(); | ||
361 | 360 | } | ||
362 | 319 | 361 | ||
363 | === modified file 'src/plugin/Evernote/notesstore.h' | |||
364 | --- src/plugin/Evernote/notesstore.h 2013-12-12 22:46:16 +0000 | |||
365 | +++ src/plugin/Evernote/notesstore.h 2013-12-12 22:46:16 +0000 | |||
366 | @@ -56,6 +56,8 @@ | |||
367 | 56 | 56 | ||
368 | 57 | QList<Notebook*> notebooks() const; | 57 | QList<Notebook*> notebooks() const; |
369 | 58 | Notebook* notebook(const QString &guid); | 58 | Notebook* notebook(const QString &guid); |
370 | 59 | Q_INVOKABLE void createNotebook(const QString &name); | ||
371 | 60 | Q_INVOKABLE void expungeNotebook(const QString &guid); | ||
372 | 59 | 61 | ||
373 | 60 | public slots: | 62 | public slots: |
374 | 61 | void refreshNotes(const QString &filterNotebookGuid = QString()); | 63 | void refreshNotes(const QString &filterNotebookGuid = QString()); |
375 | @@ -71,6 +73,7 @@ | |||
376 | 71 | 73 | ||
377 | 72 | void notebookAdded(const QString &guid); | 74 | void notebookAdded(const QString &guid); |
378 | 73 | void notebookChanged(const QString &guid); | 75 | void notebookChanged(const QString &guid); |
379 | 76 | void notebookRemoved(const QString &guid); | ||
380 | 74 | 77 | ||
381 | 75 | private slots: | 78 | private slots: |
382 | 76 | void fetchNotesJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::NotesMetadataList &results); | 79 | void fetchNotesJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::NotesMetadataList &results); |
383 | @@ -79,6 +82,8 @@ | |||
384 | 79 | void createNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result); | 82 | void createNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result); |
385 | 80 | void saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result); | 83 | void saveNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Note &result); |
386 | 81 | void deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid); | 84 | void deleteNoteJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid); |
387 | 85 | void createNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const evernote::edam::Notebook &result); | ||
388 | 86 | void expungeNotebookJobDone(EvernoteConnection::ErrorCode errorCode, const QString &errorMessage, const QString &guid); | ||
389 | 82 | 87 | ||
390 | 83 | private: | 88 | private: |
391 | 84 | explicit NotesStore(QObject *parent = 0); | 89 | explicit NotesStore(QObject *parent = 0); |
PASSED: Continuous integration, rev:21 91.189. 93.70:8080/ job/reminders- app-ci/ 35/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 395 91.189. 93.70:8080/ job/reminders- app-saucy- amd64-ci/ 35 91.189. 93.70:8080/ job/reminders- app-trusty- amd64-ci/ 35
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/reminders- app-ci/ 35/rebuild
http://