on xenial help sign in
Replaced indicator page dynamic menuSelected binding with Connection to listview selectedIndex property. Fixes: https://bugs.launchpad.net/bugs/1243146.

Approved by PS Jenkins bot, Michał Sawicz.

commit5411ba97c7acf1a26cb18e2f2a2dcbb4a3f89620 authorNick Dedekind <nicholas.dedekind@gmail.com> dateTue 10 Dec 2013, 19:41 (13 years ago) parent98a3fdaa1389c0
2 files changed+25−23
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+12−22 plugins/Unity/Indicators/qml/IndicatorPage.qml+13−1
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+12−22
@@ -37,28 +37,6 @@ Indicators.BaseMenuItem {
3737
3838 sourceComponent: loadMessage(actionsDescription);
3939
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−
6240 Component {
6341 id: simpleTextMessage
6442 SimpleTextMessage {
@@ -76,6 +54,10 @@ Indicators.BaseMenuItem {
7654 onDismiss: {
7755 menuItem.model.activate(modelIndex, false);
7856 }
57+
58+ menuSelected: menuItem.menuSelected
59+ onSelectMenu: menuItem.selectMenu()
60+ onDeselectMenu: menuItem.deselectMenu()
7961 }
8062 }
8163 Component {
@@ -107,6 +89,10 @@ Indicators.BaseMenuItem {
10789 onReply: {
10890 replyAction.activate(value);
10991 }
92+
93+ menuSelected: menuItem.menuSelected
94+ onSelectMenu: menuItem.selectMenu()
95+ onDeselectMenu: menuItem.deselectMenu()
11096 }
11197 }
11298 Component {
@@ -149,6 +135,10 @@ Indicators.BaseMenuItem {
149135 onReply: {
150136 replyAction.activate(value);
151137 }
138+
139+ menuSelected: menuItem.menuSelected
140+ onSelectMenu: menuItem.selectMenu()
141+ onDeselectMenu: menuItem.deselectMenu()
152142 }
153143 }
154144 }
plugins/Unity/Indicators/qml/IndicatorPage.qml+13−1
@@ -140,10 +140,11 @@ 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 }
147+
147148 if (item.hasOwnProperty("menu")) {
148149 item.menu = Qt.binding(function() { return model; });
149150 }
@@ -154,6 +155,17 @@ IndicatorBase {
154155 property: "objectName"
155156 value: model.action
156157 }
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+ }
157169 }
158170 }
159171 }