@@ -1,219 +0,0 @@
2− * Copyright 2013 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/>.
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
22−import Ubuntu.Components 0.1 as Components
23−import Unity.Indicators 0.1 as Indicators
29− property bool contentActive: false
30− property string title: rootActionState.title
31− property alias emptyText: emptyLabel.text
32− property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
34− Indicators.UnityMenuModelStack {
36− head: contentActive ? main.menuModel : null
38− property var rootMenu: null
43− } else if (rootMenu != tail) {
44− if (tail.get(0, "type") === rootMenuType) {
45− rootMenu = menuStack.tail.submenu(0);
55− target: menuStack.tail
57− if (menuStack.rootMenu !== menuStack.tail && menuStack.tail.get(0, "type") === rootMenuType) {
58− menuStack.rootMenu = menuStack.tail.submenu(0);
59− menuStack.push(menuStack.rootMenu, 0);
66− model: menuStack.rootMenu
70− bottomMargin: Qt.inputMethod.visible ? (Qt.inputMethod.keyboardRectangle.height - main.anchors.bottomMargin) : 0
72− Behavior on bottomMargin {
75− easing.type: Easing.OutQuad
78− // TODO - does ever frame.
79− onBottomMarginChanged: {
80− mainMenu.positionViewAtIndex(mainMenu.currentIndex, ListView.End)
84− // Ensure all delegates are cached in order to improve smoothness of scrolling
87− // Only allow flicking if the content doesn't fit on the page
88− interactive: contentHeight > height
90− property int selectedIndex: -1
91− property bool blockCurrentIndexChange: false
94− if (count == 0 && selectedIndex != -1) {
98− // for highlight following
99− onSelectedIndexChanged: {
100− if (currentIndex != selectedIndex) {
101− var blocked = blockCurrentIndexChange;
102− blockCurrentIndexChange = true;
104− currentIndex = selectedIndex;
106− blockCurrentIndexChange = blocked;
109− // for item addition/removal
110− onCurrentIndexChanged: {
111− if (!blockCurrentIndexChange) {
112− if (selectedIndex != -1 && selectedIndex != currentIndex) {
113− selectedIndex = currentIndex;
125− height: loader.height
132− property int modelIndex: index
139− sourceComponent: factory.load(model)
142− if (item.hasOwnProperty("menuSelected")) {
143− item.menuSelected = mainMenu.selectedIndex == index;
144− item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
145− item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
147− if (item.hasOwnProperty("menuData")) {
148− item.menuData = Qt.binding(function() { return model; });
150− if (item.hasOwnProperty("menuIndex")) {
151− item.menuIndex = Qt.binding(function() { return modelIndex; });
156− target: item ? item : null
157− property: "objectName"
161− // TODO: Fixes lp#1243146
162− // This is a workaround for a Qt bug. https://bugreports.qt-project.org/browse/QTBUG-34351
165− onSelectedIndexChanged: {
166− if (loader.item && loader.item.hasOwnProperty("menuSelected")) {
167− loader.item.menuSelected = mainMenu.selectedIndex == index;
177− menuModel: mainMenu.model
182− visible: mainMenu.count == 0
187− topMargin: units.gu(2)
189− wrapMode: Text.WordWrap
190− horizontalAlignment: Text.AlignHCenter
202− if (!contentActive) {
203− contentActive = true;
209− if (contentActive) {
210− contentActive = false;
216− mainMenu.selectedIndex = -1;
217− mainMenu.positionViewAtBeginning();