Merge lp:~mzanetti/reminders-app/cleanup-pages into lp:reminders-app

Proposed by Michael Zanetti
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 442
Merged at revision: 444
Proposed branch: lp:~mzanetti/reminders-app/cleanup-pages
Merge into: lp:reminders-app
Diff against target: 172 lines (+16/-38)
4 files modified
src/app/qml/reminders.qml (+11/-34)
src/app/qml/ui/AccountSelectorPage.qml (+1/-1)
src/app/qml/ui/EditNoteView.qml (+4/-2)
src/app/qml/ui/NotePage.qml (+0/-1)
To merge this branch: bzr merge lp:~mzanetti/reminders-app/cleanup-pages
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+260395@code.launchpad.net

Commit message

don't create pages manually as the pageStack won't delete them

This caused us to leak all the pages and cause weird issues in the editnoteview

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Makes sense, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/qml/reminders.qml'
--- src/app/qml/reminders.qml 2015-04-13 21:32:13 +0000
+++ src/app/qml/reminders.qml 2015-05-27 22:47:24 +0000
@@ -96,17 +96,10 @@
9696
97 backgroundColor: "#dddddd"97 backgroundColor: "#dddddd"
9898
99 property var accountPage;99 function openAccountPage() {
100
101 function openAccountPage(isChangingAccount) {
102 var unauthorizedAccounts = allAccounts.count - accounts.count > 0 ? true : false100 var unauthorizedAccounts = allAccounts.count - accounts.count > 0 ? true : false
103 if (accountPage) {101 var accountPage = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml")), { accounts: accounts, unauthorizedAccounts: unauthorizedAccounts, oaSetup: setup });
104 accountPage.destroy(100)
105 }
106 var component = Qt.createComponent(Qt.resolvedUrl("ui/AccountSelectorPage.qml"));
107 accountPage = component.createObject(root, { accounts: accounts, unauthorizedAccounts: unauthorizedAccounts, oaSetup: setup });
108 accountPage.accountSelected.connect(function(username, handle) { accountService.startAuthentication(username, handle); pagestack.pop(); root.accountPage = null });102 accountPage.accountSelected.connect(function(username, handle) { accountService.startAuthentication(username, handle); pagestack.pop(); root.accountPage = null });
109 pagestack.push(accountPage);
110 }103 }
111104
112 function displayNote(note, conflictMode) {105 function displayNote(note, conflictMode) {
@@ -118,11 +111,9 @@
118 note.load(true);111 note.load(true);
119 if (root.narrowMode) {112 if (root.narrowMode) {
120 print("creating noteview");113 print("creating noteview");
121 var page;
122 if (!conflictMode && note.conflicting) {114 if (!conflictMode && note.conflicting) {
123 // User wants to open the note even though it is conflicting! Show the Conflict page instead.115 // User wants to open the note even though it is conflicting! Show the Conflict page instead.
124 var component = Qt.createComponent(Qt.resolvedUrl("ui/NoteConflictPage.qml"));116 var page = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/NoteConflictPage.qml")), {note: note});
125 page = component.createObject(root, {note: note});
126 page.displayNote.connect(function(note) { root.displayNote(note, true); } );117 page.displayNote.connect(function(note) { root.displayNote(note, true); } );
127 page.resolveConflict.connect(function(keepLocal) {118 page.resolveConflict.connect(function(keepLocal) {
128 var confirmation = PopupUtils.open(Qt.resolvedUrl("components/ResolveConflictConfirmationDialog.qml"), page, {keepLocal: keepLocal, remoteDeleted: note.conflictingNote.deleted, localDeleted: note.deleted});119 var confirmation = PopupUtils.open(Qt.resolvedUrl("components/ResolveConflictConfirmationDialog.qml"), page, {keepLocal: keepLocal, remoteDeleted: note.conflictingNote.deleted, localDeleted: note.deleted});
@@ -132,12 +123,10 @@
132 });123 });
133 })124 })
134 } else {125 } else {
135 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotePage.qml"));126 var page = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/NotePage.qml")), {readOnly: conflictMode, note: note })
136 page = component.createObject(root, {readOnly: conflictMode, note: note });
137 page.editNote.connect(function(note) {root.switchToEditMode(note)})127 page.editNote.connect(function(note) {root.switchToEditMode(note)})
138 page.openTaggedNotes.connect(function(title, tagGuid) {pagestack.pop();root.openTaggedNotes(title, tagGuid, true)})128 page.openTaggedNotes.connect(function(title, tagGuid) {pagestack.pop();root.openTaggedNotes(title, tagGuid, true)})
139 }129 }
140 pagestack.push(page)
141 } else {130 } else {
142 var view;131 var view;
143 if (!conflictMode && note.conflicting) {132 if (!conflictMode && note.conflicting) {
@@ -166,10 +155,8 @@
166 if (pagestack.depth > 1) {155 if (pagestack.depth > 1) {
167 pagestack.pop();156 pagestack.pop();
168 }157 }
169 var component = Qt.createComponent(Qt.resolvedUrl("ui/EditNotePage.qml"));158 var page = pagestack.push(Qt.resolvedUrl("ui/EditNotePage.qml"), {note: note});
170 var page = component.createObject();
171 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop()});159 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop()});
172 pagestack.push(page, {note: note});
173 } else {160 } else {
174 sideViewLoader.clear();161 sideViewLoader.clear();
175 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"))162 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"))
@@ -180,9 +167,7 @@
180 }167 }
181168
182 function openSearch() {169 function openSearch() {
183 var component = Qt.createComponent(Qt.resolvedUrl("ui/SearchNotesPage.qml"))170 var page = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/SearchNotesPage.qml")))
184 var page = component.createObject();
185 pagestack.push(page)
186 page.noteSelected.connect(function(note) {root.displayNote(note)})171 page.noteSelected.connect(function(note) {root.displayNote(note)})
187 page.editNote.connect(function(note) {root.switchToEditMode(note)})172 page.editNote.connect(function(note) {root.switchToEditMode(note)})
188 }173 }
@@ -217,7 +202,7 @@
217 break;202 break;
218 default:203 default:
219 print("There are multiple accounts. Allowing user to select one.");204 print("There are multiple accounts. Allowing user to select one.");
220 openAccountPage(false);205 openAccountPage();
221 }206 }
222 }207 }
223208
@@ -317,10 +302,8 @@
317 }302 }
318303
319 function openTaggedNotes(title, tagGuid, narrowMode) {304 function openTaggedNotes(title, tagGuid, narrowMode) {
320 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml"))
321 var page = component.createObject();
322 print("opening note page for tag", tagGuid)305 print("opening note page for tag", tagGuid)
323 pagestack.push(page, {title: title, filterTagGuid: tagGuid, narrowMode: narrowMode});306 var page = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml")), {title: title, filterTagGuid: tagGuid, narrowMode: narrowMode});
324 page.selectedNoteChanged.connect(function() {307 page.selectedNoteChanged.connect(function() {
325 if (page.selectedNote) {308 if (page.selectedNote) {
326 root.displayNote(page.selectedNote);309 root.displayNote(page.selectedNote);
@@ -441,10 +424,8 @@
441 var note = NotesStore.note(guid);424 var note = NotesStore.note(guid);
442 print("note created:", note.guid);425 print("note created:", note.guid);
443 if (root.narrowMode) {426 if (root.narrowMode) {
444 var component = Qt.createComponent(Qt.resolvedUrl("ui/EditNotePage.qml"));427 var page = pagestack.push(Qt.resolvedUrl("ui/EditNotePage.qml"), {note: note});
445 var page = component.createObject();
446 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop();});428 page.exitEditMode.connect(function() {Qt.inputMethod.hide(); pagestack.pop();});
447 pagestack.push(page, {note: note});
448 } else {429 } else {
449 notesPage.selectedNote = note;430 notesPage.selectedNote = note;
450 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"));431 var view = sideViewLoader.embed(Qt.resolvedUrl("ui/EditNoteView.qml"));
@@ -526,10 +507,8 @@
526 onOpenNotebook: {507 onOpenNotebook: {
527 var notebook = NotesStore.notebook(notebookGuid)508 var notebook = NotesStore.notebook(notebookGuid)
528 print("have notebook:", notebook, notebook.name)509 print("have notebook:", notebook, notebook.name)
529 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml"))
530 var page = component.createObject();
531 print("opening note page for notebook", notebookGuid)510 print("opening note page for notebook", notebookGuid)
532 pagestack.push(page, {title: notebook.name, filterNotebookGuid: notebookGuid, narrowMode: root.narrowMode});511 var page = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml")), {title: notebook.name, filterNotebookGuid: notebookGuid, narrowMode: root.narrowMode});
533 page.selectedNoteChanged.connect(function() {512 page.selectedNoteChanged.connect(function() {
534 if (page.selectedNote) {513 if (page.selectedNote) {
535 root.displayNote(page.selectedNote);514 root.displayNote(page.selectedNote);
@@ -575,10 +554,8 @@
575554
576 onOpenTaggedNotes: {555 onOpenTaggedNotes: {
577 var tag = NotesStore.tag(tagGuid);556 var tag = NotesStore.tag(tagGuid);
578 var component = Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml"))
579 var page = component.createObject();
580 print("opening note page for tag", tagGuid)557 print("opening note page for tag", tagGuid)
581 pagestack.push(page, {title: tag.name, filterTagGuid: tagGuid, narrowMode: root.narrowMode});558 var page = pagestack.push(Qt.createComponent(Qt.resolvedUrl("ui/NotesPage.qml")), {title: tag.name, filterTagGuid: tagGuid, narrowMode: root.narrowMode});
582 page.selectedNoteChanged.connect(function() {559 page.selectedNoteChanged.connect(function() {
583 if (page.selectedNote) {560 if (page.selectedNote) {
584 root.displayNote(page.selectedNote);561 root.displayNote(page.selectedNote);
585562
=== modified file 'src/app/qml/ui/AccountSelectorPage.qml'
--- src/app/qml/ui/AccountSelectorPage.qml 2015-03-03 20:02:06 +0000
+++ src/app/qml/ui/AccountSelectorPage.qml 2015-05-27 22:47:24 +0000
@@ -75,7 +75,7 @@
75 }75 }
7676
77 Component.onCompleted: {77 Component.onCompleted: {
78 if (isChangingAccount && displayName == preferences.accountName) {78 if (displayName == preferences.accountName) {
79 optionSelector.selectedIndex = index;79 optionSelector.selectedIndex = index;
80 }80 }
81 if (!model.enabled) {81 if (!model.enabled) {
8282
=== modified file 'src/app/qml/ui/EditNoteView.qml'
--- src/app/qml/ui/EditNoteView.qml 2015-05-07 21:41:41 +0000
+++ src/app/qml/ui/EditNoteView.qml 2015-05-27 22:47:24 +0000
@@ -84,8 +84,10 @@
84 Connections {84 Connections {
85 target: noteTextArea85 target: noteTextArea
86 onWidthChanged: {86 onWidthChanged: {
87 note.richTextContent = noteTextArea.text;87 if (note) {
88 note.renderWidth = noteTextArea.width - noteTextArea.textMargin * 288 note.richTextContent = noteTextArea.text;
89 note.renderWidth = noteTextArea.width - noteTextArea.textMargin * 2
90 }
89 }91 }
90 }92 }
9193
9294
=== modified file 'src/app/qml/ui/NotePage.qml'
--- src/app/qml/ui/NotePage.qml 2015-03-15 20:00:21 +0000
+++ src/app/qml/ui/NotePage.qml 2015-05-27 22:47:24 +0000
@@ -63,7 +63,6 @@
63 anchors.fill: parent63 anchors.fill: parent
6464
65 onOpenTaggedNotes: {65 onOpenTaggedNotes: {
66 console.log('babbo natale')
67 root.openTaggedNotes(title, tagGuid);66 root.openTaggedNotes(title, tagGuid);
68 }67 }
69 }68 }

Subscribers

People subscribed via source and target branches