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

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 1126
Merged at revision: 1131
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/110-headerInput
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/108-HeadActionsFix
Diff against target: 439 lines (+259/-18)
10 files modified
components.api (+1/-0)
modules/Ubuntu/Components/MainView.qml (+2/-1)
modules/Ubuntu/Components/Page.qdoc (+16/-0)
modules/Ubuntu/Components/Page11.qml (+35/-0)
modules/Ubuntu/Components/PageHeadConfiguration.qml (+23/-1)
modules/Ubuntu/Components/TextField.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+9/-2)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderContentsTestCase.qml (+54/-0)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py (+58/-6)
tests/resources/toolbar/header.qml (+60/-7)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/110-headerInput
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Leo Arias (community) code review of the autopilot tests Approve
Review via email: mp+224994@code.launchpad.net

This proposal supersedes a proposal from 2014-06-27.

Commit message

Allow the developer to specify custom header contents.

Description of the change

Allow the developer to specify custom header contents.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:1113
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/496/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1285
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1132
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/328
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/328
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/328/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/328
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1601
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2185
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2185/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/8936
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/935
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1275
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1275/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/496/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:1114
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/503/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1314
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1148
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/335
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/335
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/335/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/335
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1629
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2218
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2218/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/8968
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/948
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1291
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1291/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/503/rebuild

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:1115
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/507/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1340
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1168
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/339
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/339
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/339/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/339
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1651
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2257
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2257/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9004
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/965
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1311
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1311/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/507/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote : Posted in a previous version of this proposal

Very nice.

Small glitch in the navigation test case: the search action is visible in pages other than search but doesn't work.

Most notably there's no test cases for the new API :-(

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

Ready for another review.

I replaced the example actions with search icon with another icon to avoid confusion.

I added an autopilot components test to check the visibility of the title and contents, which exposed some issues with the contents bindings that I fixed as well.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:1117
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/513/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1353
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1182
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/345
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/345
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/345/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/345
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1664
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2278
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2278/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9033
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/975
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1325
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1325/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/513/rebuild

review: Approve (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Thanks for adding tests :)
I left some small comments in the diff.

review: Needs Fixing
1125. By Tim Peeters

leo's comments

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

FAILED: Continuous integration, rev:1119
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/518/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1360
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1190
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/350
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/350
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/350/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/350
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1669
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2288
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2288/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9042
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/982
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1333
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1333/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/518/rebuild

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

PASSED: Continuous integration, rev:1125
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/521/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1379
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1202
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/353
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/353
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/353/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/353
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1683
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2321
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2321/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9064
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/992
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1345
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1345/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/521/rebuild

review: Approve (continuous-integration)
Revision history for this message
Leo Arias (elopio) :
review: Approve (code review of the autopilot tests)
1126. By Tim Peeters

merge staging

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

PASSED: Continuous integration, rev:1126
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/528/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1437
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1237
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/360
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/360
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/360/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/360
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1729
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2395
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2395/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9124
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1019
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1383
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1383/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/528/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice!

review: Approve
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-06-30 10:49:51 +0000
3+++ components.api 2014-07-01 21:02:51 +0000
4@@ -240,6 +240,7 @@
5 QtObject
6 property list<Action> actions
7 property Action backAction
8+ property Item contents
9 PageStack 0.1 1.0
10 PageTreeNode
11 property bool __showHeader
12
13=== modified file 'modules/Ubuntu/Components/MainView.qml'
14--- modules/Ubuntu/Components/MainView.qml 2014-06-26 12:37:21 +0000
15+++ modules/Ubuntu/Components/MainView.qml 2014-07-01 21:02:51 +0000
16@@ -387,7 +387,8 @@
17 // the deprecated tools property.
18 config: internal.activePage && internal.activePage.hasOwnProperty("head") &&
19 (internal.activePage.head.actions.length > 0 ||
20- internal.activePage.head.backAction !== null) ?
21+ internal.activePage.head.backAction !== null ||
22+ internal.activePage.head.contents !== null) ?
23 internal.activePage.head : headerConfig
24
25 property Item tabBar: null
26
27=== modified file 'modules/Ubuntu/Components/Page.qdoc'
28--- modules/Ubuntu/Components/Page.qdoc 2014-06-26 13:16:57 +0000
29+++ modules/Ubuntu/Components/Page.qdoc 2014-07-01 21:02:51 +0000
30@@ -1,3 +1,19 @@
31+/*
32+ * Copyright 2014 Canonical Ltd.
33+ *
34+ * This program is free software; you can redistribute it and/or modify
35+ * it under the terms of the GNU Lesser General Public License as published by
36+ * the Free Software Foundation; version 3.
37+ *
38+ * This program is distributed in the hope that it will be useful,
39+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
40+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41+ * GNU Lesser General Public License for more details.
42+ *
43+ * You should have received a copy of the GNU Lesser General Public License
44+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
45+ */
46+
47 /*!
48 \qmltype Page
49 \inqmlmodule Ubuntu.Components 1.1
50
51=== modified file 'modules/Ubuntu/Components/Page11.qml'
52--- modules/Ubuntu/Components/Page11.qml 2014-06-26 12:55:36 +0000
53+++ modules/Ubuntu/Components/Page11.qml 2014-07-01 21:02:51 +0000
54@@ -14,9 +14,12 @@
55 * along with this program. If not, see <http://www.gnu.org/licenses/>.
56 */
57
58+import QtQuick 2.2
59+
60 /*! \internal */
61 // Documentation in Page.qdoc
62 Page10 {
63+ id: page
64 /*!
65 \qmlproperty PageHeadConfiguration head
66 */
67@@ -24,4 +27,36 @@
68 PageHeadConfiguration {
69 id: headerConfig
70 }
71+
72+ Object {
73+ id: internal
74+
75+ // Note: The bindings below need to check whether headerConfig.contents
76+ // is valid in the "value", even when that is required in the Binding's "when"
77+ // property, to avoid TypeErrors while/after a page becomes (in)active.
78+ //
79+ // Note 2: contents.parent binding is made by PageHeadStyle.
80+ property bool hasParent: headerConfig.contents &&
81+ headerConfig.contents.parent
82+
83+ Binding {
84+ target: headerConfig.contents
85+ property: "visible"
86+ value: page.active
87+ when: headerConfig.contents
88+ }
89+ Binding {
90+ target: headerConfig.contents
91+ property: "anchors.verticalCenter"
92+ value: internal.hasParent ? headerConfig.contents.parent.verticalCenter :
93+ undefined
94+ when: headerConfig.contents
95+ }
96+ Binding {
97+ target: headerConfig.contents
98+ property: "anchors.left"
99+ value: internal.hasParent ? headerConfig.contents.parent.left : undefined
100+ when: headerConfig.contents
101+ }
102+ }
103 }
104
105=== modified file 'modules/Ubuntu/Components/PageHeadConfiguration.qml'
106--- modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-06-26 13:16:57 +0000
107+++ modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-07-01 21:02:51 +0000
108@@ -36,7 +36,29 @@
109
110 /*!
111 Overrides the default \l PageStack back button and the
112- \l Tabs drawer button in the header.
113+ \l Tabs drawer button in the header.
114 */
115 property Action backAction: null
116+
117+ /*!
118+ Set this property to show this Item in the header instead of
119+ the title. Use a \l TextField here for implementing search in header.
120+
121+ The parent of this Item will be binded while the \l Page is active.
122+ The header contents will automatically be anchored to the left and
123+ vertically centered inside the header.
124+
125+ Example:
126+ \qml
127+ Page {
128+ title: "Invisible title"
129+ contents: Rectangle {
130+ color: UbuntuColors.orange
131+ height: units.gu(5)
132+ width: parent ? parent.width - units.gu(2) : undefined
133+ }
134+ }
135+ \endqml
136+ */
137+ property Item contents: null
138 }
139
140=== modified file 'modules/Ubuntu/Components/TextField.qml'
141--- modules/Ubuntu/Components/TextField.qml 2014-06-28 17:26:49 +0000
142+++ modules/Ubuntu/Components/TextField.qml 2014-07-01 21:02:51 +0000
143@@ -135,7 +135,7 @@
144
145 /*!
146 The property overrides the default popover of the TextField. When set, the TextField
147- will open the given popover instead of the defaul tone defined. The popover can either
148+ will open the given popover instead of the default one defined. The popover can either
149 be a component or a URL to be loaded.
150 */
151 property var popover
152
153=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
154--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-06-30 12:47:23 +0000
155+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-01 21:02:51 +0000
156@@ -149,8 +149,9 @@
157 height: headerStyle.contentHeight
158
159 Label {
160+ objectName: "header_title_label"
161 LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
162- visible: !styledItem.contents
163+ visible: !contentsContainer.visible
164 anchors {
165 left: parent.left
166 right: parent.right
167@@ -169,7 +170,7 @@
168 // when the bindings below is no longer active
169 id: contentsContainer
170 anchors.fill: parent
171- visible: styledItem.contents
172+ visible: styledItem.contents || styledItem.config.contents
173 }
174 Binding {
175 target: styledItem.contents
176@@ -183,6 +184,12 @@
177 value: contentsContainer
178 when: styledItem.contents
179 }
180+ Binding {
181+ target: styledItem.config.contents
182+ property: "parent"
183+ value: contentsContainer
184+ when: styledItem.config.contents && !styledItem.contents
185+ }
186 }
187
188 Row {
189
190=== renamed file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderActionsTestCase.qml' => 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderActionsOverflowTestCase.actions.qml'
191=== renamed file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderToolsTestCase.qml' => 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderActionsOverflowTestCase.tools.qml'
192=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderContentsTestCase.qml'
193--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderContentsTestCase.qml 1970-01-01 00:00:00 +0000
194+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderContentsTestCase.qml 2014-07-01 21:02:51 +0000
195@@ -0,0 +1,54 @@
196+/*
197+ * Copyright 2014 Canonical Ltd.
198+ *
199+ * This program is free software; you can redistribute it and/or modify
200+ * it under the terms of the GNU Lesser General Public License as published by
201+ * the Free Software Foundation; version 3.
202+ *
203+ * This program is distributed in the hope that it will be useful,
204+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
205+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
206+ * GNU Lesser General Public License for more details.
207+ *
208+ * You should have received a copy of the GNU Lesser General Public License
209+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
210+ */
211+
212+import QtQuick 2.0
213+import Ubuntu.Components 1.1
214+
215+MainView {
216+ width: units.gu(48)
217+ height: units.gu(60)
218+
219+ useDeprecatedToolbar: false
220+
221+ PageStack {
222+ id: stack
223+ Component.onCompleted: stack.push(page)
224+
225+ Page {
226+ id: page
227+ title: "Test title"
228+ Button {
229+ objectName: "push_button"
230+ anchors.centerIn: parent
231+ text: "push"
232+ onClicked: stack.push(pushMe)
233+ }
234+ }
235+
236+ Page {
237+ id: pushMe
238+ title: "Invisible title"
239+ head {
240+ contents: Rectangle {
241+ objectName: "orange_header_contents"
242+ color: UbuntuColors.orange
243+ height: units.gu(5)
244+ width: parent ? parent.width - units.gu(2) : undefined
245+ }
246+ }
247+ }
248+ }
249+}
250
251=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py'
252--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 2014-07-01 14:22:05 +0000
253+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 2014-07-01 21:02:51 +0000
254@@ -24,16 +24,14 @@
255 from ubuntuuitoolkit import tests
256
257
258-class HeaderTestCase(tests.QMLFileAppTestCase):
259+class HeaderActionsOverflowTestCase(tests.QMLFileAppTestCase):
260
261 path = os.path.abspath(__file__)
262 dir_path = os.path.dirname(path)
263- test_qml_file_path = os.path.join(
264- dir_path, 'test_header.HeaderTestCase.qml')
265 tools_test_qml_file_path = os.path.join(
266- dir_path, 'test_header.HeaderToolsTestCase.qml')
267+ dir_path, 'test_header.HeaderActionsOverflowTestCase.tools.qml')
268 actions_test_qml_file_path = os.path.join(
269- dir_path, 'test_header.HeaderActionsTestCase.qml')
270+ dir_path, 'test_header.HeaderActionsOverflowTestCase.actions.qml')
271
272 scenarios = [
273 ('deprecated tools',
274@@ -43,7 +41,7 @@
275 ]
276
277 def setUp(self):
278- super(HeaderTestCase, self).setUp()
279+ super(HeaderActionsOverflowTestCase, self).setUp()
280 self.header = self.main_view.get_header()
281
282 def test_click_header_overflow_action_must_close_popover(self):
283@@ -57,3 +55,57 @@
284 objectName='actions_overflow_popover')
285 self.header.click_action_button('pushStackAction')
286 self.assertThat(overflow_popover.visible, Eventually(Equals(False)))
287+
288+
289+class HeaderContentsTestCase(tests.QMLFileAppTestCase):
290+
291+ path = os.path.abspath(__file__)
292+ dir_path = os.path.dirname(path)
293+ test_qml_file_path = os.path.join(
294+ dir_path, 'test_header.HeaderContentsTestCase.qml')
295+
296+ def setUp(self):
297+ super(HeaderContentsTestCase, self).setUp()
298+ self.header = self.main_view.get_header()
299+
300+ def test_open_page_with_head_contents_must_change_header(self):
301+ """Test that setting head.contents overrides header contents."""
302+
303+ label = self.header.select_single(
304+ 'Label',
305+ objectName='header_title_label')
306+ self.assertEqual(label.visible, True)
307+ self.assertEqual(label.text, 'Test title')
308+
309+ pushButton = self.main_view.select_single(
310+ 'Button',
311+ objectName='push_button')
312+ self.pointing_device.move_to_object(pushButton)
313+ self.pointing_device.click()
314+
315+ self.assertEqual(label.visible, False)
316+ headerContents = self.header.select_single(
317+ objectName='orange_header_contents')
318+ self.assertEqual(headerContents.visible, True)
319+
320+ def test_close_page_with_head_contents_must_revert_header(self):
321+ """Test that closing a page with head.contents reverts the header."""
322+ pushButton = self.main_view.select_single(
323+ 'Button',
324+ objectName='push_button')
325+ self.pointing_device.move_to_object(pushButton)
326+ self.pointing_device.click()
327+
328+ headerContents = self.header.select_single(
329+ objectName='orange_header_contents')
330+ label = self.header.select_single(
331+ 'Label',
332+ objectName='header_title_label')
333+
334+ self.assertEqual(headerContents.visible, True)
335+ self.assertEqual(label.visible, False)
336+
337+ self.header.click_back_button()
338+ self.assertEqual(headerContents.visible, False)
339+ self.assertEqual(label.visible, True)
340+ self.assertEqual(label.text, 'Test title')
341
342=== modified file 'tests/resources/toolbar/header.qml'
343--- tests/resources/toolbar/header.qml 2014-05-27 16:59:04 +0000
344+++ tests/resources/toolbar/header.qml 2014-07-01 21:02:51 +0000
345@@ -58,8 +58,8 @@
346 tools: ToolbarItems {
347 ToolbarButton {
348 action: Action {
349- iconName: "search"
350- text: "Search"
351+ iconName: "settings"
352+ text: "Settings"
353 }
354 }
355 ToolbarButton {
356@@ -122,7 +122,7 @@
357 head {
358 actions: [
359 Action {
360- iconName: "search"
361+ iconName: "settings"
362 },
363 Action {
364 iconName: "camera-flip"
365@@ -136,8 +136,61 @@
366 }
367 }
368 Tab {
369- title: "Tab 5"
370- page: Page { }
371+ title: "Search"
372+ page: Page {
373+ id: searchPage
374+
375+ Label {
376+ anchors.centerIn: parent
377+ text: searchPage.state == "search" ? "search mode" : "normal mode"
378+ }
379+
380+ head.actions: Action {
381+ id: searchAction
382+ iconName: "search"
383+ onTriggered: searchPage.state = "search"
384+ }
385+
386+ state: ""
387+ states: [
388+ State {
389+ name: ""
390+ PropertyChanges {
391+ target: searchPage.head
392+ // needed otherwise actions will not be
393+ // returned to its original state.
394+ actions: [ searchAction ]
395+ }
396+ },
397+ State {
398+ // TODO: The definition of this state will be
399+ // simplified a lot in a following MR that
400+ // introduces the HeaderState component.
401+ id: headerState
402+ name: "search"
403+ property Action back: Action {
404+ id: leaveSearchAction
405+ text: "back"
406+ iconName: "back"
407+ onTriggered: searchPage.state = ""
408+ }
409+ property list<Action> actions: [
410+ Action {
411+ iconName: "contact"
412+ }
413+ ]
414+ property TextField input: TextField {
415+ placeholderText: "search..."
416+ }
417+ PropertyChanges {
418+ target: searchPage.head
419+ backAction: headerState.back
420+ actions: headerState.actions
421+ contents: headerState.input
422+ }
423+ }
424+ ]
425+ }
426 }
427 }
428 }
429@@ -153,8 +206,8 @@
430 tools: ToolbarItems {
431 ToolbarButton {
432 action: Action {
433- iconName: "search"
434- text: "Search"
435+ iconName: "settings"
436+ text: "settings"
437 }
438 }
439 }

Subscribers

People subscribed via source and target branches