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

Proposed by Tim Peeters
Status: Rejected
Rejected by: Tim Peeters
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/hide-bars-mainview
Diff against target: 110 lines (+95/-0)
2 files modified
modules/Ubuntu/Components/MainView.qml (+9/-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
Tim Peeters Disapprove
PS Jenkins bot continuous-integration Needs Fixing
Cris Dywan Pending
Review via email: mp+196726@code.launchpad.net

This proposal supersedes a proposal from 2013-11-25.

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.
Revision history for this message
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

all unit tests and autopilot tests pass on my laptop.

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

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 : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

Tested on gallery-app on maguro, works fine.

Revision history for this message
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

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

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

Old MR, superseded by another one.

review: Disapprove

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

Subscribers

People subscribed via source and target branches

to status/vote changes: