Merge lp:~tpeeters/ubuntu-ui-toolkit/hide-bars-mainview into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 866
Merged at revision: 864
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/hide-bars-mainview
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 99 lines (+31/-35)
2 files modified
modules/Ubuntu/Components/MainView.qml (+31/-0)
modules/Ubuntu/Components/Page.qml (+0/-35)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/hide-bars-mainview
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Tim Peeters Approve
Cris Dywan Approve
Review via email: mp+196720@code.launchpad.net

Commit message

Detect interaction with contents (in order to close toolbar/tabbar) from Page to MainView.

Description of the change

Detect interaction with contents (in order to close toolbar/tabbar) from Page to MainView. It is better to do it there because the toolbar and header are more easily accessible.

This change was requested when discussing this MR: https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar/+merge/196536

It is better to have the closing of the tabbar/toolbar all in the same place (in the MainView) so it is not needed to find the bars and make connections in several different places. Also, an app typically has one MainView and many Pages, so moving the MouseArea to MainView reduces the number of MouseAreas.

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

move contentsArea from Page to MainView

863. By Tim Peeters

remove z from contentsArea. No longer needed because it is defined after contents and before Toolbar and TabBar.

864. By Tim Peeters

check for another property of TabBar that we use

865. By Tim Peeters

tabBar is Item

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: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Neat clean-up there. And a nice bonus to get rid of the maxStackingOrder hack which I didn't even consider before.

It seems like the Jenkins failures are unrelated? autopilot passes for me so I'll Approve.

review: Approve
866. By Tim Peeters

empty commit to re-trigger jenkins

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

All AP tests pass on my maguro, except for one textarea failure which is this bug: https://bugs.launchpad.net/ubuntu-keyboard/+bug/1255327

Tested apps on device, works good.

review: Approve
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
1=== modified file 'modules/Ubuntu/Components/MainView.qml'
2--- modules/Ubuntu/Components/MainView.qml 2013-11-18 15:20:18 +0000
3+++ modules/Ubuntu/Components/MainView.qml 2013-11-27 09:47:39 +0000
4@@ -270,6 +270,26 @@
5 topMargin: -parent.y
6 }
7 }
8+
9+ MouseArea {
10+ id: contentsArea
11+ anchors.fill: contents
12+ // This mouse area will be on top of the page contents, but
13+ // under the toolbar and header.
14+ // It is used for detecting interaction with the page contents
15+ // which can close the toolbar and take a tab bar out of selection mode.
16+
17+ onPressed: {
18+ mouse.accepted = false;
19+ if (!toolbarItem.locked) {
20+ toolbarItem.close();
21+ }
22+ if (headerItem.tabBar && !headerItem.tabBar.alwaysSelectionMode) {
23+ headerItem.tabBar.selectionMode = false;
24+ }
25+ }
26+ propagateComposedEvents: true
27+ }
28 }
29
30 Toolbar {
31@@ -287,6 +307,17 @@
32 objectName: "MainView_Header"
33 id: headerItem
34 property real bottomY: headerItem.y + headerItem.height
35+
36+ property Item tabBar: null
37+ Binding {
38+ target: headerItem
39+ property: "tabBar"
40+ value: headerItem.contents
41+ when: headerItem.contents &&
42+ headerItem.contents.hasOwnProperty("selectionMode") &&
43+ headerItem.contents.hasOwnProperty("alwaysSelectionMode") &&
44+ headerItem.contents.hasOwnProperty("selectedIndex")
45+ }
46 }
47 }
48
49
50=== modified file 'modules/Ubuntu/Components/Page.qml'
51--- modules/Ubuntu/Components/Page.qml 2013-11-11 10:49:10 +0000
52+++ modules/Ubuntu/Components/Page.qml 2013-11-27 09:47:39 +0000
53@@ -148,11 +148,6 @@
54 Object {
55 id: internal
56
57- // A very large real number that is used as the z-value for an item
58- // that should go on top of its siblings.
59- // FIXME: Expose this variable to all components of the toolkit
60- property real maxStackingOrder: 200000
61-
62 UnityActions.ActionContext {
63 id: actionContext
64
65@@ -250,34 +245,4 @@
66 }
67 }
68 }
69-
70- MouseArea {
71- id: contentsArea
72- anchors.fill: page
73- z: internal.maxStackingOrder
74- // This mouse area will be on top of the page contents, but
75- // under the toolbar and header.
76- // It is used for detecting interaction with the page contents
77- // which can close the toolbar and take a tab bar out of selection mode.
78-
79- property Toolbar toolbar: page.__propagated && page.__propagated.toolbar ?
80- page.__propagated.toolbar : null
81-
82- property TabBar tabBar: page.__propagated && page.__propagated.header &&
83- page.__propagated.header.contents &&
84- page.__propagated.header.contents.hasOwnProperty("selectionMode") &&
85- page.__propagated.header.contents.hasOwnProperty("alwaysSelectionMode") ?
86- page.__propagated.header.contents : null
87-
88- onPressed: {
89- mouse.accepted = false;
90- if (contentsArea.toolbar && !toolbar.locked) {
91- contentsArea.toolbar.close();
92- }
93- if (contentsArea.tabBar && !contentsArea.tabBar.alwaysSelectionMode) {
94- contentsArea.tabBar.selectionMode = false;
95- }
96- }
97- propagateComposedEvents: true
98- }
99 }

Subscribers

People subscribed via source and target branches

to status/vote changes: