on xenial help sign in
nagivation
5814a6bNick Dedekind
qml/ApplicationMenus/MenuBar.qml+23−71
@@ -35,6 +35,10 @@ Item {
35 implicitWidth: row.width + units.gu(1)
35 implicitWidth: row.width + units.gu(1)
36 height: parent.height
36 height: parent.height
37
37
38+ function select(index) {
39+ d.select(index);
40+ }
41+
38 function dismiss() {
42 function dismiss() {
39 d.dismissAll();
43 d.dismissAll();
40 }
44 }
@@ -77,9 +81,9 @@ Item {
77
81
78 Item {
82 Item {
79 id: visualItem
83 id: visualItem
80− objectName: root.objectName + "-item" + __index
84+ objectName: root.objectName + "-item" + __ownIndex
81
85
82− readonly property int __index: index
86+ readonly property int __ownIndex: index
83 property Item __popup: null;
87 property Item __popup: null;
84 property bool popupVisible: __popup && __popup.visible
88 property bool popupVisible: __popup && __popup.visible
85
89
@@ -87,15 +91,12 @@ Item {
87 implicitHeight: row.height
91 implicitHeight: row.height
88 enabled: model.sensitive
92 enabled: model.sensitive
89
93
90− Keys.forwardTo: [ root ]
91−
92 function show() {
94 function show() {
93 if (!__popup) {
95 if (!__popup) {
94 __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" });
96 __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" });
95 } else {
97 } else {
96 __popup.visible = true;
98 __popup.visible = true;
97 }
99 }
98− __popup.forceActiveFocus();
99 }
100 }
100 function hide() {
101 function hide() {
101 if (__popup) {
102 if (__popup) {
@@ -119,7 +120,10 @@ Item {
119 MenuPopup {
120 MenuPopup {
120 x: visualItem.x - units.gu(1)
121 x: visualItem.x - units.gu(1)
121 anchors.top: parent.bottom
122 anchors.top: parent.bottom
122− unityMenuModel: root.unityMenuModel.submenu(visualItem.__index)
123+ unityMenuModel: root.unityMenuModel.submenu(visualItem.__ownIndex)
124+
125+ Component.onCompleted: reset();
126+ onVisibleChanged: if (visible) { reset(); }
123 }
127 }
124 }
128 }
125
129
@@ -210,19 +214,29 @@ Item {
210 visible: d.currentItem
214 visible: d.currentItem
211 }
215 }
212
216
213− QtObject {
217+ MenuNavigator {
214 id: d
218 id: d
215 objectName: "d"
219 objectName: "d"
220+ itemView: rowRepeater
216
221
217 property Item currentItem: null
222 property Item currentItem: null
218 property Item hoveredItem: null
223 property Item hoveredItem: null
219 property Item prevCurrentItem: null
224 property Item prevCurrentItem: null
220
225
226+ readonly property int currentIndex: currentItem ? currentItem.__ownIndex : -1
227+
221 property bool altPressed: false
228 property bool altPressed: false
222 property bool longAltPressed: false
229 property bool longAltPressed: false
223
230
224 signal dismissAll()
231 signal dismissAll()
225
232
233+ onSelect: {
234+ var delegate = rowRepeater.itemAt(index);
235+ if (delegate) {
236+ d.currentItem = delegate;
237+ }
238+ }
239+
226 onCurrentItemChanged: {
240 onCurrentItemChanged: {
227 if (prevCurrentItem && prevCurrentItem != currentItem) {
241 if (prevCurrentItem && prevCurrentItem != currentItem) {
228 if (currentItem) {
242 if (currentItem) {
@@ -264,75 +278,13 @@ Item {
264
278
265 Keys.onLeftPressed: {
279 Keys.onLeftPressed: {
266 if (d.currentItem) {
280 if (d.currentItem) {
267− selectPrevious(d.currentItem.__index);
281+ d.selectPrevious(d.currentIndex);
268 }
282 }
269 }
283 }
270
284
271 Keys.onRightPressed: {
285 Keys.onRightPressed: {
272 if (d.currentItem) {
286 if (d.currentItem) {
273− selectNext(d.currentItem.__index);
274− }
275− }
276−
277− function select(index) {
278− var delegate = rowRepeater.itemAt(index);
279− if (delegate) {
280− d.currentItem = delegate;
281− }
282− }
283−
284− function selectNext(currentIndex) {
287+ d.selectNext(d.currentIndex);
285− var menu;
286− var newIndex = 0;
287− if (currentIndex === -1 && rowRepeater.count > 0) {
288− while (rowRepeater.count > newIndex) {
289− menu = rowRepeater.itemAt(newIndex);
290− if (!!menu["enabled"]) {
291− select(newIndex);
292− break;
293− }
294− newIndex++;
295− }
296− } else if (currentIndex !== -1 && rowRepeater.count > 1) {
297− var startIndex = (currentIndex + 1) % rowRepeater.count;
298− newIndex = startIndex;
299− do {
300− menu = rowRepeater.itemAt(newIndex);
301− if (!!menu["enabled"]) {
302− select(newIndex);
303− break;
304− }
305− newIndex = (newIndex + 1) % rowRepeater.count;
306− } while (newIndex !== startIndex)
307− }
308− }
309−
310− function selectPrevious(currentIndex) {
311− var menu;
312− var newIndex = rowRepeater.count-1;
313− if (currentIndex === -1 && rowRepeater.count > 0) {
314− while (rowRepeater.count > newIndex) {
315− menu = rowRepeater.itemAt(newIndex);
316− if (!!menu["enabled"]) {
317− select(newIndex);
318− break;
319− }
320− newIndex--;
321− }
322− } else if (currentIndex !== -1 && rowRepeater.count > 1) {
323− var startIndex = currentIndex - 1;
324− newIndex = startIndex;
325− do {
326− if (newIndex < 0) {
327− newIndex = rowRepeater.count - 1;
328− }
329− menu = rowRepeater.itemAt(newIndex);
330− if (!!menu["enabled"]) {
331− select(newIndex);
332− break;
333− }
334− newIndex--;
335− } while (newIndex !== startIndex)
336 }
288 }
337 }
289 }
338}
290}
qml/ApplicationMenus/MenuNavigator.qmlnew file+78
@@ -0,0 +1,78 @@
1+/*
2+ * Copyright 2016 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+
17+import QtQuick 2.4
18+
19+QtObject {
20+ property Item itemView: null
21+
22+ signal select(int index)
23+
24+ function selectNext(currentIndex) {
25+ var menu;
26+ var newIndex = 0;
27+ if (currentIndex === -1 && itemView.count > 0) {
28+ while (itemView.count > newIndex) {
29+ menu = itemView.itemAt(newIndex);
30+ if (!!menu["enabled"]) {
31+ select(newIndex);
32+ break;
33+ }
34+ newIndex++;
35+ }
36+ } else if (currentIndex !== -1 && itemView.count > 1) {
37+ var startIndex = (currentIndex + 1) % itemView.count;
38+ newIndex = startIndex;
39+ do {
40+ menu = itemView.itemAt(newIndex);
41+ if (!!menu["enabled"]) {
42+ select(newIndex);
43+ break;
44+ }
45+ newIndex = (newIndex + 1) % itemView.count;
46+ } while (newIndex !== startIndex)
47+ }
48+ }
49+
50+ function selectPrevious(currentIndex) {
51+ var menu;
52+ var newIndex = itemView.count-1;
53+ if (currentIndex === -1 && itemView.count > 0) {
54+ while (itemView.count > newIndex) {
55+ menu = itemView.itemAt(newIndex);
56+ if (!!menu["enabled"]) {
57+ select(newIndex);
58+ break;
59+ }
60+ newIndex--;
61+ }
62+ } else if (currentIndex !== -1 && itemView.count > 1) {
63+ var startIndex = currentIndex - 1;
64+ newIndex = startIndex;
65+ do {
66+ if (newIndex < 0) {
67+ newIndex = itemView.count - 1;
68+ }
69+ menu = itemView.itemAt(newIndex);
70+ if (!!menu["enabled"]) {
71+ select(newIndex);
72+ break;
73+ }
74+ newIndex--;
75+ } while (newIndex !== startIndex)
76+ }
77+ }
78+}
qml/ApplicationMenus/MenuPopup.qml+223−272
@@ -44,6 +44,10 @@ UbuntuShape {
44 d.select(index)
44 d.select(index)
45 }
45 }
46
46
47+ function reset() {
48+ d.currentItem = null;
49+ }
50+
47 function dismiss() {
51 function dismiss() {
48 d.dismissAll()
52 d.dismissAll()
49 }
53 }
@@ -51,37 +55,26 @@ UbuntuShape {
51 implicitWidth: container.width
55 implicitWidth: container.width
52 implicitHeight: MathUtils.clamp(listView.contentHeight, __ajustedMinimumHeight, __maximumHeight)
56 implicitHeight: MathUtils.clamp(listView.contentHeight, __ajustedMinimumHeight, __maximumHeight)
53
57
54− focus: true
55−
56− Keys.onUpPressed: d.selectPrevious(d.currentIndex)
57− Keys.onDownPressed: d.selectNext(d.currentIndex)
58− Keys.onRightPressed: {
59− // Don't let right keypresses fall through if the current item has a visible popup.
60− if (!d.currentItem || !d.currentItem.popup || !d.currentItem.popup.visible) {
61− event.accepted = false;
62− }
63− }
64−
65 onVisibleChanged: {
58 onVisibleChanged: {
66 if (!visible) {
59 if (!visible) {
67 d.currentItem = null;
60 d.currentItem = null;
68 }
61 }
69 }
62 }
70
63
71− QtObject {
64+ MenuNavigator {
72 id: d
65 id: d
73 objectName: "d"
66 objectName: "d"
67+ itemView: listView
74
68
75 property Item currentItem: null
69 property Item currentItem: null
76 property Item hoveredItem: null
70 property Item hoveredItem: null
77 readonly property int currentIndex: currentItem ? currentItem.__ownIndex : -1
71 readonly property int currentIndex: currentItem ? currentItem.__ownIndex : -1
78
72
79− signal select(int index)
80 signal dismissAll()
73 signal dismissAll()
81
74
82 onCurrentItemChanged: {
75 onCurrentItemChanged: {
83 if (currentItem) {
76 if (currentItem) {
84− currentItem.forceActiveFocus();
77+ currentItem.item.forceActiveFocus();
85 } else {
78 } else {
86 hoveredItem = null;
79 hoveredItem = null;
87 }
80 }
@@ -90,314 +83,272 @@ UbuntuShape {
90 onSelect: {
83 onSelect: {
91 currentItem = listView.itemAt(index);
84 currentItem = listView.itemAt(index);
92 }
85 }
86+ }
93
87
88+ FocusScope {
89+ id: focusScope
90+ anchors.fill: parent
91+ focus: visible
92+
93+ Keys.onUpPressed: d.selectPrevious(d.currentIndex)
94− function selectNext(currentIndex) {
94+ Keys.onDownPressed: d.selectNext(d.currentIndex)
95− var menu;
95+ Keys.onRightPressed: {
96− var newIndex = 0;
96+ // Don't let right keypresses fall through if the current item has a visible popup.
97− if (currentIndex === -1 && listView.count > 0) {
97+ if (!d.currentItem || !d.currentItem.popup || !d.currentItem.popup.visible) {
98− while (listView.count > newIndex) {
98+ event.accepted = false;
99− menu = listView.itemAt(newIndex);
100− if (!!menu["enabled"]) {
101− select(newIndex);
102− break;
103− }
104− newIndex++;
105− }
106− } else if (currentIndex !== -1 && listView.count > 1) {
107− var startIndex = (currentIndex + 1) % listView.count;
108− newIndex = startIndex;
109− do {
110− menu = listView.itemAt(newIndex);
111− if (!!menu["enabled"]) {
112− select(newIndex);
113− break;
114− }
115− newIndex = (newIndex + 1) % listView.count;
116− } while (newIndex !== startIndex)
117 }
99 }
118 }
100 }
119
101
120− function selectPrevious(currentIndex) {
102+ ColumnLayout {
121− var menu;
103+ id: container
122− var newIndex = listView.count-1;
104+ objectName: "container"
123− if (currentIndex === -1 && listView.count > 0) {
105+
124− while (listView.count > newIndex) {
106+ width: listView.contentWidth
125− menu = listView.itemAt(newIndex);
107+ height: parent.height
126− if (!!menu["enabled"]) {
108+ spacing: 0
127− select(newIndex);
109+
128− break;
110+ // FIXME use ListView.header - tried but was flaky with positionViewAtIndex.
111+ Item {
112+ Layout.fillWidth: true;
113+ Layout.maximumHeight: units.gu(3)
114+ Layout.minimumHeight: units.gu(3)
115+ visible: listView.contentHeight > root.height
116+ enabled: !listView.atYBeginning
117+
118+ Rectangle {
119+ color: enabled ? theme.palette.normal.overlayText :
120+ theme.palette.disabled.overlayText
121+ height: units.dp(1)
122+ anchors {
123+ bottom: parent.bottom
124+ left: parent.left
125+ right: parent.right
129 }
126 }
130− newIndex--;
131 }
127 }
132− } else if (currentIndex !== -1 && listView.count > 1) {
133− var startIndex = currentIndex - 1;
134− newIndex = startIndex;
135− do {
136− if (newIndex < 0) {
137− newIndex = listView.count - 1;
138− }
139− menu = listView.itemAt(newIndex);
140− if (!!menu["enabled"]) {
141− select(newIndex);
142− break;
143− }
144− newIndex--;
145− } while (newIndex !== startIndex)
146− }
147− }
148− }
149
128
150− ColumnLayout {
129+ Icon {
151− id: container
130+ anchors.centerIn: parent
152− objectName: "container"
131+ width: units.gu(2)
153−
132+ height: units.gu(2)
154− width: listView.contentWidth
133+ name: "up"
155− height: parent.height
156− spacing: 0
157−
158− // FIXME use ListView.header - tried but was flaky with positionViewAtIndex.
159− Item {
160− Layout.fillWidth: true;
161− Layout.maximumHeight: units.gu(3)
162− Layout.minimumHeight: units.gu(3)
163− visible: listView.contentHeight > root.height
164− enabled: !listView.atYBeginning
165−
166− Rectangle {
167− color: enabled ? theme.palette.normal.overlayText :
134+ color: enabled ? theme.palette.normal.overlayText :
168− theme.palette.disabled.overlayText
135+ theme.palette.disabled.overlayText
169− height: units.dp(1)
170− anchors {
171− bottom: parent.bottom
172− left: parent.left
173− right: parent.right
174 }
136 }
175− }
176
137
177− Icon {
178− anchors.centerIn: parent
179− width: units.gu(2)
180− height: units.gu(2)
181− name: "up"
182− color: enabled ? theme.palette.normal.overlayText :
183− theme.palette.disabled.overlayText
184− }
185−
186− MouseArea {
138+ MouseArea {
187− anchors.fill: parent
139+ anchors.fill: parent
188− onPressed: {
140+ onPressed: {
189− var index = listView.indexAt(0, listView.contentY);
141+ var index = listView.indexAt(0, listView.contentY);
190− listView.positionViewAtIndex(index-1, ListView.Beginning);
142+ listView.positionViewAtIndex(index-1, ListView.Beginning);
143+ }
191 }
144 }
192 }
145 }
193− }
194
146
195− ListView {
147+ ListView {
196− id: listView
148+ id: listView
197− objectName: "listView"
149+ objectName: "listView"
198− Layout.fillHeight: true
150+ Layout.fillHeight: true
199− Layout.fillWidth: true
151+ Layout.fillWidth: true
200− contentWidth: MathUtils.clamp(contentItem.childrenRect.width,
152+ contentWidth: MathUtils.clamp(contentItem.childrenRect.width,
201− __minimumWidth,
153+ __minimumWidth,
202− __maximumWidth)
154+ __maximumWidth)
203−
155+
204− orientation: Qt.Vertical
156+ orientation: Qt.Vertical
205− interactive: contentHeight > height
157+ interactive: contentHeight > height
206− clip: interactive
158+ clip: interactive
207− highlightFollowsCurrentItem: false
159+ highlightFollowsCurrentItem: false
208−
160+
209− highlight: Rectangle {
161+ highlight: Rectangle {
210− color: "transparent"
162+ color: "transparent"
211− border.width: units.dp(1)
163+ border.width: units.dp(1)
212− border.color: UbuntuColors.orange
164+ border.color: UbuntuColors.orange
213− z: 1
165+ z: 1
214−
166+
215− width: listView.width
167+ width: listView.width
216− height: d.currentItem ? d.currentItem.height : 0
168+ height: d.currentItem ? d.currentItem.height : 0
217− y: d.currentItem ? d.currentItem.y : 0
169+ y: d.currentItem ? d.currentItem.y : 0
218− visible: d.currentItem
170+ visible: d.currentItem
219− }
171+ }
220
172
221− function itemAt(index) {
173+ function itemAt(index) {
222− if (index > count || index < 0) return null;
174+ if (index > count || index < 0) return null;
223− currentIndex = index;
175+ currentIndex = index;
224− return currentItem;
176+ return currentItem;
225− }
177+ }
226
178
227− MouseArea {
179+ MouseArea {
228− id: menuMouseArea
180+ id: menuMouseArea
229− anchors.fill: parent
181+ anchors.fill: parent
230− hoverEnabled: true
182+ hoverEnabled: true
231− z: -1
183+ z: -1
232
184
233− onPositionChanged: updateCurrentItemFromPosition(mouse)
185+ onPositionChanged: updateCurrentItemFromPosition(mouse)
234
186
235− function updateCurrentItemFromPosition(point) {
187+ function updateCurrentItemFromPosition(point) {
236− var pos = mapToItem(listView.contentItem, point.x, point.y);
188+ var pos = mapToItem(listView.contentItem, point.x, point.y);
237
189
238− if (!d.hoveredItem || !d.currentItem ||
190+ if (!d.hoveredItem || !d.currentItem ||
239− !d.hoveredItem.contains(Qt.point(pos.x - d.currentItem.x, pos.y - d.currentItem.y))) {
191+ !d.hoveredItem.contains(Qt.point(pos.x - d.currentItem.x, pos.y - d.currentItem.y))) {
240− d.hoveredItem = listView.itemAt(listView.indexAt(pos.x, pos.y));
192+ d.hoveredItem = listView.itemAt(listView.indexAt(pos.x, pos.y));
241− if (!d.hoveredItem || !d.hoveredItem.enabled)
193+ if (!d.hoveredItem || !d.hoveredItem.enabled)
242− return false;
194+ return false;
243− d.currentItem = d.hoveredItem;
195+ d.currentItem = d.hoveredItem;
196+ }
197+ return true;
244 }
198 }
245− return true;
246 }
199 }
247− }
248
200
249− ActionContext {
201+ ActionContext {
250− id: menuBarContext
202+ id: menuBarContext
251− objectName: "menuContext"
203+ objectName: "menuContext"
252− active: {
204+ active: {
253− if (!root.visible) return false;
205+ if (!root.visible) return false;
254− if (d.currentItem && d.currentItem.popup && d.currentItem.popup.visible) {
206+ if (d.currentItem && d.currentItem.popup && d.currentItem.popup.visible) {
255− return false;
207+ return false;
208+ }
209+ return true;
256 }
210 }
257− return true;
258 }
211 }
259− }
260
212
261− delegate: Loader {
213+ delegate: Loader {
262− id: loader
214+ id: loader
263− objectName: root.objectName + "-item" + __ownIndex
215+ objectName: root.objectName + "-item" + __ownIndex
264
216
265− property int __ownIndex: index
217+ property int __ownIndex: index
266
218
267− width: root.width
219+ width: root.width
268− enabled: model.isSeparator ? false : model.sensitive
220+ enabled: model.isSeparator ? false : model.sensitive
269− Keys.forwardTo: [ item ]
270
221
271− sourceComponent: {
222+ sourceComponent: {
272− if (model.isSeparator) {
223+ if (model.isSeparator) {
273− return separatorComponent;
224+ return separatorComponent;
225+ }
226+ return menuItemComponent;
274 }
227 }
275− return menuItemComponent;
276− }
277
228
278− property Item popup: null
229+ property Item popup: null
279−
230+
280− Component {
231+ Component {
281− id: menuItemComponent
232+ id: menuItemComponent
282− MenuItem {
233+ MenuItem {
283− id: menuItem
234+ id: menuItem
284− menuData: model
235+ menuData: model
285− objectName: loader.objectName + "-actionItem"
236+ objectName: loader.objectName + "-actionItem"
286−
237+
287− action.onTriggered: {
238+ action.onTriggered: {
288− d.currentItem = loader;
239+ d.currentItem = loader;
289−
240+
290− if (hasSubmenu) {
241+ if (hasSubmenu) {
291− if (!popup) {
242+ if (!popup) {
292− var model = root.unityMenuModel.submenu(__ownIndex);
243+ var model = root.unityMenuModel.submenu(__ownIndex);
293− popup = submenuComponent.createObject(root, {
244+ popup = submenuComponent.createObject(focusScope, {
294− objectName: loader.objectName + "-",
245+ objectName: loader.objectName + "-",
295− unityMenuModel: model,
246+ unityMenuModel: model,
296− x: Qt.binding(function() { return root.width }),
247+ x: Qt.binding(function() { return root.width }),
297− y: Qt.binding(function() { return loader.y })
248+ y: Qt.binding(function() { return loader.y })
298− });
249+ });
299− } else if (popup) {
250+ } else if (popup) {
300− popup.visible = true;
251+ popup.visible = true;
252+ }
253+ popup.dismiss.connect(function() {
254+ popup.destroy();
255+ popup = null;
256+ menuItem.forceActiveFocus();
257+ })
258+ } else {
259+ root.unityMenuModel.activate(__ownIndex);
301 }
260 }
302− popup.forceActiveFocus();
303− popup.dismiss.connect(function() {
304− popup.destroy();
305− popup = null;
306− loader.forceActiveFocus();
307− })
308− } else {
309− root.unityMenuModel.activate(__ownIndex);
310 }
261 }
311− }
312
262
313− Connections {
263+ Connections {
314− target: d
264+ target: d
315− onCurrentIndexChanged: {
265+ onCurrentIndexChanged: {
316− if (popup && d.currentIndex != __ownIndex) {
266+ if (popup && d.currentIndex != __ownIndex) {
317− popup.visible = false;
267+ popup.visible = false;
268+ }
318 }
269 }
319 }
270 }
320 }
271 }
321 }
272 }
322− }
323
273
324− Component {
274+ Component {
325− id: separatorComponent
275+ id: separatorComponent
326− ListItems.ThinDivider {
276+ ListItems.ThinDivider {
327− objectName: loader.objectName + "-separator"
277+ objectName: loader.objectName + "-separator"
278+ }
328 }
279 }
329 }
280 }
330− }
331− } // ListView
281+ } // ListView
332−
282+
333− // FIXME use ListView.footer - tried but was flaky with positionViewAtIndex.
283+ // FIXME use ListView.footer - tried but was flaky with positionViewAtIndex.
334− Item {
284+ Item {
335− Layout.fillWidth: true;
285+ Layout.fillWidth: true;
336− Layout.maximumHeight: units.gu(3)
286+ Layout.maximumHeight: units.gu(3)
337− Layout.minimumHeight: units.gu(3)
287+ Layout.minimumHeight: units.gu(3)
338− visible: listView.contentHeight > root.height
288+ visible: listView.contentHeight > root.height
339− enabled: !listView.atYEnd
289+ enabled: !listView.atYEnd
340−
290+
341− Rectangle {
291+ Rectangle {
342− color: enabled ? theme.palette.normal.overlayText :
292+ color: enabled ? theme.palette.normal.overlayText :
343− theme.palette.disabled.overlayText
293+ theme.palette.disabled.overlayText
344− height: units.dp(1)
294+ height: units.dp(1)
345− anchors {
295+ anchors {
346− top: parent.top
296+ top: parent.top
347− left: parent.left
297+ left: parent.left
348− right: parent.right
298+ right: parent.right
299+ }
349 }
300 }
350− }
351
301
352− Icon {
302+ Icon {
353− anchors.centerIn: parent
303+ anchors.centerIn: parent
354− width: units.gu(2)
304+ width: units.gu(2)
355− height: units.gu(2)
305+ height: units.gu(2)
356− name: "down"
306+ name: "down"
357− color: enabled ? theme.palette.normal.overlayText :
307+ color: enabled ? theme.palette.normal.overlayText :
358− theme.palette.disabled.overlayText
308+ theme.palette.disabled.overlayText
359− }
309+ }
360
310
361− MouseArea {
311+ MouseArea {
362− anchors.fill: parent
312+ anchors.fill: parent
363− onPressed: {
313+ onPressed: {
364− var index = listView.indexAt(0, listView.contentY);
314+ var index = listView.indexAt(0, listView.contentY);
365− listView.positionViewAtIndex(index+1, ListView.Beginning);
315+ listView.positionViewAtIndex(index+1, ListView.Beginning);
316+ }
366 }
317 }
367 }
318 }
368− }
369− } // Column
319+ } // Column
370
320
371− Component {
321+ Component {
372− id: submenuComponent
322+ id: submenuComponent
373− Loader {
323+ Loader {
374− id: submenuLoader
324+ id: submenuLoader
375− source: "MenuPopup.qml"
325+ source: "MenuPopup.qml"
376
326
377− property var unityMenuModel: null
327+ property var unityMenuModel: null
378− signal dismiss()
328+ signal dismiss()
379
329
380− Binding {
330+ Binding {
381− target: item
331+ target: item
382− property: "unityMenuModel"
332+ property: "unityMenuModel"
383− value: submenuLoader.unityMenuModel
333+ value: submenuLoader.unityMenuModel
384− }
334+ }
385
335
386− Binding {
336+ Binding {
387− target: item
337+ target: item
388− property: "objectName"
338+ property: "objectName"
389− value: submenuLoader.objectName + "menu"
339+ value: submenuLoader.objectName + "menu"
390− }
340+ }
391
341
392− Connections {
342+ Connections {
393− target: d
343+ target: d
394− onDismissAll: submenuLoader.dismiss()
344+ onDismissAll: submenuLoader.dismiss()
395− }
345+ }
396
346
397− Keys.onLeftPressed: dismiss()
347+ Keys.onLeftPressed: dismiss()
398
348
399− Component.onCompleted: item.select(0);
349+ Component.onCompleted: item.select(0);
400− onVisibleChanged: if (visible) { item.select(0); }
350+ onVisibleChanged: if (visible) { item.select(0); }
351+ }
401 }
352 }
402 }
353 }
403}
354}