Warning, /utilities/ktrip/src/qml/QueryPage.qml is written in an unsupported language. File is not indexed.
0001 /**
0002 * SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
0003 *
0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006
0007 import QtQuick 2.2
0008 import QtQuick.Layouts 1.1
0009 import QtQuick.Controls 2.4
0010 import org.kde.kirigami 2.0 as Kirigami
0011 import org.kde.ktrip 1.0
0012
0013 Kirigami.Page {
0014 id: root
0015
0016 title: departures ? i18nc("@title", "Query Departures") : i18nc("@title", "Start Journey")
0017
0018 property bool departures: false
0019
0020 actions: [
0021 Kirigami.Action {
0022 icon.name: "system-search-symbolic"
0023 text: i18nc("@action", "Search")
0024 enabled: Controller.start.name != "" && (Controller.destination.name != "" || root.departures)
0025 onTriggered: pageStack.push(root.departures ? Qt.resolvedUrl("DeparturesPage.qml") : Qt.resolvedUrl("ConnectionsPage.qml"))
0026 }
0027 ]
0028
0029 function startPicked(data) {
0030 Controller.start = data;
0031 }
0032
0033 function destinationPicked(data) {
0034 Controller.destination = data;
0035 }
0036
0037 ColumnLayout {
0038
0039 width: parent.width
0040
0041 Label {
0042 text: i18n("From:")
0043 }
0044 Button {
0045 Layout.fillWidth: true
0046 text: Controller.start.name ? Controller.start.name : i18nc("@action:button", "Pick Start")
0047 onClicked: pageStack.push(Qt.resolvedUrl("LocationQueryPage.qml"), {
0048 title: i18nc("@title", "Search for Start Location"),
0049 callback: root.startPicked
0050 })
0051 }
0052
0053 Label {
0054 text: i18n("To:")
0055 visible: !root.departures
0056 }
0057 Button {
0058 Layout.fillWidth: true
0059 visible: !root.departures
0060 text: Controller.destination.name ? Controller.destination.name : i18nc("@action:button", "Pick Destination")
0061 onClicked: pageStack.push(Qt.resolvedUrl("LocationQueryPage.qml"), {
0062 title: i18nc("@title", "Search for Destination Location"),
0063 callback: root.destinationPicked
0064 })
0065 }
0066
0067 Label {
0068 text: i18n("Departure date:")
0069 }
0070
0071 DatePickerButton {
0072 text: Qt.formatDate(Controller.departureDate, Qt.DefaultLocaleShortDate)
0073 Layout.fillWidth: true
0074 onDatePicked: theDate => {
0075 if (theDate != "") {
0076 Controller.departureDate = theDate;
0077 }
0078 }
0079 }
0080
0081 Label {
0082 text: i18n("Departure time:")
0083 }
0084
0085 TimePickerButton {
0086 text: Qt.formatTime(Controller.departureTime, Qt.DefaultLocaleShortDate)
0087 Layout.fillWidth: true
0088 onTimePicked: theTime => {
0089 if (theTime != "") {
0090 Controller.departureTime = theTime;
0091 }
0092 }
0093 }
0094 }
0095 }