Warning, /pim/itinerary/src/app/FlightDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Layouts 0009 import QtQuick.Controls as QQC2 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.itinerary 0012 0013 TimelineDelegate { 0014 id: root 0015 0016 function airportDisplayString(airport) 0017 { 0018 return airport.name ? airport.name : airport.iataCode; 0019 } 0020 0021 function airportDisplayCode(airport) 0022 { 0023 return airport.iataCode ? airport.iataCode : airport.name; 0024 } 0025 0026 function seatString() { 0027 var s = new Array(); 0028 for (var i = 0; i < root.resIds.length; ++i) { 0029 var res = ReservationManager.reservation(root.resIds[i]); 0030 if (res.airplaneSeat) 0031 s.push(res.airplaneSeat); 0032 } 0033 if (s.length === 0) 0034 return "-"; 0035 return s.join(", "); 0036 } 0037 0038 headerIconSource: "qrc:///images/flight.svg" 0039 headerItem: RowLayout { 0040 QQC2.Label { 0041 id: headerLabel 0042 text: i18n("%1 %2 → %3", 0043 reservationFor.airline.iataCode + " " + reservationFor.flightNumber, 0044 airportDisplayCode(reservationFor.departureAirport), 0045 airportDisplayCode(reservationFor.arrivalAirport)) 0046 color: root.headerTextColor 0047 elide: Text.ElideRight 0048 Layout.fillWidth: true 0049 Accessible.ignored: true 0050 } 0051 QQC2.Label { 0052 text: isNaN(reservationFor.boardingTime.getTime()) ? 0053 Localizer.formatTime(reservationFor, "departureTime") : 0054 Localizer.formatTime(reservationFor, "boardingTime") 0055 color: root.headerTextColor 0056 } 0057 } 0058 0059 contentItem: Column { 0060 id: topLayout 0061 spacing: Kirigami.Units.smallSpacing 0062 0063 QQC2.Label { 0064 text: i18nc("flight departure, %1 is airport, %2 is time", "Departure from %1: %2", 0065 airportDisplayString(reservationFor.departureAirport), 0066 Localizer.formatTime(reservationFor, "departureTime") + " ") 0067 color: Kirigami.Theme.textColor 0068 wrapMode: Text.WordWrap 0069 width: topLayout.width 0070 } 0071 QQC2.Label { 0072 visible: text !== "" 0073 width: topLayout.width 0074 text: Localizer.formatAddressWithContext(reservationFor.departureAirport.address, 0075 reservationFor.arrivalAirport.address, 0076 Settings.homeCountryIsoCode) 0077 } 0078 QQC2.Label { 0079 text: i18n("Terminal: %1 Gate: %2 Seat: %3", 0080 reservationFor.departureTerminal ? reservationFor.departureTerminal : "-", 0081 reservationFor.departureGate ? reservationFor.departureGate : "-", seatString()) 0082 color: Kirigami.Theme.textColor 0083 } 0084 0085 Kirigami.Separator { 0086 width: topLayout.width 0087 } 0088 0089 QQC2.Label { 0090 text: i18nc("flight arrival, %1 is airport, %2 is time", "Arrival at %1: %2", 0091 airportDisplayString(reservationFor.arrivalAirport), 0092 Localizer.formatDateTime(reservationFor, "arrivalTime") + " ") 0093 color: Kirigami.Theme.textColor 0094 wrapMode: Text.WordWrap 0095 width: topLayout.width 0096 } 0097 QQC2.Label { 0098 visible: text !== "" 0099 width: topLayout.width 0100 text: Localizer.formatAddressWithContext(reservationFor.arrivalAirport.address, 0101 reservationFor.departureAirport.address, 0102 Settings.homeCountryIsoCode) 0103 } 0104 } 0105 0106 onClicked: showDetailsPage(flightDetailsPage, root.batchId) 0107 Accessible.name: headerLabel.text 0108 }