on xenial help sign in
Merge
c6b0f38Albert Astals
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"
Shell.qml+1−1
@@ -667,7 +667,7 @@ FocusScope {
667 dragAreaWidth: shell.edgeSize
667 dragAreaWidth: shell.edgeSize
668 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
668 available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
669
669
670− onDashItemSelected: {
670+ onShowDashHome: {
671 if (edgeDemo.running)
671 if (edgeDemo.running)
672 return;
672 return;
673
673
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+12−22
@@ -37,28 +37,6 @@ Indicators.BaseMenuItem {
37
37
38 sourceComponent: loadMessage(actionsDescription);
38 sourceComponent: loadMessage(actionsDescription);
39
39
40− // Binding all properties for the item, to make sure that any change in the
41− // property will be propagated to the contents.item at any time
42− Binding {
43− target: contents.item
44− property: "menuSelected"
45− value: menuSelected
46− when: (contents.status == Loader.Ready)
47− }
48−
49− Binding {
50− target: contents.item
51− property: "menu"
52− value: menu
53− when: (contents.status == Loader.Ready)
54− }
55−
56− Connections {
57− target: contents.item ? contents.item : null
58− onSelectMenu: selectMenu()
59− onDeselectMenu: deselectMenu()
60− }
61−
62 Component {
40 Component {
63 id: simpleTextMessage
41 id: simpleTextMessage
64 SimpleTextMessage {
42 SimpleTextMessage {
@@ -76,6 +54,10 @@ Indicators.BaseMenuItem {
76 onDismiss: {
54 onDismiss: {
77 menuItem.model.activate(modelIndex, false);
55 menuItem.model.activate(modelIndex, false);
78 }
56 }
57+
58+ menuSelected: menuItem.menuSelected
59+ onSelectMenu: menuItem.selectMenu()
60+ onDeselectMenu: menuItem.deselectMenu()
79 }
61 }
80 }
62 }
81 Component {
63 Component {
@@ -107,6 +89,10 @@ Indicators.BaseMenuItem {
107 onReply: {
89 onReply: {
108 replyAction.activate(value);
90 replyAction.activate(value);
109 }
91 }
92+
93+ menuSelected: menuItem.menuSelected
94+ onSelectMenu: menuItem.selectMenu()
95+ onDeselectMenu: menuItem.deselectMenu()
110 }
96 }
111 }
97 }
112 Component {
98 Component {
@@ -149,6 +135,10 @@ Indicators.BaseMenuItem {
149 onReply: {
135 onReply: {
150 replyAction.activate(value);
136 replyAction.activate(value);
151 }
137 }
138+
139+ menuSelected: menuItem.menuSelected
140+ onSelectMenu: menuItem.selectMenu()
141+ onDeselectMenu: menuItem.deselectMenu()
152 }
142 }
153 }
143 }
154 }
144 }
plugins/Unity/Indicators/qml/IndicatorPage.qml+13−1
@@ -140,10 +140,11 @@ 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 }
147+
147 if (item.hasOwnProperty("menu")) {
148 if (item.hasOwnProperty("menu")) {
148 item.menu = Qt.binding(function() { return model; });
149 item.menu = Qt.binding(function() { return model; });
149 }
150 }
@@ -154,6 +155,17 @@ IndicatorBase {
154 property: "objectName"
155 property: "objectName"
155 value: model.action
156 value: model.action
156 }
157 }
158+
159+ // TODO: Fixes lp#1243146
160+ // This is a workaround for a Qt bug. https://bugreports.qt-project.org/browse/QTBUG-34351
161+ Connections {
162+ target: mainMenu
163+ onSelectedIndexChanged: {
164+ if (loader.item && loader.item.hasOwnProperty("menuSelected")) {
165+ loader.item.menuSelected = mainMenu.selectedIndex == index;
166+ }
167+ }
168+ }
157 }
169 }
158 }
170 }
159 }
171 }
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()