on xenial help sign in
MenuItemFactory: don't use a special standard menu for settings items, but a correct linkMenu
a3d0091Marco Trevisan (Treviño)
qml/Panel/Indicators/MenuItemFactory.qml+20−25
@@ -251,34 +251,18 @@ Item {
251 onTriggered: {
251 onTriggered: {
252 menuModel.activate(menuIndex);
252 menuModel.activate(menuIndex);
253 }
253 }
254−
255− // FIXME : At the moment, the indicators aren't using
256− // com.canonical.indicators.link for settings menu. Need to fudge it.
257− property bool settingsMenu: menuData && menuData.action.indexOf("settings") > -1 || false
258− backColor: settingsMenu ? Qt.rgba(1,1,1,0.07) : "transparent"
259− component: settingsMenu ? buttonForSettings : undefined
260− Component {
261− id: buttonForSettings
262− Icon {
263− name: "settings"
264− height: units.gu(3)
265− width: height
266− color: theme.palette.normal.backgroundText
267− }
268− }
269 }
254 }
270 }
255 }
271
256
272 Component {
257 Component {
273 id: linkMenu;
258 id: linkMenu;
274
259
275− Menus.StandardMenu {
260+ Menus.BaseLayoutMenu {
276 objectName: "linkMenu"
261 objectName: "linkMenu"
277 property QtObject menuData: null
262 property QtObject menuData: null
278 property int menuIndex: -1
263 property int menuIndex: -1
279
264
280 text: menuData && menuData.label || ""
265 text: menuData && menuData.label || ""
281− iconSource: menuData && menuData.icon || ""
282 enabled: menuData && menuData.sensitive || false
266 enabled: menuData && menuData.sensitive || false
283 highlightWhenPressed: false
267 highlightWhenPressed: false
284
268
@@ -288,15 +272,21 @@ Item {
288
272
289 backColor: Qt.rgba(1,1,1,0.07)
273 backColor: Qt.rgba(1,1,1,0.07)
290
274
291− component: menuData.icon ? icon : undefined
292− Component {
293− id: icon
294− Icon {
275+ slots: Icon {
276+ source: {
277+ if (menuData) {
295− source: menuData.icon
278+ if (menuData.icon && menuData.icon != "") {
296− height: units.gu(3)
279+ return menuData.icon
297− width: height
280+ } else if (menuData.action.indexOf("settings") > -1) {
298− color: theme.palette.normal.backgroundText
281+ return "image://theme/settings"
282+ }
283+ }
284+ return ""
299 }
285 }
286+ height: units.gu(3)
287+ width: height
288+ color: theme.palette.normal.backgroundText
289+ SlotsLayout.position: SlotsLayout.Trailing
300 }
290 }
301 }
291 }
302 }
292 }
@@ -1073,6 +1063,11 @@ Item {
1073 if (modelData.isSeparator) {
1063 if (modelData.isSeparator) {
1074 return separatorMenu;
1064 return separatorMenu;
1075 }
1065 }
1066+ if (modelData.action !== undefined && modelData.action.indexOf("settings") > -1) {
1067+ // FIXME : At the moment, the indicators aren't using
1068+ // com.canonical.indicators.link for settings menu. Need to fudge it.
1069+ return linkMenu;
1070+ }
1076 return standardMenu;
1071 return standardMenu;
1077 }
1072 }
1078}
1073}
tests/mocks/Unity/Indicators/fakeindicatorsmodeldata.js+1−1
@@ -1262,7 +1262,7 @@ var fakeMenuData = {
1262 "icon": "",
1262 "icon": "",
1263 "type": "",
1263 "type": "",
1264 "ext": {},
1264 "ext": {},
1265− "action": "indicator.key-map",
1265+ "action": "indicator.key-map.settings",
1266 "actionState": "",
1266 "actionState": "",
1267 "isCheck": false,
1267 "isCheck": false,
1268 "isRadio": false,
1268 "isRadio": false,