on xenial help sign in
Merged with trunk
commitb984f95d7cd7ec752f96c894e7ac325d4cd278d8 authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 11 Dec 2013, 16:20 (13 years ago) parentb6d73b64f3b200
12 files changed+123−35
Dash/DashFilterGrid.qml+3−2 Dash/DashRenderer.qml+2−2 Launcher/Launcher.qml+3−3 Launcher/LauncherPanel.qml+2−2 Panel/Panel.qml+22 Shell.qml+5−1 plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+15−15 plugins/Unity/Indicators/qml/IndicatorPage.qml+12−1 plugins/Unity/Indicators/qml/MenuItemFactory.qml+6 tests/qmltests/Dash/tst_GenericScopeView.qml+33−3 tests/qmltests/Launcher/tst_Launcher.qml+6−6 tests/qmltests/Panel/tst_Panel.qml+14
Dash/DashFilterGrid.qml+3−2
@@ -35,8 +35,6 @@ DashRenderer {
3535 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
3636 currentItem: filterGrid.currentItem
3737 expandable: filterGrid.expandable
38− delegateCreationBegin: filterGrid.delegateCreationBegin
39− delegateCreationEnd: filterGrid.delegateCreationEnd
4038 height: filterGrid.height
4139 margins: filterGrid.margins
4240 uncollapsedHeight: filterGrid.uncollapsedHeight
@@ -56,9 +54,12 @@ DashRenderer {
5654 model: dashFilterGrid.model
5755 filter: dashFilterGrid.filter
5856 highlightIndex: dashFilterGrid.highlightIndex
57+ delegateCreationBegin: dashFilterGrid.delegateCreationBegin
58+ delegateCreationEnd: dashFilterGrid.delegateCreationEnd
5959
6060 onFilterChanged: {
6161 dashFilterGrid.filter = filter
62+ filter = Qt.binding(function() { return dashFilterGrid.filter })
6263 }
6364 }
6465}
Dash/DashRenderer.qml+2−2
@@ -38,9 +38,9 @@ Item {
3838
3939 property int uncollapsedHeight: height
4040
41− property real delegateCreationBegin
41+ property var delegateCreationBegin: undefined
4242
43− property real delegateCreationEnd
43+ property var delegateCreationEnd: undefined
4444
4545 property real verticalSpacing: 0
4646
Launcher/Launcher.qml+3−3
@@ -41,7 +41,7 @@ Item {
4141 signal dash()
4242
4343 // emitted when the dash icon in the launcher has been tapped
44− signal dashItemSelected()
44+ signal showDashHome()
4545
4646 onStateChanged: {
4747 if (state == "") {
@@ -161,9 +161,9 @@ Item {
161161 root.state = ""
162162 launcherApplicationSelected(appId)
163163 }
164− onDashItemSelected: {
164+ onShowDashHome: {
165165 root.state = ""
166− root.dashItemSelected(index)
166+ root.showDashHome();
167167 }
168168
169169 onPreventHidingChanged: {
Launcher/LauncherPanel.qml+2−2
@@ -36,7 +36,7 @@ Item {
3636 property int highlightIndex: -1
3737
3838 signal applicationSelected(string appId)
39− signal dashItemSelected(int index)
39+ signal showDashHome()
4040
4141 BorderImage {
4242 id: background
@@ -57,7 +57,7 @@ Item {
5757 id: dashItem
5858 width: parent.width
5959 height: units.gu(7)
60− onClicked: root.dashItemSelected(0)
60+ onClicked: root.showDashHome()
6161 z: 1
6262 Image {
6363 objectName: "dashItem"
Panel/Panel.qml+22
@@ -31,6 +31,28 @@ Item {
3131
3232 signal searchClicked
3333
34+ function hideIndicatorMenu(delay) {
35+ if (delay !== undefined) {
36+ hideTimer.interval = delay;
37+ hideTimer.start();
38+ } else {
39+ indicatorsMenu.hide();
40+ }
41+ }
42+
43+ Timer {
44+ id: hideTimer
45+ running: false
46+ onTriggered: {
47+ indicatorsMenu.hide();
48+ }
49+ }
50+
51+ Connections {
52+ target: indicatorsMenu
53+ onShown: hideTimer.stop()
54+ }
55+
3456 PanelBackground {
3557 id: panelBackground
3658 anchors {
Shell.qml+5−1
@@ -576,6 +576,10 @@ FocusScope {
576576 stages.hide()
577577 }
578578
579+ function hideIndicatorMenu(delay) {
580+ panel.hideIndicatorMenu(delay);
581+ }
582+
579583 Item {
580584 id: overlay
581585
@@ -667,7 +671,7 @@ FocusScope {
667671 dragAreaWidth: shell.edgeSize
668672 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
669673
670− onDashItemSelected: {
674+ onShowDashHome: {
671675 if (edgeDemo.running)
672676 return;
673677
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+15−15
@@ -57,21 +57,6 @@ Indicators.BaseMenuItem {
5757
5858 sourceComponent: loadMessage(actionsDescription);
5959
60− // Binding all properties for the item, to make sure that any change in the
61− // property will be propagated to the contents.item at any time
62− Binding {
63− target: contents.item
64− property: "menuSelected"
65− value: menuSelected
66− when: (contents.status == Loader.Ready)
67− }
68−
69− Connections {
70− target: contents.item ? contents.item : null
71− onSelectMenu: selectMenu()
72− onDeselectMenu: deselectMenu()
73− }
74−
7560 Component {
7661 id: simpleTextMessage
7762 SimpleTextMessage {
@@ -85,10 +70,15 @@ Indicators.BaseMenuItem {
8570
8671 onActivateApp: {
8772 menuModel.activate(menuIndex, true);
73+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
8874 }
8975 onDismiss: {
9076 menuModel.activate(menuIndex, false);
9177 }
78+
79+ menuSelected: messageFactoryItem.menuSelected
80+ onSelectMenu: messageFactoryItem.selectMenu()
81+ onDeselectMenu: messageFactoryItem.deselectMenu()
9282 }
9383 }
9484 Component {
@@ -115,6 +105,7 @@ Indicators.BaseMenuItem {
115105
116106 onActivateApp: {
117107 menuModel.activate(menuIndex, true);
108+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
118109 }
119110 onDismiss: {
120111 menuModel.activate(menuIndex, false);
@@ -122,6 +113,10 @@ Indicators.BaseMenuItem {
122113 onReply: {
123114 replyAction.activate(value);
124115 }
116+
117+ menuSelected: messageFactoryItem.menuSelected
118+ onSelectMenu: messageFactoryItem.selectMenu()
119+ onDeselectMenu: messageFactoryItem.deselectMenu()
125120 }
126121 }
127122 Component {
@@ -157,6 +152,7 @@ Indicators.BaseMenuItem {
157152
158153 onActivateApp: {
159154 menuModel.activate(menuIndex, true);
155+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
160156 }
161157 onDismiss: {
162158 menuModel.activate(menuIndex, false);
@@ -167,6 +163,10 @@ Indicators.BaseMenuItem {
167163 onReply: {
168164 replyAction.activate(value);
169165 }
166+
167+ menuSelected: messageFactoryItem.menuSelected
168+ onSelectMenu: messageFactoryItem.selectMenu()
169+ onDeselectMenu: messageFactoryItem.deselectMenu()
170170 }
171171 }
172172 }
plugins/Unity/Indicators/qml/IndicatorPage.qml+12−1
@@ -140,7 +140,7 @@ IndicatorBase {
140140
141141 onLoaded: {
142142 if (item.hasOwnProperty("menuSelected")) {
143− item.menuSelected = Qt.binding(function() { return mainMenu.selectedIndex == index; });
143+ item.menuSelected = mainMenu.selectedIndex == index;
144144 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
145145 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
146146 }
@@ -157,6 +157,17 @@ IndicatorBase {
157157 property: "objectName"
158158 value: model.action
159159 }
160+
161+ // TODO: Fixes lp#1243146
162+ // This is a workaround for a Qt bug. https://bugreports.qt-project.org/browse/QTBUG-34351
163+ Connections {
164+ target: mainMenu
165+ onSelectedIndexChanged: {
166+ if (loader.item && loader.item.hasOwnProperty("menuSelected")) {
167+ loader.item.menuSelected = mainMenu.selectedIndex == index;
168+ }
169+ }
170+ }
160171 }
161172 }
162173 }
plugins/Unity/Indicators/qml/MenuItemFactory.qml+6
@@ -22,6 +22,7 @@ import Unity.Indicators 0.1 as Indicators
2222import Unity.Indicators.Network 0.1 as ICNetwork
2323import Unity.Indicators.Messaging 0.1 as ICMessaging
2424import QMenuModel 0.1 as QMenuModel
25+import Ubuntu.Components 0.1
2526
2627Item {
2728 id: menuFactory
@@ -107,6 +108,7 @@ Item {
107108
108109 onActivate: {
109110 menuModel.activate(menuIndex);
111+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
110112 }
111113 }
112114 }
@@ -147,6 +149,7 @@ Item {
147149
148150 onActivate: {
149151 menuModel.activate(menuIndex);
152+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
150153 }
151154 }
152155 }
@@ -164,6 +167,7 @@ Item {
164167
165168 onActivate: {
166169 menuModel.activate(menuIndex);
170+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
167171 }
168172 }
169173 }
@@ -222,6 +226,7 @@ Item {
222226 }
223227 onActivate: {
224228 menuModel.activate(menuIndex);
229+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
225230 }
226231
227232 function loadAttributes() {
@@ -260,6 +265,7 @@ Item {
260265 }
261266 onActivateApp: {
262267 menuModel.activate(menuIndex, true);
268+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
263269 }
264270 onDismiss: {
265271 menuModel.activate(menuIndex, false);
tests/qmltests/Dash/tst_GenericScopeView.qml+33−3
@@ -79,14 +79,14 @@ Item {
7979 var categoryListView = findChild(genericScopeView, "categoryListView");
8080 categoryListView.positionAtBeginning();
8181
82− var tile = findChild(genericScopeView, "delegate0");
82+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
8383 mouseClick(tile, tile.width / 2, tile.height / 2);
8484 var openEffect = findChild(genericScopeView, "openEffect");
8585 tryCompare(openEffect, "gap", 1);
8686 }
8787
8888 function checkArrowPosition(index) {
89− var tile = findChild(genericScopeView, "delegate" + index);
89+ var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
9090 var tileCenter = tile.x + tile.width/2;
9191 var pointerArrow = findChild(genericScopeView, "pointerArrow");
9292 var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
@@ -141,7 +141,7 @@ Item {
141141 categoryListView.flick(0, -units.gu(80));
142142 tryCompare(categoryListView.flicking, false);
143143
144− var tile = findChild(genericScopeView, "delegate0");
144+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
145145 mouseClick(tile, tile.width / 2, tile.height - 1);
146146 var openEffect = findChild(genericScopeView, "openEffect");
147147 tryCompare(openEffect, "gap", 1);
@@ -276,6 +276,36 @@ Item {
276276 closePreview();
277277 tryCompare(previewListView, "open", false);
278278 }
279+
280+ function test_filter_expand_expand() {
281+ // wait for the item to be there
282+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != undefined; }, true);
283+
284+ var categoryListView = findChild(genericScopeView, "categoryListView");
285+ categoryListView.contentY = categoryListView.height;
286+
287+ var header2 = findChild(genericScopeView, "dashSectionHeader2")
288+ var category2 = findChild(genericScopeView, "dashCategory2")
289+ var category2FilterGrid = category2.children[0].children[0].children[0];
290+ verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
291+
292+ waitForRendering(header2);
293+ verify(category2.expandable);
294+ verify(category2.filtered);
295+
296+ mouseClick(header2, header2.width / 2, header2.height / 2);
297+ tryCompare(category2, "filtered", false);
298+ tryCompare(category2FilterGrid, "filter", false);
299+
300+ categoryListView.positionAtBeginning();
301+
302+ var header0 = findChild(genericScopeView, "dashSectionHeader0")
303+ var category0 = findChild(genericScopeView, "dashCategory0")
304+ mouseClick(header0, header0.width / 2, header0.height / 2);
305+ tryCompare(category0, "filtered", false);
306+ tryCompare(category2, "filtered", true);
307+ tryCompare(category2FilterGrid, "filter", true);
308+ }
279309 }
280310 }
281311}
tests/qmltests/Launcher/tst_Launcher.qml+6−6
@@ -41,9 +41,9 @@ Item {
4141 lastSelectedApplication = appId
4242 }
4343
44− property int dashItemSelected_count: 0
45− onDashItemSelected: {
46− dashItemSelected_count++;
44+ property int showDashHome_count: 0
45+ onShowDashHome: {
46+ showDashHome_count++;
4747 }
4848
4949 property int maxPanelX: 0
@@ -138,9 +138,9 @@ Item {
138138 }
139139
140140 /* If I click on the dash icon on the launcher
141− Launcher::dashItemSelected signal should be emitted */
141+ Launcher::showDashHome signal should be emitted */
142142 function test_clickingOnDashIconCausesSignalEmission() {
143− launcher.dashItemSelected_count = 0
143+ launcher.showDashHome_count = 0
144144
145145 revealer.dragLauncherIntoView()
146146
@@ -149,7 +149,7 @@ Item {
149149
150150 mouseClick(dashIcon, dashIcon.width/2, dashIcon.height/2)
151151
152− tryCompare(launcher, "dashItemSelected_count", 1)
152+ tryCompare(launcher, "showDashHome_count", 1)
153153
154154 // Tapping on the dash icon also dismisses the launcher
155155 revealer.waitUntilLauncherDisappears()
tests/qmltests/Panel/tst_Panel.qml+14
@@ -264,5 +264,19 @@ Item {
264264
265265 compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
266266 }
267+
268+ function test_hideIndicatorMenu_data() {
269+ return [ {tag: "no-delay", delay: undefined },
270+ {tag: "delayed", delay: 200 }
271+ ];
272+ }
273+
274+ function test_hideIndicatorMenu(data) {
275+ panel.indicators.show();
276+ compare(panel.indicators.shown, true);
277+
278+ panel.hideIndicatorMenu(data.delay);
279+ tryCompare(panel.indicators, "shown", false);
280+ }
267281 }
268282}