on xenial help sign in
Merged with trunk
b984f95Nick Dedekind
Dash/DashFilterGrid.qml+3−2
@@ -35,8 +35,6 @@ DashRenderer {
35 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
35 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
36 currentItem: filterGrid.currentItem
36 currentItem: filterGrid.currentItem
37 expandable: filterGrid.expandable
37 expandable: filterGrid.expandable
38− delegateCreationBegin: filterGrid.delegateCreationBegin
39− delegateCreationEnd: filterGrid.delegateCreationEnd
40 height: filterGrid.height
38 height: filterGrid.height
41 margins: filterGrid.margins
39 margins: filterGrid.margins
42 uncollapsedHeight: filterGrid.uncollapsedHeight
40 uncollapsedHeight: filterGrid.uncollapsedHeight
@@ -56,9 +54,12 @@ DashRenderer {
56 model: dashFilterGrid.model
54 model: dashFilterGrid.model
57 filter: dashFilterGrid.filter
55 filter: dashFilterGrid.filter
58 highlightIndex: dashFilterGrid.highlightIndex
56 highlightIndex: dashFilterGrid.highlightIndex
57+ delegateCreationBegin: dashFilterGrid.delegateCreationBegin
58+ delegateCreationEnd: dashFilterGrid.delegateCreationEnd
59
59
60 onFilterChanged: {
60 onFilterChanged: {
61 dashFilterGrid.filter = filter
61 dashFilterGrid.filter = filter
62+ filter = Qt.binding(function() { return dashFilterGrid.filter })
62 }
63 }
63 }
64 }
64}
65}
Dash/DashRenderer.qml+2−2
@@ -38,9 +38,9 @@ Item {
38
38
39 property int uncollapsedHeight: height
39 property int uncollapsedHeight: height
40
40
41− property real delegateCreationBegin
41+ property var delegateCreationBegin: undefined
42
42
43− property real delegateCreationEnd
43+ property var delegateCreationEnd: undefined
44
44
45 property real verticalSpacing: 0
45 property real verticalSpacing: 0
46
46
Launcher/Launcher.qml+3−3
@@ -41,7 +41,7 @@ Item {
41 signal dash()
41 signal dash()
42
42
43 // emitted when the dash icon in the launcher has been tapped
43 // emitted when the dash icon in the launcher has been tapped
44− signal dashItemSelected()
44+ signal showDashHome()
45
45
46 onStateChanged: {
46 onStateChanged: {
47 if (state == "") {
47 if (state == "") {
@@ -161,9 +161,9 @@ Item {
161 root.state = ""
161 root.state = ""
162 launcherApplicationSelected(appId)
162 launcherApplicationSelected(appId)
163 }
163 }
164− onDashItemSelected: {
164+ onShowDashHome: {
165 root.state = ""
165 root.state = ""
166− root.dashItemSelected(index)
166+ root.showDashHome();
167 }
167 }
168
168
169 onPreventHidingChanged: {
169 onPreventHidingChanged: {
Launcher/LauncherPanel.qml+2−2
@@ -36,7 +36,7 @@ Item {
36 property int highlightIndex: -1
36 property int highlightIndex: -1
37
37
38 signal applicationSelected(string appId)
38 signal applicationSelected(string appId)
39− signal dashItemSelected(int index)
39+ signal showDashHome()
40
40
41 BorderImage {
41 BorderImage {
42 id: background
42 id: background
@@ -57,7 +57,7 @@ Item {
57 id: dashItem
57 id: dashItem
58 width: parent.width
58 width: parent.width
59 height: units.gu(7)
59 height: units.gu(7)
60− onClicked: root.dashItemSelected(0)
60+ onClicked: root.showDashHome()
61 z: 1
61 z: 1
62 Image {
62 Image {
63 objectName: "dashItem"
63 objectName: "dashItem"
Panel/Panel.qml+22
@@ -31,6 +31,28 @@ Item {
31
31
32 signal searchClicked
32 signal searchClicked
33
33
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+
34 PanelBackground {
56 PanelBackground {
35 id: panelBackground
57 id: panelBackground
36 anchors {
58 anchors {
Shell.qml+5−1
@@ -576,6 +576,10 @@ FocusScope {
576 stages.hide()
576 stages.hide()
577 }
577 }
578
578
579+ function hideIndicatorMenu(delay) {
580+ panel.hideIndicatorMenu(delay);
581+ }
582+
579 Item {
583 Item {
580 id: overlay
584 id: overlay
581
585
@@ -667,7 +671,7 @@ FocusScope {
667 dragAreaWidth: shell.edgeSize
671 dragAreaWidth: shell.edgeSize
668 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
672 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
669
673
670− onDashItemSelected: {
674+ onShowDashHome: {
671 if (edgeDemo.running)
675 if (edgeDemo.running)
672 return;
676 return;
673
677
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+15−15
@@ -57,21 +57,6 @@ Indicators.BaseMenuItem {
57
57
58 sourceComponent: loadMessage(actionsDescription);
58 sourceComponent: loadMessage(actionsDescription);
59
59
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−
75 Component {
60 Component {
76 id: simpleTextMessage
61 id: simpleTextMessage
77 SimpleTextMessage {
62 SimpleTextMessage {
@@ -85,10 +70,15 @@ Indicators.BaseMenuItem {
85
70
86 onActivateApp: {
71 onActivateApp: {
87 menuModel.activate(menuIndex, true);
72 menuModel.activate(menuIndex, true);
73+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
88 }
74 }
89 onDismiss: {
75 onDismiss: {
90 menuModel.activate(menuIndex, false);
76 menuModel.activate(menuIndex, false);
91 }
77 }
78+
79+ menuSelected: messageFactoryItem.menuSelected
80+ onSelectMenu: messageFactoryItem.selectMenu()
81+ onDeselectMenu: messageFactoryItem.deselectMenu()
92 }
82 }
93 }
83 }
94 Component {
84 Component {
@@ -115,6 +105,7 @@ Indicators.BaseMenuItem {
115
105
116 onActivateApp: {
106 onActivateApp: {
117 menuModel.activate(menuIndex, true);
107 menuModel.activate(menuIndex, true);
108+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
118 }
109 }
119 onDismiss: {
110 onDismiss: {
120 menuModel.activate(menuIndex, false);
111 menuModel.activate(menuIndex, false);
@@ -122,6 +113,10 @@ Indicators.BaseMenuItem {
122 onReply: {
113 onReply: {
123 replyAction.activate(value);
114 replyAction.activate(value);
124 }
115 }
116+
117+ menuSelected: messageFactoryItem.menuSelected
118+ onSelectMenu: messageFactoryItem.selectMenu()
119+ onDeselectMenu: messageFactoryItem.deselectMenu()
125 }
120 }
126 }
121 }
127 Component {
122 Component {
@@ -157,6 +152,7 @@ Indicators.BaseMenuItem {
157
152
158 onActivateApp: {
153 onActivateApp: {
159 menuModel.activate(menuIndex, true);
154 menuModel.activate(menuIndex, true);
155+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
160 }
156 }
161 onDismiss: {
157 onDismiss: {
162 menuModel.activate(menuIndex, false);
158 menuModel.activate(menuIndex, false);
@@ -167,6 +163,10 @@ Indicators.BaseMenuItem {
167 onReply: {
163 onReply: {
168 replyAction.activate(value);
164 replyAction.activate(value);
169 }
165 }
166+
167+ menuSelected: messageFactoryItem.menuSelected
168+ onSelectMenu: messageFactoryItem.selectMenu()
169+ onDeselectMenu: messageFactoryItem.deselectMenu()
170 }
170 }
171 }
171 }
172 }
172 }
plugins/Unity/Indicators/qml/IndicatorPage.qml+12−1
@@ -140,7 +140,7 @@ IndicatorBase {
140
140
141 onLoaded: {
141 onLoaded: {
142 if (item.hasOwnProperty("menuSelected")) {
142 if (item.hasOwnProperty("menuSelected")) {
143− item.menuSelected = Qt.binding(function() { return mainMenu.selectedIndex == index; });
143+ item.menuSelected = mainMenu.selectedIndex == index;
144 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
144 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
145 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
145 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
146 }
146 }
@@ -157,6 +157,17 @@ IndicatorBase {
157 property: "objectName"
157 property: "objectName"
158 value: model.action
158 value: model.action
159 }
159 }
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+ }
160 }
171 }
161 }
172 }
162 }
173 }
plugins/Unity/Indicators/qml/MenuItemFactory.qml+6
@@ -22,6 +22,7 @@ import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators.Network 0.1 as ICNetwork
22import Unity.Indicators.Network 0.1 as ICNetwork
23import Unity.Indicators.Messaging 0.1 as ICMessaging
23import Unity.Indicators.Messaging 0.1 as ICMessaging
24import QMenuModel 0.1 as QMenuModel
24import QMenuModel 0.1 as QMenuModel
25+import Ubuntu.Components 0.1
25
26
26Item {
27Item {
27 id: menuFactory
28 id: menuFactory
@@ -107,6 +108,7 @@ Item {
107
108
108 onActivate: {
109 onActivate: {
109 menuModel.activate(menuIndex);
110 menuModel.activate(menuIndex);
111+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
110 }
112 }
111 }
113 }
112 }
114 }
@@ -147,6 +149,7 @@ Item {
147
149
148 onActivate: {
150 onActivate: {
149 menuModel.activate(menuIndex);
151 menuModel.activate(menuIndex);
152+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
150 }
153 }
151 }
154 }
152 }
155 }
@@ -164,6 +167,7 @@ Item {
164
167
165 onActivate: {
168 onActivate: {
166 menuModel.activate(menuIndex);
169 menuModel.activate(menuIndex);
170+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
167 }
171 }
168 }
172 }
169 }
173 }
@@ -222,6 +226,7 @@ Item {
222 }
226 }
223 onActivate: {
227 onActivate: {
224 menuModel.activate(menuIndex);
228 menuModel.activate(menuIndex);
229+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
225 }
230 }
226
231
227 function loadAttributes() {
232 function loadAttributes() {
@@ -260,6 +265,7 @@ Item {
260 }
265 }
261 onActivateApp: {
266 onActivateApp: {
262 menuModel.activate(menuIndex, true);
267 menuModel.activate(menuIndex, true);
268+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
263 }
269 }
264 onDismiss: {
270 onDismiss: {
265 menuModel.activate(menuIndex, false);
271 menuModel.activate(menuIndex, false);
tests/qmltests/Dash/tst_GenericScopeView.qml+33−3
@@ -79,14 +79,14 @@ Item {
79 var categoryListView = findChild(genericScopeView, "categoryListView");
79 var categoryListView = findChild(genericScopeView, "categoryListView");
80 categoryListView.positionAtBeginning();
80 categoryListView.positionAtBeginning();
81
81
82− var tile = findChild(genericScopeView, "delegate0");
82+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
83 mouseClick(tile, tile.width / 2, tile.height / 2);
83 mouseClick(tile, tile.width / 2, tile.height / 2);
84 var openEffect = findChild(genericScopeView, "openEffect");
84 var openEffect = findChild(genericScopeView, "openEffect");
85 tryCompare(openEffect, "gap", 1);
85 tryCompare(openEffect, "gap", 1);
86 }
86 }
87
87
88 function checkArrowPosition(index) {
88 function checkArrowPosition(index) {
89− var tile = findChild(genericScopeView, "delegate" + index);
89+ var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
90 var tileCenter = tile.x + tile.width/2;
90 var tileCenter = tile.x + tile.width/2;
91 var pointerArrow = findChild(genericScopeView, "pointerArrow");
91 var pointerArrow = findChild(genericScopeView, "pointerArrow");
92 var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
92 var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
@@ -141,7 +141,7 @@ Item {
141 categoryListView.flick(0, -units.gu(80));
141 categoryListView.flick(0, -units.gu(80));
142 tryCompare(categoryListView.flicking, false);
142 tryCompare(categoryListView.flicking, false);
143
143
144− var tile = findChild(genericScopeView, "delegate0");
144+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
145 mouseClick(tile, tile.width / 2, tile.height - 1);
145 mouseClick(tile, tile.width / 2, tile.height - 1);
146 var openEffect = findChild(genericScopeView, "openEffect");
146 var openEffect = findChild(genericScopeView, "openEffect");
147 tryCompare(openEffect, "gap", 1);
147 tryCompare(openEffect, "gap", 1);
@@ -276,6 +276,36 @@ Item {
276 closePreview();
276 closePreview();
277 tryCompare(previewListView, "open", false);
277 tryCompare(previewListView, "open", false);
278 }
278 }
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+ }
279 }
309 }
280 }
310 }
281}
311}
tests/qmltests/Launcher/tst_Launcher.qml+6−6
@@ -41,9 +41,9 @@ Item {
41 lastSelectedApplication = appId
41 lastSelectedApplication = appId
42 }
42 }
43
43
44− property int dashItemSelected_count: 0
44+ property int showDashHome_count: 0
45− onDashItemSelected: {
45+ onShowDashHome: {
46− dashItemSelected_count++;
46+ showDashHome_count++;
47 }
47 }
48
48
49 property int maxPanelX: 0
49 property int maxPanelX: 0
@@ -138,9 +138,9 @@ Item {
138 }
138 }
139
139
140 /* If I click on the dash icon on the launcher
140 /* If I click on the dash icon on the launcher
141− Launcher::dashItemSelected signal should be emitted */
141+ Launcher::showDashHome signal should be emitted */
142 function test_clickingOnDashIconCausesSignalEmission() {
142 function test_clickingOnDashIconCausesSignalEmission() {
143− launcher.dashItemSelected_count = 0
143+ launcher.showDashHome_count = 0
144
144
145 revealer.dragLauncherIntoView()
145 revealer.dragLauncherIntoView()
146
146
@@ -149,7 +149,7 @@ Item {
149
149
150 mouseClick(dashIcon, dashIcon.width/2, dashIcon.height/2)
150 mouseClick(dashIcon, dashIcon.width/2, dashIcon.height/2)
151
151
152− tryCompare(launcher, "dashItemSelected_count", 1)
152+ tryCompare(launcher, "showDashHome_count", 1)
153
153
154 // Tapping on the dash icon also dismisses the launcher
154 // Tapping on the dash icon also dismisses the launcher
155 revealer.waitUntilLauncherDisappears()
155 revealer.waitUntilLauncherDisappears()
tests/qmltests/Panel/tst_Panel.qml+14
@@ -264,5 +264,19 @@ Item {
264
264
265 compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
265 compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
266 }
266 }
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+ }
267 }
281 }
268}
282}