2 * Copyright 2016 Canonical Ltd.
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.
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.
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/>.
18import Lomiri.Settings.Menus 0.1 as Menus
19import Lomiri.Settings.Components 0.1
21import Utils 0.1 as Utils
22import Lomiri.Components 1.3
27 property string context
28 property var rootModel: null
29 property var menuModel: null
35 property QtObject menuData: null
36 property int menuIndex: -1
39 enabled: menuData && menuData.sensitive || false
40 divider.visible: false
43 menuModel.activate(menuIndex);
48 text: menuData ? menuData.label.replace("_", "&") : ""
53 title.text: action.text
56 source: menuData ? menuData.icon : ""
57 SlotsLayout.position: SlotsLayout.Leading
62 text: menuData ? menuData.shortcut : ""
63 visible: menuData && menuData.shortcut && QuickUtils.keyboardAttached
64 SlotsLayout.position: SlotsLayout.Trailing
65 color: enabled ? theme.palette.normal.backgroundSecondaryText :
66 theme.palette.disabled.backgroundSecondaryText
76 property QtObject menuData: null
77 property int menuIndex: -1
80 enabled: menuData && menuData.sensitive || false
81 divider.visible: false
84 menuModel.activate(menuIndex);
89 text: menuData ? menuData.label.replace("_", "&") : ""
94 title.text: action.text
97 source: menuData ? menuData.icon : ""
98 SlotsLayout.position: SlotsLayout.Leading
103 name: "toolkit_chevron-ltr_1gu"
104 SlotsLayout.position: SlotsLayout.Trailing
106 color: enabled ? theme.palette.normal.backgroundSecondaryText :
107 theme.palette.disabled.backgroundSecondaryText
114 id: applicationMenuSeparator;
116 Menus.SeparatorMenu {
117 objectName: "separatorMenu"
121 function load(modelData) {
122 if (modelData.isSeparator) {
123 return applicationMenuSeparator;
125 if (modelData.isRadio) {
127 if (modelData.isCheck) {
130 if (modelData.hasSubmenu) {
133 return applicationMenu;