Merge lp:~mzanetti/reminders-app/refresh-note-on-view into lp:~notes-app-dev/reminders-app/new-design

Proposed by Michael Zanetti
Status: Merged
Approved by: David Planella
Approved revision: 104
Merged at revision: 104
Proposed branch: lp:~mzanetti/reminders-app/refresh-note-on-view
Merge into: lp:~notes-app-dev/reminders-app/new-design
Diff against target: 127 lines (+19/-24)
4 files modified
src/app/qml/reminders.qml (+3/-2)
src/app/qml/ui/NoteView.qml (+11/-21)
src/plugin/Evernote/note.cpp (+3/-0)
src/plugin/Evernote/note.h (+2/-1)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/refresh-note-on-view
Reviewer Review Type Date Requested Status
David Planella Approve
Review via email: mp+218951@code.launchpad.net

Commit message

refresh note content when opening it for viewing
also drops some handcraftet indicator stuff replacing it by the proper loading mechanism

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

This works great for the note's textual content.

However, for attachments I've noticed that after I've added one attachment, for subsequent ones I need to open the note twice to see any new images added from the web. E.g.

1. Phone: Open the app
2. Phone: Create a new note on the web, add some text
3. Phone: On the app's notes list, pull the toolbar and hit Refresh
4. Phone: Tap on the newly added note to see the content
5. Phone: Go back to the list of notes with by pulling the toolbar and tapping on Back
6. Desktop: Add an attachment (image) on the web
7. Phone: On the app, tap on that same note. You'll see the new attachment fetched and displayed as expected
8. Phone: Go back to the list of notes with by pulling the toolbar and tapping on Back
9. Desktop: Add a second image to the same note on the web
10. Phone: Tap on the same note to see the content

Actual:

- The second image is not entirely loaded, it is shown as a small square in the note, but it never gets fetched
- If you go back to the list of notes and then tap on the note to reopen it, the second image will then be shown as expected

Expected:

- The second image should be shown after opening the note, no two refreshes would be required

104. By Michael Zanetti

reload the note if resources change

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

good catch! fixed.

Revision history for this message
David Planella (dpm) wrote :

LGTM now, thanks!

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/reminders.qml'
2--- src/app/qml/reminders.qml 2014-05-09 09:02:54 +0000
3+++ src/app/qml/reminders.qml 2014-05-09 13:03:12 +0000
4@@ -71,10 +71,11 @@
5
6 function displayNote(note) {
7 if (root.narrowMode) {
8+ print("creating noteview");
9 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotePage.qml"));
10- var page = component.createObject();
11+ var page = component.createObject(root, {note: note});
12 page.editNote.connect(function(note) {root.switchToEditMode(note)})
13- pagestack.push(page, {note: note})
14+ pagestack.push(page)
15 } else {
16 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/NoteView.qml"))
17 view.note = note;
18
19=== modified file 'src/app/qml/ui/NoteView.qml'
20--- src/app/qml/ui/NoteView.qml 2014-05-07 07:55:08 +0000
21+++ src/app/qml/ui/NoteView.qml 2014-05-09 13:03:12 +0000
22@@ -29,30 +29,14 @@
23
24 signal editNote(var note)
25
26- QtObject {
27- id: priv
28- property bool loading: false
29- }
30-
31- Component.onCompleted: {
32- if (note.enmlContent.length === 0) {
33- NotesStore.refreshNoteContent(root.note.guid)
34- priv.loading = true;
35- }
36- }
37-
38- Connections {
39- target: NotesStore
40- onNoteChanged: {
41- if (guid === root.note.guid) {
42- priv.loading = false;
43- }
44- }
45+ onNoteChanged: {
46+ print("refreshing note:", root.note.guid)
47+ NotesStore.refreshNoteContent(root.note.guid)
48 }
49
50 ActivityIndicator {
51 anchors.centerIn: parent
52- running: priv.loading
53+ running: root.note.loading
54 visible: running
55 }
56
57@@ -62,7 +46,6 @@
58 Flickable {
59 anchors { fill: parent }
60 contentHeight: height
61- visible: !priv.loading
62
63 UbuntuWebView {
64 id: noteTextArea
65@@ -72,6 +55,13 @@
66 loadHtml(html, "file:///")
67 }
68
69+ Connections {
70+ target: note
71+ onResourcesChanged: {
72+ noteTextArea.loadHtml(noteTextArea.html, "file:///")
73+ }
74+ }
75+
76 experimental.preferences.navigatorQtObjectEnabled: true
77 experimental.preferredMinimumContentsWidth: root.width
78 experimental.userScripts: [Qt.resolvedUrl("reminders-scripts.js")]
79
80=== modified file 'src/plugin/Evernote/note.cpp'
81--- src/plugin/Evernote/note.cpp 2014-05-08 17:42:55 +0000
82+++ src/plugin/Evernote/note.cpp 2014-05-09 13:03:12 +0000
83@@ -305,6 +305,7 @@
84 {
85 Resource *resource = new Resource(data, hash, fileName, type, this);
86 m_resources.insert(hash, resource);
87+ emit resourcesChanged();
88 return resource;
89 }
90
91@@ -312,6 +313,7 @@
92 {
93 Resource *resource = new Resource(fileName);
94 m_resources.insert(resource->hash(), resource);
95+ emit resourcesChanged();
96 return resource;
97 }
98
99@@ -330,6 +332,7 @@
100
101 Resource *resource = addResource(fileName.path());
102 m_content.attachFile(position, resource->hash(), resource->type());
103+ emit resourcesChanged();
104 emit contentChanged();
105
106 // Cleanup imported file.
107
108=== modified file 'src/plugin/Evernote/note.h'
109--- src/plugin/Evernote/note.h 2014-05-06 20:05:25 +0000
110+++ src/plugin/Evernote/note.h 2014-05-09 13:03:12 +0000
111@@ -44,7 +44,7 @@
112 Q_PROPERTY(QString richTextContent READ richTextContent WRITE setRichTextContent NOTIFY contentChanged)
113 Q_PROPERTY(QString enmlContent READ enmlContent WRITE setEnmlContent NOTIFY contentChanged)
114 Q_PROPERTY(QString plaintextContent READ plaintextContent NOTIFY contentChanged)
115- Q_PROPERTY(QStringList resourceUrls READ resourceUrls NOTIFY contentChanged)
116+ Q_PROPERTY(QStringList resourceUrls READ resourceUrls NOTIFY resourcesChanged)
117 Q_PROPERTY(bool reminder READ reminder WRITE setReminder NOTIFY reminderChanged)
118 Q_PROPERTY(bool hasReminderTime READ hasReminderTime WRITE setHasReminderTime NOTIFY reminderTimeChanged)
119 Q_PROPERTY(QDateTime reminderTime READ reminderTime WRITE setReminderTime NOTIFY reminderTimeChanged)
120@@ -134,6 +134,7 @@
121 void titleChanged();
122 void notebookGuidChanged();
123 void contentChanged();
124+ void resourcesChanged();
125 void reminderChanged();
126 void reminderTimeChanged();
127 void reminderDoneChanged();

Subscribers

People subscribed via source and target branches