Merge lp:~bzoltan/ubuntu-ui-toolkit/reverse_cherrypicking_rev734 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: 738
Merged at revision: 738
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/reverse_cherrypicking_rev734
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 309 lines (+41/-87)
9 files modified
CHANGES (+0/-3)
components.api (+1/-4)
modules/Ubuntu/Components/Panel.qml (+12/-27)
modules/Ubuntu/Components/Toolbar.qml (+17/-40)
tests/resources/toolbar/panels.qml (+1/-3)
tests/unit/tst_components/tst_page.qml (+0/-1)
tests/unit/tst_components/tst_toolbar.qml (+5/-4)
tests/unit/tst_components/tst_toolbaritems.qml (+3/-3)
tests/unit_x11/tst_components/tst_panel.qml (+2/-2)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/reverse_cherrypicking_rev734
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Łukasz Zemczak Approve
Review via email: mp+183628@code.launchpad.net

Commit message

Reverse cherrypicking rev734

Description of the change

Reverse cherrypicking rev734

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Since the other revert got already approved, I'm approving this one - it seems correct.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2013-09-03 10:12:39 +0000
3+++ CHANGES 2013-09-03 10:52:42 +0000
4@@ -50,9 +50,6 @@
5 * ADDED IN MainView: property bool anchorToKeyboard
6 * CHANGED IN Tabs: property Component __headerContents TO property TabBar tabBar
7 * CHANGED IN Header: property Component contents TO property Item contents
8-* CHANGED IN Panel property bool opened TO readonly property bool opened
9-* ADDED IN Panel function open()
10-* ADDED IN Panel function close()
11
12 Compatibility Breaks
13 ********************
14
15=== modified file 'components.api'
16--- components.api 2013-09-03 10:12:39 +0000
17+++ components.api 2013-09-03 10:52:42 +0000
18@@ -157,9 +157,7 @@
19 Item
20 default property list<Object> contents
21 property int align
22- readonly property bool opened
23- function open()
24- function close()
25+ property bool opened
26 property bool locked
27 property real hintSize
28 property real triggerSize
29@@ -351,7 +349,6 @@
30 modules/Ubuntu/Components/Toolbar.qml
31 Panel
32 property Item tools
33- property int hideTimeout
34 modules/Ubuntu/Components/ToolbarButton.qml
35 ActionItem
36 modules/Ubuntu/Components/ToolbarItems.qml
37
38=== modified file 'modules/Ubuntu/Components/Panel.qml'
39--- modules/Ubuntu/Components/Panel.qml 2013-09-02 09:21:40 +0000
40+++ modules/Ubuntu/Components/Panel.qml 2013-09-03 10:52:42 +0000
41@@ -175,23 +175,11 @@
42 Use edge swipes to open/close the panel.
43 The opened property is not updated until the swipe gesture is completed.
44 */
45- // opened is true if state is spread, or if state is moving/hint and the previous state was spread.
46- readonly property bool opened: (panel.state === "spread") ||
47- (panel.state === "moving" && internal.previousState === "spread")
48+ property bool opened: false
49 /*! \internal */
50-
51- /*!
52- Open the panel
53- */
54- function open() {
55- panel.state = "spread";
56- }
57-
58- /*!
59- Close the panel
60- */
61- function close() {
62- panel.state = "";
63+ onOpenedChanged: {
64+ if (opened) state = "spread";
65+ else state = "";
66 }
67
68 /*!
69@@ -344,19 +332,13 @@
70 if (bottomBarVisibilityCommunicator.forceHidden) {
71 internal.savedLocked = panel.locked;
72 internal.savedOpened = panel.opened;
73- panel.close();
74+ panel.opened = false;
75 panel.locked = true;
76 } else { // don't force hidden
77 panel.locked = internal.savedLocked;
78- if (panel.locked) {
79- if (internal.savedOpened) {
80- panel.open();
81- } else {
82- panel.close();
83- }
84+ if (internal.savedLocked) panel.opened = internal.savedOpened;
85 // if the panel was locked, do not slide it back in
86 // until the user performs an edge swipe.
87- }
88 }
89 }
90 }
91@@ -367,7 +349,12 @@
92 internal.movingDelta = panel.hintSize + draggingArea.initialPosition - bar.size;
93 } else if (state == "moving" && internal.previousState == "spread") {
94 internal.movingDelta = draggingArea.initialPosition;
95+ } else if (state == "spread") {
96+ panel.opened = true;
97+ } else if (state == "") {
98+ panel.opened = false;
99 }
100+ internal.previousState = state;
101 }
102
103 Toolkit.InverseMouseArea {
104@@ -376,7 +363,7 @@
105 mouse.accepted = false;
106 // the mouse click may cause an update
107 // of locked by the clicked Item behind
108- if (!panel.locked) panel.close();
109+ if (!panel.locked) panel.opened = false;
110 }
111 propagateComposedEvents: true
112 visible: panel.locked == false && panel.state == "spread"
113@@ -453,11 +440,9 @@
114 onPositionChanged: {
115 if (panel.locked) return;
116 if (panel.state == "hint" && mousePosition < initialPosition - dragThreshold) {
117- internal.previousState = "hint";
118 panel.state = "moving";
119 pressedItem = null;
120 } else if (panel.state == "spread" && mousePosition > initialPosition + dragThreshold) {
121- internal.previousState = "spread";
122 panel.state = "moving";
123 pressedItem = null;
124 }
125
126=== modified file 'modules/Ubuntu/Components/Toolbar.qml'
127--- modules/Ubuntu/Components/Toolbar.qml 2013-09-02 13:54:47 +0000
128+++ modules/Ubuntu/Components/Toolbar.qml 2013-09-03 10:52:42 +0000
129@@ -39,63 +39,40 @@
130 */
131 property Item tools: null
132
133- /*!
134- \preliminary
135- The time in milliseconds before the toolbar automatically hides after inactivity
136- when it is not locked.
137- */
138- property int hideTimeout: 5000
139-
140 /*! \internal */
141 onToolsChanged: {
142- internal.updateVisibleTools();
143- if (tools) {
144- if (tools && tools.hasOwnProperty("locked")) locked = tools.locked;
145- // open the toolbar, except when it is locked in closed position
146- if (tools && tools.hasOwnProperty("locked") && tools.hasOwnProperty("opened")
147- && !tools.opened && tools.locked) {
148- // toolbar is locked in closed state
149- toolbar.close();
150- } else {
151- toolbar.open();
152- }
153-
154- if (tools && tools.hasOwnProperty("opened")) {
155- tools.opened = toolbar.opened;
156- }
157- } else { // no tools
158- locked = true;
159- toolbar.close();
160+ if (tools && tools.hasOwnProperty("locked")) locked = tools.locked;
161+ if (tools && tools.hasOwnProperty("locked") && tools.hasOwnProperty("opened")
162+ && tools.opened && tools.locked) {
163+ // toolbar is locked in visible state.
164+ internal.updateVisibleTools();
165+ opened = true;
166+ } else if (!opened && !animating) {
167+ // toolbar is closed
168+ internal.updateVisibleTools();
169+ } else {
170+ opened = false;
171+ // internal.visibleTools will be updated
172+ // when the hide animation is finished
173+ }
174+ if (tools && tools.hasOwnProperty("opened")) {
175+ tools.opened = toolbar.opened;
176 }
177 }
178
179 // if tools is not specified, lock the toolbar in closed position
180 locked: tools && tools.hasOwnProperty("locked") ? tools.locked : false
181
182- Timer {
183- id: hideTimer
184- interval: toolbar.hideTimeout
185- running: toolbar.opened && !toolbar.locked
186- onTriggered: toolbar.close()
187- }
188-
189 onOpenedChanged: {
190 if (tools && tools.hasOwnProperty("opened")) {
191 tools.opened = toolbar.opened;
192 }
193- if (!toolbar.locked) hideTimer.restart()
194 }
195
196 Connections {
197 target: tools
198 ignoreUnknownSignals: true
199- onOpenedChanged: {
200- if (tools.opened) {
201- toolbar.open();
202- } else {
203- toolbar.close();
204- }
205- }
206+ onOpenedChanged: toolbar.opened = tools.opened;
207 onLockedChanged: toolbar.locked = tools.locked;
208 }
209
210
211=== modified file 'tests/resources/toolbar/panels.qml'
212--- tests/resources/toolbar/panels.qml 2013-09-02 09:02:40 +0000
213+++ tests/resources/toolbar/panels.qml 2013-09-03 10:52:42 +0000
214@@ -93,7 +93,7 @@
215 }
216 height: toolbar.height
217
218- StyledItem {
219+ Item {
220 id: toolbar
221 anchors {
222 left: parent.left
223@@ -103,8 +103,6 @@
224 height: units.gu(8)
225 property bool opened: bottomLeftPanel.opened
226 property bool animating: bottomLeftPanel.animating
227- style: Theme.createStyleComponent("ToolbarStyle.qml", toolbar)
228-
229 Label {
230 anchors.centerIn: parent
231 text: "This looks like a standard toolbar"
232
233=== modified file 'tests/unit/tst_components/tst_page.qml'
234--- tests/unit/tst_components/tst_page.qml 2013-09-02 10:23:51 +0000
235+++ tests/unit/tst_components/tst_page.qml 2013-09-03 10:52:42 +0000
236@@ -69,7 +69,6 @@
237 function test_0_noHeader_bug1162028_bug1161910() {
238 compare(mainView.__propagated.header.title, "", "no header title by default")
239 compare(mainView.__propagated.header.visible, false, "header is hidden when title is not set")
240- mainView.__propagated.toolbar.close(); // close toolbar before checking height.
241 compare(page.height, mainView.height, "page uses full height when there is no header")
242 }
243
244
245=== modified file 'tests/unit/tst_components/tst_toolbar.qml'
246--- tests/unit/tst_components/tst_toolbar.qml 2013-09-02 10:23:51 +0000
247+++ tests/unit/tst_components/tst_toolbar.qml 2013-09-03 10:52:42 +0000
248@@ -44,14 +44,15 @@
249 compare(page.tools, toolbarItems, "Page tools are set initially");
250 compare(page.__propagated, mainView.__propagated, "propagated property is propagated from mainView to page")
251 compare(mainView.__propagated.toolbar.tools, page.tools, "Toolbar tools are set to page tools initially");
252- compare(mainView.__propagated.toolbar.tools.opened, true, "Toolbar is opened initially");
253+ compare(mainView.__propagated.toolbar.tools.opened, false, "Toolbar is closed initially");
254 compare(mainView.__propagated.toolbar.tools.locked, false, "Toolbar is initially not locked");
255 }
256
257 function test_opened() {
258- mainView.__propagated.toolbar.open();
259+ compare(mainView.__propagated.toolbar.tools.opened, false, "Toolbar initially closed");
260+ mainView.__propagated.toolbar.opened = true;
261 compare(mainView.__propagated.toolbar.opened, true, "Toolbar can be made opened");
262- mainView.__propagated.toolbar.close();
263+ mainView.__propagated.toolbar.opened = false;
264 compare(mainView.__propagated.toolbar.opened, false, "Toolbar can be made closed");
265 page.tools.opened = true;
266 compare(mainView.__propagated.toolbar.opened, true, "Toolbar can be made opened by setting page.tools.opened");
267@@ -73,7 +74,7 @@
268
269 function test_bug1192673() {
270 toolbarItems.opened = false;
271- mainView.__propagated.toolbar.open();
272+ mainView.__propagated.toolbar.opened = true;
273 compare(toolbarItems.opened, true, "opening the toolbar updates toolbarItems.opened");
274 toolbarItems.opened = false;
275 compare(mainView.__propagated.toolbar.opened, false, "setting toolbarActions.opened to false closes the toolbar");
276
277=== modified file 'tests/unit/tst_components/tst_toolbaritems.qml'
278--- tests/unit/tst_components/tst_toolbaritems.qml 2013-09-02 10:23:51 +0000
279+++ tests/unit/tst_components/tst_toolbaritems.qml 2013-09-03 10:52:42 +0000
280@@ -61,11 +61,11 @@
281 }
282
283 function test_opened() {
284- compare(toolbarItems.opened, true, "Toolbar items initially opened");
285+ compare(toolbarItems.opened, false, "Toolbar items initially closed");
286+ toolbarItems.opened = true;
287+ compare(toolbarItems.opened, true, "Toolbar items can be made opened");
288 toolbarItems.opened = false;
289 compare(toolbarItems.opened, false, "Toolbar items can be made closed");
290- toolbarItems.opened = true;
291- compare(toolbarItems.opened, true, "Toolbar items can be made opened");
292 }
293
294 function test_locked() {
295
296=== modified file 'tests/unit_x11/tst_components/tst_panel.qml'
297--- tests/unit_x11/tst_components/tst_panel.qml 2013-09-02 09:13:50 +0000
298+++ tests/unit_x11/tst_components/tst_panel.qml 2013-09-03 10:52:42 +0000
299@@ -58,9 +58,9 @@
300 }
301
302 function test_opened() {
303- panel.open();
304+ panel.opened = true;
305 compare(panel.opened, true, "Can set opened");
306- panel.close();
307+ panel.opened = false;
308 compare(panel.opened, false, "Can unset opened");
309 }
310

Subscribers

People subscribed via source and target branches

to status/vote changes: