Merge lp:~tpeeters/ubuntu-ui-toolkit/emptyHeader into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 412
Merged at revision: 406
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/emptyHeader
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 136 lines (+58/-29)
3 files modified
modules/Ubuntu/Components/Header.qml (+5/-5)
modules/Ubuntu/Components/Page.qml (+1/-1)
tests/unit/tst_components/tst_page.qml (+52/-23)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/emptyHeader
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zoltan Balogh Pending
Review via email: mp+157211@code.launchpad.net

Commit message

Disable header when it does not have contents or title.

Description of the change

Disable header when it does not have contents or title.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/Header.qml'
--- modules/Ubuntu/Components/Header.qml 2013-03-27 11:11:43 +0000
+++ modules/Ubuntu/Components/Header.qml 2013-04-04 19:43:21 +0000
@@ -46,6 +46,8 @@
46 }46 }
47 height: Theming.ComponentUtils.delegateProperty(header, "height", units.gu(10))47 height: Theming.ComponentUtils.delegateProperty(header, "height", units.gu(10))
4848
49 visible: title || contents
50
49 /*!51 /*!
50 Show the header52 Show the header
51 */53 */
@@ -63,16 +65,14 @@
63 /*!65 /*!
64 The text to display in the header66 The text to display in the header
65 */67 */
66 property string title68 property string title: ""
67 onTitleChanged: {69 onTitleChanged: contentsChanged()
68 if (title) header.show();
69 else header.hide();
70 }
7170
72 /*!71 /*!
73 The contents of the header. If this is set, \l title will be ignored.72 The contents of the header. If this is set, \l title will be ignored.
74 */73 */
75 property Component contents: null74 property Component contents: null
75 onContentsChanged: header.show()
7676
77 /*!77 /*!
78 The flickable that controls the movement of the header.78 The flickable that controls the movement of the header.
7979
=== modified file 'modules/Ubuntu/Components/Page.qml'
--- modules/Ubuntu/Components/Page.qml 2013-03-08 12:45:26 +0000
+++ modules/Ubuntu/Components/Page.qml 2013-04-04 19:43:21 +0000
@@ -116,7 +116,7 @@
116 onHeaderHeightChanged: internal.updateFlickableMargins()116 onHeaderHeightChanged: internal.updateFlickableMargins()
117 Component.onCompleted: internal.updateFlickableMargins()117 Component.onCompleted: internal.updateFlickableMargins()
118118
119 property real headerHeight: page.header ? page.header.height : 0119 property real headerHeight: page.header && page.header.visible ? page.header.height : 0
120120
121 function isFlickable(object) {121 function isFlickable(object) {
122 return object && object.hasOwnProperty("flicking") && object.hasOwnProperty("flickableDirection");122 return object && object.hasOwnProperty("flicking") && object.hasOwnProperty("flickableDirection");
123123
=== modified file 'tests/unit/tst_components/tst_page.qml'
--- tests/unit/tst_components/tst_page.qml 2013-03-12 18:48:37 +0000
+++ tests/unit/tst_components/tst_page.qml 2013-04-04 19:43:21 +0000
@@ -18,34 +18,63 @@
18import QtTest 1.018import QtTest 1.0
19import Ubuntu.Components 0.119import Ubuntu.Components 0.1
2020
21TestCase {21Item {
22 name: "PageAPI"22 width: 200
2323 height: 200
24 function test_title() {
25 compare(page.title, "", "is not set by default")
26 compare(mainView.header.title, "", "header title is not set by default")
27 var newTitle = "Hello World!"
28 page.title = newTitle
29 compare(page.title, newTitle, "can set/get")
30 compare(mainView.header.title, newTitle, "header title updated by changing page title")
31 }
32
33 function test_tools() {
34 compare(mainView.toolbar.tools, page.tools, "Page updates toolbar tools");
35 }
36
37 function test_active() {
38 compare(page.active, true, "Page is active by default");
39 }
40
41 function test_pageStack() {
42 compare(page.pageStack, null, "is not set by default")
43 }
4424
45 MainView {25 MainView {
26 anchors.fill: parent
46 id: mainView27 id: mainView
47 Page {28 Page {
48 id: page29 id: page
49 }30 }
50 }31 }
32
33 TestCase {
34 name: "PageAPI"
35 when: windowShown
36
37 function initTestCase() {
38 compare(page.title, "", "is not set by default")
39 compare(page.header, mainView.header, "page header equals mainView header")
40 compare(page.header.title, page.title, "header title is same as page title")
41 compare(page.header.visible, false, "header is not visible initially because there is no title")
42 }
43
44 function test_0_noHeader_bug1162028_bug1161910() {
45 compare(mainView.header.title, "", "no header title by default")
46 compare(mainView.header.visible, false, "header is hidden when title is not set")
47 compare(page.height, mainView.height, "page uses full height when there is no header")
48 }
49
50 function test_title() {
51 var newTitle = "Hello World!"
52 page.title = newTitle
53 compare(page.title, newTitle, "can set/get")
54 page.title = ""
55 compare(page.title, "", "can unset")
56 }
57
58 function test_header() {
59 var newTitle = "Hello header!"
60 page.title = newTitle
61 compare(mainView.header.title, newTitle, "header title updated by changing page title")
62 compare(mainView.header.visible, true, "header is visible when title is set")
63 page.title = ""
64 compare(mainView.header.title, "", "header title unset by unsetting page title")
65 compare(mainView.header.visible, false, "header is hidden when title is unset")
66 }
67
68 function test_tools() {
69 compare(mainView.toolbar.tools, page.tools, "Page updates toolbar tools");
70 }
71
72 function test_active() {
73 compare(page.active, true, "Page is active by default");
74 }
75
76 function test_pageStack() {
77 compare(page.pageStack, null, "is not set by default")
78 }
79 }
51}80}

Subscribers

People subscribed via source and target branches

to status/vote changes: