Warning, /pim/itinerary/src/app/TicketTokenDelegate.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 QtQuick.Window 0011 import org.kde.kirigami as Kirigami 0012 import org.kde.prison as Prison 0013 import org.kde.kitinerary 0014 import org.kde.itinerary 0015 0016 ColumnLayout { 0017 id: root 0018 property var resIds 0019 0020 readonly property var currentReservationId: ticketModel.reservationIdAt(travelerBox.currentIndex) 0021 readonly property var currentTicket: ticketModel.reservationAt(travelerBox.currentIndex) ? ticketModel.reservationAt(travelerBox.currentIndex).reservedTicket : undefined 0022 readonly property int ticketTokenCount: travelerBox.count 0023 Layout.fillWidth: true 0024 Layout.topMargin: Kirigami.Units.largeSpacing 0025 Layout.bottomMargin: Kirigami.Units.largeSpacing 0026 0027 /** There is a barcode displayed. */ 0028 readonly property alias hasBarcode: barcodeContainer.visible 0029 /** Double tap on the barcode to request scan mode. */ 0030 signal scanModeToggled() 0031 0032 TicketTokenModel { 0033 id: ticketModel 0034 reservationManager: ReservationManager 0035 reservationIds: resIds 0036 } 0037 0038 QQC2.ComboBox { 0039 id: travelerBox 0040 Layout.alignment: Qt.AlignCenter 0041 model: ticketModel 0042 textRole: "display" 0043 Layout.fillWidth: true 0044 Layout.leftMargin: Kirigami.Units.largeSpacing 0045 Layout.rightMargin: Kirigami.Units.largeSpacing 0046 0047 // ugly, but rowCount does not trigger binding changes 0048 Component.onCompleted: { 0049 visible = ticketModel.rowCount() >= 1 && root.resIds.length > 1; 0050 currentIndex = ticketModel.initialIndex; 0051 } 0052 } 0053 0054 BarcodeContainer { 0055 id: barcodeContainer 0056 Layout.alignment: Qt.AlignCenter 0057 Layout.fillWidth: true 0058 barcodeType: currentTicket ? currentTicket.ticketTokenType : undefined 0059 barcodeContent: currentTicket ? currentTicket.ticketTokenData : undefined 0060 onDoubleClicked: root.scanModeToggled() 0061 } 0062 }