diff --git a/src/app/FlightDelegate.qml b/src/app/FlightDelegate.qml index e13179f..c353ebb 100644 --- a/src/app/FlightDelegate.qml +++ b/src/app/FlightDelegate.qml @@ -1,123 +1,123 @@ /* Copyright (C) 2018 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root function airportDisplayString(airport) { return airport.name ? airport.name : airport.iataCode; } function airportDisplayCode(airport) { return airport.iataCode ? airport.iataCode : airport.name; } function seatString() { var s = new Array(); for (var i = 0; i < root.resIds.length; ++i) { var res = _reservationManager.reservation(root.resIds[i]); if (res.airplaneSeat) s.push(res.airplaneSeat); } if (s.length === 0) return "-"; return s.join(", "); } headerIconSource: "qrc:///images/flight.svg" headerItem: RowLayout { QQC2.Label { text: i18n("%1 %2 → %3", reservationFor.airline.iataCode + " " + reservationFor.flightNumber, airportDisplayCode(reservationFor.departureAirport), airportDisplayCode(reservationFor.arrivalAirport)) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale elide: Text.ElideRight Layout.fillWidth: true } QQC2.Label { text: isNaN(reservationFor.boardingTime.getTime()) ? Localizer.formatTime(reservationFor, "departureTime") : Localizer.formatTime(reservationFor, "boardingTime") color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale } } contentItem: ColumnLayout { id: topLayout QQC2.Label { - text: i18n("Departure from %1: %2", + text: i18nc("flight departure, %1 is airport, %2 is time", "Departure from %1: %2", airportDisplayString(reservationFor.departureAirport), Localizer.formatTime(reservationFor, "departureTime") + " ") color: Kirigami.Theme.textColor wrapMode: Text.WordWrap Layout.fillWidth: true } App.PlaceDelegate { place: reservationFor.departureAirport controller: root.controller isRangeBegin: true Layout.fillWidth: true } QQC2.Label { text: i18n("Terminal: %1 Gate: %2 Seat: %3", reservationFor.departureTerminal ? reservationFor.departureTerminal : "-", reservationFor.departureGate ? reservationFor.departureGate : "-", seatString()) color: Kirigami.Theme.textColor } Kirigami.Separator { Layout.fillWidth: true } QQC2.Label { - text: i18n("Arrival at %1: %2", + text: i18nc("flight arrival, %1 is airport, %2 is time", "Arrival at %1: %2", airportDisplayString(reservationFor.arrivalAirport), Localizer.formatDateTime(reservationFor, "arrivalTime") + " ") color: Kirigami.Theme.textColor wrapMode: Text.WordWrap Layout.fillWidth: true } App.PlaceDelegate { place: reservationFor.arrivalAirport controller: root.controller isRangeEnd: true Layout.fillWidth: true } } Component { id: detailsComponent App.FlightPage { batchId: root.batchId } } onClicked: applicationWindow().pageStack.push(detailsComponent); } diff --git a/src/app/FlightPage.qml b/src/app/FlightPage.qml index b7178f9..450aaf4 100644 --- a/src/app/FlightPage.qml +++ b/src/app/FlightPage.qml @@ -1,178 +1,178 @@ /* Copyright (C) 2018 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App App.DetailsPage { id: root title: i18n("Flight") property var resIds: _reservationManager.reservationsForBatch(root.batchId) editor: Component { App.FlightEditor { batchId: root.batchId } } function airportDisplayString(airport) { if (airport.name && airport.iataCode) { return airport.name + " (" + airport.iataCode + ")"; } else { return airport.name || airport.iataCode || ""; } } ColumnLayout { width: parent.width QQC2.Label { Layout.fillWidth: true text: reservationFor.airline.iataCode + " " + reservationFor.flightNumber horizontalAlignment: Qt.AlignHCenter font.bold: true } // ticket barcode App.TicketTokenDelegate { id: ticketDelegate resIds: _reservationManager.reservationsForBatch(root.batchId) onCurrentReservationIdChanged: { if (!currentReservationId) return; root.currentReservationId = currentReservationId; } } Kirigami.FormLayout { Layout.fillWidth: true // sequence number belongs to the selected barcode QQC2.Label { Kirigami.FormData.label: i18n("Sequence Number:") text: _reservationManager.reservation(ticketDelegate.currentReservationId).passengerSequenceNumber visible: text } // flight details Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: i18n("Flight") } QQC2.Label { Kirigami.FormData.label: i18n("Boarding:") text: Localizer.formatDateTime(reservationFor, "boardingTime") visible: reservationFor.boardingTime > 0 } QQC2.Label { Kirigami.FormData.label: i18n("Boarding group:") text: reservation.boardingGroup visible: reservation.boardingGroup.length > 0 } QQC2.Label { Kirigami.FormData.label: i18n("Seat:") text: reservation.airplaneSeat visible: reservation.airplaneSeat.length > 0 } QQC2.Label { Kirigami.FormData.label: i18n("Airline:") text: reservationFor.airline.name visible: reservationFor.airline.name.length > 0 } // departure data Kirigami.Separator { Kirigami.FormData.isSection: true - Kirigami.FormData.label: i18n("Departure") + Kirigami.FormData.label: i18nc("flight departure", "Departure") } QQC2.Label { Kirigami.FormData.label: i18n("Time:") text: Localizer.formatDateTime(reservationFor, "departureTime") visible: reservationFor.departureTime > 0 } QQC2.Label { Kirigami.FormData.label: i18n("Airport:") text: airportDisplayString(reservationFor.departureAirport) visible: text.length > 0 } App.PlaceDelegate { place: reservationFor.departureAirport controller: root.controller isRangeBegin: true } QQC2.Label { Kirigami.FormData.label: i18n("Terminal:") text: reservationFor.departureTerminal visible: reservationFor.departureTerminal.length > 0 } QQC2.Label { Kirigami.FormData.label: i18n("Gate:") text: reservationFor.departureGate visible: reservationFor.departureGate.length > 0 } // arrival data Kirigami.Separator { Kirigami.FormData.isSection: true - Kirigami.FormData.label: i18n("Arrival") + Kirigami.FormData.label: i18nc("flight arrival", "Arrival") } QQC2.Label { Kirigami.FormData.label: i18n("Time:") text: Localizer.formatDateTime(reservationFor, "arrivalTime") visible: reservationFor.arrivalTime > 0 } QQC2.Label { Kirigami.FormData.label: i18n("Airport:") text: airportDisplayString(reservationFor.arrivalAirport) visible: text.length > 0 } App.PlaceDelegate { place: reservationFor.arrivalAirport controller: root.controller isRangeEnd: true } QQC2.Label { Kirigami.FormData.label: i18n("Terminal:") text: reservationFor.arrivalTerminal visible: reservationFor.arrivalTerminal.length > 0 } // booking details Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: i18n("Booking") } Repeater { model: resIds.length * 2 delegate: QQC2.Label { property var res: _reservationManager.reservation(resIds[Math.floor(index/2)]); Kirigami.FormData.label: index % 2 == 0 ? i18n("Under name:") : i18n("Reference:") text: index % 2 == 0 ? res.underName.name : res.reservationNumber } } } } }