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>
22import Ubuntu.Components 0.1 as Components
23import 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 = Qt.binding(function() { return mainMenu.selectedIndex == index; });
144 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
145 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
147 if (item.hasOwnProperty("menu")) {
148 item.menu = Qt.binding(function() { return model; });
153 target: item ? item : null
154 property: "objectName"
163 model: mainMenu.model
168 visible: mainMenu.count == 0
173 topMargin: units.gu(2)
175 wrapMode: Text.WordWrap
176 horizontalAlignment: Text.AlignHCenter
188 if (!contentActive) {
189 contentActive = true;
196 contentActive = false;
202 mainMenu.selectedIndex = -1;
203 mainMenu.positionViewAtBeginning();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list