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
=== modified file 'components.api'
--- components.api 2014-04-30 13:19:18 +0000
+++ components.api 2014-05-05 11:48:20 +0000
@@ -71,6 +71,7 @@
71 property var tabsModel71 property var tabsModel
72 property var pageStack72 property var pageStack
73 property var actions73 property var actions
74 property var __customBackAction
74 property Flickable flickable75 property Flickable flickable
75 property bool useDeprecatedToolbar76 property bool useDeprecatedToolbar
76Icon 0.1 1.077Icon 0.1 1.0
7778
=== modified file 'modules/Ubuntu/Components/Header.qml'
--- modules/Ubuntu/Components/Header.qml 2014-04-30 13:19:18 +0000
+++ modules/Ubuntu/Components/Header.qml 2014-05-05 11:48:20 +0000
@@ -109,6 +109,14 @@
109 */109 */
110 property var actions: null110 property var actions: null
111111
112 /*!
113 \internal
114 Action shown before the title. Setting this will disable the back
115 button and tabs drawer button in the new header and replace it with a button
116 representing the action below.
117 */
118 property var __customBackAction: null
119
112 // FIXME: Currently autopilot can only get visual items, but once bug #1273956120 // FIXME: Currently autopilot can only get visual items, but once bug #1273956
113 // is fixed to support non-visual items, a QtObject may be used.121 // is fixed to support non-visual items, a QtObject may be used.
114 // --timp - 2014-03-20122 // --timp - 2014-03-20
115123
=== modified file 'modules/Ubuntu/Components/MainView.qml'
--- modules/Ubuntu/Components/MainView.qml 2014-05-01 23:51:43 +0000
+++ modules/Ubuntu/Components/MainView.qml 2014-05-05 11:48:20 +0000
@@ -342,6 +342,11 @@
342 title: internal.activePage ? internal.activePage.title : ""342 title: internal.activePage ? internal.activePage.title : ""
343 flickable: internal.activePage ? internal.activePage.flickable : null343 flickable: internal.activePage ? internal.activePage.flickable : null
344 pageStack: internal.activePage ? internal.activePage.pageStack : null344 pageStack: internal.activePage ? internal.activePage.pageStack : null
345 __customBackAction: internal.activePage && internal.activePage.tools &&
346 internal.activePage.tools.hasOwnProperty("back") &&
347 internal.activePage.tools.back &&
348 internal.activePage.tools.back.hasOwnProperty("action") ?
349 internal.activePage.tools.back.action : null
345350
346 property Item tabBar: null351 property Item tabBar: null
347 Binding {352 Binding {
348353
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-01 15:19:12 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-05 11:48:20 +0000
@@ -74,6 +74,16 @@
74 height: headerStyle.contentHeight74 height: headerStyle.contentHeight
7575
76 AbstractButton {76 AbstractButton {
77 id: customBackButton
78 objectName: "customBackButton"
79 height: parent ? parent.height : undefined
80 width: visible ? units.gu(5) : 0
81 action: styledItem.__customBackAction
82 visible: null !== styledItem.__customBackAction
83 style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)
84 }
85
86 AbstractButton {
77 id: backButton87 id: backButton
78 objectName: "backButton"88 objectName: "backButton"
79 height: parent ? parent.height : undefined89 height: parent ? parent.height : undefined
@@ -81,7 +91,8 @@
8191
82 iconName: "back"92 iconName: "back"
83 visible: styledItem.pageStack !== null &&93 visible: styledItem.pageStack !== null &&
84 styledItem.pageStack.depth > 194 styledItem.pageStack.depth > 1 &&
95 !customBackButton.visible
8596
86 text: "back"97 text: "back"
87 style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)98 style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)
@@ -98,7 +109,8 @@
98 width: visible ? units.gu(5) : 0109 width: visible ? units.gu(5) : 0
99110
100 iconName: "navigation-menu"111 iconName: "navigation-menu"
101 visible: styledItem.tabsModel !== null && !backButton.visible112 visible: styledItem.tabsModel !== null && !backButton.visible &&
113 !customBackButton.visible
102 text: visible ? styledItem.tabsModel.count + " tabs" : ""114 text: visible ? styledItem.tabsModel.count + " tabs" : ""
103 style: Theme.createStyleComponent("HeaderButtonStyle.qml", tabsButton)115 style: Theme.createStyleComponent("HeaderButtonStyle.qml", tabsButton)
104116
@@ -166,7 +178,8 @@
166 id: numberOfSlots178 id: numberOfSlots
167 property int requested: styledItem.actions && styledItem.actions.hasOwnProperty("length") ?179 property int requested: styledItem.actions && styledItem.actions.hasOwnProperty("length") ?
168 styledItem.actions.length : 0180 styledItem.actions.length : 0
169 property int left: tabsButton.visible || backButton.visible ? 1 : 0181 property int left: tabsButton.visible || backButton.visible ||
182 customBackButton.visible ? 1 : 0
170 property int right: 3 - left183 property int right: 3 - left
171 property int overflow: actionsOverflowButton.visible ? 1 : 0184 property int overflow: actionsOverflowButton.visible ? 1 : 0
172 property int used: Math.min(right - overflow, requested)185 property int used: Math.min(right - overflow, requested)
173186
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-04-30 19:11:34 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-05 11:48:20 +0000
@@ -50,6 +50,21 @@
50 raise _common.ToolkitException('Back button in header not visible')50 raise _common.ToolkitException('Back button in header not visible')
51 self.pointing_device.click_object(back_button)51 self.pointing_device.click_object(back_button)
5252
53 def click_custom_back_button(self):
54 if self.useDeprecatedToolbar:
55 raise _common.ToolkitException(
56 'Old header has no custom back button')
57 try:
58 custom_back_button = self.select_single(
59 'AbstractButton', objectName='customBackButton')
60 except dbus.StateNotFoundError:
61 raise _common.ToolkitException(
62 'Missing custom back button in header')
63 if not custom_back_button.visible:
64 raise _common.ToolkitException(
65 'Custom back button in header not visible')
66 self.pointing_device.click_object(custom_back_button)
67
53 def _get_animating(self):68 def _get_animating(self):
54 if self.useDeprecatedToolbar:69 if self.useDeprecatedToolbar:
55 tab_bar_style = self.select_single('TabBarStyle')70 tab_bar_style = self.select_single('TabBarStyle')
5671
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-04-30 19:11:34 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-05 11:48:20 +0000
@@ -41,6 +41,13 @@
41 }41 }
4242
43 tools: ToolbarItems {43 tools: ToolbarItems {
44 back: ToolbarButton {
45 action: Action {
46 iconName: "cancel"
47 text: "cancel"
48 onTriggered: label.text = "Cancel button clicked."
49 }
50 }
44 Repeater {51 Repeater {
45 model: 552 model: 5
46 ToolbarButton {53 ToolbarButton {
@@ -74,7 +81,7 @@
74 self.assertEqual(self.label.text, 'Button 1 clicked.')81 self.assertEqual(self.label.text, 'Button 1 clicked.')
7582
76 def test_click_header_overflow_action_button(self):83 def test_click_header_overflow_action_button(self):
77 # there are more than 3 buttons, so the first two go in the header84 # custom back button and first action button go in the header
78 # and the others in the overflow.85 # and the others in the overflow.
79 self.header.click_action_button('action3')86 self.header.click_action_button('action3')
80 self.assertEqual(self.label.text, 'Button 3 clicked.')87 self.assertEqual(self.label.text, 'Button 3 clicked.')
@@ -86,3 +93,8 @@
86 self.assertEqual(93 self.assertEqual(
87 str(error),94 str(error),
88 'Button not found in header or overflow')95 'Button not found in header or overflow')
96
97 # back button and tabs button are tested in pagestack and tabs tests
98 def test_click_custom_back_button(self):
99 self.header.click_custom_back_button()
100 self.assertEqual(self.label.text, 'Cancel button clicked.')
89101
=== modified file 'tests/resources/toolbar/headerTools.qml'
--- tests/resources/toolbar/headerTools.qml 2014-04-28 16:48:41 +0000
+++ tests/resources/toolbar/headerTools.qml 2014-05-05 11:48:20 +0000
@@ -68,8 +68,11 @@
68 }68 }
6969
70 back: ToolbarButton {70 back: ToolbarButton {
71 text: "cancel"71 action: Action {
72 iconSource: Qt.resolvedUrl("../../../modules/Ubuntu/Components/artwork/back.png")72 text: "cancel"
73 iconName: "cancel"
74 onTriggered: print("cancelled!")
75 }
73 anchors.verticalCenter: parent.verticalCenter76 anchors.verticalCenter: parent.verticalCenter
74 }77 }
75 }78 }

Subscribers

People subscribed via source and target branches