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 {
0015     id: root
0016 
0017     title: departures ? i18nc("@title", "Query Departures") : i18nc("@title", "Start Journey")
0018 
0019     property bool departures: false
0020 
0021     actions.main: 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     function startPicked(data) {
0029         Controller.start = data
0030     }
0031 
0032     function destinationPicked(data) {
0033         Controller.destination = data
0034     }
0035 
0036     ColumnLayout {
0037 
0038         width: parent.width
0039 
0040         Label {
0041             text: i18n("From:")
0042         }
0043         Button {
0044             Layout.fillWidth: true
0045             text: Controller.start.name ? Controller.start.name : i18nc("@action:button", "Pick Start")
0046             onClicked: pageStack.push(Qt.resolvedUrl("LocationQueryPage.qml"), {title: i18nc("@title", "Search for Start Location"), callback: root.startPicked})
0047         }
0048 
0049         Label {
0050             text: i18n("To:")
0051             visible: !root.departures
0052         }
0053         Button {
0054             Layout.fillWidth: true
0055             visible: !root.departures
0056             text: Controller.destination.name ? Controller.destination.name : i18nc("@action:button", "Pick Destination")
0057             onClicked: pageStack.push(Qt.resolvedUrl("LocationQueryPage.qml"), {title: i18nc("@title", "Search for Destination Location"), callback: root.destinationPicked})
0058         }
0059 
0060         Label {
0061             text: i18n("Departure date:")
0062         }
0063 
0064         DatePickerButton {
0065             text: Qt.formatDate(Controller.departureDate, Qt.DefaultLocaleShortDate)
0066             Layout.fillWidth: true
0067             onDatePicked: {
0068                 if (theDate != "") {
0069                     Controller.departureDate = theDate
0070                 }
0071             }
0072         }
0073 
0074         Label {
0075             text: i18n("Departure time:")
0076         }
0077 
0078         TimePickerButton {
0079             text: Qt.formatTime(Controller.departureTime, Qt.DefaultLocaleShortDate)
0080             Layout.fillWidth: true
0081             onTimePicked: {
0082                 if (theTime != "") {
0083                     Controller.departureTime = theTime
0084                 }
0085             }
0086         }
0087     }
0088 }
0089 
0090