on xenial help sign in
Added CheckableMenu
commitf9a875bd014312aa702f9c8fe9e7a166a2c84ef4 authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 13 Dec 2013, 15:38 (13 years ago) parente497842
3 files changed+25−41
plugins/Unity/Indicators/qml/HLine.qml−29 plugins/Unity/Indicators/qml/MenuItemFactory.qml+24 plugins/Unity/Indicators/qml/qmldir+1−12
plugins/Unity/Indicators/qml/HLine.qmldeleted−29
@@ -1,29 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−Rectangle {
24− height: units.dp(1)
25− anchors {
26− left: parent.left
27− right: parent.right
28− }
29−}
plugins/Unity/Indicators/qml/MenuItemFactory.qml+24
@@ -174,6 +174,25 @@ Item {
174174 }
175175 }
176176
177+ Component {
178+ id: checkableMenu;
179+ Menus.CheckableMenu {
180+ objectName: "checkableMenu"
181+ property QtObject menuData: null
182+ property int menuIndex: -1
183+
184+ text: menuData && menuData.label || ""
185+ enabled: menuData && menuData.sensitive || false
186+ checked: menuData && menuData.isToggled || false
187+
188+ onTriggered: {
189+ menuModel.activate(menuIndex);
190+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
191+ }
192+ }
193+ }
194+
195+
177196 Component {
178197 id: switchMenu;
179198 Menus.SwitchMenu {
@@ -386,6 +405,7 @@ Item {
386405 Component {
387406 id: mediaPayerMenu;
388407 Menus.MediaPlayerMenu {
408+ objectName: "mediaPayerMenu"
389409 property QtObject menuData: null
390410 property var menuModel: menuFactory.menuModel
391411 property int menuIndex: -1
@@ -410,6 +430,7 @@ Item {
410430 Component {
411431 id: playbackItemMenu;
412432 Menus.PlaybackItemMenu {
433+ objectName: "playbackItemMenu"
413434 property var menuModel: menuFactory.menuModel
414435 property int menuIndex: -1
415436 property var extendedData: menuData && menuData.ext || undefined
@@ -467,6 +488,9 @@ Item {
467488 return component;
468489 }
469490 }
491+ if (modelData.isCheck || modelData.isRadio) {
492+ return checkableMenu;
493+ }
470494 if (modelData.isSeparator) {
471495 return separatorMenu;
472496 }
plugins/Unity/Indicators/qml/qmldir+1−12
@@ -2,20 +2,9 @@ module Unity.Indicators
22plugin IndicatorsQml
33typeinfo plugin.qmltypes
44
5−BaseMenuItem 0.1 BaseMenuItem.qml
6−ButtonMenuItem 0.1 ButtonMenuItem.qml
75CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
8−DivMenuItem 0.1 DivMenuItem.qml
9−FramedMenuItem 0.1 FramedMenuItem.qml
10−HLine 0.1 HLine.qml
116IndicatorBase 0.1 IndicatorBase.qml
12−MenuActionBinding 0.1 MenuActionBinding.qml
137MenuItemFactory 0.1 MenuItemFactory.qml
14−ProgressMenuItem 0.1 ProgressMenuItem.qml
15−SectionMenuItem 0.1 SectionMenuItem.qml
16−SliderMenuItem 0.1 SliderMenuItem.qml
17−StandardMenuItem 0.1 StandardMenuItem.qml
18−SwitchMenuItem 0.1 SwitchMenuItem.qml
19−
208
9+internal MessageMenuItemFactory MessageMenuItemFactory.qml
2110internal RemoveBackground RemoveBackground.qml