@@ -31,7 +31,7 @@ Item {
3131 property var rootModel: null
3232 property var menuModel: null
3333
34− property var _map: {
34+ readonly property var _map: {
3535 "default": {
3636 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
3737 "unity.widgets.systemsettings.tablet.switch" : switchMenu,
@@ -69,8 +69,21 @@ Item {
6969 "indicator.guest-menu-item": Platform.isPC ? userMenuItem : null,
7070 "com.canonical.indicator.switch": Math.min(Screen.width, Screen.height) > units.gu(60) ? switchMenu : null // Desktop mode switch
7171 },
72− "indicator-messages" : {
73− "com.canonical.indicator.button" : messagesButtonMenu
72+ "indicator-messages": {
73+ "com.canonical.indicator.button": messagesButtonMenu
74+ }
75+ }
76+
77+ readonly property var _action_filter_map: {
78+ "indicator-session": {
79+ "indicator.logout": Platform.isPC ? undefined : null,
80+ "indicator.suspend": Platform.isPC ? undefined : null,
81+ "indicator.hibernate": Platform.isPC ? undefined : null,
82+ "indicator.reboot": Platform.isPC ? undefined : null
83+ },
84+ "indicator-keyboard": {
85+ "indicator.map": null,
86+ "indicator.chart": null
7487 }
7588 }
7689
@@ -1016,21 +1029,12 @@ Item {
10161029 if (context.indexOf("fake-") == 0)
10171030 context = context.substring("fake-".length)
10181031
1019− // tweak indicator-session items
1020− if (context === "indicator-session") {
1021− if ((modelData.action === "indicator.logout" || modelData.action === "indicator.suspend" || modelData.action === "indicator.hibernate" ||
1022− modelData.action === "indicator.reboot")
1023− && !Platform.isPC) {
1024− return null; // logout, suspend and hibernate hidden on devices
1025− }
1026− }
1027−
1028− // specialize for indicator-keyboard
1029− if (context === "indicator-keyboard") {
1030− if (modelData.isRadio) {
1031− return keymapMenu;
1032− } else if (modelData.action === "indicator.map" || modelData.action === "indicator.chart") {
1033− return null; // map and chart not available
1032+ if (modelData.action !== undefined && modelData.action !== "") {
1033+ var contextFilter = _action_filter_map[context]
1034+ if (contextFilter !== undefined) {
1035+ var component = contextFilter[modelData.action];
1036+ if (component !== undefined)
1037+ return component
10341038 }
10351039 }
10361040