Merge lp:~boiko/messaging-app/fix_thread_removing into lp:messaging-app

Proposed by Gustavo Pichorim Boiko
Status: Needs review
Proposed branch: lp:~boiko/messaging-app/fix_thread_removing
Merge into: lp:messaging-app
Prerequisite: lp:~tiagosh/messaging-app/fix_leaks_and_empty_view
Diff against target: 296 lines (+48/-83)
8 files modified
src/qml/MMS/Previewer.qml (+2/-2)
src/qml/MainPage.qml (+23/-16)
src/qml/Messages.qml (+1/-1)
src/qml/MessagingContactEditorPage.qml (+1/-1)
src/qml/MessagingContactViewPage.qml (+2/-2)
src/qml/MessagingPageLayout.qml (+9/-47)
src/qml/NewRecipientPage.qml (+2/-3)
src/qml/messaging-app.qml (+8/-11)
To merge this branch: bzr merge lp:~boiko/messaging-app/fix_thread_removing
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+287937@code.launchpad.net

Commit message

Instead of creating the pages statically, incubator.forceCompletion() to force the page creation to be fast.
Also, when removing one thread, move to the next one on the list.

Description of the change

Instead of creating the pages statically, incubator.forceCompletion() to force the page creation to be fast.
Also, when removing one thread, move to the next one on the list.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

519. By Gustavo Pichorim Boiko

Instead of creating the pages statically, incubator.forceCompletion() to force
the page creation to be fast.
Also, when removing one thread, move to the next one on the list.

516. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/MMS/Previewer.qml'
2--- src/qml/MMS/Previewer.qml 2016-02-01 20:10:42 +0000
3+++ src/qml/MMS/Previewer.qml 2016-03-03 14:15:15 +0000
4@@ -120,11 +120,11 @@
5
6 onPeerSelected: {
7 picker.curTransfer = peer.request();
8- mainStack.removePage(picker);
9+ mainStack.removePages(picker);
10 if (picker.curTransfer.state === ContentTransfer.InProgress)
11 picker.__exportItems(picker.url);
12 }
13- onCancelPressed: mainStack.removePage(picker);
14+ onCancelPressed: mainStack.removePages(picker);
15 }
16
17 Connections {
18
19=== modified file 'src/qml/MainPage.qml'
20--- src/qml/MainPage.qml 2016-02-12 13:15:42 +0000
21+++ src/qml/MainPage.qml 2016-03-03 14:15:15 +0000
22@@ -242,6 +242,23 @@
23 // FIXME: find a better unique name
24 objectName: "thread%1".arg(participants[0].identifier)
25
26+ function activate() {
27+ var properties = model.properties
28+ properties["keyboardFocus"] = false
29+ properties["threads"] = model.threads
30+ var participantIds = [];
31+ for (var i in model.participants) {
32+ participantIds.push(model.participants[i].identifier)
33+ }
34+ properties["participantIds"] = participantIds
35+ properties["participants"] = model.participants
36+ properties["presenceRequest"] = threadDelegate.presenceItem
37+ if (displayedEvent != null) {
38+ properties["scrollToEventId"] = displayedEvent.eventId
39+ }
40+ mainStack.addPageToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
41+ }
42+
43 anchors {
44 left: parent.left
45 right: parent.right
46@@ -264,22 +281,6 @@
47 threadList.deselectItem(threadDelegate)
48 }
49 } else {
50- var properties = model.properties
51- properties["keyboardFocus"] = false
52- properties["threads"] = model.threads
53- var participantIds = [];
54- for (var i in model.participants) {
55- participantIds.push(model.participants[i].identifier)
56- }
57- properties["participantIds"] = participantIds
58- properties["participants"] = model.participants
59- properties["presenceRequest"] = threadDelegate.presenceItem
60- if (displayedEvent != null) {
61- properties["scrollToEventId"] = displayedEvent.eventId
62- }
63- emptyStack()
64- mainStack.addComponentToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
65-
66 // mark this item as current
67 threadList.currentIndex = index
68 }
69@@ -302,6 +303,12 @@
70 }
71 }
72
73+ onCurrentItemChanged: {
74+ if (currentItem && currentItem.activate) {
75+ currentItem.activate()
76+ }
77+ }
78+
79 Binding {
80 target: threadList
81 property: 'contentY'
82
83=== modified file 'src/qml/Messages.qml'
84--- src/qml/Messages.qml 2016-03-03 14:15:14 +0000
85+++ src/qml/Messages.qml 2016-03-03 14:15:15 +0000
86@@ -641,7 +641,7 @@
87 iconName: "contact"
88 onTriggered: {
89 Qt.inputMethod.hide()
90- mainStack.addFileToCurrentColumnSync(messages.basePage, Qt.resolvedUrl("NewRecipientPage.qml"), {"multiRecipient": multiRecipient})
91+ mainStack.addPageToCurrentColumnSync(messages.basePage, Qt.resolvedUrl("NewRecipientPage.qml"), {"multiRecipient": multiRecipient})
92 }
93 }
94
95
96=== modified file 'src/qml/MessagingContactEditorPage.qml'
97--- src/qml/MessagingContactEditorPage.qml 2016-02-01 20:10:42 +0000
98+++ src/qml/MessagingContactEditorPage.qml 2016-03-03 14:15:15 +0000
99@@ -53,7 +53,7 @@
100 onContactSaved: {
101 if (root.contactListPage) {
102 if (root.contactListPage.phoneToAdd !== "") {
103- mainStack.removePage(root.contactListPage)
104+ mainStack.removePages(root.contactListPage)
105 } else {
106 root.contactListPage.moveListToContact(contact)
107 root.contactListPage.phoneToAdd = ""
108
109=== modified file 'src/qml/MessagingContactViewPage.qml'
110--- src/qml/MessagingContactViewPage.qml 2016-02-01 20:10:42 +0000
111+++ src/qml/MessagingContactViewPage.qml 2016-03-03 14:15:15 +0000
112@@ -123,9 +123,9 @@
113 } else {
114 Qt.openUrlExternally(("%1:%2").arg(action).arg(detail.value(0)))
115 }
116- pageStack.removePage(root)
117+ pageStack.removePages(root)
118 }
119- onContactRemoved: pageStack.removePage(root)
120+ onContactRemoved: pageStack.removePages(root)
121 onContactFetched: {
122 root.contact = contact
123 if (root.active && root.addPhoneToContact != "") {
124
125=== modified file 'src/qml/MessagingPageLayout.qml'
126--- src/qml/MessagingPageLayout.qml 2016-02-05 21:19:56 +0000
127+++ src/qml/MessagingPageLayout.qml 2016-03-03 14:15:15 +0000
128@@ -3,52 +3,14 @@
129
130 AdaptivePageLayout {
131 id: layout
132- property var _pagesToRemove: []
133-
134- function deleteInstances() {
135- for (var i in _pagesToRemove) {
136- if (_pagesToRemove[i].destroy) {
137- _pagesToRemove[i].destroy()
138- }
139- }
140- _pagesToRemove = []
141- }
142-
143- function removePage(page) {
144- // check if this page was allocated dynamically and then remove it
145- for (var i in _pagesToRemove) {
146- if (_pagesToRemove[i] == page) {
147- _pagesToRemove[i].destroy()
148- _pagesToRemove.splice(i, 1)
149- break
150- }
151- }
152- removePages(page)
153- }
154-
155- function addFileToNextColumnSync(parentObject, resolvedUrl, properties) {
156- addComponentToNextColumnSync(parentObject, Qt.createComponent(resolvedUrl), properties)
157- }
158-
159- function addFileToCurrentColumnSync(parentObject, resolvedUrl, properties) {
160- addComponentToCurrentColumnSync(parentObject, Qt.createComponent(resolvedUrl), properties)
161- }
162-
163- function addComponentToNextColumnSync(parentObject, component, properties) {
164- if (typeof(properties) === 'undefined') {
165- properties = {}
166- }
167- var page = component.createObject(parentObject, properties)
168- layout.addPageToNextColumn(parentObject, page)
169- _pagesToRemove.push(page)
170- }
171-
172- function addComponentToCurrentColumnSync(parentObject, component, properties) {
173- if (typeof(properties) === 'undefined') {
174- properties = {}
175- }
176- var page = component.createObject(parentObject, properties)
177- layout.addPageToCurrentColumn(parentObject, page)
178- _pagesToRemove.push(page)
179+
180+ function addPageToNextColumnSync(parentObject, page, properties) {
181+ var incubator = addPageToNextColumn(parentObject, page, properties)
182+ incubator.forceCompletion()
183+ }
184+
185+ function addPageToCurrentColumnSync(parentObject, page, properties) {
186+ var incubator = addPageToCurrentColumn(parentObject, page, properties)
187+ incubator.forceCompletion()
188 }
189 }
190
191=== modified file 'src/qml/NewRecipientPage.qml'
192--- src/qml/NewRecipientPage.qml 2016-02-01 20:10:42 +0000
193+++ src/qml/NewRecipientPage.qml 2016-03-03 14:15:15 +0000
194@@ -43,7 +43,7 @@
195 {
196 multiRecipient.addRecipient(phoneNumber)
197 multiRecipient.forceActiveFocus()
198- mainStack.removePage(newRecipientPage)
199+ mainStack.removePages(newRecipientPage)
200 }
201
202 header: PageHeader {
203@@ -64,8 +64,7 @@
204 text: i18n.tr("Back")
205 iconName: "back"
206 onTriggered: {
207- mainStack.removePage(newRecipientPage)
208- newRecipientPage.destroy()
209+ mainStack.removePages(newRecipientPage)
210 }
211 }
212 ]
213
214=== modified file 'src/qml/messaging-app.qml'
215--- src/qml/messaging-app.qml 2016-03-03 14:15:14 +0000
216+++ src/qml/messaging-app.qml 2016-03-03 14:15:15 +0000
217@@ -73,13 +73,13 @@
218 initialProperties['contact'] = contact
219 }
220
221- mainStack.addFileToCurrentColumnSync(currentPage,
222+ mainStack.addPageToCurrentColumnSync(currentPage,
223 Qt.resolvedUrl("MessagingContactViewPage.qml"),
224 initialProperties)
225 }
226
227 function addNewContact(currentPage, phoneNumber, contactListPage) {
228- mainStack.addFileToCurrentColumnSync(currentPage,
229+ mainStack.addPageToCurrentColumnSync(currentPage,
230 Qt.resolvedUrl("MessagingContactEditorPage.qml"),
231 { "contactId": contactId,
232 "addPhoneToContact": phoneNumber,
233@@ -88,7 +88,7 @@
234
235 function addPhoneToContact(currentPage, contact, phoneNumber, contactListPage, contactsModel) {
236 if (contact === "") {
237- mainStack.addFileToCurrentColumnSync(currentPage,
238+ mainStack.addPageToCurrentColumnSync(currentPage,
239 Qt.resolvedUrl("NewRecipientPage.qml"),
240 { "phoneToAdd": phoneNumber })
241 } else {
242@@ -100,7 +100,7 @@
243 } else {
244 initialProperties['contact'] = contact
245 }
246- mainStack.addFileToCurrentColumnSync(currentPage,
247+ mainStack.addPageToCurrentColumnSync(currentPage,
248 Qt.resolvedUrl("MessagingContactViewPage.qml"),
249 initialProperties)
250 }
251@@ -228,15 +228,14 @@
252 }
253
254 function emptyStack() {
255- mainStack.removePage(mainPage)
256- layout.deleteInstances()
257+ mainStack.removePages(mainPage)
258 showEmptyState()
259 mainPage.displayedThreadIndex = -1
260 }
261
262 function showEmptyState() {
263 if (mainStack.columns > 1 && !application.findChild("emptyStatePage")) {
264- layout.addComponentToNextColumnSync(mainPage, emptyStatePageComponent)
265+ layout.addPageToNextColumnSync(mainPage, emptyStatePageComponent)
266 }
267 }
268
269@@ -289,7 +288,7 @@
270 emptyStack()
271 // FIXME: AdaptivePageLayout takes a really long time to create pages,
272 // so we create manually and push that
273- mainStack.addComponentToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
274+ mainStack.addPageToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
275 }
276
277 InputInfo {
278@@ -345,9 +344,8 @@
279 target: layout
280 onColumnsChanged: {
281 if (layout.columns == 1) {
282- emptyStatePage.destroy()
283 if (!application.findChild("fakeItem")) {
284- layout.removePage(mainPage)
285+ layout.removePages(mainPage)
286 }
287 }
288 }
289@@ -380,7 +378,6 @@
290 onColumnsChanged: {
291 // we only have things to do here in case no thread is selected
292 if (layout.columns == 2 && !application.findChild("emptyStatePage") && !application.findChild("fakeItem")) {
293- layout.removePage(mainPage)
294 emptyStack()
295 showEmptyState()
296 }

Subscribers

People subscribed via source and target branches