Merge lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Superseded
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 121 lines (+106/-0)
2 files modified
modules/Ubuntu/Components/MainView.qml (+20/-0)
tests/unit_x11/tst_components/tst_hide_chrome.qml (+86/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Needs Information
Review via email: mp+196536@code.launchpad.net

This proposal has been superseded by a proposal from 2013-11-26.

Commit message

Close toolbar when user interacts with tabs header.

Description of the change

Close toolbar when user interacts with tabs header.

Note that the HideChrome TestCase will be extended in later MRs where the tabs are hidden when the user interacts with the toolbar.

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

don't state the obvious in comments

863. By Tim Peeters

better test name

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

all unit tests and autopilot tests pass on my laptop.

864. By Tim Peeters

don't close locked toolbar

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)
865. By Tim Peeters

empty commit to trigger jenkins again

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

Why is this handled in MainView instead of Page? The Page already has tabbar code and and closes the toolbar when interacting with it.

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

An app normally has one MainView and many Pages. So if we can handle something in the MainView, that is the better place to do it.

The question is, can we move the page contents interaction from the Page to the MainView? But if that is the case I don't want to do it in this MR.

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

Tested on gallery-app on maguro, works fine.

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

Ok, I'll move the detection of the contents interaction also to the MainView in this MR https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/hide-bars-mainview/+merge/196720 which is now a prerequisite of this one.

866. By Tim Peeters

merge prerequisite branch

Unmerged revisions

866. By Tim Peeters

merge prerequisite branch

865. By Tim Peeters

empty commit to trigger jenkins again

864. By Tim Peeters

don't close locked toolbar

863. By Tim Peeters

better test name

862. By Tim Peeters

don't state the obvious in comments

861. By Tim Peeters

close toolbar when selectionMode becomes true

860. By Tim Peeters

edit copyright year

859. By Tim Peeters

add unit test

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-25 15:57:58 +0000
4@@ -287,6 +287,26 @@
5 objectName: "MainView_Header"
6 id: headerItem
7 property real bottomY: headerItem.y + headerItem.height
8+
9+ property var tabBar: null
10+ Binding {
11+ target: headerItem
12+ property: "tabBar"
13+ value: headerItem.contents
14+ when: headerItem.contents &&
15+ headerItem.contents.hasOwnProperty("selectionMode") &&
16+ headerItem.contents.hasOwnProperty("model") &&
17+ headerItem.contents.hasOwnProperty("selectedIndex")
18+ }
19+ Connections {
20+ // no connections are made when target is null
21+ target: headerItem.tabBar
22+ onSelectionModeChanged: {
23+ if (headerItem.tabBar.selectionMode) {
24+ if (!toolbar.locked) toolbarItem.close();
25+ }
26+ }
27+ }
28 }
29 }
30
31
32=== added file 'tests/unit_x11/tst_components/tst_hide_chrome.qml'
33--- tests/unit_x11/tst_components/tst_hide_chrome.qml 1970-01-01 00:00:00 +0000
34+++ tests/unit_x11/tst_components/tst_hide_chrome.qml 2013-11-25 15:57:58 +0000
35@@ -0,0 +1,86 @@
36+/*
37+ * Copyright 2013 Canonical Ltd.
38+ *
39+ * This program is free software; you can redistribute it and/or modify
40+ * it under the terms of the GNU Lesser General Public License as published by
41+ * the Free Software Foundation; version 3.
42+ *
43+ * This program is distributed in the hope that it will be useful,
44+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
45+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+ * GNU Lesser General Public License for more details.
47+ *
48+ * You should have received a copy of the GNU Lesser General Public License
49+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
50+ */
51+
52+import QtQuick 2.0
53+import QtTest 1.0
54+import Ubuntu.Components 0.1
55+
56+Item {
57+ width: units.gu(50)
58+ height: units.gu(80)
59+
60+ MainView {
61+ id: mainView
62+ anchors.fill: parent
63+ Tabs {
64+ id: tabs
65+ Tab {
66+ id: tab1
67+ title: "tab 1"
68+ page: Page {
69+ id: page1
70+ Button {
71+ id: button
72+ anchors.centerIn: parent
73+ text: "click"
74+ }
75+
76+ tools: ToolbarItems {
77+ ToolbarButton {
78+ text: "something"
79+ }
80+ }
81+ }
82+ }
83+ Tab {
84+ id: tab2
85+ title: "tab 2"
86+ page: Page {
87+ id: page2
88+ }
89+ }
90+ }
91+ }
92+
93+ TestCase {
94+ name: "HideChrome"
95+ when: windowShown
96+ id: testCase
97+
98+ function openToolbar() {
99+ var toolbar = mainView.__propagated.toolbar;
100+ toolbar.open();
101+ compare(toolbar.opened, true, "Cannot open toolbar using open()");
102+ return toolbar;
103+ }
104+
105+ function setTabBarSelectionMode(newSelectionMode) {
106+ var tabBar = tabs.tabBar;
107+ var header = mainView.__propagated.header;
108+ compare(tabBar, header.contents, "TabBar is not the active header contents");
109+ header.show();
110+ tabBar.selectionMode = newSelectionMode;
111+ return tabBar;
112+ }
113+
114+ function test_tabBar_selectionMode_closes_toolbar_bug1223600() {
115+ testCase.setTabBarSelectionMode(false);
116+ var toolbar = testCase.openToolbar();
117+ testCase.setTabBarSelectionMode(true);
118+ compare(toolbar.opened, false, "Activating TabBar did not close toolbar");
119+ }
120+ }
121+}

Subscribers

People subscribed via source and target branches

to status/vote changes: