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

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 1130
Merged at revision: 1136
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/120-HeaderState
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/110-headerInput
Diff against target: 329 lines (+183/-68)
6 files modified
components.api (+6/-0)
modules/Ubuntu/Components/PageHeadConfiguration.qml (+3/-0)
modules/Ubuntu/Components/PageHeadState.qml (+113/-0)
modules/Ubuntu/Components/qmldir (+1/-0)
tests/resources/toolbar/header.qml (+18/-32)
tests/resources/toolbar/headerTextInput.qml (+42/-36)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/120-HeaderState
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+224813@code.launchpad.net

Commit message

Add PageHeadState component.

Description of the change

Add PageHeadState to make it easier to configure the page header when changing states.

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

FAILED: Continuous integration, rev:1120
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/501/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1305
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1143
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/333
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/333
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/333/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/333
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1620
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2207
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2207/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/8957
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/944
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1286
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1286/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/501/rebuild

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

FAILED: Continuous integration, rev:1121
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/506/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1339
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1167
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/338
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/338
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/338/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/338
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1650
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2256
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2256/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9003
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/964
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1310
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1310/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/506/rebuild

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

merge 110-headerInput

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

FAILED: Continuous integration, rev:1123
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/529/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1438
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1238
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/361
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/361
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/361/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/361
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1728
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2396
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2396/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9123
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1020
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1384
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1384/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/529/rebuild

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

kick jenkins

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

PASSED: Continuous integration, rev:1124
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/532/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1452
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1250
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/364
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/364
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/364/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/364
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1740
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2418
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2418/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9144
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1030
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1398
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1398/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/532/rebuild

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

Could PageHeadState potentially be used instead of the State { PropertyChanges } hack, if there's no way to correctly reset the actions otherwise? It seems like a bad idea to push internal details into app logic.

review: Needs Information
1125. By Tim Peeters

use PageHeadState for all States in example

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

I updated the example to use PageHeadState instead of the state there. But still this state is needed to reset the actions after the state was changed, so I am not sure this is what you meant.

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/542/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1485
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1279
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/374
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/374
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/374/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/374
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1771
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2455
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2455/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9185
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1053
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1427
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1427/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/542/rebuild

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

How about defining the search action in the default state? That way there's no redundancy, it's less hacky and less confusing to read. Like so http://paste.ubuntu.com/7740992/

1126. By Tim Peeters

name the default state

1127. By Tim Peeters

fix example code

1128. By Tim Peeters

remove searchAction

1129. By Tim Peeters

fix

1130. By Tim Peeters

remove comment

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

Looking nice now!

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

PASSED: Continuous integration, rev:1127
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/544/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/1522
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/1320
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/376
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/376
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/376/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/376
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/1804
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2503
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/2503/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/9242
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1091
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1484
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/1484/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/544/rebuild

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-07-02 13:39:29 +0000
+++ components.api 2014-07-03 11:13:13 +0000
@@ -250,6 +250,12 @@
250 property list<Action> actions250 property list<Action> actions
251 property Action backAction251 property Action backAction
252 property Item contents252 property Item contents
253PageHeadState 1.1
254State
255 property PageHeadConfiguration head
256 property list<Action> actions
257 property Action backAction
258 property Item contents
253PageStack 0.1 1.0259PageStack 0.1 1.0
254PageTreeNode260PageTreeNode
255 property bool __showHeader261 property bool __showHeader
256262
=== modified file 'modules/Ubuntu/Components/PageHeadConfiguration.qml'
--- modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-06-30 17:49:31 +0000
+++ modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-07-03 11:13:13 +0000
@@ -59,6 +59,9 @@
59 }59 }
60 }60 }
61 \endqml61 \endqml
62
63 See \l PageHeadState for an example that shows how search mode can
64 be implemented.
62 */65 */
63 property Item contents: null66 property Item contents: null
64}67}
6568
=== added file 'modules/Ubuntu/Components/PageHeadState.qml'
--- modules/Ubuntu/Components/PageHeadState.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/PageHeadState.qml 2014-07-03 11:13:13 +0000
@@ -0,0 +1,113 @@
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
18
19/*!
20 \qmltype PageHeadState
21 \inqmlmodule Ubuntu.Components 1.1
22 \ingroup ubuntu
23 \since Ubuntu.Components 1.1
24 \brief PageHeadState is a helper component to make it easier to
25 configure the page header when changing states.
26
27 This example shows how to add an action to the header that
28 enables the user to enter search/input mode:
29 \qml
30 import QtQuick 2.2
31 import Ubuntu.Components 1.1
32
33 MainView {
34 id: mainView
35 width: units.gu(40)
36 height: units.gu(50)
37 useDeprecatedToolbar: false
38
39 Page {
40 id: searchPage
41 title: "Click the icon"
42
43 Label {
44 anchors.centerIn: parent
45 text: searchPage.state == "search" ? "search mode" : "normal mode"
46 }
47
48 state: "default"
49 states: [
50 PageHeadState {
51 name: "default"
52 head: searchPage.head
53 actions: Action {
54 iconName: "search"
55 onTriggered: searchPage.state = "search"
56 }
57 },
58 PageHeadState {
59 id: headerState
60 name: "search"
61 head: searchPage.head
62 actions: [
63 Action {
64 iconName: "contact"
65 }
66 ]
67 backAction: Action {
68 id: leaveSearchAction
69 text: "back"
70 iconName: "back"
71 onTriggered: searchPage.state = "default"
72 }
73 contents: TextField {
74 placeholderText: "search..."
75 }
76 }
77 ]
78 }
79 }
80 \endqml
81 */
82State {
83 id: state
84
85 /*!
86 The head property of the \l Page which will be the target of
87 the property changes of this State. This property must always
88 be set before the State can be used.
89 */
90 property PageHeadConfiguration head
91
92 /*!
93 The actions to be shown in the header with this state.
94 */
95 property list<Action> actions
96
97 /*!
98 The back action for this state.
99 */
100 property Action backAction
101
102 /*!
103 The contents of the header when this state is active.
104 */
105 property Item contents
106
107 PropertyChanges {
108 target: state.head
109 backAction: state.backAction
110 actions: state.actions
111 contents: state.contents
112 }
113}
0114
=== modified file 'modules/Ubuntu/Components/qmldir'
--- modules/Ubuntu/Components/qmldir 2014-07-02 13:39:29 +0000
+++ modules/Ubuntu/Components/qmldir 2014-07-03 11:13:13 +0000
@@ -99,3 +99,4 @@
99internal PageBase Page10.qml99internal PageBase Page10.qml
100Page 1.1 Page11.qml100Page 1.1 Page11.qml
101PageHeadConfiguration 1.1 PageHeadConfiguration.qml101PageHeadConfiguration 1.1 PageHeadConfiguration.qml
102PageHeadState 1.1 PageHeadState.qml
102103
=== modified file 'tests/resources/toolbar/header.qml'
--- tests/resources/toolbar/header.qml 2014-06-30 12:09:25 +0000
+++ tests/resources/toolbar/header.qml 2014-07-03 11:13:13 +0000
@@ -145,49 +145,35 @@
145 text: searchPage.state == "search" ? "search mode" : "normal mode"145 text: searchPage.state == "search" ? "search mode" : "normal mode"
146 }146 }
147147
148 head.actions: Action {148 state: "default"
149 id: searchAction
150 iconName: "search"
151 onTriggered: searchPage.state = "search"
152 }
153
154 state: ""
155 states: [149 states: [
156 State {150 PageHeadState {
157 name: ""151 name: "default"
158 PropertyChanges {152 head: searchPage.head
159 target: searchPage.head153 actions: Action {
160 // needed otherwise actions will not be154 id: searchAction
161 // returned to its original state.155 iconName: "search"
162 actions: [ searchAction ]156 onTriggered: searchPage.state = "search"
163 }157 }
164 },158 },
165 State {159 PageHeadState {
166 // TODO: The definition of this state will be
167 // simplified a lot in a following MR that
168 // introduces the HeaderState component.
169 id: headerState160 id: headerState
170 name: "search"161 name: "search"
171 property Action back: Action {162 head: searchPage.head
172 id: leaveSearchAction163 actions: [
173 text: "back"
174 iconName: "back"
175 onTriggered: searchPage.state = ""
176 }
177 property list<Action> actions: [
178 Action {164 Action {
179 iconName: "contact"165 iconName: "contact"
180 }166 }
181 ]167 ]
182 property TextField input: TextField {168 backAction: Action {
169 id: leaveSearchAction
170 text: "back"
171 iconName: "back"
172 onTriggered: searchPage.state = "default"
173 }
174 contents: TextField {
183 placeholderText: "search..."175 placeholderText: "search..."
184 }176 }
185 PropertyChanges {
186 target: searchPage.head
187 backAction: headerState.back
188 actions: headerState.actions
189 contents: headerState.input
190 }
191 }177 }
192 ]178 ]
193 }179 }
194180
=== modified file 'tests/resources/toolbar/headerTextInput.qml'
--- tests/resources/toolbar/headerTextInput.qml 2014-05-06 16:20:50 +0000
+++ tests/resources/toolbar/headerTextInput.qml 2014-07-03 11:13:13 +0000
@@ -14,53 +14,59 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17import QtQuick 2.017import QtQuick 2.2
18import Ubuntu.Components 1.118import Ubuntu.Components 1.1
1919
20MainView {20MainView {
21 width: units.gu(50)21 width: units.gu(40)
22 height: units.gu(80)22 height: units.gu(50)
23 useDeprecatedToolbar: false23 useDeprecatedToolbar: false
2424
25 Page {25 Page {
26 title: "test page"26 id: searchPage
2727 title: "Click the icon"
28 id: page
29
30 __customHeaderContents: Item {
31 TextField {
32 anchors {
33 left: parent.left
34 verticalCenter: parent.verticalCenter
35 }
36 }
37 }
3828
39 Label {29 Label {
40 anchors.centerIn: parent30 anchors.centerIn: parent
41 text: "Hello, world"31 text: searchPage.state == "search" ? "search mode" : "normal mode"
42 }32 }
4333
44 tools: ToolbarItems {34 head.actions: Action {
45 ToolbarButton {35 id: searchAction
46 action: Action {36 iconName: "search"
47 iconName: "contact"37 onTriggered: searchPage.state = "search"
48 text: "oh"38 }
49 onTriggered: print("lala")39
50 enabled: false40 state: ""
41 states: [
42 State {
43 name: ""
44 PropertyChanges {
45 target: searchPage.head
46 // needed otherwise actions will not be
47 // returned to its original state.
48 actions: [ searchAction ]
51 }49 }
52 }50 },
5351 PageHeadState {
54 back: ToolbarButton {52 id: headerState
55 action: Action {53 name: "search"
56 text: "cancel"54 head: searchPage.head
57 iconName: "cancel"55 actions: [
58 onTriggered: {56 Action {
59 page.__customHeaderContents = null;57 iconName: "contact"
60 }58 }
61 }59 ]
62 anchors.verticalCenter: parent.verticalCenter60 backAction: Action {
61 id: leaveSearchAction
62 text: "back"
63 iconName: "back"
64 onTriggered: searchPage.state = ""
65 }
66 contents: TextField {
67 placeholderText: "search..."
68 }
63 }69 }
64 }70 ]
65 }71 }
66}72}

Subscribers

People subscribed via source and target branches