Commit 0215896b authored by Volker Krause's avatar Volker Krause
Browse files

Add JS API to parse VDV tickets too

parent 2d3ed06a
......@@ -23,6 +23,8 @@
#include <KItinerary/IataBcbpParser>
#include <KItinerary/PdfDocument>
#include <KItinerary/Uic9183Parser>
#include <KItinerary/VdvTicket>
#include <KItinerary/VdvTicketParser>
#include <QImage>
......@@ -110,6 +112,15 @@ QVariant JsApi::Barcode::decodeIataBcbp(const QString &s) const
return QVariant::fromValue(IataBcbpParser::parse(s,;
QVariant JsApi::Barcode::decodeVdvTicket(const QVariant &s) const
VdvTicketParser p;
if (!p.parse(s.toByteArray())) {
return {};
return QVariant::fromValue(p.ticket());
QString JsApi::Barcode::toBase64(const QVariant &b) const
return QString::fromUtf8(b.toByteArray().toBase64());
......@@ -63,6 +63,11 @@ public:
* @returns A JSON-LD structure representing the boarding pass.
Q_INVOKABLE QVariant decodeIataBcbp(const QString &s) const;
/** Decode an VDV ticket barcode.
* @param s A QByteArray containing the raw VDV barcode data.
* @returns An instance of VdvTicket.
Q_INVOKABLE QVariant decodeVdvTicket(const QVariant &s) const;
/** Converts the given QByteArray into an base64 encoded string. */
Q_INVOKABLE QString toBase64(const QVariant &b) const;
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