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 alias emptyText: emptyLabel.text
30 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
32 Indicators.UnityMenuModelStack {
39 model: menuStack.tail ? menuStack.tail : null
43 bottomMargin: Qt.inputMethod.visible ? (Qt.inputMethod.keyboardRectangle.height - main.anchors.bottomMargin) : 0
45 Behavior on bottomMargin {
48 easing.type: Easing.OutQuad
51 // TODO - does ever frame.
52 onBottomMarginChanged: {
53 mainMenu.positionViewAtIndex(mainMenu.currentIndex, ListView.End)
57 // Ensure all delegates are cached in order to improve smoothness of scrolling
60 // Only allow flicking if the content doesn't fit on the page
61 interactive: contentHeight > height
63 property int selectedIndex: -1
64 property bool blockCurrentIndexChange: false
67 if (count == 0 && selectedIndex != -1) {
71 // for highlight following
72 onSelectedIndexChanged: {
73 if (currentIndex != selectedIndex) {
74 var blocked = blockCurrentIndexChange;
75 blockCurrentIndexChange = true;
77 currentIndex = selectedIndex;
79 blockCurrentIndexChange = blocked;
82 // for item addition/removal
83 onCurrentIndexChanged: {
84 if (!blockCurrentIndexChange) {
85 if (selectedIndex != -1 && selectedIndex != currentIndex) {
86 selectedIndex = currentIndex;
105 property int modelIndex: index
112 sourceComponent: factory.load(model)
115 if (model.type === rootMenuType) {
116 menuStack.push(mainMenu.model.submenu(index));
119 if (item.hasOwnProperty("menuSelected")) {
120 item.menuSelected = Qt.binding(function() { return mainMenu.selectedIndex == index; });
121 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
122 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
124 if (item.hasOwnProperty("menu")) {
125 item.menu = Qt.binding(function() { return model; });
130 target: item ? item : null
131 property: "objectName"
140 model: mainMenu.model
145 visible: mainMenu.count == 0
150 topMargin: units.gu(2)
152 wrapMode: Text.WordWrap
153 horizontalAlignment: Text.AlignHCenter
179 mainMenu.selectedIndex = -1;
180 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