Warning, /pim/itinerary/src/app/PkPassPage.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 org.kde.kirigami as Kirigami
0009 import org.kde.pkpass as KPkPass
0010 
0011 Kirigami.ScrollablePage {
0012     id: root
0013     property string passId
0014     property var pass
0015     title: {
0016         switch (pass.type) {
0017             case KPkPass.Pass.BoardingPass: return i18n("Boarding Pass");
0018             case KPkPass.Pass.EventTicket: return i18n("Event Ticket");
0019             case KPkPass.Pass.Generic: return i18n("Pass");
0020         }
0021     }
0022 
0023     data: BarcodeScanModeButton {
0024         page: root
0025         visible: pass.barcodes.length > 0
0026     }
0027 
0028     Component {
0029         id: boardingPass
0030         BoardingPass {
0031             passId: root.passId
0032             pass: root.pass
0033         }
0034     }
0035 
0036     Component {
0037         id: eventTicket
0038         EventTicket {
0039             passId: root.passId
0040             pass: root.pass
0041         }
0042     }
0043 
0044     Component {
0045         id: genericPass
0046         GenericPass {
0047             passId: root.passId
0048             pass: root.pass
0049         }
0050     }
0051 
0052     Item {
0053         id: contentItem
0054         width: parent.width
0055         implicitHeight: loader.item.implicitHeight
0056 
0057         Loader {
0058             id: loader
0059             x: (parent.width - implicitWidth) / 2
0060             sourceComponent: {
0061                 switch (root.pass.type) {
0062                     case KPkPass.Pass.BoardingPass: return boardingPass;
0063                     case KPkPass.Pass.EventTicket: return eventTicket;
0064                     case KPkPass.Pass.Generic: return genericPass;
0065                 }
0066             }
0067         }
0068 
0069         Connections {
0070             target: loader.item
0071             function onScanModeToggled() {
0072                 scanModeController.toggle();
0073             }
0074         }
0075     }
0076 }