2
* uNav http://launchpad.net/unav
3
* Copyright (C) 2015-2016 Marcos Alvarez Costales https://launchpad.net/~costales
4
* Copyright (C) 2015-2016 JkB https://launchpad.net/~joergberroth
5
* Copyright (C) 2016 Nekhelesh Ramananthan https://launchpad.net/~nik90
7
* uNav is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3 of the License, or
10
* (at your option) any later version.
12
* uNav is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
19
import Ubuntu.Components 1.3
26
title: i18n.tr("Menu")
29
// #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
30
// This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
31
// at which point this back button can be removed.
32
leadingActionBar.actions: Action {
42
Component.onCompleted: mainPageStack.executeJavaScript("qml_set_route_status();")
47
anchors { fill: parent; margins: units.gu(2); topMargin: units.gu(4) }
48
height: contentItem.childrenRect.height
49
boundsBehavior: (contentHeight > routePage.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
53
Component.onCompleted: initialize()
55
function initialize() {
56
routePageModel.append({mode: "SEARCH", text: i18n.tr("Search"), iconName: "find", visible: true})
57
routePageModel.append({mode: "FAVORITES", text: i18n.tr("Favorites"), iconName: "starred", visible: true})
58
routePageModel.append({mode: "NEARBY", text: i18n.tr("Nearby"), iconName: "location", visible: true})
59
routePageModel.append({mode: "COORDINATES", text: i18n.tr("Coordinates"), iconName: "webbrowser-app-symbolic", visible: true})
60
routePageModel.append({mode: "SHARE", text: i18n.tr("Share"), iconName: "share", visible: true})
61
routePageModel.append({mode: "CANCEL", text: i18n.tr("Cancel"), iconName: "dialog-error-symbolic", visible: mainPageStack.routeState !== 'no'})
69
delegate: GridDelegate {
73
icon.name: model.iconName
74
visible: model.visible
77
if (model.mode === "FAVORITES") {
78
mainPageStack.push(Qt.resolvedUrl("FavoritesPage.qml"))
79
} else if (model.mode === "SEARCH") {
80
mainPageStack.push(Qt.resolvedUrl("SearchPage.qml"))
81
} else if (model.mode === "NEARBY") {
82
mainPageStack.push(Qt.resolvedUrl("Nearby.qml"))
83
} else if (model.mode === "COORDINATES") {
84
mainPageStack.push(Qt.resolvedUrl("Coordinate.qml"))
85
} else if (model.mode === "SHARE") {
86
mainPageStack.push(Qt.resolvedUrl("SharePage.qml"))
87
} else if (model.mode === "CANCEL") {
88
mainPageStack.routeState = 'no';
89
mainPageStack.executeJavaScript("click_cancel_route();");