Merge lp:~tpeeters/ubuntu-ui-toolkit/60-back-override into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Florian Boucault
Approved revision: 1062
Merged at revision: 1035
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/60-back-override
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/55-MainView-Page-clean
Diff against target: 177 lines (+63/-6)
7 files modified
components.api (+1/-0)
modules/Ubuntu/Components/Header.qml (+8/-0)
modules/Ubuntu/Components/MainView.qml (+5/-0)
modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+16/-3)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+15/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+13/-1)
tests/resources/toolbar/headerTools.qml (+5/-2)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/60-back-override
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Florian Boucault (community) Approve
Review via email: mp+218042@code.launchpad.net

Description of the change

Add the possibility to override the back button in the header.

To post a comment you must log in.
1057. By Tim Peeters

rename customLeftButton to customBackButton

1058. By Tim Peeters

check that back is not null

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)
1059. By Tim Peeters

fix flake8 too long lines

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

FAILED: Continuous integration, rev:1059
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/161/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/582/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5214
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/161
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/161
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/161/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/161
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/506/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4879
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4879/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6718
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4481
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5439
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5439/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/161/rebuild

review: Needs Fixing (continuous-integration)
1060. By Tim Peeters

trigger jenkins

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

FAILED: Continuous integration, rev:1060
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/162/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/584
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5224
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/162
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/162
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/162/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/162
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/509
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4888
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4888/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6731
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4491
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5450
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5450/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/162/rebuild

review: Needs Fixing (continuous-integration)
1061. By Tim Peeters

no change

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

PASSED: Continuous integration, rev:1061
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/164/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/591
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5230
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/164
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/164
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/164/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/164
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/515
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4897
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4897/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6751
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4497
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5456
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5456/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/164/rebuild

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

merge trunk

Revision history for this message
Florian Boucault (fboucault) wrote :

All good for me aside from the idea that private variables exist: I don't think they do even when their names are prefixed with underscores.

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

PASSED: Continuous integration, rev:1062
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/167/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/597
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5235
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/167
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/167
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/167/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/167
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/521
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4910
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4910/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6778
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4502
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5476
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5476/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/167/rebuild

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2014-04-30 13:19:18 +0000
3+++ components.api 2014-05-05 11:48:20 +0000
4@@ -71,6 +71,7 @@
5 property var tabsModel
6 property var pageStack
7 property var actions
8+ property var __customBackAction
9 property Flickable flickable
10 property bool useDeprecatedToolbar
11 Icon 0.1 1.0
12
13=== modified file 'modules/Ubuntu/Components/Header.qml'
14--- modules/Ubuntu/Components/Header.qml 2014-04-30 13:19:18 +0000
15+++ modules/Ubuntu/Components/Header.qml 2014-05-05 11:48:20 +0000
16@@ -109,6 +109,14 @@
17 */
18 property var actions: null
19
20+ /*!
21+ \internal
22+ Action shown before the title. Setting this will disable the back
23+ button and tabs drawer button in the new header and replace it with a button
24+ representing the action below.
25+ */
26+ property var __customBackAction: null
27+
28 // FIXME: Currently autopilot can only get visual items, but once bug #1273956
29 // is fixed to support non-visual items, a QtObject may be used.
30 // --timp - 2014-03-20
31
32=== modified file 'modules/Ubuntu/Components/MainView.qml'
33--- modules/Ubuntu/Components/MainView.qml 2014-05-01 23:51:43 +0000
34+++ modules/Ubuntu/Components/MainView.qml 2014-05-05 11:48:20 +0000
35@@ -342,6 +342,11 @@
36 title: internal.activePage ? internal.activePage.title : ""
37 flickable: internal.activePage ? internal.activePage.flickable : null
38 pageStack: internal.activePage ? internal.activePage.pageStack : null
39+ __customBackAction: internal.activePage && internal.activePage.tools &&
40+ internal.activePage.tools.hasOwnProperty("back") &&
41+ internal.activePage.tools.back &&
42+ internal.activePage.tools.back.hasOwnProperty("action") ?
43+ internal.activePage.tools.back.action : null
44
45 property Item tabBar: null
46 Binding {
47
48=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml'
49--- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-01 15:19:12 +0000
50+++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-05 11:48:20 +0000
51@@ -74,6 +74,16 @@
52 height: headerStyle.contentHeight
53
54 AbstractButton {
55+ id: customBackButton
56+ objectName: "customBackButton"
57+ height: parent ? parent.height : undefined
58+ width: visible ? units.gu(5) : 0
59+ action: styledItem.__customBackAction
60+ visible: null !== styledItem.__customBackAction
61+ style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)
62+ }
63+
64+ AbstractButton {
65 id: backButton
66 objectName: "backButton"
67 height: parent ? parent.height : undefined
68@@ -81,7 +91,8 @@
69
70 iconName: "back"
71 visible: styledItem.pageStack !== null &&
72- styledItem.pageStack.depth > 1
73+ styledItem.pageStack.depth > 1 &&
74+ !customBackButton.visible
75
76 text: "back"
77 style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)
78@@ -98,7 +109,8 @@
79 width: visible ? units.gu(5) : 0
80
81 iconName: "navigation-menu"
82- visible: styledItem.tabsModel !== null && !backButton.visible
83+ visible: styledItem.tabsModel !== null && !backButton.visible &&
84+ !customBackButton.visible
85 text: visible ? styledItem.tabsModel.count + " tabs" : ""
86 style: Theme.createStyleComponent("HeaderButtonStyle.qml", tabsButton)
87
88@@ -166,7 +178,8 @@
89 id: numberOfSlots
90 property int requested: styledItem.actions && styledItem.actions.hasOwnProperty("length") ?
91 styledItem.actions.length : 0
92- property int left: tabsButton.visible || backButton.visible ? 1 : 0
93+ property int left: tabsButton.visible || backButton.visible ||
94+ customBackButton.visible ? 1 : 0
95 property int right: 3 - left
96 property int overflow: actionsOverflowButton.visible ? 1 : 0
97 property int used: Math.min(right - overflow, requested)
98
99=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
100--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-04-30 19:11:34 +0000
101+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-05 11:48:20 +0000
102@@ -50,6 +50,21 @@
103 raise _common.ToolkitException('Back button in header not visible')
104 self.pointing_device.click_object(back_button)
105
106+ def click_custom_back_button(self):
107+ if self.useDeprecatedToolbar:
108+ raise _common.ToolkitException(
109+ 'Old header has no custom back button')
110+ try:
111+ custom_back_button = self.select_single(
112+ 'AbstractButton', objectName='customBackButton')
113+ except dbus.StateNotFoundError:
114+ raise _common.ToolkitException(
115+ 'Missing custom back button in header')
116+ if not custom_back_button.visible:
117+ raise _common.ToolkitException(
118+ 'Custom back button in header not visible')
119+ self.pointing_device.click_object(custom_back_button)
120+
121 def _get_animating(self):
122 if self.useDeprecatedToolbar:
123 tab_bar_style = self.select_single('TabBarStyle')
124
125=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
126--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-04-30 19:11:34 +0000
127+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-05 11:48:20 +0000
128@@ -41,6 +41,13 @@
129 }
130
131 tools: ToolbarItems {
132+ back: ToolbarButton {
133+ action: Action {
134+ iconName: "cancel"
135+ text: "cancel"
136+ onTriggered: label.text = "Cancel button clicked."
137+ }
138+ }
139 Repeater {
140 model: 5
141 ToolbarButton {
142@@ -74,7 +81,7 @@
143 self.assertEqual(self.label.text, 'Button 1 clicked.')
144
145 def test_click_header_overflow_action_button(self):
146- # there are more than 3 buttons, so the first two go in the header
147+ # custom back button and first action button go in the header
148 # and the others in the overflow.
149 self.header.click_action_button('action3')
150 self.assertEqual(self.label.text, 'Button 3 clicked.')
151@@ -86,3 +93,8 @@
152 self.assertEqual(
153 str(error),
154 'Button not found in header or overflow')
155+
156+ # back button and tabs button are tested in pagestack and tabs tests
157+ def test_click_custom_back_button(self):
158+ self.header.click_custom_back_button()
159+ self.assertEqual(self.label.text, 'Cancel button clicked.')
160
161=== modified file 'tests/resources/toolbar/headerTools.qml'
162--- tests/resources/toolbar/headerTools.qml 2014-04-28 16:48:41 +0000
163+++ tests/resources/toolbar/headerTools.qml 2014-05-05 11:48:20 +0000
164@@ -68,8 +68,11 @@
165 }
166
167 back: ToolbarButton {
168- text: "cancel"
169- iconSource: Qt.resolvedUrl("../../../modules/Ubuntu/Components/artwork/back.png")
170+ action: Action {
171+ text: "cancel"
172+ iconName: "cancel"
173+ onTriggered: print("cancelled!")
174+ }
175 anchors.verticalCenter: parent.verticalCenter
176 }
177 }

Subscribers

People subscribed via source and target branches