Commit 7963c5ec authored by Volker Krause's avatar Volker Krause

Use new Ticket API for parsing ticketToken

parent 73c76d54
......@@ -20,6 +20,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.kirigami 2.0 as Kirigami
import org.kde.prison 1.0 as Prison
import org.kde.kitinerary 1.0
import org.kde.itinerary 1.0
import "." as App
......@@ -49,23 +50,20 @@ Kirigami.Page {
Layout.margins: 4
barcodeType:
{
console.log(reservation.reservedTicket.ticketTokenType, Ticket.AztecCode);
if (reservation == undefined || reservation.reservedTicket == undefined)
return Prison.Barcode.Null;
if (reservation.reservedTicket.ticketToken.startsWith("qrCode:"))
return Prison.Barcode.QRCode;
return Prison.Barcode.Aztec;
switch (reservation.reservedTicket.ticketTokenType) {
case Ticket.QRCode: return Prison.Barcode.QRCode;
case Ticket.AztecCode: return Prison.Barcode.Aztec;
}
return Prison.Barcode.Null;
}
content:
{
if (barcodeType == Prison.Barcode.Null || reservation == undefined || reservation.reservedTicket == undefined)
return "";
switch (barcodeType) {
case Prison.Barcode.QRCode:
return reservation.reservedTicket.ticketToken.substr(7); // "qrCode:"
case Prison.Barcode.Aztec:
return reservation.reservedTicket.ticketToken.substr(10); // "aztecCode:"
}
return "";
return reservation.reservedTicket.ticketTokenData;
}
}
}
......
......@@ -25,6 +25,8 @@
#include "pkpassimageprovider.h"
#include "reservationmanager.h"
#include <KItinerary/Ticket>
#include <KPkPass/Field>
#include <KPkPass/Barcode>
......@@ -108,6 +110,8 @@ int main(int argc, char **argv)
qmlRegisterUncreatableType<KPkPass::Barcode>("org.kde.pkpass", 1, 0, "Barcode", {});
qmlRegisterUncreatableType<KPkPass::Field>("org.kde.pkpass", 1, 0, "Field", {});
qmlRegisterUncreatableType<KItinerary::Ticket>("org.kde.kitinerary", 1, 0, "Ticket", {});
qmlRegisterUncreatableType<TimelineModel>("org.kde.itinerary", 1, 0, "TimelineModel", {});
qmlRegisterSingletonType<Localizer>("org.kde.itinerary", 1, 0, "Localizer", [](QQmlEngine*, QJSEngine*) -> QObject*{
return new Localizer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment