Commit 527b6b96 authored by Volker Krause's avatar Volker Krause

Merge imported content with existing content

This is necessary when e.g. scanning a boarding pass barcode of an
already existing booking.
parent 1697c9e9
......@@ -22,7 +22,6 @@
#include "reservationmanager.h"
#include <KItinerary/ExtractorEngine>
#include <KItinerary/ExtractorPostprocessor>
#include <KItinerary/IataBcbpParser>
#include <KItinerary/JsonLdDocument>
#include <KItinerary/PdfDocument>
......@@ -433,23 +432,13 @@ void ApplicationController::importPdf(const QByteArray &data)
ExtractorEngine engine;
engine.setContextDate(QDateTime::currentDateTime());
engine.setPdfDocument(doc.get());
ExtractorPostprocessor postproc;
postproc.setContextDate(QDateTime::currentDateTime());
postproc.process(JsonLdDocument::fromJson(engine.extract()));
const auto res = postproc.result();
for (const auto &r : res) {
m_resMgr->addReservation(r);
}
m_resMgr->importReservations(JsonLdDocument::fromJson(engine.extract()));
}
void ApplicationController::importIataBcbp(const QByteArray &data)
{
const auto content = IataBcbpParser::parse(QString::fromUtf8(data), QDate::currentDate());
ExtractorPostprocessor postproc;
postproc.setContextDate(QDateTime::currentDateTime());
postproc.process(content);
for (const auto &res : postproc.result())
m_resMgr->addReservation(res);
m_resMgr->importReservations(content);
}
void ApplicationController::checkCalendar()
......
......@@ -46,6 +46,7 @@ public:
Q_INVOKABLE void removeReservations(const QStringList &ids);
void importReservation(const QByteArray &data);
void importReservations(const QVector<QVariant> &resData);
signals:
void reservationAdded(const QString &id);
......@@ -54,7 +55,6 @@ signals:
private:
static QString basePath();
void importReservations(const QVector<QVariant> &resData);
void passAdded(const QString &passId);
void passUpdated(const QString &passId);
......
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