on xenial help sign in
Fixed up MenuItem names & bindings
b6d73b6Nick Dedekind
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+63−45
@@ -24,12 +24,32 @@ import Unity.Indicators 0.1 as Indicators
24import QMenuModel 0.1 as QMenuModel
24import QMenuModel 0.1 as QMenuModel
25
25
26Indicators.BaseMenuItem {
26Indicators.BaseMenuItem {
27+ id: messageFactoryItem
28+ property var menuModel: null
27− id: menuItem
29+ property QtObject menuItem: null
28− property var actionsDescription: menu ? menu.ext.xCanonicalMessageActions : undefined
30+ property var menuIndex: undefined
29
31
30− implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
32+ property var extAttrib: menuItem && menuItem.ext ? menuItem.ext : undefined
33+ property var actionsDescription: extAttrib && extAttrib.hasOwnProperty("xCanonicalMessageActions") ? extAttrib.xCanonicalMessageActions : undefined
34+
35+ onMenuModelChanged: {
36+ loadAttributes();
37+ }
38+ onMenuIndexChanged: {
39+ loadAttributes();
40+ }
31
41
32− property var model: null
42+ function loadAttributes() {
43+ if (!menuModel || menuIndex == undefined) return;
44+
45+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-time': 'int64',
46+ 'x-canonical-text': 'string',
47+ 'x-canonical-message-actions': 'variant',
48+ 'icon': 'icon',
49+ 'x-canonical-app-icon': 'icon'});
50+ }
51+
52+ implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
33
53
34 Loader {
54 Loader {
35 id: contents
55 id: contents
@@ -46,13 +66,6 @@ Indicators.BaseMenuItem {
46 when: (contents.status == Loader.Ready)
66 when: (contents.status == Loader.Ready)
47 }
67 }
48
68
49− Binding {
50− target: contents.item
51− property: "menu"
52− value: menu
53− when: (contents.status == Loader.Ready)
54− }
55−
56 Connections {
69 Connections {
57 target: contents.item ? contents.item : null
70 target: contents.item ? contents.item : null
58 onSelectMenu: selectMenu()
71 onSelectMenu: selectMenu()
@@ -63,46 +76,48 @@ Indicators.BaseMenuItem {
63 id: simpleTextMessage
76 id: simpleTextMessage
64 SimpleTextMessage {
77 SimpleTextMessage {
65 // text
78 // text
66− title: menu && menu.label ? menu.label : ""
79+ title: menuItem && menuItem.label ? menuItem.label : ""
67− time: menu ? menu.ext.xCanonicalTime : 0
80+ time: extAttrib && extAttrib.hasOwnProperty("xCanonicalTime") ? extAttrib.xCanonicalTime : 0
68− message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
81+ message: extAttrib && extAttrib.hasOwnProperty("xCanonicalText") ? extAttrib.xCanonicalText : ""
69 // icons
82 // icons
70− avatar: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
83+ avatar: extAttrib && extAttrib.hasOwnProperty("icon") ? extAttrib.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
71− appIcon: menu && menu.ext.xCanonicalAppIcon !== undefined ? menu.ext.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
84+ appIcon: extAttrib && extAttrib.hasOwnProperty("xCanonicalAppIcon") ? extAttrib.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
72
85
73 onActivateApp: {
86 onActivateApp: {
74− menuItem.model.activate(modelIndex, true);
87+ menuModel.activate(menuIndex, true);
75 }
88 }
76 onDismiss: {
89 onDismiss: {
77− menuItem.model.activate(modelIndex, false);
90+ menuModel.activate(menuIndex, false);
78 }
91 }
79 }
92 }
80 }
93 }
81 Component {
94 Component {
82 id: textMessage
95 id: textMessage
83 TextMessage {
96 TextMessage {
97+ property var replyActionDescription: actionsDescription && actionsDescription.length > 0 ? actionsDescription[0] : undefined
98+
84 property var replyAction: QMenuModel.UnityMenuAction {
99 property var replyAction: QMenuModel.UnityMenuAction {
85− model: menuItem.model
100+ model: menuModel
86− index: modelIndex
101+ index: menuIndex
87− name: menu && actionsDescription[0].name ? actionsDescription[0].name : ""
102+ name: replyActionDescription !== undefined ? replyActionDescription.name : ""
88 }
103 }
89
104
90 // text
105 // text
91− title: menu && menu.label ? menu.label : ""
106+ title: menuItem && menuItem.label ? menuItem.label : ""
92− time: menu ? menu.ext.xCanonicalTime : 0
107+ time: extAttrib && extAttrib.hasOwnProperty("xCanonicalTime") ? extAttrib.xCanonicalTime : 0
93− message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
108+ message: extAttrib && extAttrib.hasOwnProperty("xCanonicalText") ? extAttrib.xCanonicalText : ""
94− replyButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Send"
109+ replyButtonText: replyActionDescription !== undefined && replyActionDescription.hasOwnProperty("label") ? replyActionDescription.label : "Send"
95 // icons
110 // icons
96− avatar: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
111+ avatar: extAttrib && extAttrib.hasOwnProperty("icon") ? extAttrib.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
97− appIcon: menu && menu.ext.xCanonicalAppIcon !== undefined ? menu.ext.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
112+ appIcon: extAttrib && extAttrib.hasOwnProperty("xCanonicalAppIcon") ? extAttrib.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
98 // actions
113 // actions
99 replyEnabled: replyAction.valid && replyAction.enabled
114 replyEnabled: replyAction.valid && replyAction.enabled
100
115
101 onActivateApp: {
116 onActivateApp: {
102− menuItem.model.activate(modelIndex, true);
117+ menuModel.activate(menuIndex, true);
103 }
118 }
104 onDismiss: {
119 onDismiss: {
105− menuItem.model.activate(modelIndex, false);
120+ menuModel.activate(menuIndex, false);
106 }
121 }
107 onReply: {
122 onReply: {
108 replyAction.activate(value);
123 replyAction.activate(value);
@@ -112,36 +127,39 @@ Indicators.BaseMenuItem {
112 Component {
127 Component {
113 id: snapDecision
128 id: snapDecision
114 SnapDecision {
129 SnapDecision {
130+ property var activateActionDescription: actionsDescription && actionsDescription.length > 0 ? actionsDescription[0] : undefined
131+ property var replyActionDescription: actionsDescription && actionsDescription.length > 1 ? actionsDescription[1] : undefined
132+
115 property var activateAction: QMenuModel.UnityMenuAction {
133 property var activateAction: QMenuModel.UnityMenuAction {
116− model: menuItem.model
134+ model: menuModel
117− index: modelIndex
135+ index: menuIndex
118− name: menu && actionsDescription[0].name ? actionsDescription[0].name : ""
136+ name: activateActionDescription !== undefined ? activateActionDescription.name : ""
119 }
137 }
120 property var replyAction: QMenuModel.UnityMenuAction {
138 property var replyAction: QMenuModel.UnityMenuAction {
121− model: menuItem.model
139+ model: menuModel
122− index: modelIndex
140+ index: menuIndex
123− name: menu && actionsDescription[1].name ? actionsDescription[1].name : ""
141+ name: replyActionDescription !== undefined ? replyActionDescription.name : ""
124 }
142 }
125
143
126 // text
144 // text
127− title: menu && menu.label ? menu.label : ""
145+ title: menuItem && menuItem.label ? menuItem.label : ""
128− time: menu ? menu.ext.xCanonicalTime : ""
146+ time: extAttrib && extAttrib.hasOwnProperty("xCanonicalTime") ? extAttrib.xCanonicalTime : ""
129− message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
147+ message: extAttrib && extAttrib.hasOwnProperty("xCanonicalText") ? extAttrib.xCanonicalText : ""
130− actionButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Call back"
148+ actionButtonText: activateActionDescription !== undefined && activateActionDescription.hasOwnProperty("label") ? activateActionDescription.label : "Call back"
131− replyButtonText: actionsDescription && actionsDescription[1].label ? actionsDescription[1].label : "Send"
149+ replyButtonText: replyActionDescription !== undefined && replyActionDescription.hasOwnProperty("label") ? replyActionDescription.label : "Send"
132− replyMessages: actionsDescription && actionsDescription[1]["parameter-hint"] ? actionsDescription[1]["parameter-hint"] : ""
150+ replyMessages: replyActionDescription !== undefined && replyActionDescription.hasOwnProperty("parameter-hint") ? replyActionDescription["parameter-hint"] : ""
133 // icons
151 // icons
134− avatar: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
152+ avatar: extAttrib && extAttrib.hasOwnProperty("icon") ? extAttrib.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
135− appIcon: menu && menu.ext.xCanonicalAppIcon !== undefined ? menu.ext.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
153+ appIcon: extAttrib && extAttrib.hasOwnProperty("xCanonicalAppIcon") ? extAttrib.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
136 // actions
154 // actions
137 activateEnabled: activateAction.valid && activateAction.enabled
155 activateEnabled: activateAction.valid && activateAction.enabled
138 replyEnabled: replyAction.valid && replyAction.enabled
156 replyEnabled: replyAction.valid && replyAction.enabled
139
157
140 onActivateApp: {
158 onActivateApp: {
141− menuItem.model.activate(modelIndex, true);
159+ menuModel.activate(menuIndex, true);
142 }
160 }
143 onDismiss: {
161 onDismiss: {
144− menuItem.model.activate(modelIndex, false);
162+ menuModel.activate(menuIndex, false);
145 }
163 }
146 onActivate: {
164 onActivate: {
147 activateAction.activate();
165 activateAction.activate();
plugins/Unity/Indicators/qml/IndicatorPage.qml+6−3
@@ -144,8 +144,11 @@ IndicatorBase {
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− if (item.hasOwnProperty("menu")) {
147+ if (item.hasOwnProperty("menuItem")) {
148− item.menu = Qt.binding(function() { return model; });
148+ item.menuItem = Qt.binding(function() { return model; });
149+ }
150+ if (item.hasOwnProperty("menuIndex")) {
151+ item.menuIndex = Qt.binding(function() { return modelIndex; });
149 }
152 }
150 }
153 }
151
154
@@ -160,7 +163,7 @@ IndicatorBase {
160
163
161 MenuItemFactory {
164 MenuItemFactory {
162 id: factory
165 id: factory
163− model: mainMenu.model
166+ menuModel: mainMenu.model
164 }
167 }
165
168
166 Components.Label {
169 Components.Label {
plugins/Unity/Indicators/qml/MenuItemFactory.qml+118−78
@@ -26,7 +26,7 @@ import QMenuModel 0.1 as QMenuModel
26Item {
26Item {
27 id: menuFactory
27 id: menuFactory
28
28
29− property var model: null
29+ property var menuModel: null
30
30
31 property var _map: {
31 property var _map: {
32 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
32 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
@@ -54,84 +54,99 @@ Item {
54 Component {
54 Component {
55 id: sliderMenu;
55 id: sliderMenu;
56 Indicators.SliderMenuItem {
56 Indicators.SliderMenuItem {
57− property QtObject menu: null
57+ property QtObject menuItem: null
58+ property var menuModel: menuFactory.menuModel
59+ property var menuIndex: undefined
60+ property var extAttrib: menuItem && menuItem.ext ? menuItem.ext : undefined
58
61
59− text: menu && menu.label ? menu.label : ""
62+ text: menuItem && menuItem.label ? menuItem.label : ""
60− icon: menu && menu.icon ? menu.icon : ""
63+ icon: menuItem && menuItem.icon ? menuItem.icon : ""
61− minIcon: menu && menu.ext.minIcon ? menu.ext.minIcon : ""
64+ minIcon: extAttrib && extAttrib.hasOwnProperty("minIcon") ? extAttrib.minIcon : ""
62− maxIcon: menu && menu.ext.maxIcon ? menu.ext.maxIcon : ""
65+ maxIcon: extAttrib && extAttrib.hasOwnProperty("maxIcon") ? extAttrib.maxIcon : ""
63
66
64− minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
67+ minimumValue: extAttrib && extAttrib.hasOwnProperty("minValue") ? extAttrib.minValue : 0.0
65 maximumValue: {
68 maximumValue: {
66− var maximum = menu.ext.maxValue ? menu.ext.maxValue : 1.0
69+ var maximum = extAttrib && extAttrib.hasOwnProperty("maxValue") ? extAttrib.maxValue : 1.0
67 if (maximum <= minimumValue) {
70 if (maximum <= minimumValue) {
68 return minimumValue + 1;
71 return minimumValue + 1;
69 }
72 }
70 return maximum;
73 return maximum;
71 }
74 }
72− value: menu ? menu.actionState : 0.0
75+ value: menuItem ? menuItem.actionState : 0.0
73− enabled: menu ? menu.sensitive : false
76+ enabled: menuItem ? menuItem.sensitive : false
74
77
75− Component.onCompleted: {
78+ onMenuModelChanged: {
79+ loadAttributes();
80+ }
81+ onMenuIndexChanged: {
82+ loadAttributes();
83+ }
84+ onChangeState: {
85+ menuModel.changeState(menuIndex, value);
86+ }
87+
88+ function loadAttributes() {
89+ if (!menuModel || menuIndex == undefined) return;
76− model.loadExtendedAttributes(modelIndex, {'min-value': 'double',
90+ menuModel.loadExtendedAttributes(menuIndex, {'min-value': 'double',
77 'max-value': 'double',
91 'max-value': 'double',
78 'min-icon': 'icon',
92 'min-icon': 'icon',
79 'max-icon': 'icon'});
93 'max-icon': 'icon'});
80 }
94 }
81−
82− onChangeState: {
83− model.changeState(modelIndex, value);
84− }
85 }
95 }
86 }
96 }
87
97
88 Component {
98 Component {
89 id: buttonMenu;
99 id: buttonMenu;
90 Indicators.ButtonMenuItem {
100 Indicators.ButtonMenuItem {
91− property QtObject menu: null
101+ property QtObject menuItem: null
102+ property var menuModel: menuFactory.menuModel
103+ property var menuIndex: undefined
92
104
93− text: menu && menu.label ? menu.label : ""
105+ text: menuItem && menuItem.label ? menuItem.label : ""
94− enabled: menu ? menu.sensitive : false
106+ enabled: menuItem ? menuItem.sensitive : false
95
107
96 onActivate: {
108 onActivate: {
97− model.activate(modelIndex);
109+ menuModel.activate(menuIndex);
98 }
110 }
99 }
111 }
100 }
112 }
101 Component {
113 Component {
102 id: sectionMenu;
114 id: sectionMenu;
103 Indicators.SectionMenuItem {
115 Indicators.SectionMenuItem {
104− property QtObject menu: null
116+ property QtObject menuItem: null
117+ property var menuIndex: undefined
105
118
106− text: menu && menu.label ? menu.label : ""
119+ text: menuItem && menuItem.label ? menuItem.label : ""
107 }
120 }
108 }
121 }
109
122
110 Component {
123 Component {
111 id: progressMenu;
124 id: progressMenu;
112 Indicators.ProgressMenuItem {
125 Indicators.ProgressMenuItem {
113− property QtObject menu: null
126+ property QtObject menuItem: null
127+ property var menuIndex: undefined
114
128
115− text: menu && menu.label ? menu.label : ""
129+ text: menuItem && menuItem.label ? menuItem.label : ""
116− icon: menu ? menu.icon : ""
130+ icon: menuItem ? menuItem.icon : ""
117− value : menu ? menu.actionState : 0.0
131+ value : menuItem ? menuItem.actionState : 0.0
118− enabled: menu ? menu.sensitive : false
132+ enabled: menuItem ? menuItem.sensitive : false
119 }
133 }
120 }
134 }
121
135
122 Component {
136 Component {
123 id: standardMenu;
137 id: standardMenu;
124 Indicators.StandardMenuItem {
138 Indicators.StandardMenuItem {
125− property QtObject menu: null
139+ property QtObject menuItem: null
140+ property var menuIndex: undefined
126
141
127− text: menu && menu.label ? menu.label : ""
142+ text: menuItem && menuItem.label ? menuItem.label : ""
128− icon: menu && menu.icon ? menu.icon : ""
143+ icon: menuItem && menuItem.icon ? menuItem.icon : ""
129− checkable: menu ? (menu.isCheck || menu.isRadio) : false
144+ checkable: menuItem ? (menuItem.isCheck || menuItem.isRadio) : false
130− checked: checkable ? menu.isToggled : false
145+ checked: checkable ? menuItem.isToggled : false
131− enabled: menu ? menu.sensitive : false
146+ enabled: menuItem ? menuItem.sensitive : false
132
147
133 onActivate: {
148 onActivate: {
134− model.activate(modelIndex);
149+ menuModel.activate(menuIndex);
135 }
150 }
136 }
151 }
137 }
152 }
@@ -139,15 +154,16 @@ Item {
139 Component {
154 Component {
140 id: switchMenu;
155 id: switchMenu;
141 Indicators.SwitchMenuItem {
156 Indicators.SwitchMenuItem {
142− property QtObject menu: null
157+ property QtObject menuItem: null
158+ property var menuIndex: undefined
143
159
144− text: menu && menu.label ? menu.label : ""
160+ text: menuItem && menuItem.label ? menuItem.label : ""
145− icon: menu && menu.icon ? menu.icon : ""
161+ icon: menuItem && menuItem.icon ? menuItem.icon : ""
146− checked: menu ? menu.isToggled : false
162+ checked: menuItem ? menuItem.isToggled : false
147− enabled: menu ? menu.sensitive : false
163+ enabled: menuItem ? menuItem.sensitive : false
148
164
149 onActivate: {
165 onActivate: {
150− model.activate(modelIndex);
166+ menuModel.activate(menuIndex);
151 }
167 }
152 }
168 }
153 }
169 }
@@ -155,13 +171,24 @@ Item {
155 Component {
171 Component {
156 id: wifiSection;
172 id: wifiSection;
157 Indicators.SectionMenuItem {
173 Indicators.SectionMenuItem {
158− property QtObject menu: null
174+ property QtObject menuItem: null
175+ property var menuModel: menuFactory.menuModel
176+ property var menuIndex: undefined
177+ property var extAttrib: menuItem && menuItem.ext ? menuItem.ext : undefined
178+
179+ text: menuItem && menuItem.label ? menuItem.label : ""
180+ busy: extAttrib && extAttrib.hasOwnProperty("xCanonicalBusyAction") ? extAttrib.xCanonicalBusyAction : false
159
181
160− text: menu && menu.label ? menu.label : ""
182+ onMenuModelChanged: {
161− busy: menu ? menu.ext.xCanonicalBusyAction : false
183+ loadAttributes();
184+ }
185+ onMenuIndexChanged: {
186+ loadAttributes();
187+ }
162
188
163− Component.onCompleted: {
189+ function loadAttributes() {
190+ if (!menuModel || menuIndex == undefined) return;
164− model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});
191+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-busy-action': 'bool'})
165 }
192 }
166 }
193 }
167 }
194 }
@@ -169,27 +196,39 @@ Item {
169 Component {
196 Component {
170 id: accessPoint;
197 id: accessPoint;
171 ICNetwork.AccessPoint {
198 ICNetwork.AccessPoint {
172− property QtObject menu: null
199+ property QtObject menuItem: null
200+ property var menuModel: menuFactory.menuModel
201+ property var menuIndex: undefined
202+ property var extAttrib: menuItem && menuItem.ext ? menuItem.ext : undefined
203+
173 property var strengthAction: QMenuModel.UnityMenuAction {
204 property var strengthAction: QMenuModel.UnityMenuAction {
174− model: menuFactory.model ? menuFactory.model : null
205+ model: menuModel
175− index: modelIndex
206+ index: menuIndex
176− name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
207+ name: extAttrib && extAttrib.hasOwnProperty("xCanonicalWifiApStrengthAction") ? extAttrib.xCanonicalWifiApStrengthAction : ""
177 }
208 }
178
209
179− text: menu && menu.label ? menu.label : ""
210+ text: menuItem && menuItem.label ? menuItem.label : ""
180− secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
211+ secure: extAttrib && extAttrib.hasOwnProperty("xCanonicalWifiApIsSecure") ? extAttrib.xCanonicalWifiApIsSecure : false
181− adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
212+ adHoc: extAttrib && extAttrib.hasOwnProperty("xCanonicalWifiApIsAdhoc") ? extAttrib.xCanonicalWifiApIsAdhoc : false
182− checked: menu ? menu.isToggled : false
213+ checked: menuItem ? menuItem.isToggled : false
183 signalStrength: strengthAction.valid ? strengthAction.state : 0
214 signalStrength: strengthAction.valid ? strengthAction.state : 0
184− enabled: menu ? menu.sensitive : false
215+ enabled: menuItem ? menuItem.sensitive : false
185
216
186− Component.onCompleted: {
217+ onMenuModelChanged: {
187− model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
218+ loadAttributes();
188− 'x-canonical-wifi-ap-is-secure': 'bool',
219+ }
189− 'x-canonical-wifi-ap-strength-action': 'string'});
220+ onMenuIndexChanged: {
221+ loadAttributes();
190 }
222 }
191 onActivate: {
223 onActivate: {
192− model.activate(modelIndex);
224+ menuModel.activate(menuIndex);
225+ }
226+
227+ function loadAttributes() {
228+ if (!menuModel || menuIndex == undefined) return;
229+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
230+ 'x-canonical-wifi-ap-is-secure': 'bool',
231+ 'x-canonical-wifi-ap-strength-action': 'string'});
193 }
232 }
194 }
233 }
195 }
234 }
@@ -197,37 +236,38 @@ Item {
197 Component {
236 Component {
198 id: messageItem
237 id: messageItem
199 ICMessaging.MessageMenuItemFactory {
238 ICMessaging.MessageMenuItemFactory {
200−
239+ menuModel: menuFactory.menuModel
201− property QtObject menu: null
202− model: menuFactory.model ? menuFactory.model : null
203−
204− Component.onCompleted: {
205− model.loadExtendedAttributes(modelIndex, {'x-canonical-time': 'int64',
206− 'x-canonical-text': 'string',
207− 'x-canonical-message-actions': 'variant',
208− 'icon': 'icon',
209− 'x-canonical-app-icon': 'icon'});
210− }
211 }
240 }
212 }
241 }
213
242
214 Component {
243 Component {
215 id: groupedMessage
244 id: groupedMessage
216 ICMessaging.GroupedMessage {
245 ICMessaging.GroupedMessage {
217− property QtObject menu: null
246+ property QtObject menuItem: null
247+ property var menuModel: menuFactory.menuModel
248+ property var menuIndex: undefined
249+ property var extAttrib: menuItem && menuItem.ext ? menuItem.ext : undefined
218
250
219− title: menu && menu.label ? menu.label : ""
251+ title: menuItem && menuItem.label ? menuItem.label : ""
220− count: menu && menu.actionState[0] ? menu.actionState[0] : "0"
252+ count: menuItem && menuItem.actionState.length > 0 ? menuItem.actionState[0] : "0"
221− appIcon: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_app.svg"
253+ appIcon: extAttrib && extAttrib.hasOwnProperty("icon") ? extAttrib.icon : "qrc:/indicators/artwork/messaging/default_app.svg"
222
254
223− Component.onCompleted: {
255+ onMenuModelChanged: {
224− model.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
256+ loadAttributes();
257+ }
258+ onMenuIndexChanged: {
259+ loadAttributes();
225 }
260 }
226 onActivateApp: {
261 onActivateApp: {
227− model.activate(modelIndex, true);
262+ menuModel.activate(menuIndex, true);
228 }
263 }
229 onDismiss: {
264 onDismiss: {
230− model.activate(modelIndex, false);
265+ menuModel.activate(menuIndex, false);
266+ }
267+
268+ function loadAttributes() {
269+ if (!menuModel || menuIndex == undefined) return;
270+ menuModel.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
231 }
271 }
232 }
272 }
233 }
273 }