Merge lp:~mzanetti/reminders-app/basic-workflow into lp:reminders-app
- basic-workflow
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | David Planella |
Approved revision: | 33 |
Merged at revision: | 24 |
Proposed branch: | lp:~mzanetti/reminders-app/basic-workflow |
Merge into: | lp:reminders-app |
Prerequisite: | lp:~mzanetti/reminders-app/notebooksdelegate |
Diff against target: |
505 lines (+286/-43) 12 files modified
src/app/app.pro (+2/-1) src/app/qml/ui/EditNotePage.qml (+105/-0) src/app/qml/ui/NotePage.qml (+39/-20) src/app/qml/ui/NotebooksPage.qml (+94/-11) src/app/qml/ui/NotesPage.qml (+2/-5) src/app/qml/ui/RemindersPage.qml (+20/-0) src/plugin/Evernote/evernoteplugin.cpp (+2/-0) src/plugin/Evernote/jobs/evernotejob.cpp (+2/-2) src/plugin/Evernote/notebooks.cpp (+5/-0) src/plugin/Evernote/notebooks.h (+2/-0) src/plugin/Evernote/notesstore.cpp (+10/-3) src/plugin/Evernote/notesstore.h (+3/-1) |
To merge this branch: | bzr merge lp:~mzanetti/reminders-app/basic-workflow |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
David Planella | Approve | ||
Alan Pope πΊπ§π± π¦ (community) | Approve | ||
Review via email: mp+199035@code.launchpad.net |
Commit message
Implemented basic app workflow
Description of the change
This implements the basic add workflow for viewing, editing, creating and deleting notes.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:32
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Pope πΊπ§π± π¦ (popey) : | # |
David Planella (dpm) wrote : | # |
The prerequisite branches have now been approved, but it seems this one has a couple of conflicts.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
David Planella (dpm) wrote : | # |
Works well after the merge
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
Preview Diff
1 | === modified file 'src/app/app.pro' |
2 | --- src/app/app.pro 2013-12-14 23:59:04 +0000 |
3 | +++ src/app/app.pro 2014-01-10 10:14:02 +0000 |
4 | @@ -14,7 +14,8 @@ |
5 | qml/ui/SearchNotesPage.qml \ |
6 | qml/components/ToolbarSpacer.qml \ |
7 | qml/components/NotesDelegate.qml \ |
8 | - qml/components/NotebooksDelegate.qml |
9 | + qml/components/NotebooksDelegate.qml \ |
10 | + qml/ui/EditNotePage.qml |
11 | |
12 | # Copy qml to build dir for running with qtcreator |
13 | qmlfolder.source = src/app/qml |
14 | |
15 | === added file 'src/app/qml/ui/EditNotePage.qml' |
16 | --- src/app/qml/ui/EditNotePage.qml 1970-01-01 00:00:00 +0000 |
17 | +++ src/app/qml/ui/EditNotePage.qml 2014-01-10 10:14:02 +0000 |
18 | @@ -0,0 +1,105 @@ |
19 | +/* |
20 | + * Copyright: 2013 Canonical, Ltd |
21 | + * |
22 | + * This file is part of reminders-app |
23 | + * |
24 | + * reminders-app is free software: you can redistribute it and/or modify |
25 | + * it under the terms of the GNU General Public License as published by |
26 | + * the Free Software Foundation; version 3. |
27 | + * |
28 | + * reminders-app is distributed in the hope that it will be useful, |
29 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
30 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31 | + * GNU General Public License for more details. |
32 | + * |
33 | + * You should have received a copy of the GNU General Public License |
34 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
35 | + */ |
36 | + |
37 | +import QtQuick 2.0 |
38 | +import Ubuntu.Components 0.1 |
39 | +import Ubuntu.Components.ListItems 0.1 |
40 | +import Evernote 0.1 |
41 | +import "../components" |
42 | + |
43 | +Page { |
44 | + id: root |
45 | + property var note |
46 | + |
47 | + tools: ToolbarItems { |
48 | + ToolbarButton { |
49 | + text: "save" |
50 | + iconName: "select" |
51 | + onTriggered: { |
52 | + var title = titleTextField.text ? titleTextField.text : i18n.tr("Untitled"); |
53 | + var notebookGuid = notebookSelector.selectedGuid; |
54 | + var text = noteTextArea.text; |
55 | + |
56 | + if (note) { |
57 | + note.title = titleTextField.text |
58 | + note.notebookGuid = notebookSelector.selectedGuid |
59 | + note.htmlContent = noteTextArea.text |
60 | + NotesStore.saveNote(note.guid); |
61 | + } else { |
62 | + NotesStore.createNote(title, notebookGuid, text); |
63 | + } |
64 | + |
65 | + pagestack.pop(); |
66 | + } |
67 | + } |
68 | + ToolbarSpacer {} |
69 | + |
70 | + ToolbarButton { |
71 | + text: "attach" |
72 | + } |
73 | + ToolbarButton { |
74 | + text: "camera" |
75 | + iconName: "camera-symbolic" |
76 | + } |
77 | + ToolbarButton { |
78 | + text: "rtf" |
79 | + } |
80 | + |
81 | + } |
82 | + |
83 | + Column { |
84 | + anchors.fill: parent |
85 | + anchors.margins: units.gu(2) |
86 | + spacing: units.gu(1) |
87 | + |
88 | + TextField { |
89 | + id: titleTextField |
90 | + text: root.note ? root.note.title : "" |
91 | + placeholderText: "Untitled" |
92 | + height: units.gu(5) |
93 | + anchors { left: parent.left; right: parent.right } |
94 | + } |
95 | + |
96 | + Divider { |
97 | + anchors { leftMargin: -units.gu(2); rightMargin: -units.gu(2) } |
98 | + height: units.gu(2) |
99 | + } |
100 | + |
101 | + OptionSelector { |
102 | + id: notebookSelector |
103 | + text: i18n.tr("Notebook") |
104 | + model: Notebooks {} |
105 | + property string selectedGuid: model.notebook(selectedIndex).guid |
106 | + |
107 | + delegate: OptionSelectorDelegate { |
108 | + text: model.name |
109 | + } |
110 | + } |
111 | + |
112 | + TextArea { |
113 | + id: noteTextArea |
114 | + anchors { left: parent.left; right: parent.right } |
115 | + height: parent.height - y |
116 | + highlighted: true |
117 | + |
118 | + textFormat: TextEdit.RichText |
119 | + text: root.note ? root.note.htmlContent : "" |
120 | + } |
121 | + } |
122 | +} |
123 | + |
124 | |
125 | === modified file 'src/app/qml/ui/NotePage.qml' |
126 | --- src/app/qml/ui/NotePage.qml 2013-12-14 22:38:57 +0000 |
127 | +++ src/app/qml/ui/NotePage.qml 2014-01-10 10:14:02 +0000 |
128 | @@ -19,33 +19,52 @@ |
129 | import QtQuick 2.0 |
130 | import Ubuntu.Components 0.1 |
131 | import Evernote 0.1 |
132 | +import "../components" |
133 | |
134 | Page { |
135 | + id: root |
136 | title: note.title |
137 | property var note |
138 | |
139 | Component.onCompleted: NotesStore.refreshNoteContent(note.guid) |
140 | |
141 | - Column { |
142 | - anchors.fill: parent |
143 | - spacing: units.gu(1) |
144 | - Button { |
145 | - width: parent.width |
146 | - text: "save" |
147 | - onClicked: { |
148 | - note.htmlContent = noteTextArea.text |
149 | - note.save(); |
150 | - } |
151 | - } |
152 | - |
153 | - TextArea { |
154 | - id: noteTextArea |
155 | - anchors { left: parent.left; right: parent.right } |
156 | - height: parent.height - y |
157 | - |
158 | - textFormat: TextEdit.RichText |
159 | - text: note.htmlContent |
160 | - } |
161 | + tools: ToolbarItems { |
162 | + ToolbarButton { |
163 | + text: "delete" |
164 | + iconName: "delete" |
165 | + onTriggered: { |
166 | + NotesStore.deleteNote(note.guid); |
167 | + pagestack.pop(); |
168 | + } |
169 | + } |
170 | + ToolbarSpacer {} |
171 | + ToolbarButton { |
172 | + text: note.reminder ? "reminder (set)" : "reminder" |
173 | + iconName: "alarm-clock" |
174 | + onTriggered: { |
175 | + note.reminder = !note.reminder |
176 | + NotesStore.saveNote(note.guid) |
177 | + } |
178 | + } |
179 | + ToolbarButton { |
180 | + text: "edit" |
181 | + iconName: "edit" |
182 | + onTriggered: { |
183 | + pagestack.pop() |
184 | + pagestack.push(Qt.resolvedUrl("EditNotePage.qml"), {note: root.note}) |
185 | + } |
186 | + } |
187 | + } |
188 | + |
189 | + TextArea { |
190 | + id: noteTextArea |
191 | + anchors { fill: parent; margins: units.gu(2) } |
192 | + height: parent.height - y |
193 | + highlighted: true |
194 | + readOnly: true |
195 | + |
196 | + textFormat: TextEdit.RichText |
197 | + text: note.htmlContent |
198 | } |
199 | } |
200 | |
201 | |
202 | === modified file 'src/app/qml/ui/NotebooksPage.qml' |
203 | --- src/app/qml/ui/NotebooksPage.qml 2013-12-14 23:59:04 +0000 |
204 | +++ src/app/qml/ui/NotebooksPage.qml 2014-01-10 10:14:02 +0000 |
205 | @@ -33,28 +33,111 @@ |
206 | |
207 | tools: ToolbarItems { |
208 | ToolbarButton { |
209 | + text: "search" |
210 | + iconName: "search" |
211 | + onTriggered: { |
212 | + pagestack.push(Qt.resolvedUrl("SearchNotesPage.qml")) |
213 | + } |
214 | + } |
215 | + |
216 | + ToolbarSpacer { } |
217 | + |
218 | + ToolbarButton { |
219 | text: "add notebook" |
220 | + iconName: "add" |
221 | onTriggered: { |
222 | - NotesStore.createNotebook("new notebook"); |
223 | + contentColumn.newNotebook = true; |
224 | } |
225 | } |
226 | } |
227 | |
228 | + |
229 | Notebooks { |
230 | id: notebooks |
231 | } |
232 | |
233 | - ListView { |
234 | + Column { |
235 | + id: contentColumn |
236 | anchors.fill: parent |
237 | - model: notebooks |
238 | - |
239 | - delegate: NotebooksDelegate { |
240 | - name: model.name |
241 | - noteCount: model.noteCount |
242 | - shareStatus: model.publised ? i18n.tr("shared") : i18n.tr("private") |
243 | - |
244 | - onClicked: { |
245 | - pagestack.push(Qt.resolvedUrl("NotesPage.qml"), {title: name, filter: guid}); |
246 | + property bool newNotebook: false |
247 | + |
248 | + states: [ |
249 | + State { |
250 | + name: "newNotebook"; when: contentColumn.newNotebook |
251 | + PropertyChanges { target: newNotebookContainer; opacity: 1; height: newNotebookContainer.implicitHeight } |
252 | + PropertyChanges { target: buttonRow; opacity: 1; height: cancelButton.height + units.gu(4) } |
253 | + } |
254 | + ] |
255 | + |
256 | + Empty { |
257 | + id: newNotebookContainer |
258 | + height: 0 |
259 | + visible: opacity > 0 |
260 | + opacity: 0 |
261 | + clip: true |
262 | + |
263 | + Behavior on height { |
264 | + UbuntuNumberAnimation {} |
265 | + } |
266 | + Behavior on opacity { |
267 | + UbuntuNumberAnimation {} |
268 | + } |
269 | + |
270 | + onVisibleChanged: { |
271 | + newNoteTitleTextField.forceActiveFocus(); |
272 | + } |
273 | + |
274 | + TextField { |
275 | + id: newNoteTitleTextField |
276 | + anchors { left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter } |
277 | + } |
278 | + } |
279 | + |
280 | + ListView { |
281 | + model: notebooks |
282 | + anchors { left: parent.left; right: parent.right } |
283 | + height: parent.height - y - buttonRow.height |
284 | + |
285 | + delegate: NotebooksDelegate { |
286 | + name: model.name |
287 | + noteCount: model.noteCount |
288 | + shareStatus: model.publised ? i18n.tr("shared") : i18n.tr("private") |
289 | + |
290 | + onClicked: { |
291 | + pagestack.push(Qt.resolvedUrl("NotesPage.qml"), {title: name, filter: guid}); |
292 | + } |
293 | + } |
294 | + } |
295 | + |
296 | + Item { |
297 | + id: buttonRow |
298 | + anchors { left: parent.left; right: parent.right; margins: units.gu(2) } |
299 | + height: 0 |
300 | + visible: height > 0 |
301 | + clip: true |
302 | + |
303 | + Behavior on height { |
304 | + UbuntuNumberAnimation {} |
305 | + } |
306 | + |
307 | + Button { |
308 | + id: cancelButton |
309 | + anchors { left: parent.left; verticalCenter: parent.verticalCenter } |
310 | + text: i18n.tr("Cancel") |
311 | + onClicked: { |
312 | + newNoteTitleTextField.text = ""; |
313 | + contentColumn.newNotebook = false |
314 | + } |
315 | + } |
316 | + Button { |
317 | + anchors { right: parent.right; verticalCenter: parent.verticalCenter } |
318 | + text: i18n.tr("Save") |
319 | + enabled: newNoteTitleTextField.text.length > 0 |
320 | + onClicked: { |
321 | + NotesStore.createNotebook(newNoteTitleTextField.text); |
322 | + newNoteTitleTextField.text = ""; |
323 | + contentColumn.newNotebook = false |
324 | + } |
325 | } |
326 | } |
327 | } |
328 | |
329 | === modified file 'src/app/qml/ui/NotesPage.qml' |
330 | --- src/app/qml/ui/NotesPage.qml 2013-12-14 22:38:57 +0000 |
331 | +++ src/app/qml/ui/NotesPage.qml 2014-01-10 10:14:02 +0000 |
332 | @@ -47,12 +47,9 @@ |
333 | |
334 | ToolbarButton { |
335 | text: "add note" |
336 | - enabled: notes.filterNotebookGuid.length > 0 |
337 | + iconName: "add" |
338 | onTriggered: { |
339 | - var content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\"><en-note><div><br clear=\"none\"/>" |
340 | - content = content + "fobar" |
341 | - content = content + "<br clear=\"none\"/></div><div><br clear=\"none\"/></div></en-note>" |
342 | - NotesStore.createNote("Untitled", notes.filterNotebookGuid, content); |
343 | + pagestack.push(Qt.resolvedUrl("EditNotePage.qml")); |
344 | } |
345 | } |
346 | } |
347 | |
348 | === modified file 'src/app/qml/ui/RemindersPage.qml' |
349 | --- src/app/qml/ui/RemindersPage.qml 2013-11-29 20:38:11 +0000 |
350 | +++ src/app/qml/ui/RemindersPage.qml 2014-01-10 10:14:02 +0000 |
351 | @@ -20,10 +20,30 @@ |
352 | import Ubuntu.Components 0.1 |
353 | import Ubuntu.Components.ListItems 0.1 |
354 | import Evernote 0.1 |
355 | +import "../components" |
356 | |
357 | Page { |
358 | id: remindersPage |
359 | |
360 | + tools: ToolbarItems { |
361 | + ToolbarButton { |
362 | + text: "search" |
363 | + iconName: "search" |
364 | + onTriggered: { |
365 | + pagestack.push(Qt.resolvedUrl("SearchNotesPage.qml")) |
366 | + } |
367 | + } |
368 | + |
369 | + ToolbarSpacer { } |
370 | + |
371 | + ToolbarButton { |
372 | + text: "add" |
373 | + iconName: "add" |
374 | + onTriggered: { |
375 | + } |
376 | + } |
377 | + } |
378 | + |
379 | Notes { |
380 | id: notes |
381 | onlyReminders: true |
382 | |
383 | === modified file 'src/plugin/Evernote/evernoteplugin.cpp' |
384 | --- src/plugin/Evernote/evernoteplugin.cpp 2013-12-14 22:38:57 +0000 |
385 | +++ src/plugin/Evernote/evernoteplugin.cpp 2014-01-10 10:14:02 +0000 |
386 | @@ -26,6 +26,7 @@ |
387 | #include "notes.h" |
388 | #include "notebooks.h" |
389 | #include "note.h" |
390 | +#include "notebook.h" |
391 | #include "resourceimageprovider.h" |
392 | |
393 | #include <QtQml> |
394 | @@ -54,6 +55,7 @@ |
395 | qmlRegisterType<Notes>("Evernote", 0, 1, "Notes"); |
396 | qmlRegisterType<Notebooks>("Evernote", 0, 1, "Notebooks"); |
397 | qmlRegisterUncreatableType<Note>("Evernote", 0, 1, "Note", "Cannot create Notes in QML. Use NotesStore.createNote() instead."); |
398 | + qmlRegisterUncreatableType<Notebook>("Evernote", 0, 1, "Notebook", "Cannot create Notes in QML. Use NotesStore.createNotebook() instead."); |
399 | } |
400 | |
401 | void EvernotePlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
402 | |
403 | === modified file 'src/plugin/Evernote/jobs/evernotejob.cpp' |
404 | --- src/plugin/Evernote/jobs/evernotejob.cpp 2013-12-14 22:38:57 +0000 |
405 | +++ src/plugin/Evernote/jobs/evernotejob.cpp 2014-01-10 10:14:02 +0000 |
406 | @@ -55,6 +55,7 @@ |
407 | |
408 | try { |
409 | startJob(); |
410 | + emitJobDone(EvernoteConnection::ErrorCodeNoError, QString()); |
411 | } catch (const TTransportException & e) { |
412 | |
413 | // The connection broke down. libthrift + evernote servers seem to be quite flaky |
414 | @@ -63,6 +64,7 @@ |
415 | try { |
416 | resetConnection(); |
417 | startJob(); |
418 | + emitJobDone(EvernoteConnection::ErrorCodeNoError, QString()); |
419 | } catch (const TTransportException &e) { |
420 | // Giving up... the connection seems to be down for real. |
421 | qWarning() << "Cannot reestablish connection:" << e.what(); |
422 | @@ -92,8 +94,6 @@ |
423 | qWarning() << "EDAMNotFoundException" << e.what(); |
424 | emitJobDone(EvernoteConnection::ErrorCodeNotFoundExcpetion, e.what()); |
425 | } |
426 | - |
427 | - emitJobDone(EvernoteConnection::ErrorCodeNoError, QString()); |
428 | } |
429 | |
430 | QString EvernoteJob::token() |
431 | |
432 | === modified file 'src/plugin/Evernote/notebooks.cpp' |
433 | --- src/plugin/Evernote/notebooks.cpp 2013-12-14 23:59:04 +0000 |
434 | +++ src/plugin/Evernote/notebooks.cpp 2014-01-10 10:14:02 +0000 |
435 | @@ -65,6 +65,11 @@ |
436 | return roles; |
437 | } |
438 | |
439 | +Notebook *Notebooks::notebook(int index) |
440 | +{ |
441 | + return NotesStore::instance()->notebook(m_list.at(index)); |
442 | +} |
443 | + |
444 | void Notebooks::refresh() |
445 | { |
446 | NotesStore::instance()->refreshNotebooks(); |
447 | |
448 | === modified file 'src/plugin/Evernote/notebooks.h' |
449 | --- src/plugin/Evernote/notebooks.h 2014-01-10 09:07:23 +0000 |
450 | +++ src/plugin/Evernote/notebooks.h 2014-01-10 10:14:02 +0000 |
451 | @@ -41,6 +41,8 @@ |
452 | int rowCount(const QModelIndex &parent) const; |
453 | QHash<int, QByteArray> roleNames() const; |
454 | |
455 | + Q_INVOKABLE Notebook *notebook(int index); |
456 | + |
457 | public slots: |
458 | void refresh(); |
459 | |
460 | |
461 | === modified file 'src/plugin/Evernote/notesstore.cpp' |
462 | --- src/plugin/Evernote/notesstore.cpp 2013-12-14 23:59:04 +0000 |
463 | +++ src/plugin/Evernote/notesstore.cpp 2014-01-10 10:14:02 +0000 |
464 | @@ -279,9 +279,16 @@ |
465 | } |
466 | } |
467 | |
468 | -void NotesStore::createNote(const QString &title, const QString ¬ebookGuid, const QString &content) |
469 | -{ |
470 | - CreateNoteJob *job = new CreateNoteJob(title, notebookGuid, content); |
471 | +void NotesStore::createNote(const QString &title, const QString ¬ebookGuid, const QString &htmlContent) |
472 | +{ |
473 | + EnmlDocument enmlDoc; |
474 | + enmlDoc.setHtml(htmlContent); |
475 | + createNote(title, notebookGuid, enmlDoc); |
476 | +} |
477 | + |
478 | +void NotesStore::createNote(const QString &title, const QString ¬ebookGuid, const EnmlDocument &content) |
479 | +{ |
480 | + CreateNoteJob *job = new CreateNoteJob(title, notebookGuid, content.enml()); |
481 | connect(job, &CreateNoteJob::jobDone, this, &NotesStore::createNoteJobDone); |
482 | EvernoteConnection::instance()->enqueue(job); |
483 | } |
484 | |
485 | === modified file 'src/plugin/Evernote/notesstore.h' |
486 | --- src/plugin/Evernote/notesstore.h 2014-01-10 09:07:23 +0000 |
487 | +++ src/plugin/Evernote/notesstore.h 2014-01-10 10:14:02 +0000 |
488 | @@ -22,6 +22,7 @@ |
489 | #define NOTESSTORE_H |
490 | |
491 | #include "evernoteconnection.h" |
492 | +#include "utils/enmldocument.h" |
493 | |
494 | // Thrift |
495 | #include <arpa/inet.h> // seems thrift forgot this one |
496 | @@ -75,7 +76,8 @@ |
497 | QList<Note*> notes() const; |
498 | |
499 | Q_INVOKABLE Note* note(const QString &guid); |
500 | - Q_INVOKABLE void createNote(const QString &title, const QString ¬ebookGuid, const QString &content); |
501 | + Q_INVOKABLE void createNote(const QString &title, const QString ¬ebookGuid, const QString &htmlContent); |
502 | + void createNote(const QString &title, const QString ¬ebookGuid, const EnmlDocument &content); |
503 | Q_INVOKABLE void saveNote(const QString &guid); |
504 | Q_INVOKABLE void deleteNote(const QString &guid); |
505 | Q_INVOKABLE void findNotes(const QString &searchWords); |
FAILED: Continuous integration, rev:31 91.189. 93.70:8080/ job/reminders- app-ci/ 44/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 454 91.189. 93.70:8080/ job/reminders- app-saucy- amd64-ci/ 44/console 91.189. 93.70:8080/ job/reminders- app-trusty- amd64-ci/ 44/console
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/reminders- app-ci/ 44/rebuild
http://