Merge lp:~tpeeters/ubuntu-ui-toolkit/noBackButton into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Superseded
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/noBackButton
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 264 lines (+197/-11)
6 files modified
debian/control (+1/-0)
modules/Ubuntu/Components/Icon.qml (+28/-8)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+1/-1)
tests/unit_x11/tst_components/tst_headActions.qml (+103/-0)
tests/unit_x11/tst_components/tst_icon.qml (+62/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/noBackButton
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Cris Dywan Approve
Review via email: mp+228557@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-30.

Commit message

Allow app developers to disable the back button by setting an invisible back action for the page.

Description of the change

Allow app developers to disable the back button by setting an invisible back action for the page.

Use case: dialer app pushes call page on the pagestack when in a phone call, but the user cannot use the 'back' button to leave the call page. When the phone call is terminated, the call page is popped from the pagestack.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

why don't you put this

99 + pageStack.pop();

and this

117 + page2.head.backAction = null;

on the cleanup function?

I'm trying to learn more QML, so I'll put my nose on some of your new branches. Please bare with my questions while I get up to speed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

QWARN : components::HeaderBackButton::test_custom_back_button() file:///tmp/buildd/ubuntu-ui-toolkit-0.1.50+14.10.20140724.2bzr1167pkg0utopic507/modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml:29:5: QML QQuickImage: Failed to get image from provider: image://theme/search

Revision history for this message
Cris Dywan (kalikiana) wrote :

Looks good.

I've seen the warning in another branch - I wonder if we're missing a dependency somewhere, though the package depends on suru-icon-theme already.

review: Approve
Revision history for this message
Tim Peeters (tpeeters) wrote :

> Looks good.
>
> I've seen the warning in another branch - I wonder if we're missing a
> dependency somewhere, though the package depends on suru-icon-theme already.

it may be this bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1349769

Revision history for this message
Tim Peeters (tpeeters) wrote :

Don't happrove this yet. I am abusing this MR to test whether the fix in the iconFix branch works.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1170
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/682/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2674
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2137
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/514
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/514
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/514/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/514
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2794
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3917
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3917/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10641
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1781
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2395
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2395/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/682/rebuild

review: Approve (continuous-integration)
1171. By Tim Peeters

merge iconFix

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1171
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/684/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2719
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2165
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/516
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/516
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/516/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/516
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/2825
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3962
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/3962/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10680
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1798
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2424
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2424/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/684/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-07-28 15:09:00 +0000
+++ debian/control 2014-07-30 11:48:25 +0000
@@ -26,6 +26,7 @@
26 qtdeclarative5-doc-html,26 qtdeclarative5-doc-html,
27 qtwebkit5-doc-html,27 qtwebkit5-doc-html,
28 qtsvg5-doc-html,28 qtsvg5-doc-html,
29 libqt5svg5,
29 qtscript5-doc-html,30 qtscript5-doc-html,
30 qtmultimedia5-doc-html,31 qtmultimedia5-doc-html,
31 unity-action-doc,32 unity-action-doc,
3233
=== modified file 'modules/Ubuntu/Components/Icon.qml'
--- modules/Ubuntu/Components/Icon.qml 2014-07-03 13:30:32 +0000
+++ modules/Ubuntu/Components/Icon.qml 2014-07-30 11:48:25 +0000
@@ -84,17 +84,37 @@
8484
85 Image {85 Image {
86 id: image86 id: image
87 anchors.fill: parent
8788
88 /* Necessary so that icons are not loaded before a size is set. */89 /* Necessary so that icons are not loaded before a size is set. */
89 property bool ready: false90 source: ""
90 Component.onCompleted: ready = true
91
92 anchors.fill: parent
93 source: ready && width > 0 && height > 0 && icon.name ? "image://theme/%1".arg(icon.name) : ""
94 sourceSize {91 sourceSize {
95 width: width92 width: 0
96 height: height93 height: 0
97 }94 }
95
96 Component.onCompleted: update()
97 onWidthChanged: update()
98 onHeightChanged: update()
99 Connections {
100 target: icon
101 onNameChanged: image.update()
102 }
103
104 function update() {
105 // only set sourceSize.width, sourceSize.height and source when
106 // icon dimensions are valid, see bug #1349769.
107 if (width > 0 && height > 0 && icon.name) {
108 sourceSize.width = width;
109 sourceSize.height = height;
110 source = "image://theme/%1".arg(icon.name);
111 } else {
112 source = "";
113 sourceSize.width = 0;
114 sourceSize.height = 0;
115 }
116 }
117
98 cache: true118 cache: true
99 visible: !colorizedImage.active119 visible: !colorizedImage.active
100 }120 }
101121
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-07-22 15:11:03 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-07-30 11:48:25 +0000
@@ -20,8 +20,8 @@
20AbstractButton {20AbstractButton {
21 id: button21 id: button
2222
23 property int iconWidth: units.gu(2)23 property real iconWidth: units.gu(2)
24 property int iconHeight: iconWidth24 property real iconHeight: iconWidth
2525
26 width: visible ? units.gu(4) : 026 width: visible ? units.gu(4) : 0
27 height: parent ? parent.height : undefined27 height: parent ? parent.height : undefined
2828
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-28 10:38:00 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-30 11:48:25 +0000
@@ -134,7 +134,7 @@
134 visible: styledItem.pageStack !== null &&134 visible: styledItem.pageStack !== null &&
135 styledItem.pageStack !== undefined &&135 styledItem.pageStack !== undefined &&
136 styledItem.pageStack.depth > 1 &&136 styledItem.pageStack.depth > 1 &&
137 !customBackButton.visible137 !styledItem.config.backAction
138138
139 text: "back"139 text: "back"
140140
141141
=== added file 'tests/unit_x11/tst_components/tst_headActions.qml'
--- tests/unit_x11/tst_components/tst_headActions.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_headActions.qml 2014-07-30 11:48:25 +0000
@@ -0,0 +1,103 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import Ubuntu.Test 1.0
19import Ubuntu.Components 1.1
20
21// NOTE: Other parts of the page head API are tested with autopilot in
22// ubuntuuitoolkit.tests.components.test_header
23
24Item {
25 width: units.gu(50)
26 height: units.gu(80)
27
28 MainView {
29 id: mainView
30 anchors.fill: parent
31 useDeprecatedToolbar: false
32
33 PageStack {
34 id: pageStack
35 Page {
36 id: page1
37 title: "First page"
38 }
39 Page {
40 id: page2
41 title: "Second page"
42
43 Action {
44 id: customBackAction
45 iconName: "search"
46 text: "Search"
47 }
48 Action {
49 id: invisibleAction
50 visible: false
51 }
52 }
53 }
54 Component.onCompleted: {
55 pageStack.push(page1);
56 }
57 }
58
59 UbuntuTestCase {
60 name: "HeaderBackButton"
61 when: windowShown
62 id: testCase
63
64 property var app_header
65 property var back_button
66 property var custom_back_button
67
68 function initTestCase() {
69 testCase.app_header = findChild(mainView, "MainView_Header");
70 testCase.back_button = findChild(app_header, "backButton");
71 testCase.custom_back_button = findChild(app_header, "customBackButton");
72
73 compare(page2.head.backAction, null, "Back action set by default.");
74 compare(back_button.visible, false, "Back button visible with only 1 page on the stack.");
75 compare(custom_back_button.visible, false, "Custom back button visible without custom back action.")
76 }
77
78 function test_default_back_button() {
79 pageStack.push(page2);
80 compare(back_button.visible, true, "Back button not visible with 2 pages on stack.");
81 compare(custom_back_button.visible, false, "Showing custom back button without custom back action.");
82 pageStack.pop();
83 }
84
85 function test_custom_back_button() {
86 page2.head.backAction = customBackAction;
87 pageStack.push(page2);
88 compare(back_button.visible, false, "Default back button visible with custom back action.");
89 compare(custom_back_button.visible, true, "Custom back button invisible with back action.");
90 pageStack.pop();
91 page2.head.backAction = null;
92 }
93
94 function test_no_back_button() {
95 page2.head.backAction = invisibleAction;
96 pageStack.push(page2);
97 compare(back_button.visible, false, "Default back button visible with invisible custom back action.");
98 compare(custom_back_button.visible, false, "Custom back button visible with invisible custom back action.");
99 pageStack.pop();
100 page2.head.backAction = null;
101 }
102 }
103}
0104
=== added file 'tests/unit_x11/tst_components/tst_icon.qml'
--- tests/unit_x11/tst_components/tst_icon.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_icon.qml 2014-07-30 11:48:25 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import Ubuntu.Components 1.1
20
21Item {
22 width: units.gu(50)
23 height: units.gu(50)
24
25 Row {
26 anchors.centerIn: parent
27 height: units.gu(10)
28 width: childrenRect.width
29
30 Icon {
31 // Fails to load the icon when suru-icon-theme or libqt5svg5 are
32 // not installed. This causes a warning and rejection
33 // by jenkins continuous integration.
34 name: "add"
35 height: parent.height
36 width: height
37 }
38 Icon {
39 // Fails when the icon is becoming invisible when non-atomic updates
40 // cause sourceSize.width or sourceSize.height to be 0 before other
41 // properties are updated.
42 id: icon
43 width: visible ? units.gu(10) : 0
44 height: width
45 name: "search"
46
47 }
48 }
49
50 TestCase {
51 name: "Icon"
52 when: windowShown
53
54 function test_updateIconSize_bug1349769() {
55 icon.visible = false;
56 // causes "QML Image: Failed to get image from provider: image://theme/search"
57 // warning and when sourceSize.width or sourceSize.height becomes 0 while
58 // while still trying to render the icon. Tests will pass with the warning, but
59 // the MR is rejected by jenkins continuous integration.
60 }
61 }
62}

Subscribers

People subscribed via source and target branches