Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Itinerary
Commits
b659cd4b
Commit
b659cd4b
authored
Aug 07, 2021
by
Volker Krause
Browse files
Remove the last bits of extraction code from ReservationManager
That's now all centralized in ApplicationController.
parent
e373f2d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/app/CMakeLists.txt
View file @
b659cd4b
...
...
@@ -54,6 +54,7 @@ target_link_libraries(itinerary PUBLIC
KPublicTransport
KPim::Itinerary
KPim::PkPass
KF5::Mime
KF5::I18n
KF5::Contacts
KF5::CoreAddons
...
...
@@ -97,7 +98,6 @@ if (ANDROID)
# so androiddeployqt picks them up
target_link_libraries
(
itinerary PUBLIC Qt::AndroidExtras KAndroidExtras
)
target_link_libraries
(
itinerary-app PRIVATE
KF5::Mime
KF5::Archive
KF5::Kirigami2
Qt::Svg
...
...
src/app/applicationcontroller.cpp
View file @
b659cd4b
...
...
@@ -52,10 +52,10 @@
#include
<QUrl>
#include
<QUrlQuery>
#ifdef Q_OS_ANDROID
#include
<KMime/Message>
#include
<KMime/Types>
#ifdef Q_OS_ANDROID
#include
<kandroidextras/activity.h>
#include
<kandroidextras/contentresolver.h>
#include
<kandroidextras/intent.h>
...
...
@@ -248,7 +248,7 @@ void ApplicationController::importFromIntent(const KAndroidExtras::Intent &inten
msg
.
assemble
();
qDebug
().
noquote
()
<<
msg
.
encodedContent
();
m_resMgr
->
importReservation
(
&
msg
);
importReservation
(
&
msg
);
return
;
}
...
...
@@ -557,6 +557,13 @@ void ApplicationController::importPass(const QString &passId)
}
}
void
ApplicationController
::
importMimeMessage
(
KMime
::
Message
*
msg
)
{
ExtractorEngine
engine
;
engine
.
setContent
(
QVariant
::
fromValue
<
KMime
::
Content
*>
(
msg
),
u"message/rfc822"
);
m_resMgr
->
importReservations
(
JsonLdDocument
::
fromJson
(
engine
.
extract
()));
}
void
ApplicationController
::
addDocument
(
const
QString
&
batchId
,
const
QUrl
&
url
)
{
if
(
!
url
.
isValid
())
{
...
...
src/app/applicationcontroller.h
View file @
b659cd4b
...
...
@@ -23,6 +23,8 @@ class ExtractorDocumentNode;
class
File
;
}
namespace
KMime
{
class
Message
;
}
namespace
KAndroidExtras
{
class
Intent
;
}
...
...
@@ -88,6 +90,7 @@ private:
bool
importBundle
(
KItinerary
::
File
*
file
);
bool
importHealthCertificateRecursive
(
const
KItinerary
::
ExtractorDocumentNode
&
node
);
void
importPass
(
const
QString
&
passId
);
void
importMimeMessage
(
KMime
::
Message
*
msg
);
static
ApplicationController
*
s_instance
;
...
...
src/app/reservationmanager.cpp
View file @
b659cd4b
...
...
@@ -9,7 +9,6 @@
#include
"reservationhelper.h"
#include
"logging.h"
#include
<KItinerary/ExtractorEngine>
#include
<KItinerary/ExtractorPostprocessor>
#include
<KItinerary/Event>
#include
<KItinerary/Flight>
...
...
@@ -19,10 +18,6 @@
#include
<KItinerary/SortUtil>
#include
<KItinerary/Visit>
#ifdef Q_OS_ANDROID
#include
<KMime/Message>
#endif
#include
<KLocalizedString>
#include
<QDate>
...
...
@@ -141,15 +136,6 @@ QString ReservationManager::batchesBasePath()
return
QStandardPaths
::
writableLocation
(
QStandardPaths
::
AppDataLocation
)
+
QLatin1String
(
"/batches/"
);
}
#ifdef Q_OS_ANDROID
QVector
<
QString
>
ReservationManager
::
importReservation
(
KMime
::
Message
*
msg
)
{
ExtractorEngine
engine
;
engine
.
setContent
(
QVariant
::
fromValue
<
KMime
::
Content
*>
(
msg
),
u"message/rfc822"
);
return
importReservations
(
JsonLdDocument
::
fromJson
(
engine
.
extract
()));
}
#endif
QVector
<
QString
>
ReservationManager
::
importReservations
(
const
QVector
<
QVariant
>
&
resData
)
{
ExtractorPostprocessor
postproc
;
...
...
src/app/reservationmanager.h
View file @
b659cd4b
...
...
@@ -13,10 +13,6 @@
#include
<QObject>
#include
<QVariant>
namespace
KMime
{
class
Message
;
}
class
PkPassManager
;
class
QUrl
;
/** Manages JSON-LD reservation data.
...
...
@@ -53,9 +49,6 @@ public:
* ids that previously existed, in case the extracted elements could be merged.
*/
QVector
<
QString
>
importReservations
(
const
QVector
<
QVariant
>
&
resData
);
#ifdef Q_OS_ANDROID
QVector
<
QString
>
importReservation
(
KMime
::
Message
*
msg
);
#endif
const
std
::
vector
<
QString
>&
batches
()
const
;
bool
hasBatch
(
const
QString
&
batchId
)
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment