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

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 578
Merged at revision: 582
Proposed branch: lp:~phablet-team/messaging-app/remove_apl_workarounds
Merge into: lp:messaging-app
Prerequisite: lp:~fboucault/messaging-app/async_bottom_edge
Diff against target: 421 lines (+51/-139)
10 files modified
src/qml/MMS/Previewer.qml (+3/-3)
src/qml/MMS/PreviewerMultipleContacts.qml (+1/-1)
src/qml/MMSDelegate.qml (+1/-1)
src/qml/MainPage.qml (+2/-4)
src/qml/Messages.qml (+1/-1)
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/messaging-app.qml (+34/-36)
To merge this branch: bzr merge lp:~phablet-team/messaging-app/remove_apl_workarounds
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
system-apps-ci-bot continuous-integration Approve
Review via email: mp+300615@code.launchpad.net

This proposal supersedes a proposal from 2016-07-19.

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 : Posted in a previous version of this proposal

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)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

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

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

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

Merge trunk

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:577
https://jenkins.canonical.com/system-apps/job/lp-messaging-app-ci/60/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1019
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/193
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1019
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/917
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/917
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/917
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/911/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/911
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/911/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
578. By Gustavo Pichorim Boiko

Merge parent

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:578
https://jenkins.canonical.com/system-apps/job/lp-messaging-app-ci/66/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1037
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/203
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1037
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/933
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/933
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/933
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/927/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/927
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/927/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

nice to get rid of these workarounds.
Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/qml/MMS/Previewer.qml'
--- src/qml/MMS/Previewer.qml 2016-04-21 04:15:31 +0000
+++ src/qml/MMS/Previewer.qml 2016-07-25 17:14:08 +0000
@@ -63,7 +63,7 @@
63 iconName: "back"63 iconName: "back"
64 shortcut: "Esc"64 shortcut: "Esc"
65 onTriggered: {65 onTriggered: {
66 mainStack.removePage(previewerPage)66 mainStack.removePages(previewerPage)
67 }67 }
68 }68 }
69 ]69 ]
@@ -133,11 +133,11 @@
133133
134 onPeerSelected: {134 onPeerSelected: {
135 picker.curTransfer = peer.request();135 picker.curTransfer = peer.request();
136 mainStack.removePage(picker);136 mainStack.removePages(picker);
137 if (picker.curTransfer.state === ContentTransfer.InProgress)137 if (picker.curTransfer.state === ContentTransfer.InProgress)
138 picker.__exportItems(picker.url);138 picker.__exportItems(picker.url);
139 }139 }
140 onCancelPressed: mainStack.removePage(picker);140 onCancelPressed: mainStack.removePages(picker);
141 }141 }
142142
143 Connections {143 Connections {
144144
=== modified file 'src/qml/MMS/PreviewerMultipleContacts.qml'
--- src/qml/MMS/PreviewerMultipleContacts.qml 2016-04-21 04:15:31 +0000
+++ src/qml/MMS/PreviewerMultipleContacts.qml 2016-07-25 17:14:08 +0000
@@ -58,7 +58,7 @@
58 property var contact: thumbnail.vcard.contacts[index]58 property var contact: thumbnail.vcard.contacts[index]
5959
60 onClicked: {60 onClicked: {
61 mainStack.addComponentToCurrentColumnSync(root, sigleContatPreviewer, {'contact': contact})61 mainStack.addPageToCurrentColumn(root, sigleContatPreviewer, {'contact': contact})
62 }62 }
63 }63 }
64 }64 }
6565
=== modified file 'src/qml/MMSDelegate.qml'
--- src/qml/MMSDelegate.qml 2016-06-28 20:21:42 +0000
+++ src/qml/MMSDelegate.qml 2016-07-25 17:14:08 +0000
@@ -45,7 +45,7 @@
45 var properties = {}45 var properties = {}
46 properties["attachment"] = attachment.item.attachment46 properties["attachment"] = attachment.item.attachment
47 properties["thumbnail"] = attachment.item47 properties["thumbnail"] = attachment.item
48 mainStack.addFileToCurrentColumnSync(messages.basePage, Qt.resolvedUrl(attachment.item.previewer), properties)48 mainStack.addPageToCurrentColumn(messages.basePage, Qt.resolvedUrl(attachment.item.previewer), properties)
49 }49 }
50 }50 }
5151
5252
=== modified file 'src/qml/MainPage.qml'
--- src/qml/MainPage.qml 2016-07-08 13:46:54 +0000
+++ src/qml/MainPage.qml 2016-07-25 17:14:08 +0000
@@ -96,8 +96,7 @@
96 text: i18n.tr("Settings")96 text: i18n.tr("Settings")
97 iconName: "settings"97 iconName: "settings"
98 onTriggered: {98 onTriggered: {
99 emptyStack(false)99 pageStack.addPageToNextColumn(mainPage, Qt.resolvedUrl("SettingsPage.qml"))
100 pageStack.addFileToNextColumnSync(mainPage, Qt.resolvedUrl("SettingsPage.qml"))
101 }100 }
102 },101 },
103 Action {102 Action {
@@ -282,8 +281,7 @@
282 if (displayedEvent != null) {281 if (displayedEvent != null) {
283 properties["scrollToEventId"] = displayedEvent.eventId282 properties["scrollToEventId"] = displayedEvent.eventId
284 }283 }
285 emptyStack(false)284 mainStack.addPageToNextColumn(mainPage, messagesWithBottomEdge, properties)
286 mainStack.addComponentToNextColumnSync(mainPage, messagesWithBottomEdge, properties)
287285
288 // mark this item as current286 // mark this item as current
289 threadList.currentIndex = index287 threadList.currentIndex = index
290288
=== modified file 'src/qml/Messages.qml'
--- src/qml/Messages.qml 2016-07-13 20:42:55 +0000
+++ src/qml/Messages.qml 2016-07-25 17:14:08 +0000
@@ -676,7 +676,7 @@
676 iconName: "contact"676 iconName: "contact"
677 onTriggered: {677 onTriggered: {
678 Qt.inputMethod.hide()678 Qt.inputMethod.hide()
679 mainStack.addFileToCurrentColumnSync(messages.basePage, Qt.resolvedUrl("NewRecipientPage.qml"), {"multiRecipient": multiRecipient})679 mainStack.addPageToCurrentColumn(messages.basePage, Qt.resolvedUrl("NewRecipientPage.qml"), {"multiRecipient": multiRecipient})
680 }680 }
681 }681 }
682682
683683
=== modified file 'src/qml/MessagingContactEditorPage.qml'
--- src/qml/MessagingContactEditorPage.qml 2016-06-20 12:22:19 +0000
+++ src/qml/MessagingContactEditorPage.qml 2016-07-25 17:14:08 +0000
@@ -55,7 +55,7 @@
55 onContactSaved: {55 onContactSaved: {
56 if (root.contactListPage) {56 if (root.contactListPage) {
57 if (root.contactListPage.phoneToAdd !== "") {57 if (root.contactListPage.phoneToAdd !== "") {
58 mainStack.removePage(root.contactListPage)58 mainStack.removePages(root.contactListPage)
59 } else {59 } else {
60 root.contactListPage.moveListToContact(contact)60 root.contactListPage.moveListToContact(contact)
61 root.contactListPage.phoneToAdd = ""61 root.contactListPage.phoneToAdd = ""
6262
=== modified file 'src/qml/MessagingContactViewPage.qml'
--- src/qml/MessagingContactViewPage.qml 2016-02-01 20:10:42 +0000
+++ src/qml/MessagingContactViewPage.qml 2016-07-25 17:14:08 +0000
@@ -35,6 +35,7 @@
35 readonly property string contactEditorPageURL: Qt.resolvedUrl("MessagingContactEditorPage.qml")35 readonly property string contactEditorPageURL: Qt.resolvedUrl("MessagingContactEditorPage.qml")
36 property string addPhoneToContact: ""36 property string addPhoneToContact: ""
37 property var contactListPage: null37 property var contactListPage: null
38 model: null
3839
39 function addPhoneToContactImpl(contact, phoneNumber)40 function addPhoneToContactImpl(contact, phoneNumber)
40 {41 {
@@ -62,7 +63,7 @@
62 iconName: "share"63 iconName: "share"
63 visible: root.editable64 visible: root.editable
64 onTriggered: {65 onTriggered: {
65 pageStack.addComponentToCurrentColumnSync(root, contactShareComponent,66 pageStack.addPageToCurrentColumn(root, contactShareComponent,
66 { contactModel: root.model,67 { contactModel: root.model,
67 contacts: [root.contact] })68 contacts: [root.contact] })
68 }69 }
@@ -73,7 +74,7 @@
73 iconName: "edit"74 iconName: "edit"
74 visible: root.editable75 visible: root.editable
75 onTriggered: {76 onTriggered: {
76 pageStack.addFileToCurrentColumnSync(root, contactEditorPageURL,77 pageStack.addPageToCurrentColumn(root, contactEditorPageURL,
77 { model: root.model,78 { model: root.model,
78 contact: root.contact,79 contact: root.contact,
79 contactListPage: root.contactListPage })80 contactListPage: root.contactListPage })
@@ -123,9 +124,9 @@
123 } else {124 } else {
124 Qt.openUrlExternally(("%1:%2").arg(action).arg(detail.value(0)))125 Qt.openUrlExternally(("%1:%2").arg(action).arg(detail.value(0)))
125 }126 }
126 pageStack.removePage(root)127 pageStack.removePages(root)
127 }128 }
128 onContactRemoved: pageStack.removePage(root)129 onContactRemoved: pageStack.removePages(root)
129 onContactFetched: {130 onContactFetched: {
130 root.contact = contact131 root.contact = contact
131 if (root.active && root.addPhoneToContact != "") {132 if (root.active && root.addPhoneToContact != "") {
132133
=== removed file 'src/qml/MessagingPageLayout.qml'
--- src/qml/MessagingPageLayout.qml 2016-05-02 18:35:28 +0000
+++ src/qml/MessagingPageLayout.qml 1970-01-01 00:00:00 +0000
@@ -1,85 +0,0 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This file is part of messaging-app.
5 *
6 * messaging-app is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * messaging-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 1.3
21
22AdaptivePageLayout {
23 id: layout
24 property var _pagesToRemove: []
25
26 layouts: PageColumnsLayout {
27 when: mainStack.width >= units.gu(90)
28 PageColumn {
29 maximumWidth: units.gu(50)
30 minimumWidth: units.gu(40)
31 preferredWidth: units.gu(40)
32 }
33 PageColumn {
34 fillWidth: true
35 }
36 }
37
38
39 function deleteInstances() {
40 for (var i in _pagesToRemove) {
41 if (_pagesToRemove[i].destroy) {
42 _pagesToRemove[i].destroy()
43 }
44 }
45 _pagesToRemove = []
46 }
47
48 function removePage(page) {
49 // check if this page was allocated dynamically and then remove it
50 for (var i in _pagesToRemove) {
51 if (_pagesToRemove[i] == page) {
52 _pagesToRemove[i].destroy()
53 _pagesToRemove.splice(i, 1)
54 break
55 }
56 }
57 removePages(page)
58 }
59
60 function addFileToNextColumnSync(parentObject, resolvedUrl, properties) {
61 addComponentToNextColumnSync(parentObject, Qt.createComponent(resolvedUrl), properties)
62 }
63
64 function addFileToCurrentColumnSync(parentObject, resolvedUrl, properties) {
65 addComponentToCurrentColumnSync(parentObject, Qt.createComponent(resolvedUrl), properties)
66 }
67
68 function addComponentToNextColumnSync(parentObject, component, properties) {
69 if (typeof(properties) === 'undefined') {
70 properties = {}
71 }
72 var page = component.createObject(parentObject, properties)
73 layout.addPageToNextColumn(parentObject, page)
74 _pagesToRemove.push(page)
75 }
76
77 function addComponentToCurrentColumnSync(parentObject, component, properties) {
78 if (typeof(properties) === 'undefined') {
79 properties = {}
80 }
81 var page = component.createObject(parentObject, properties)
82 layout.addPageToCurrentColumn(parentObject, page)
83 _pagesToRemove.push(page)
84 }
85}
860
=== modified file 'src/qml/NewRecipientPage.qml'
--- src/qml/NewRecipientPage.qml 2016-06-21 00:56:52 +0000
+++ src/qml/NewRecipientPage.qml 2016-07-25 17:14:08 +0000
@@ -43,7 +43,7 @@
43 {43 {
44 multiRecipient.addRecipient(phoneNumber)44 multiRecipient.addRecipient(phoneNumber)
45 multiRecipient.forceActiveFocus()45 multiRecipient.forceActiveFocus()
46 mainStack.removePage(newRecipientPage)46 mainStack.removePages(newRecipientPage)
47 }47 }
4848
49 header: PageHeader {49 header: PageHeader {
@@ -64,7 +64,7 @@
64 text: i18n.tr("Back")64 text: i18n.tr("Back")
65 iconName: "back"65 iconName: "back"
66 onTriggered: {66 onTriggered: {
67 mainStack.removePage(newRecipientPage)67 mainStack.removePages(newRecipientPage)
68 newRecipientPage.destroy()68 newRecipientPage.destroy()
69 }69 }
70 }70 }
@@ -190,7 +190,7 @@
190190
191 onAddNewContactClicked: {191 onAddNewContactClicked: {
192 var newContact = ContactsJS.createEmptyContact(newRecipientPage.phoneToAdd, newRecipientPage)192 var newContact = ContactsJS.createEmptyContact(newRecipientPage.phoneToAdd, newRecipientPage)
193 mainStack.addFileToCurrentColumnSync(newRecipientPage,193 mainStack.addPageToCurrentColumn(newRecipientPage,
194 Qt.resolvedUrl("MessagingContactEditorPage.qml"),194 Qt.resolvedUrl("MessagingContactEditorPage.qml"),
195 { model: contactList.listModel,195 { model: contactList.listModel,
196 contact: newContact,196 contact: newContact,
197197
=== modified file 'src/qml/messaging-app.qml'
--- src/qml/messaging-app.qml 2016-07-21 19:47:04 +0000
+++ src/qml/messaging-app.qml 2016-07-25 17:14:08 +0000
@@ -105,8 +105,13 @@
105 }105 }
106106
107 function showContactDetails(currentPage, contact, contactListPage, contactsModel) {107 function showContactDetails(currentPage, contact, contactListPage, contactsModel) {
108 var initialProperties = { "contactListPage": contactListPage,108 var initialProperties = {}
109 "model": contactsModel}109 if (contactListPage) {
110 initialProperties["contactListPage"] = contactListPage
111 }
112 if (contactsModel) {
113 initialProperties["model"] = contactsModel
114 }
110115
111 if (typeof(contact) == 'string') {116 if (typeof(contact) == 'string') {
112 initialProperties['contactId'] = contact117 initialProperties['contactId'] = contact
@@ -114,34 +119,30 @@
114 initialProperties['contact'] = contact119 initialProperties['contact'] = contact
115 }120 }
116121
117 mainStack.addFileToCurrentColumnSync(currentPage,122 mainStack.addPageToCurrentColumn(currentPage,
118 Qt.resolvedUrl("MessagingContactViewPage.qml"),123 Qt.resolvedUrl("MessagingContactViewPage.qml"),
119 initialProperties)124 initialProperties)
120 }125 }
121126
122 function addNewContact(currentPage, phoneNumber, contactListPage) {
123 mainStack.addFileToCurrentColumnSync(currentPage,
124 Qt.resolvedUrl("MessagingContactEditorPage.qml"),
125 { "contactId": contactId,
126 "addPhoneToContact": phoneNumber,
127 "contactListPage": contactListPage })
128 }
129
130 function addPhoneToContact(currentPage, contact, phoneNumber, contactListPage, contactsModel) {127 function addPhoneToContact(currentPage, contact, phoneNumber, contactListPage, contactsModel) {
131 if (contact === "") {128 if (contact === "") {
132 mainStack.addFileToCurrentColumnSync(currentPage,129 mainStack.addPageToCurrentColumn(currentPage,
133 Qt.resolvedUrl("NewRecipientPage.qml"),130 Qt.resolvedUrl("NewRecipientPage.qml"),
134 { "phoneToAdd": phoneNumber })131 { "phoneToAdd": phoneNumber })
135 } else {132 } else {
136 var initialProperties = { "addPhoneToContact": phoneNumber,133 var initialProperties = { "addPhoneToContact": phoneNumber }
137 "contactListPage": contactListPage,134 if (contactListPage) {
138 "model": contactsModel }135 initialProperties["contactListPage"] = contactListPage
136 }
137 if (contactsModel) {
138 initialProperties["model"] = contactsModel
139 }
139 if (typeof(contact) == 'string') {140 if (typeof(contact) == 'string') {
140 initialProperties['contactId'] = contact141 initialProperties['contactId'] = contact
141 } else {142 } else {
142 initialProperties['contact'] = contact143 initialProperties['contact'] = contact
143 }144 }
144 mainStack.addFileToCurrentColumnSync(currentPage,145 mainStack.addPageToCurrentColumn(currentPage,
145 Qt.resolvedUrl("MessagingContactViewPage.qml"),146 Qt.resolvedUrl("MessagingContactViewPage.qml"),
146 initialProperties)147 initialProperties)
147 }148 }
@@ -288,8 +289,7 @@
288 function emptyStack(showEmpty) {289 function emptyStack(showEmpty) {
289 if (typeof showEmpty === 'undefined') { showEmpty = true; }290 if (typeof showEmpty === 'undefined') { showEmpty = true; }
290 mainView.emptyStackRequested()291 mainView.emptyStackRequested()
291 mainStack.removePage(mainPage)292 mainStack.removePages(mainPage)
292 layout.deleteInstances()
293 if (showEmpty) {293 if (showEmpty) {
294 showEmptyState()294 showEmptyState()
295 }295 }
@@ -298,7 +298,7 @@
298298
299 function showEmptyState() {299 function showEmptyState() {
300 if (mainStack.columns > 1 && !application.findMessagingChild("emptyStatePage")) {300 if (mainStack.columns > 1 && !application.findMessagingChild("emptyStatePage")) {
301 layout.addComponentToNextColumnSync(mainPage, emptyStatePageComponent)301 layout.addPageToNextColumn(mainPage, emptyStatePageComponent)
302 }302 }
303 }303 }
304304
@@ -351,7 +351,7 @@
351 emptyStack(false)351 emptyStack(false)
352 // FIXME: AdaptivePageLayout takes a really long time to create pages,352 // FIXME: AdaptivePageLayout takes a really long time to create pages,
353 // so we create manually and push that353 // so we create manually and push that
354 mainStack.addComponentToNextColumnSync(mainPage, messagesWithBottomEdge, properties)354 mainStack.addPageToNextColumn(mainPage, messagesWithBottomEdge, properties)
355 }355 }
356356
357 InputInfo {357 InputInfo {
@@ -409,30 +409,17 @@
409 id: emptyStatePage409 id: emptyStatePage
410 objectName: "emptyStatePage"410 objectName: "emptyStatePage"
411411
412 function deleteMe() {
413 emptyStatePage.destroy(1)
414 emptyStatePage.objectName = ""
415 }
416
417 Connections {412 Connections {
418 target: layout413 target: layout
419 onColumnsChanged: {414 onColumnsChanged: {
420 if (layout.columns == 1) {415 if (layout.columns == 1) {
421 emptyStatePage.deleteMe()
422 if (!application.findMessagingChild("fakeItem")) {416 if (!application.findMessagingChild("fakeItem")) {
423 layout.removePage(mainPage)417 emptyStack()
424 }418 }
425 }419 }
426 }420 }
427 }421 }
428422
429 Connections {
430 target: mainView
431 onEmptyStackRequested: {
432 emptyStatePage.deleteMe()
433 }
434 }
435
436 EmptyState {423 EmptyState {
437 labelVisible: false424 labelVisible: false
438 }425 }
@@ -455,9 +442,21 @@
455 }442 }
456 }443 }
457444
458 MessagingPageLayout {445 AdaptivePageLayout {
459 id: layout446 id: layout
460 anchors.fill: parent447 anchors.fill: parent
448 layouts: PageColumnsLayout {
449 when: mainStack.width >= units.gu(90)
450 PageColumn {
451 maximumWidth: units.gu(50)
452 minimumWidth: units.gu(40)
453 preferredWidth: units.gu(40)
454 }
455 PageColumn {
456 fillWidth: true
457 }
458 }
459 asynchronous: false
461 primaryPage: MainPage {460 primaryPage: MainPage {
462 id: mainPage461 id: mainPage
463 }462 }
@@ -467,7 +466,6 @@
467 onColumnsChanged: {466 onColumnsChanged: {
468 // we only have things to do here in case no thread is selected467 // we only have things to do here in case no thread is selected
469 if (layout.completed && layout.columns == 2 && !application.findMessagingChild("emptyStatePage") && !application.findMessagingChild("fakeItem")) {468 if (layout.completed && layout.columns == 2 && !application.findMessagingChild("emptyStatePage") && !application.findMessagingChild("fakeItem")) {
470 layout.removePage(mainPage)
471 emptyStack()469 emptyStack()
472 }470 }
473 }471 }

Subscribers

People subscribed via source and target branches

to all changes: