on 7235b09 help sign in
unity8/qml/Panel/MenuContent.qml
79 lines 2.4 kB history raw
1/*
2 * Copyright (C) 2013-2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17import QtQuick 2.2
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.1
20import Unity.Indicators 0.1 as Indicators
21import Utils 0.1
22import "../Components"
24Rectangle {
25 id: content
27 property QtObject indicatorsModel: null
28 readonly property alias currentMenuIndex: listViewContent.currentIndex
29 color: "#221e1c" // FIXME not in palette yet
31 width: units.gu(40)
32 height: units.gu(42)
34 function setCurrentMenuIndex(index) {
35 // FIXME - https://bugreports.qt-project.org/browse/QTBUG-41229
36 listViewContent.currentIndex = -1;
37 listViewContent.currentIndex = index;
38 }
40 ListView {
41 id: listViewContent
42 objectName: "indicatorsContentListView"
43 anchors.fill: parent
44 model: content.indicatorsModel
45 clip: true
47 highlightFollowsCurrentItem: true
48 interactive: false
49 highlightMoveDuration: 0
50 orientation: ListView.Horizontal
51 // Load all the indicator menus (a big number)
52 cacheBuffer: 1073741823
54 delegate: Loader {
55 id: loader
57 width: ListView.view.width
58 height: ListView.view.height
59 objectName: identifier
60 asynchronous: true
62 sourceComponent: IndicatorPage {
63 objectName: identifier + "-page"
65 identifier: model.identifier
66 busName: indicatorProperties.busName
67 actionsObjectPath: indicatorProperties.actionsObjectPath
68 menuObjectPath: indicatorProperties.menuObjectPath
69 }
71 onVisibleChanged: {
72 // Reset the indicator states
73 if (!visible && status == Loader.Ready) {
74 item.reset();
75 }
76 }
77 }
78 }