@@ -32,31 +32,36 @@ Item {
3232 property var menuModel: null
3333
3434 property var _map: {
35− "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
36− "unity.widgets.systemsettings.tablet.switch" : switchMenu,
37−
38− "com.canonical.indicator.button" : buttonMenu,
39− "com.canonical.indicator.div" : separatorMenu,
40− "com.canonical.indicator.section" : sectionMenu,
41− "com.canonical.indicator.progress" : progressMenu,
42− "com.canonical.indicator.slider" : sliderMenu,
43− "com.canonical.indicator.switch" : switchMenu,
44− "com.canonical.indicator.alarm" : alarmMenu,
45− "com.canonical.indicator.appointment" : appointmentMenu,
46− "com.canonical.indicator.transfer" : transferMenu,
47− "com.canonical.indicator.button-section" : buttonSectionMenu,
48−
49− "com.canonical.indicator.messages.messageitem" : messageItem,
50− "com.canonical.indicator.messages.sourceitem" : groupedMessage,
51−
52− "com.canonical.unity.slider" : sliderMenu,
53− "com.canonical.unity.switch" : switchMenu,
54−
55− "com.canonical.unity.media-player" : mediaPayerMenu,
56− "com.canonical.unity.playback-item" : playbackItemMenu,
57−
58− "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
59− "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
35+ "default": {
36+ "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
37+ "unity.widgets.systemsettings.tablet.switch" : switchMenu,
38+
39+ "com.canonical.indicator.button" : buttonMenu,
40+ "com.canonical.indicator.div" : separatorMenu,
41+ "com.canonical.indicator.section" : sectionMenu,
42+ "com.canonical.indicator.progress" : progressMenu,
43+ "com.canonical.indicator.slider" : sliderMenu,
44+ "com.canonical.indicator.switch" : switchMenu,
45+ "com.canonical.indicator.alarm" : alarmMenu,
46+ "com.canonical.indicator.appointment" : appointmentMenu,
47+ "com.canonical.indicator.transfer" : transferMenu,
48+ "com.canonical.indicator.button-section" : buttonSectionMenu,
49+
50+ "com.canonical.indicator.messages.messageitem" : messageItem,
51+ "com.canonical.indicator.messages.sourceitem" : groupedMessage,
52+
53+ "com.canonical.unity.slider" : sliderMenu,
54+ "com.canonical.unity.switch" : switchMenu,
55+
56+ "com.canonical.unity.media-player" : mediaPayerMenu,
57+ "com.canonical.unity.playback-item" : playbackItemMenu,
58+
59+ "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
60+ "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
61+ },
62+ "indicator-messages" : {
63+ "com.canonical.indicator.button" : messagesButtonMenu
64+ }
6065 }
6166
6267 function getExtendedProperty(object, propertyName, defaultValue) {
@@ -126,6 +131,7 @@ Item {
126131 }
127132 }
128133
134+
129135 Component {
130136 id: buttonMenu;
131137
@@ -143,6 +149,36 @@ Item {
143149 }
144150 }
145151 }
152+
153+ Component {
154+ id: messagesButtonMenu;
155+
156+ Item {
157+ objectName: "messagesButtonMenu"
158+ property QtObject menuData: null
159+ property var menuModel: menuFactory.menuModel
160+ property int menuIndex: -1
161+
162+ implicitHeight: units.gu(5)
163+ enabled: menuData && menuData.sensitive || false
164+
165+ Label {
166+ id: buttonMenuLabel
167+ text: menuData && menuData.label || ""
168+ anchors.centerIn: parent
169+ font.bold: true
170+ }
171+
172+ MouseArea {
173+ anchors {
174+ fill: buttonMenuLabel
175+ margins: units.gu(-1)
176+ }
177+ onClicked: menuModel.activate(menuIndex);
178+ }
179+ }
180+ }
181+
146182 Component {
147183 id: sectionMenu;
148184
@@ -186,6 +222,20 @@ Item {
186222 onTriggered: {
187223 menuModel.activate(menuIndex);
188224 }
225+
226+ property bool settingsMenu: menuData.action.indexOf("settings") > -1
227+ backColor: settingsMenu ? Qt.rgba(1,1,1,0.05) : "transparent"
228+
229+ component: settingsMenu ? buttonForSettings : undefined
230+ Component {
231+ id: buttonForSettings
232+ Icon {
233+ name: "settings"
234+ height: units.gu(3)
235+ width: height
236+ color: Theme.palette.selected.backgroundText
237+ }
238+ }
189239 }
190240 }
191241
@@ -207,7 +257,6 @@ Item {
207257 }
208258 }
209259
210−
211260 Component {
212261 id: switchMenu;
213262
@@ -350,7 +399,7 @@ Item {
350399
351400 text: menuData && menuData.label || ""
352401 enabled: menuData && menuData.sensitive || false
353− checked: menuData && menuData.isToggled || false
402+ active: menuData && menuData.isToggled || false
354403 secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
355404 adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
356405 signalStrength: strengthAction.valid ? strengthAction.state : 0
@@ -439,6 +488,7 @@ Item {
439488 running: getExtendedProperty(actionState, "running", false)
440489 state: getExtendedProperty(actionState, "state", "")
441490 enabled: menuData && menuData.sensitive || false
491+ showDivider: false
442492
443493 onTriggered: {
444494 model.activate(modelIndex);
@@ -647,9 +697,18 @@ Item {
647697 }
648698 }
649699
650− function load(modelData) {
700+ function load(modelData, context) {
651701 if (modelData.type !== undefined) {
652− var component = _map[modelData.type];
702+ var component = undefined;
703+
704+ var contextComponents = _map[context];
705+ if (contextComponents !== undefined) {
706+ component = contextComponents[modelData.type];
707+ }
708+
709+ if (component === undefined) {
710+ component = _map["default"][modelData.type];
711+ }
653712 if (component !== undefined) {
654713 return component;
655714 }