Merge lp:~phablet-team/messaging-app/remove_apl_workarounds into lp:messaging-app

Proposed by Gustavo Pichorim Boiko
Status: Superseded
Proposed branch: lp:~phablet-team/messaging-app/remove_apl_workarounds
Merge into: lp:messaging-app
Diff against target: 664 lines (+157/-151)
15 files modified
debian/rules (+1/-1)
src/qml/MMS/Previewer.qml (+3/-3)
src/qml/MMS/PreviewerMultipleContacts.qml (+1/-1)
src/qml/MMSDelegate.qml (+1/-1)
src/qml/MainPage.qml (+9/-5)
src/qml/Messages.qml (+1/-1)
src/qml/MessagingBottomEdge.qml (+14/-5)
src/qml/MessagingContactEditorPage.qml (+1/-1)
src/qml/MessagingContactViewPage.qml (+5/-4)
src/qml/MessagingPageLayout.qml (+0/-85)
src/qml/NewRecipientPage.qml (+3/-3)
src/qml/SettingsPage.qml (+5/-0)
src/qml/messaging-app.qml (+107/-41)
tests/qml/tst_DualSim.qml (+4/-0)
tests/qml/tst_SingleSim.qml (+2/-0)
To merge this branch: bzr merge lp:~phablet-team/messaging-app/remove_apl_workarounds
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+300507@code.launchpad.net

This proposal has been superseded by a proposal from 2016-07-20.

Commit message

Now that AdaptivePageLayout supports loading pages synchronously and that the memory management bugs are fixed, remove the workarounds from the app.

Description of the change

Now that AdaptivePageLayout supports loading pages synchronously and that the memory management bugs are fixed, remove the workarounds from the app.

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:575
https://jenkins.canonical.com/system-apps/job/lp-messaging-app-ci/58/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1002/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1002
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/900
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/900
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/900
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/894/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/894
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/894/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/894
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/894/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/894/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/894
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/894/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/894
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/894/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/894/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/894
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/894/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/894
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/894/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-messaging-app-ci/58/rebuild

review: Needs Fixing (continuous-integration)
576. By Gustavo Pichorim Boiko

merge async_bottom_edge branch

577. By Gustavo Pichorim Boiko

Merge trunk

578. By Gustavo Pichorim Boiko

Merge parent

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/rules'
2--- debian/rules 2016-06-24 13:46:28 +0000
3+++ debian/rules 2016-07-20 14:12:11 +0000
4@@ -10,7 +10,7 @@
5 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
6 # Skip tests on the archs they are known to be flaky with current configuration
7 # Ref.: https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1585942
8-testskip_architectures := arm64
9+testskip_architectures := arm64 s390x
10
11 %:
12 dh $@ --parallel --fail-missing --with translations
13
14=== modified file 'src/qml/MMS/Previewer.qml'
15--- src/qml/MMS/Previewer.qml 2016-04-21 04:15:31 +0000
16+++ src/qml/MMS/Previewer.qml 2016-07-20 14:12:11 +0000
17@@ -63,7 +63,7 @@
18 iconName: "back"
19 shortcut: "Esc"
20 onTriggered: {
21- mainStack.removePage(previewerPage)
22+ mainStack.removePages(previewerPage)
23 }
24 }
25 ]
26@@ -133,11 +133,11 @@
27
28 onPeerSelected: {
29 picker.curTransfer = peer.request();
30- mainStack.removePage(picker);
31+ mainStack.removePages(picker);
32 if (picker.curTransfer.state === ContentTransfer.InProgress)
33 picker.__exportItems(picker.url);
34 }
35- onCancelPressed: mainStack.removePage(picker);
36+ onCancelPressed: mainStack.removePages(picker);
37 }
38
39 Connections {
40
41=== modified file 'src/qml/MMS/PreviewerMultipleContacts.qml'
42--- src/qml/MMS/PreviewerMultipleContacts.qml 2016-04-21 04:15:31 +0000
43+++ src/qml/MMS/PreviewerMultipleContacts.qml 2016-07-20 14:12:11 +0000
44@@ -58,7 +58,7 @@
45 property var contact: thumbnail.vcard.contacts[index]
46
47 onClicked: {
48- mainStack.addComponentToCurrentColumnSync(root, sigleContatPreviewer, {'contact': contact})
49+ mainStack.addPageToCurrentColumn(root, sigleContatPreviewer, {'contact': contact})
50 }
51 }
52 }
53
54=== modified file 'src/qml/MMSDelegate.qml'
55--- src/qml/MMSDelegate.qml 2016-06-28 20:21:42 +0000
56+++ src/qml/MMSDelegate.qml 2016-07-20 14:12:11 +0000
57@@ -45,7 +45,7 @@
58 var properties = {}
59 properties["attachment"] = attachment.item.attachment
60 properties["thumbnail"] = attachment.item
61- mainStack.addFileToCurrentColumnSync(messages.basePage, Qt.resolvedUrl(attachment.item.previewer), properties)
62+ mainStack.addPageToCurrentColumn(messages.basePage, Qt.resolvedUrl(attachment.item.previewer), properties)
63 }
64 }
65
66
67=== modified file 'src/qml/MainPage.qml'
68--- src/qml/MainPage.qml 2016-05-23 13:02:03 +0000
69+++ src/qml/MainPage.qml 2016-07-20 14:12:11 +0000
70@@ -96,8 +96,7 @@
71 text: i18n.tr("Settings")
72 iconName: "settings"
73 onTriggered: {
74- emptyStack()
75- pageStack.addFileToNextColumnSync(mainPage, Qt.resolvedUrl("SettingsPage.qml"))
76+ pageStack.addPageToNextColumn(mainPage, Qt.resolvedUrl("SettingsPage.qml"))
77 }
78 },
79 Action {
80@@ -229,7 +228,8 @@
81 section.delegate: searching && searchField.text !== "" ? null : sectionDelegate
82 header: ListItem.Standard {
83 id: newItem
84- height: mainView.bottomEdge.status === BottomEdge.Committed &&
85+ height: mainView.bottomEdge &&
86+ mainView.bottomEdge.status === BottomEdge.Committed &&
87 !mainView.bottomEdge.showingConversation &&
88 mainView.dualPanel ? units.gu(10) : 0
89 text: i18n.tr("New message")
90@@ -281,8 +281,7 @@
91 if (displayedEvent != null) {
92 properties["scrollToEventId"] = displayedEvent.eventId
93 }
94- emptyStack()
95- mainStack.addComponentToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
96+ mainStack.addPageToNextColumn(mainPage, messagesWithBottomEdge, properties)
97
98 // mark this item as current
99 threadList.currentIndex = index
100@@ -326,6 +325,11 @@
101 Loader {
102 id: bottomEdgeLoader
103 active: !selectionMode && !searching && !mainView.dualPanel
104+ asynchronous: true
105+ /* FIXME: would be even more efficient to use setSource() to
106+ delay the compilation step but a bug in Qt prevents us.
107+ Ref.: https://bugreports.qt.io/browse/QTBUG-54657
108+ */
109 sourceComponent: MessagingBottomEdge {
110 parent: mainPage
111 }
112
113=== modified file 'src/qml/Messages.qml'
114--- src/qml/Messages.qml 2016-07-13 20:42:55 +0000
115+++ src/qml/Messages.qml 2016-07-20 14:12:11 +0000
116@@ -676,7 +676,7 @@
117 iconName: "contact"
118 onTriggered: {
119 Qt.inputMethod.hide()
120- mainStack.addFileToCurrentColumnSync(messages.basePage, Qt.resolvedUrl("NewRecipientPage.qml"), {"multiRecipient": multiRecipient})
121+ mainStack.addPageToCurrentColumn(messages.basePage, Qt.resolvedUrl("NewRecipientPage.qml"), {"multiRecipient": multiRecipient})
122 }
123 }
124
125
126=== modified file 'src/qml/MessagingBottomEdge.qml'
127--- src/qml/MessagingBottomEdge.qml 2016-05-02 18:35:28 +0000
128+++ src/qml/MessagingBottomEdge.qml 2016-07-20 14:12:11 +0000
129@@ -23,7 +23,9 @@
130 id: bottomEdge
131
132 function commitWithProperties(properties) {
133- _realPage.destroy()
134+ if (_realPage) {
135+ _realPage.destroy()
136+ }
137 _realPage = messagesComponent.createObject(null, properties)
138 commit()
139 }
140@@ -42,16 +44,23 @@
141 }
142
143 Component.onCompleted: {
144- mainView.bottomEdge = bottomEdge
145- _realPage = messagesComponent.createObject(null)
146+ if (!_realPage) {
147+ _realPage = messagesComponent.createObject(null)
148+ }
149+ mainView.setBottomEdge(bottomEdge)
150 }
151
152 Component.onDestruction: {
153- _realPage.destroy()
154+ mainView.unsetBottomEdge(bottomEdge)
155+ if (_realPage) {
156+ _realPage.destroy()
157+ }
158 }
159
160 onCollapseCompleted: {
161- _realPage.destroy()
162+ if (_realPage) {
163+ _realPage.destroy()
164+ }
165 _realPage = messagesComponent.createObject(null)
166 }
167
168
169=== modified file 'src/qml/MessagingContactEditorPage.qml'
170--- src/qml/MessagingContactEditorPage.qml 2016-06-20 12:22:19 +0000
171+++ src/qml/MessagingContactEditorPage.qml 2016-07-20 14:12:11 +0000
172@@ -55,7 +55,7 @@
173 onContactSaved: {
174 if (root.contactListPage) {
175 if (root.contactListPage.phoneToAdd !== "") {
176- mainStack.removePage(root.contactListPage)
177+ mainStack.removePages(root.contactListPage)
178 } else {
179 root.contactListPage.moveListToContact(contact)
180 root.contactListPage.phoneToAdd = ""
181
182=== modified file 'src/qml/MessagingContactViewPage.qml'
183--- src/qml/MessagingContactViewPage.qml 2016-02-01 20:10:42 +0000
184+++ src/qml/MessagingContactViewPage.qml 2016-07-20 14:12:11 +0000
185@@ -35,6 +35,7 @@
186 readonly property string contactEditorPageURL: Qt.resolvedUrl("MessagingContactEditorPage.qml")
187 property string addPhoneToContact: ""
188 property var contactListPage: null
189+ model: null
190
191 function addPhoneToContactImpl(contact, phoneNumber)
192 {
193@@ -62,7 +63,7 @@
194 iconName: "share"
195 visible: root.editable
196 onTriggered: {
197- pageStack.addComponentToCurrentColumnSync(root, contactShareComponent,
198+ pageStack.addPageToCurrentColumn(root, contactShareComponent,
199 { contactModel: root.model,
200 contacts: [root.contact] })
201 }
202@@ -73,7 +74,7 @@
203 iconName: "edit"
204 visible: root.editable
205 onTriggered: {
206- pageStack.addFileToCurrentColumnSync(root, contactEditorPageURL,
207+ pageStack.addPageToCurrentColumn(root, contactEditorPageURL,
208 { model: root.model,
209 contact: root.contact,
210 contactListPage: root.contactListPage })
211@@ -123,9 +124,9 @@
212 } else {
213 Qt.openUrlExternally(("%1:%2").arg(action).arg(detail.value(0)))
214 }
215- pageStack.removePage(root)
216+ pageStack.removePages(root)
217 }
218- onContactRemoved: pageStack.removePage(root)
219+ onContactRemoved: pageStack.removePages(root)
220 onContactFetched: {
221 root.contact = contact
222 if (root.active && root.addPhoneToContact != "") {
223
224=== removed file 'src/qml/MessagingPageLayout.qml'
225--- src/qml/MessagingPageLayout.qml 2016-05-02 18:35:28 +0000
226+++ src/qml/MessagingPageLayout.qml 1970-01-01 00:00:00 +0000
227@@ -1,85 +0,0 @@
228-/*
229- * Copyright 2016 Canonical Ltd.
230- *
231- * This file is part of messaging-app.
232- *
233- * messaging-app is free software; you can redistribute it and/or modify
234- * it under the terms of the GNU General Public License as published by
235- * the Free Software Foundation; version 3.
236- *
237- * messaging-app is distributed in the hope that it will be useful,
238- * but WITHOUT ANY WARRANTY; without even the implied warranty of
239- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
240- * GNU General Public License for more details.
241- *
242- * You should have received a copy of the GNU General Public License
243- * along with this program. If not, see <http://www.gnu.org/licenses/>.
244- */
245-
246-import QtQuick 2.0
247-import Ubuntu.Components 1.3
248-
249-AdaptivePageLayout {
250- id: layout
251- property var _pagesToRemove: []
252-
253- layouts: PageColumnsLayout {
254- when: mainStack.width >= units.gu(90)
255- PageColumn {
256- maximumWidth: units.gu(50)
257- minimumWidth: units.gu(40)
258- preferredWidth: units.gu(40)
259- }
260- PageColumn {
261- fillWidth: true
262- }
263- }
264-
265-
266- function deleteInstances() {
267- for (var i in _pagesToRemove) {
268- if (_pagesToRemove[i].destroy) {
269- _pagesToRemove[i].destroy()
270- }
271- }
272- _pagesToRemove = []
273- }
274-
275- function removePage(page) {
276- // check if this page was allocated dynamically and then remove it
277- for (var i in _pagesToRemove) {
278- if (_pagesToRemove[i] == page) {
279- _pagesToRemove[i].destroy()
280- _pagesToRemove.splice(i, 1)
281- break
282- }
283- }
284- removePages(page)
285- }
286-
287- function addFileToNextColumnSync(parentObject, resolvedUrl, properties) {
288- addComponentToNextColumnSync(parentObject, Qt.createComponent(resolvedUrl), properties)
289- }
290-
291- function addFileToCurrentColumnSync(parentObject, resolvedUrl, properties) {
292- addComponentToCurrentColumnSync(parentObject, Qt.createComponent(resolvedUrl), properties)
293- }
294-
295- function addComponentToNextColumnSync(parentObject, component, properties) {
296- if (typeof(properties) === 'undefined') {
297- properties = {}
298- }
299- var page = component.createObject(parentObject, properties)
300- layout.addPageToNextColumn(parentObject, page)
301- _pagesToRemove.push(page)
302- }
303-
304- function addComponentToCurrentColumnSync(parentObject, component, properties) {
305- if (typeof(properties) === 'undefined') {
306- properties = {}
307- }
308- var page = component.createObject(parentObject, properties)
309- layout.addPageToCurrentColumn(parentObject, page)
310- _pagesToRemove.push(page)
311- }
312-}
313
314=== modified file 'src/qml/NewRecipientPage.qml'
315--- src/qml/NewRecipientPage.qml 2016-06-21 00:56:52 +0000
316+++ src/qml/NewRecipientPage.qml 2016-07-20 14:12:11 +0000
317@@ -43,7 +43,7 @@
318 {
319 multiRecipient.addRecipient(phoneNumber)
320 multiRecipient.forceActiveFocus()
321- mainStack.removePage(newRecipientPage)
322+ mainStack.removePages(newRecipientPage)
323 }
324
325 header: PageHeader {
326@@ -64,7 +64,7 @@
327 text: i18n.tr("Back")
328 iconName: "back"
329 onTriggered: {
330- mainStack.removePage(newRecipientPage)
331+ mainStack.removePages(newRecipientPage)
332 newRecipientPage.destroy()
333 }
334 }
335@@ -190,7 +190,7 @@
336
337 onAddNewContactClicked: {
338 var newContact = ContactsJS.createEmptyContact(newRecipientPage.phoneToAdd, newRecipientPage)
339- mainStack.addFileToCurrentColumnSync(newRecipientPage,
340+ mainStack.addPageToCurrentColumn(newRecipientPage,
341 Qt.resolvedUrl("MessagingContactEditorPage.qml"),
342 { model: contactList.listModel,
343 contact: newContact,
344
345=== modified file 'src/qml/SettingsPage.qml'
346--- src/qml/SettingsPage.qml 2016-03-22 13:52:47 +0000
347+++ src/qml/SettingsPage.qml 2016-07-20 14:12:11 +0000
348@@ -110,6 +110,11 @@
349 Loader {
350 id: messagesBottomEdgeLoader
351 active: mainView.dualPanel
352+ asynchronous: true
353+ /* FIXME: would be even more efficient to use setSource() to
354+ delay the compilation step but a bug in Qt prevents us.
355+ Ref.: https://bugreports.qt.io/browse/QTBUG-54657
356+ */
357 sourceComponent: MessagingBottomEdge {
358 id: messagesBottomEdge
359 parent: settingsPage
360
361=== modified file 'src/qml/messaging-app.qml'
362--- src/qml/messaging-app.qml 2016-05-04 19:36:27 +0000
363+++ src/qml/messaging-app.qml 2016-07-20 14:12:11 +0000
364@@ -50,6 +50,44 @@
365
366 activeFocusOnPress: false
367
368+ /* Multiple MessagingBottomEdge instances can be created simultaneously
369+ and ask to become the unique 'bottomEdge'.
370+ Queue the requests until only one MessagingBottomEdge instance is left.
371+ */
372+ property var bottomEdgeQueue: []
373+ function setBottomEdge(newBottomEdge) {
374+ /* If the queue is empty and no other bottom edge is set then
375+ set 'bottomEdge' to newBottomEdge. Otherwise insert newBottomEdge
376+ in the queue
377+ */
378+ if (!bottomEdge && bottomEdgeQueue.length == 0) {
379+ bottomEdge = newBottomEdge;
380+ } else {
381+ if (bottomEdge) {
382+ bottomEdgeQueue.unshift(bottomEdge)
383+ bottomEdge = null
384+ }
385+ bottomEdgeQueue.push(newBottomEdge)
386+ }
387+ }
388+
389+ function unsetBottomEdge(oldBottomEdge) {
390+ /* Remove all references to oldBottomEdge (from the queue and from 'bottomEdge')
391+ If only one bottom edge remains in the queue then set 'bottomEdge' to it
392+ */
393+ if (bottomEdge == oldBottomEdge) {
394+ bottomEdge = null;
395+ } else {
396+ var index = bottomEdgeQueue.indexOf(oldBottomEdge);
397+ if (index != -1) {
398+ bottomEdgeQueue.splice(index, 1);
399+ if (bottomEdgeQueue.length == 1) {
400+ bottomEdge = bottomEdgeQueue.pop();
401+ }
402+ }
403+ }
404+ }
405+
406 function defaultPhoneAccount() {
407 // we only use the default account property if we have more
408 // than one account, otherwise we use always the first one
409@@ -67,8 +105,13 @@
410 }
411
412 function showContactDetails(currentPage, contact, contactListPage, contactsModel) {
413- var initialProperties = { "contactListPage": contactListPage,
414- "model": contactsModel}
415+ var initialProperties = {}
416+ if (contactListPage) {
417+ initialProperties["contactListPage"] = contactListPage
418+ }
419+ if (contactsModel) {
420+ initialProperties["model"] = contactsModel
421+ }
422
423 if (typeof(contact) == 'string') {
424 initialProperties['contactId'] = contact
425@@ -76,34 +119,30 @@
426 initialProperties['contact'] = contact
427 }
428
429- mainStack.addFileToCurrentColumnSync(currentPage,
430+ mainStack.addPageToCurrentColumn(currentPage,
431 Qt.resolvedUrl("MessagingContactViewPage.qml"),
432 initialProperties)
433 }
434
435- function addNewContact(currentPage, phoneNumber, contactListPage) {
436- mainStack.addFileToCurrentColumnSync(currentPage,
437- Qt.resolvedUrl("MessagingContactEditorPage.qml"),
438- { "contactId": contactId,
439- "addPhoneToContact": phoneNumber,
440- "contactListPage": contactListPage })
441- }
442-
443 function addPhoneToContact(currentPage, contact, phoneNumber, contactListPage, contactsModel) {
444 if (contact === "") {
445- mainStack.addFileToCurrentColumnSync(currentPage,
446+ mainStack.addPageToCurrentColumn(currentPage,
447 Qt.resolvedUrl("NewRecipientPage.qml"),
448 { "phoneToAdd": phoneNumber })
449 } else {
450- var initialProperties = { "addPhoneToContact": phoneNumber,
451- "contactListPage": contactListPage,
452- "model": contactsModel }
453+ var initialProperties = { "addPhoneToContact": phoneNumber }
454+ if (contactListPage) {
455+ initialProperties["contactListPage"] = contactListPage
456+ }
457+ if (contactsModel) {
458+ initialProperties["model"] = contactsModel
459+ }
460 if (typeof(contact) == 'string') {
461 initialProperties['contactId'] = contact
462 } else {
463 initialProperties['contact'] = contact
464 }
465- mainStack.addFileToCurrentColumnSync(currentPage,
466+ mainStack.addPageToCurrentColumn(currentPage,
467 Qt.resolvedUrl("MessagingContactViewPage.qml"),
468 initialProperties)
469 }
470@@ -131,8 +170,22 @@
471 threadModel.removeThreads(threads);
472 }
473
474+ property var pendingCommitProperties
475+ function bottomEdgeCommit() {
476+ if (bottomEdge) {
477+ mainView.onBottomEdgeChanged.disconnect(bottomEdgeCommit);
478+ bottomEdge.commitWithProperties(pendingCommitProperties);
479+ pendingCommitProperties = null;
480+ }
481+ }
482+
483 function showBottomEdgePage(properties) {
484- bottomEdge.commitWithProperties(properties)
485+ pendingCommitProperties = properties;
486+ if (bottomEdge) {
487+ bottomEdgeCommit();
488+ } else {
489+ mainView.onBottomEdgeChanged.connect(bottomEdgeCommit);
490+ }
491 }
492
493 Connections {
494@@ -230,17 +283,19 @@
495 return ContentType.Unknown
496 }
497
498- function emptyStack() {
499+ function emptyStack(showEmpty) {
500+ if (typeof showEmpty === 'undefined') { showEmpty = true; }
501 mainView.emptyStackRequested()
502- mainStack.removePage(mainPage)
503- layout.deleteInstances()
504- showEmptyState()
505+ mainStack.removePages(mainPage)
506+ if (showEmpty) {
507+ showEmptyState()
508+ }
509 mainPage.displayedThreadIndex = -1
510 }
511
512 function showEmptyState() {
513 if (mainStack.columns > 1 && !application.findMessagingChild("emptyStatePage")) {
514- layout.addComponentToNextColumnSync(mainPage, emptyStatePageComponent)
515+ layout.addPageToNextColumn(mainPage, emptyStatePageComponent)
516 }
517 }
518
519@@ -290,10 +345,10 @@
520 properties["accountId"] = accountId
521 }
522
523- emptyStack()
524+ emptyStack(false)
525 // FIXME: AdaptivePageLayout takes a really long time to create pages,
526 // so we create manually and push that
527- mainStack.addComponentToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
528+ mainStack.addPageToNextColumn(mainPage, messagesWithBottomEdge, properties)
529 }
530
531 InputInfo {
532@@ -330,6 +385,11 @@
533 Loader {
534 id: messagesBottomEdgeLoader
535 active: mainView.dualPanel
536+ asynchronous: true
537+ /* FIXME: would be even more efficient to use setSource() to
538+ delay the compilation step but a bug in Qt prevents us.
539+ Ref.: https://bugreports.qt.io/browse/QTBUG-54657
540+ */
541 sourceComponent: MessagingBottomEdge {
542 id: messagesBottomEdge
543 parent: messages
544@@ -346,30 +406,17 @@
545 id: emptyStatePage
546 objectName: "emptyStatePage"
547
548- function deleteMe() {
549- emptyStatePage.destroy(1)
550- emptyStatePage.objectName = ""
551- }
552-
553 Connections {
554 target: layout
555 onColumnsChanged: {
556 if (layout.columns == 1) {
557- emptyStatePage.deleteMe()
558 if (!application.findMessagingChild("fakeItem")) {
559- layout.removePage(mainPage)
560+ emptyStack()
561 }
562 }
563 }
564 }
565
566- Connections {
567- target: mainView
568- onEmptyStackRequested: {
569- emptyStatePage.deleteMe()
570- }
571- }
572-
573 EmptyState {
574 labelVisible: false
575 }
576@@ -378,6 +425,11 @@
577
578 Loader {
579 id: bottomEdgeLoader
580+ asynchronous: true
581+ /* FIXME: would be even more efficient to use setSource() to
582+ delay the compilation step but a bug in Qt prevents us.
583+ Ref.: https://bugreports.qt.io/browse/QTBUG-54657
584+ */
585 sourceComponent: MessagingBottomEdge {
586 parent: emptyStatePage
587 hint.text: ""
588@@ -387,17 +439,30 @@
589 }
590 }
591
592- MessagingPageLayout {
593+ AdaptivePageLayout {
594 id: layout
595 anchors.fill: parent
596+ layouts: PageColumnsLayout {
597+ when: mainStack.width >= units.gu(90)
598+ PageColumn {
599+ maximumWidth: units.gu(50)
600+ minimumWidth: units.gu(40)
601+ preferredWidth: units.gu(40)
602+ }
603+ PageColumn {
604+ fillWidth: true
605+ }
606+ }
607+ asynchronous: false
608 primaryPage: MainPage {
609 id: mainPage
610 }
611
612+ property bool completed: false
613+
614 onColumnsChanged: {
615 // we only have things to do here in case no thread is selected
616- if (layout.columns == 2 && !application.findMessagingChild("emptyStatePage") && !application.findMessagingChild("fakeItem")) {
617- layout.removePage(mainPage)
618+ if (layout.completed && layout.columns == 2 && !application.findMessagingChild("emptyStatePage") && !application.findMessagingChild("fakeItem")) {
619 emptyStack()
620 }
621 }
622@@ -405,6 +470,7 @@
623 if (layout.columns == 2 && !application.findMessagingChild("emptyStatePage")) {
624 emptyStack()
625 }
626+ layout.completed = true;
627 }
628 }
629 }
630
631=== modified file 'tests/qml/tst_DualSim.qml'
632--- tests/qml/tst_DualSim.qml 2016-07-13 21:37:55 +0000
633+++ tests/qml/tst_DualSim.qml 2016-07-20 14:12:11 +0000
634@@ -153,6 +153,8 @@
635
636 mainViewLoader.item.startNewMessage()
637 waitForRendering(mainViewLoader.item)
638+ tryCompare(mainViewLoader.item, 'pendingCommitProperties', null)
639+ waitForRendering(mainViewLoader.item.bottomEdge)
640
641 var messagesView = findChild(mainViewLoader, "messagesPage")
642 var headerSections = findChild(messagesView, "headerSections")
643@@ -215,6 +217,8 @@
644
645 mainViewLoader.item.startNewMessage()
646 waitForRendering(mainViewLoader.item)
647+ tryCompare(mainViewLoader.item, 'pendingCommitProperties', null)
648+ waitForRendering(mainViewLoader.item.bottomEdge)
649
650 var messagesView = findChild(mainViewLoader, "messagesPage")
651 var textArea = findChild(messagesView, "messageTextArea")
652
653=== modified file 'tests/qml/tst_SingleSim.qml'
654--- tests/qml/tst_SingleSim.qml 2016-05-05 19:57:41 +0000
655+++ tests/qml/tst_SingleSim.qml 2016-07-20 14:12:11 +0000
656@@ -138,6 +138,8 @@
657
658 mainViewLoader.item.startNewMessage()
659 waitForRendering(mainViewLoader.item)
660+ tryCompare(mainViewLoader.item, 'pendingCommitProperties', null)
661+ waitForRendering(mainViewLoader.item.bottomEdge)
662
663 var messagesView = findChild(mainViewLoader, "messagesPage")
664 var textArea = findChild(messagesView, "messageTextArea")

Subscribers

People subscribed via source and target branches

to all changes: