Merge lp:~mzanetti/reminders-app/prefetch-notes into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 52
Merged at revision: 52
Proposed branch: lp:~mzanetti/reminders-app/prefetch-notes
Merge into: lp:reminders-app
Diff against target: 72 lines (+23/-10)
2 files modified
src/app/qml/ui/NotePage.qml (+21/-10)
src/app/qml/ui/NotesPage.qml (+2/-0)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/prefetch-notes
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+204905@code.launchpad.net

Commit message

prefetch notes content when they become visible in the NotesPage.

Also fixes an issue with the NotePage listening for the wrong note refreshed signals

To post a comment you must log in.
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 :

lgfm

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/NotePage.qml'
2--- src/app/qml/ui/NotePage.qml 2014-02-01 19:19:13 +0000
3+++ src/app/qml/ui/NotePage.qml 2014-02-05 13:27:39 +0000
4@@ -28,15 +28,26 @@
5 id: root
6 title: note.title
7 property var note
8- property bool noteReady: false
9+
10+ QtObject {
11+ id: priv
12+ property bool loading: false
13+ }
14
15 Component.onCompleted: {
16- noteReady=false;
17- NotesStore.refreshNoteContent(note.guid)
18+ if (note.enmlContent.length === 0) {
19+ NotesStore.refreshNoteContent(root.note.guid)
20+ priv.loading = true;
21+ }
22 }
23- Connections{ //set noteReady when note is fetched
24+
25+ Connections {
26 target: NotesStore
27- onNoteChanged: noteReady=true;
28+ onNoteChanged: {
29+ if (guid === root.note.guid) {
30+ priv.loading = false;
31+ }
32+ }
33 }
34
35 tools: ToolbarItems {
36@@ -68,18 +79,18 @@
37 }
38
39 ActivityIndicator {
40- id: activityIndicator
41- running: !noteReady
42+ anchors.centerIn: parent
43+ running: priv.loading
44 visible: running
45- anchors.centerIn: parent
46 }
47+
48 // FIXME: This is a workaround for an issue in the WebView. For some reason certain
49 // documents cause a binding loop in the webview's contentHeight. Wrapping it inside
50 // another flickable prevents this from happening.
51 Flickable {
52- visible: noteReady
53- anchors { fill: parent}
54+ anchors { fill: parent }
55 contentHeight: height
56+ visible: !priv.loading
57
58 UbuntuWebView {
59 id: noteTextArea
60
61=== modified file 'src/app/qml/ui/NotesPage.qml'
62--- src/app/qml/ui/NotesPage.qml 2014-01-28 08:31:37 +0000
63+++ src/app/qml/ui/NotesPage.qml 2014-02-05 13:27:39 +0000
64@@ -70,6 +70,8 @@
65 content: model.plaintextContent
66 resource: model.resourceUrls.length > 0 ? model.resourceUrls[0] : ""
67
68+ Component.onCompleted: NotesStore.refreshNoteContent(model.guid)
69+
70 onClicked: {
71 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})
72 }

Subscribers

People subscribed via source and target branches