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
=== modified file 'src/app/qml/ui/NotePage.qml'
--- src/app/qml/ui/NotePage.qml 2014-02-01 19:19:13 +0000
+++ src/app/qml/ui/NotePage.qml 2014-02-05 13:27:39 +0000
@@ -28,15 +28,26 @@
28 id: root28 id: root
29 title: note.title29 title: note.title
30 property var note30 property var note
31 property bool noteReady: false31
32 QtObject {
33 id: priv
34 property bool loading: false
35 }
3236
33 Component.onCompleted: {37 Component.onCompleted: {
34 noteReady=false;38 if (note.enmlContent.length === 0) {
35 NotesStore.refreshNoteContent(note.guid)39 NotesStore.refreshNoteContent(root.note.guid)
40 priv.loading = true;
41 }
36 }42 }
37 Connections{ //set noteReady when note is fetched43
44 Connections {
38 target: NotesStore45 target: NotesStore
39 onNoteChanged: noteReady=true;46 onNoteChanged: {
47 if (guid === root.note.guid) {
48 priv.loading = false;
49 }
50 }
40 }51 }
4152
42 tools: ToolbarItems {53 tools: ToolbarItems {
@@ -68,18 +79,18 @@
68 }79 }
6980
70 ActivityIndicator {81 ActivityIndicator {
71 id: activityIndicator82 anchors.centerIn: parent
72 running: !noteReady83 running: priv.loading
73 visible: running84 visible: running
74 anchors.centerIn: parent
75 }85 }
86
76 // FIXME: This is a workaround for an issue in the WebView. For some reason certain87 // FIXME: This is a workaround for an issue in the WebView. For some reason certain
77 // documents cause a binding loop in the webview's contentHeight. Wrapping it inside88 // documents cause a binding loop in the webview's contentHeight. Wrapping it inside
78 // another flickable prevents this from happening.89 // another flickable prevents this from happening.
79 Flickable {90 Flickable {
80 visible: noteReady91 anchors { fill: parent }
81 anchors { fill: parent}
82 contentHeight: height92 contentHeight: height
93 visible: !priv.loading
8394
84 UbuntuWebView {95 UbuntuWebView {
85 id: noteTextArea96 id: noteTextArea
8697
=== modified file 'src/app/qml/ui/NotesPage.qml'
--- src/app/qml/ui/NotesPage.qml 2014-01-28 08:31:37 +0000
+++ src/app/qml/ui/NotesPage.qml 2014-02-05 13:27:39 +0000
@@ -70,6 +70,8 @@
70 content: model.plaintextContent70 content: model.plaintextContent
71 resource: model.resourceUrls.length > 0 ? model.resourceUrls[0] : ""71 resource: model.resourceUrls.length > 0 ? model.resourceUrls[0] : ""
7272
73 Component.onCompleted: NotesStore.refreshNoteContent(model.guid)
74
73 onClicked: {75 onClicked: {
74 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})76 pageStack.push(Qt.resolvedUrl("NotePage.qml"), {note: NotesStore.note(guid)})
75 }77 }

Subscribers

People subscribed via source and target branches