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
1=== modified file 'debian/control'
2--- debian/control 2014-07-28 15:09:00 +0000
3+++ debian/control 2014-07-30 11:48:25 +0000
4@@ -26,6 +26,7 @@
5 qtdeclarative5-doc-html,
6 qtwebkit5-doc-html,
7 qtsvg5-doc-html,
8+ libqt5svg5,
9 qtscript5-doc-html,
10 qtmultimedia5-doc-html,
11 unity-action-doc,
12
13=== modified file 'modules/Ubuntu/Components/Icon.qml'
14--- modules/Ubuntu/Components/Icon.qml 2014-07-03 13:30:32 +0000
15+++ modules/Ubuntu/Components/Icon.qml 2014-07-30 11:48:25 +0000
16@@ -84,17 +84,37 @@
17
18 Image {
19 id: image
20+ anchors.fill: parent
21
22 /* Necessary so that icons are not loaded before a size is set. */
23- property bool ready: false
24- Component.onCompleted: ready = true
25-
26- anchors.fill: parent
27- source: ready && width > 0 && height > 0 && icon.name ? "image://theme/%1".arg(icon.name) : ""
28+ source: ""
29 sourceSize {
30- width: width
31- height: height
32- }
33+ width: 0
34+ height: 0
35+ }
36+
37+ Component.onCompleted: update()
38+ onWidthChanged: update()
39+ onHeightChanged: update()
40+ Connections {
41+ target: icon
42+ onNameChanged: image.update()
43+ }
44+
45+ function update() {
46+ // only set sourceSize.width, sourceSize.height and source when
47+ // icon dimensions are valid, see bug #1349769.
48+ if (width > 0 && height > 0 && icon.name) {
49+ sourceSize.width = width;
50+ sourceSize.height = height;
51+ source = "image://theme/%1".arg(icon.name);
52+ } else {
53+ source = "";
54+ sourceSize.width = 0;
55+ sourceSize.height = 0;
56+ }
57+ }
58+
59 cache: true
60 visible: !colorizedImage.active
61 }
62
63=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml'
64--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-07-22 15:11:03 +0000
65+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-07-30 11:48:25 +0000
66@@ -20,8 +20,8 @@
67 AbstractButton {
68 id: button
69
70- property int iconWidth: units.gu(2)
71- property int iconHeight: iconWidth
72+ property real iconWidth: units.gu(2)
73+ property real iconHeight: iconWidth
74
75 width: visible ? units.gu(4) : 0
76 height: parent ? parent.height : undefined
77
78=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
79--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-28 10:38:00 +0000
80+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-30 11:48:25 +0000
81@@ -134,7 +134,7 @@
82 visible: styledItem.pageStack !== null &&
83 styledItem.pageStack !== undefined &&
84 styledItem.pageStack.depth > 1 &&
85- !customBackButton.visible
86+ !styledItem.config.backAction
87
88 text: "back"
89
90
91=== added file 'tests/unit_x11/tst_components/tst_headActions.qml'
92--- tests/unit_x11/tst_components/tst_headActions.qml 1970-01-01 00:00:00 +0000
93+++ tests/unit_x11/tst_components/tst_headActions.qml 2014-07-30 11:48:25 +0000
94@@ -0,0 +1,103 @@
95+/*
96+ * Copyright 2014 Canonical Ltd.
97+ *
98+ * This program is free software; you can redistribute it and/or modify
99+ * it under the terms of the GNU Lesser General Public License as published by
100+ * the Free Software Foundation; version 3.
101+ *
102+ * This program is distributed in the hope that it will be useful,
103+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
104+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
105+ * GNU Lesser General Public License for more details.
106+ *
107+ * You should have received a copy of the GNU Lesser General Public License
108+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
109+ */
110+
111+import QtQuick 2.2
112+import Ubuntu.Test 1.0
113+import Ubuntu.Components 1.1
114+
115+// NOTE: Other parts of the page head API are tested with autopilot in
116+// ubuntuuitoolkit.tests.components.test_header
117+
118+Item {
119+ width: units.gu(50)
120+ height: units.gu(80)
121+
122+ MainView {
123+ id: mainView
124+ anchors.fill: parent
125+ useDeprecatedToolbar: false
126+
127+ PageStack {
128+ id: pageStack
129+ Page {
130+ id: page1
131+ title: "First page"
132+ }
133+ Page {
134+ id: page2
135+ title: "Second page"
136+
137+ Action {
138+ id: customBackAction
139+ iconName: "search"
140+ text: "Search"
141+ }
142+ Action {
143+ id: invisibleAction
144+ visible: false
145+ }
146+ }
147+ }
148+ Component.onCompleted: {
149+ pageStack.push(page1);
150+ }
151+ }
152+
153+ UbuntuTestCase {
154+ name: "HeaderBackButton"
155+ when: windowShown
156+ id: testCase
157+
158+ property var app_header
159+ property var back_button
160+ property var custom_back_button
161+
162+ function initTestCase() {
163+ testCase.app_header = findChild(mainView, "MainView_Header");
164+ testCase.back_button = findChild(app_header, "backButton");
165+ testCase.custom_back_button = findChild(app_header, "customBackButton");
166+
167+ compare(page2.head.backAction, null, "Back action set by default.");
168+ compare(back_button.visible, false, "Back button visible with only 1 page on the stack.");
169+ compare(custom_back_button.visible, false, "Custom back button visible without custom back action.")
170+ }
171+
172+ function test_default_back_button() {
173+ pageStack.push(page2);
174+ compare(back_button.visible, true, "Back button not visible with 2 pages on stack.");
175+ compare(custom_back_button.visible, false, "Showing custom back button without custom back action.");
176+ pageStack.pop();
177+ }
178+
179+ function test_custom_back_button() {
180+ page2.head.backAction = customBackAction;
181+ pageStack.push(page2);
182+ compare(back_button.visible, false, "Default back button visible with custom back action.");
183+ compare(custom_back_button.visible, true, "Custom back button invisible with back action.");
184+ pageStack.pop();
185+ page2.head.backAction = null;
186+ }
187+
188+ function test_no_back_button() {
189+ page2.head.backAction = invisibleAction;
190+ pageStack.push(page2);
191+ compare(back_button.visible, false, "Default back button visible with invisible custom back action.");
192+ compare(custom_back_button.visible, false, "Custom back button visible with invisible custom back action.");
193+ pageStack.pop();
194+ page2.head.backAction = null;
195+ }
196+ }
197+}
198
199=== added file 'tests/unit_x11/tst_components/tst_icon.qml'
200--- tests/unit_x11/tst_components/tst_icon.qml 1970-01-01 00:00:00 +0000
201+++ tests/unit_x11/tst_components/tst_icon.qml 2014-07-30 11:48:25 +0000
202@@ -0,0 +1,62 @@
203+/*
204+ * Copyright 2012 Canonical Ltd.
205+ *
206+ * This program is free software; you can redistribute it and/or modify
207+ * it under the terms of the GNU Lesser General Public License as published by
208+ * the Free Software Foundation; version 3.
209+ *
210+ * This program is distributed in the hope that it will be useful,
211+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
213+ * GNU Lesser General Public License for more details.
214+ *
215+ * You should have received a copy of the GNU Lesser General Public License
216+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
217+ */
218+
219+import QtQuick 2.0
220+import QtTest 1.0
221+import Ubuntu.Components 1.1
222+
223+Item {
224+ width: units.gu(50)
225+ height: units.gu(50)
226+
227+ Row {
228+ anchors.centerIn: parent
229+ height: units.gu(10)
230+ width: childrenRect.width
231+
232+ Icon {
233+ // Fails to load the icon when suru-icon-theme or libqt5svg5 are
234+ // not installed. This causes a warning and rejection
235+ // by jenkins continuous integration.
236+ name: "add"
237+ height: parent.height
238+ width: height
239+ }
240+ Icon {
241+ // Fails when the icon is becoming invisible when non-atomic updates
242+ // cause sourceSize.width or sourceSize.height to be 0 before other
243+ // properties are updated.
244+ id: icon
245+ width: visible ? units.gu(10) : 0
246+ height: width
247+ name: "search"
248+
249+ }
250+ }
251+
252+ TestCase {
253+ name: "Icon"
254+ when: windowShown
255+
256+ function test_updateIconSize_bug1349769() {
257+ icon.visible = false;
258+ // causes "QML Image: Failed to get image from provider: image://theme/search"
259+ // warning and when sourceSize.width or sourceSize.height becomes 0 while
260+ // while still trying to render the icon. Tests will pass with the warning, but
261+ // the MR is rejected by jenkins continuous integration.
262+ }
263+ }
264+}

Subscribers

People subscribed via source and target branches