summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-10-11 14:08:35 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-10-12 21:23:29 (GMT)
commit277cbdcbfbce200957c107a96bc6f6627bdafe3e (patch)
treeda99d9e653391b8d08bf527199dd609bd7922c60
parent75b1bd97fd877f7f200b86bab6ce4cb36bcd3097 (diff)
Port messagelib to GpgME 1.7 and new LibKleo
-rw-r--r--CMakeLists.txt5
-rw-r--r--messagecomposer/autotests/CMakeLists.txt2
-rw-r--r--messagecomposer/autotests/cryptofunctions.cpp2
-rw-r--r--messagecomposer/autotests/encryptjobtest.cpp2
-rw-r--r--messagecomposer/autotests/setupenv.cpp18
-rw-r--r--messagecomposer/autotests/signencrypttest.cpp2
-rw-r--r--messagecomposer/autotests/signjobtest.cpp2
-rw-r--r--messagecomposer/src/attachment/attachmentcontrollerbase.cpp4
-rw-r--r--messagecomposer/src/composer/keyresolver.cpp22
-rw-r--r--messagecomposer/src/composer/keyresolver.h4
-rw-r--r--messagecomposer/src/job/attachmentfrompublickeyjob.cpp7
-rw-r--r--messagecomposer/src/job/encryptjob.cpp17
-rw-r--r--messagecomposer/src/job/encryptjob.h3
-rw-r--r--messagecomposer/src/job/signencryptjob.cpp16
-rw-r--r--messagecomposer/src/job/signencryptjob.h3
-rw-r--r--messagecomposer/src/job/signjob.cpp16
-rw-r--r--messagecomposer/src/job/signjob.h2
-rw-r--r--messageviewer/autotests/CMakeLists.txt2
-rw-r--r--messageviewer/src/CMakeLists.txt7
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer.cpp15
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp11
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp3
-rw-r--r--messageviewer/src/viewer/webengine/autotests/CMakeLists.txt2
-rw-r--r--mimetreeparser/src/CMakeLists.txt3
-rw-r--r--mimetreeparser/src/bodyformatter/applicationpgpencrypted.cpp4
-rw-r--r--mimetreeparser/src/bodyformatter/applicationpkcs7mime.cpp4
-rw-r--r--mimetreeparser/src/bodyformatter/multipartencrypted.cpp8
-rw-r--r--mimetreeparser/src/bodyformatter/multipartsigned.cpp12
-rw-r--r--mimetreeparser/src/job/qgpgmejobexecutor.cpp (renamed from mimetreeparser/src/job/kleojobexecutor.cpp)51
-rw-r--r--mimetreeparser/src/job/qgpgmejobexecutor.h (renamed from mimetreeparser/src/job/kleojobexecutor.h)14
-rw-r--r--mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.cpp12
-rw-r--r--mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.h6
-rw-r--r--mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.cpp6
-rw-r--r--mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.h10
-rw-r--r--mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.cpp6
-rw-r--r--mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.h10
-rw-r--r--mimetreeparser/src/viewer/messagepart.cpp39
-rw-r--r--mimetreeparser/src/viewer/messagepart.h18
-rw-r--r--mimetreeparser/src/viewer/objecttreeparser.cpp6
-rw-r--r--mimetreeparser/src/viewer/objecttreeparser.h1
-rw-r--r--templateparser/autotests/CMakeLists.txt2
41 files changed, 179 insertions, 200 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06c549e..947e19f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.72")
+set(PIM_VERSION "5.3.73")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
@@ -38,7 +38,7 @@ set(KMBOX_LIB_VERSION "5.3.40")
set(KMIME_LIB_VERSION "5.3.40")
set(KPIMTEXTEDIT_LIB_VERSION "5.3.43")
set(LIBKDEPIM_LIB_VERSION "5.3.42")
-set(LIBKLEO_LIB_VERSION "5.3.40")
+set(LIBKLEO_LIB_VERSION "5.3.46")
set(PIMCOMMON_LIB_VERSION "5.3.54")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test Network PrintSupport WebEngine WebEngineWidgets WebKitWidgets)
@@ -61,7 +61,6 @@ find_package(KF5WindowSystem ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
find_package(Grantlee5 "5.1" CONFIG REQUIRED)
-find_package(Gpgme REQUIRED)
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
diff --git a/messagecomposer/autotests/CMakeLists.txt b/messagecomposer/autotests/CMakeLists.txt
index 73c4354..496b21e 100644
--- a/messagecomposer/autotests/CMakeLists.txt
+++ b/messagecomposer/autotests/CMakeLists.txt
@@ -27,7 +27,7 @@ macro( add_messagecomposer_cryptotest _source )
KF5::PimTextEdit
KF5::AkonadiCore
Qt5::Test
- KF5::QGpgme
+ QGpgme
KF5::IconThemes
KF5::Completion
KF5::MailTransport
diff --git a/messagecomposer/autotests/cryptofunctions.cpp b/messagecomposer/autotests/cryptofunctions.cpp
index 24c87de..8a093a5 100644
--- a/messagecomposer/autotests/cryptofunctions.cpp
+++ b/messagecomposer/autotests/cryptofunctions.cpp
@@ -26,8 +26,6 @@
#include "MessageComposer/Util"
#include <Libkleo/Enum>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/CryptoBackendFactory>
#include <KMime/Message>
#include <KMime/Content>
diff --git a/messagecomposer/autotests/encryptjobtest.cpp b/messagecomposer/autotests/encryptjobtest.cpp
index c44e1e7..62097bb 100644
--- a/messagecomposer/autotests/encryptjobtest.cpp
+++ b/messagecomposer/autotests/encryptjobtest.cpp
@@ -28,8 +28,6 @@
#include <kmime/kmime_content.h>
#include <Libkleo/Enum>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/CryptoBackendFactory>
#include <kjob.h>
#include <MessageComposer/Composer>
diff --git a/messagecomposer/autotests/setupenv.cpp b/messagecomposer/autotests/setupenv.cpp
index 431e31d..6392519 100644
--- a/messagecomposer/autotests/setupenv.cpp
+++ b/messagecomposer/autotests/setupenv.cpp
@@ -20,9 +20,9 @@
#include "setupenv.h"
-#include <Libkleo/KeyListJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/KeyListJob>
#include <gpgme++/keylistresult.h>
-#include <Libkleo/CryptoBackendFactory>
#include <QFile>
#include <QDir>
@@ -32,26 +32,18 @@ void MessageComposer::Test::setupEnv()
{
setenv("LC_ALL", "C", 1);
setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1("/.qttest")).constData(), 1);
-
- QStringList reasons;
- Kleo::CryptoBackendFactory::instance()->scanForBackends(&reasons);
- if (!reasons.isEmpty()) {
- Q_FOREACH (const QString &reason, reasons) {
- qWarning() << reason;
- }
- }
}
std::vector< GpgME::Key, std::allocator< GpgME::Key > > MessageComposer::Test::getKeys(bool smime)
{
- Kleo::KeyListJob *job = 0;
+ QGpgME::KeyListJob *job = 0;
if (smime) {
- const Kleo::CryptoBackend::Protocol *const backend = Kleo::CryptoBackendFactory::instance()->smime();
+ const QGpgME::Protocol *const backend = QGpgME::smime();
Q_ASSERT(backend);
job = backend->keyListJob(false);
} else {
- const Kleo::CryptoBackend::Protocol *const backend = Kleo::CryptoBackendFactory::instance()->openpgp();
+ const QGpgME::Protocol *const backend = QGpgME::openpgp();
Q_ASSERT(backend);
job = backend->keyListJob(false);
}
diff --git a/messagecomposer/autotests/signencrypttest.cpp b/messagecomposer/autotests/signencrypttest.cpp
index 5e7637e..4f99267 100644
--- a/messagecomposer/autotests/signencrypttest.cpp
+++ b/messagecomposer/autotests/signencrypttest.cpp
@@ -30,8 +30,6 @@
#include <kmime/kmime_content.h>
#include <Libkleo/Enum>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/CryptoBackendFactory>
#include <kjob.h>
#include <MessageComposer/Composer>
diff --git a/messagecomposer/autotests/signjobtest.cpp b/messagecomposer/autotests/signjobtest.cpp
index bb731e7..e9a6c9d 100644
--- a/messagecomposer/autotests/signjobtest.cpp
+++ b/messagecomposer/autotests/signjobtest.cpp
@@ -28,8 +28,6 @@
#include <kmime/kmime_content.h>
#include <Libkleo/Enum>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/CryptoBackendFactory>
#include <kjob.h>
#include <MessageComposer/Composer>
diff --git a/messagecomposer/src/attachment/attachmentcontrollerbase.cpp b/messagecomposer/src/attachment/attachmentcontrollerbase.cpp
index 28703e7..dba0277 100644
--- a/messagecomposer/src/attachment/attachmentcontrollerbase.cpp
+++ b/messagecomposer/src/attachment/attachmentcontrollerbase.cpp
@@ -58,7 +58,7 @@
#include <KFileItemActions>
#include <KActionMenu>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include <Libkleo/KeySelectionDialog>
#include <MessageCore/AttachmentCompressJob>
@@ -390,7 +390,7 @@ void AttachmentControllerBase::Private::createOpenWithMenu(QMenu *topMenu, Attac
void AttachmentControllerBase::exportPublicKey(const QString &fingerprint)
{
- if (fingerprint.isEmpty() || !Kleo::CryptoBackendFactory::instance()->openpgp()) {
+ if (fingerprint.isEmpty() || !QGpgME::openpgp()) {
qCWarning(MESSAGECOMPOSER_LOG) << "Tried to export key with empty fingerprint, or no OpenPGP.";
return;
}
diff --git a/messagecomposer/src/composer/keyresolver.cpp b/messagecomposer/src/composer/keyresolver.cpp
index f69c325..bc1beb4 100644
--- a/messagecomposer/src/composer/keyresolver.cpp
+++ b/messagecomposer/src/composer/keyresolver.cpp
@@ -43,10 +43,11 @@
#include "utils/kleo_util.h"
#include <KEmailAddress>
-#include "Libkleo/KeySelectionDialog"
-#include "Libkleo/CryptoBackendFactory"
-#include "Libkleo/KeyListJob"
-#include "Libkleo/Dn"
+#include <Libkleo/KeySelectionDialog>
+#include <Libkleo/Dn>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/KeyListJob>
#include <gpgme++/key.h>
#include <gpgme++/keylistresult.h>
@@ -113,11 +114,6 @@ CopyKeysAndEncryptionPreferences(const Kleo::KeyResolver::Item &oldItem,
return Kleo::KeyResolver::Item(oldItem.address, newItem.keys, newItem.pref, oldItem.signPref, oldItem.format);
}
-static inline bool ByKeyID(const GpgME::Key &left, const GpgME::Key &right)
-{
- return qstrcmp(left.keyID(), right.keyID()) < 0;
-}
-
static inline bool WithRespectToKeyID(const GpgME::Key &left, const GpgME::Key &right)
{
return qstrcmp(left.keyID(), right.keyID()) == 0;
@@ -1866,8 +1862,8 @@ std::vector<GpgME::Key> Kleo::KeyResolver::lookup(const QStringList &patterns, b
qCDebug(MESSAGECOMPOSER_LOG) << "( \"" << patterns.join(QStringLiteral("\", \"")) << "\"," << secret << ")";
std::vector<GpgME::Key> result;
if (mCryptoMessageFormats & (InlineOpenPGPFormat | OpenPGPMIMEFormat))
- if (const Kleo::CryptoBackend::Protocol *p = Kleo::CryptoBackendFactory::instance()->openpgp()) {
- std::unique_ptr<Kleo::KeyListJob> job(p->keyListJob(false, false, true)); // use validating keylisting
+ if (const QGpgME::Protocol *p = QGpgME::openpgp()) {
+ std::unique_ptr<QGpgME::KeyListJob> job(p->keyListJob(false, false, true)); // use validating keylisting
if (job.get()) {
std::vector<GpgME::Key> keys;
job->exec(patterns, secret, keys);
@@ -1875,8 +1871,8 @@ std::vector<GpgME::Key> Kleo::KeyResolver::lookup(const QStringList &patterns, b
}
}
if (mCryptoMessageFormats & (SMIMEFormat | SMIMEOpaqueFormat))
- if (const Kleo::CryptoBackend::Protocol *p = Kleo::CryptoBackendFactory::instance()->smime()) {
- std::unique_ptr<Kleo::KeyListJob> job(p->keyListJob(false, false, true)); // use validating keylisting
+ if (const QGpgME::Protocol *p = QGpgME::smime()) {
+ std::unique_ptr<QGpgME::KeyListJob> job(p->keyListJob(false, false, true)); // use validating keylisting
if (job.get()) {
std::vector<GpgME::Key> keys;
job->exec(patterns, secret, keys);
diff --git a/messagecomposer/src/composer/keyresolver.h b/messagecomposer/src/composer/keyresolver.h
index 2e99edd..55ec978 100644
--- a/messagecomposer/src/composer/keyresolver.h
+++ b/messagecomposer/src/composer/keyresolver.h
@@ -38,8 +38,8 @@
#define __KLEO_KEYRESOLVER_H__
#include "messagecomposer_export.h"
-#include "Libkleo/KeyApprovalDialog"
-#include "Libkleo/Enum"
+#include <Libkleo/KeyApprovalDialog>
+#include <Libkleo/Enum>
#include <gpgme++/key.h>
diff --git a/messagecomposer/src/job/attachmentfrompublickeyjob.cpp b/messagecomposer/src/job/attachmentfrompublickeyjob.cpp
index 8adfeb3..8d7b1f8 100644
--- a/messagecomposer/src/job/attachmentfrompublickeyjob.cpp
+++ b/messagecomposer/src/job/attachmentfrompublickeyjob.cpp
@@ -26,8 +26,9 @@
#include <KDialogJobUiDelegate>
#include <KLocalizedString>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/ExportJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/ExportJob>
+
#include <Libkleo/ProgressDialog>
using namespace MessageComposer;
@@ -105,7 +106,7 @@ void AttachmentFromPublicKeyJob::setFingerprint(const QString &fingerprint)
void AttachmentFromPublicKeyJob::doStart()
{
- Kleo::ExportJob *job = Kleo::CryptoBackendFactory::instance()->openpgp()->publicKeyExportJob(true);
+ QGpgME::ExportJob *job = QGpgME::openpgp()->publicKeyExportJob(true);
Q_ASSERT(job);
QObject::connect(job, SIGNAL(result(GpgME::Error,QByteArray)),
this, SLOT(exportResult(GpgME::Error,QByteArray)));
diff --git a/messagecomposer/src/job/encryptjob.cpp b/messagecomposer/src/job/encryptjob.cpp
index 0710d07..5b3d256 100644
--- a/messagecomposer/src/job/encryptjob.cpp
+++ b/messagecomposer/src/job/encryptjob.cpp
@@ -21,12 +21,13 @@
#include "job/encryptjob.h"
#include "contentjobbase_p.h"
-#include "Libkleo/CryptoBackendFactory"
-#include "Libkleo/CryptoBackend"
-#include "Libkleo/EncryptJob"
-#include "Libkleo/Enum"
#include "utils/util.h"
+#include <Libkleo/Enum>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/EncryptJob>
+
#include "messagecomposer_debug.h"
#include <kmime/kmime_message.h>
@@ -155,11 +156,11 @@ void EncryptJob::process()
//d->resultContent = new KMime::Content;
- const Kleo::CryptoBackend::Protocol *proto = Q_NULLPTR;
+ const QGpgME::Protocol *proto = Q_NULLPTR;
if (d->format & Kleo::AnyOpenPGP) {
- proto = Kleo::CryptoBackendFactory::instance()->openpgp();
+ proto = QGpgME::openpgp();
} else if (d->format & Kleo::AnySMIME) {
- proto = Kleo::CryptoBackendFactory::instance()->smime();
+ proto = QGpgME::smime();
} else {
qCDebug(MESSAGECOMPOSER_LOG) << "HELP! Encrypt job but have protocol to encrypt with.";
return;
@@ -168,7 +169,7 @@ void EncryptJob::process()
Q_ASSERT(proto);
qCDebug(MESSAGECOMPOSER_LOG) << "got backend, starting job";
- Kleo::EncryptJob *seJob = proto->encryptJob(!d->binaryHint(d->format), d->format == Kleo::InlineOpenPGPFormat);
+ QGpgME::EncryptJob *seJob = proto->encryptJob(!d->binaryHint(d->format), d->format == Kleo::InlineOpenPGPFormat);
// for now just do the main recipients
QByteArray encryptedBody;
diff --git a/messagecomposer/src/job/encryptjob.h b/messagecomposer/src/job/encryptjob.h
index 865a9b5..99b24b6 100644
--- a/messagecomposer/src/job/encryptjob.h
+++ b/messagecomposer/src/job/encryptjob.h
@@ -25,7 +25,8 @@
#include "contentjobbase.h"
#include "part/infopart.h"
#include "messagecomposer_export.h"
-#include "Libkleo/Enum"
+
+#include <Libkleo/Enum>
#include <gpgme++/key.h>
#include <vector>
diff --git a/messagecomposer/src/job/signencryptjob.cpp b/messagecomposer/src/job/signencryptjob.cpp
index 842c92e..9423b0e 100644
--- a/messagecomposer/src/job/signencryptjob.cpp
+++ b/messagecomposer/src/job/signencryptjob.cpp
@@ -21,12 +21,12 @@
#include "job/signencryptjob.h"
#include "contentjobbase_p.h"
-#include "Libkleo/CryptoBackendFactory"
-#include "Libkleo/CryptoBackend"
-#include "Libkleo/Enum"
-#include "Libkleo/SignEncryptJob"
#include "utils/util.h"
+#include <Libkleo/Enum>
+#include <QGpgME/Protocol>
+#include <QGpgME/SignEncryptJob>
+
#include "messagecomposer_debug.h"
#include <kmime/kmime_message.h>
#include <kmime/kmime_content.h>
@@ -157,11 +157,11 @@ void SignEncryptJob::process()
d->content = d->subjobContents.first();
}
- const Kleo::CryptoBackend::Protocol *proto = Q_NULLPTR;
+ const QGpgME::Protocol *proto = Q_NULLPTR;
if (d->format & Kleo::AnyOpenPGP) {
- proto = Kleo::CryptoBackendFactory::instance()->openpgp();
+ proto = QGpgME::openpgp();
} else if (d->format & Kleo::AnySMIME) {
- proto = Kleo::CryptoBackendFactory::instance()->smime();
+ proto = QGpgME::smime();
} else {
return;
}
@@ -169,7 +169,7 @@ void SignEncryptJob::process()
//d->resultContent = new KMime::Content;
qCDebug(MESSAGECOMPOSER_LOG) << "creating signencrypt from:" << proto->name() << proto->displayName();
- std::unique_ptr<Kleo::SignEncryptJob> job(proto->signEncryptJob(!d->binaryHint(d->format), d->format == Kleo::InlineOpenPGPFormat));
+ std::unique_ptr<QGpgME::SignEncryptJob> job(proto->signEncryptJob(!d->binaryHint(d->format), d->format == Kleo::InlineOpenPGPFormat));
QByteArray encBody;
d->content->assemble();
diff --git a/messagecomposer/src/job/signencryptjob.h b/messagecomposer/src/job/signencryptjob.h
index 023f13f..6f8cd70 100644
--- a/messagecomposer/src/job/signencryptjob.h
+++ b/messagecomposer/src/job/signencryptjob.h
@@ -25,7 +25,8 @@
#include "contentjobbase.h"
#include "part/infopart.h"
#include "messagecomposer_export.h"
-#include "Libkleo/Enum"
+
+#include <Libkleo/Enum>
#include <gpgme++/key.h>
#include <vector>
diff --git a/messagecomposer/src/job/signjob.cpp b/messagecomposer/src/job/signjob.cpp
index 57efd57..3add0e2 100644
--- a/messagecomposer/src/job/signjob.cpp
+++ b/messagecomposer/src/job/signjob.cpp
@@ -21,12 +21,12 @@
#include "job/signjob.h"
#include "contentjobbase_p.h"
-#include "Libkleo/CryptoBackendFactory"
-#include "Libkleo/CryptoBackend"
-#include "Libkleo/Enum"
-#include "Libkleo/SignJob"
#include "utils/util.h"
+#include <Libkleo/Enum>
+#include <QGpgME/Protocol>
+#include <QGpgME/SignJob>
+
#include "messagecomposer_debug.h"
#include <kmime/kmime_headers.h>
#include <kmime/kmime_message.h>
@@ -140,17 +140,17 @@ void SignJob::process()
//d->resultContent = new KMime::Content;
- const Kleo::CryptoBackend::Protocol *proto = Q_NULLPTR;
+ const QGpgME::Protocol *proto = Q_NULLPTR;
if (d->format & Kleo::AnyOpenPGP) {
- proto = Kleo::CryptoBackendFactory::instance()->openpgp();
+ proto = QGpgME::openpgp();
} else if (d->format & Kleo::AnySMIME) {
- proto = Kleo::CryptoBackendFactory::instance()->smime();
+ proto = QGpgME::smime();
}
Q_ASSERT(proto);
qCDebug(MESSAGECOMPOSER_LOG) << "creating signJob from:" << proto->name() << proto->displayName();
- std::unique_ptr<Kleo::SignJob> job(proto->signJob(!d->binaryHint(d->format), d->format == Kleo::InlineOpenPGPFormat));
+ std::unique_ptr<QGpgME::SignJob> job(proto->signJob(!d->binaryHint(d->format), d->format == Kleo::InlineOpenPGPFormat));
// for now just do the main recipients
QByteArray signature;
diff --git a/messagecomposer/src/job/signjob.h b/messagecomposer/src/job/signjob.h
index 2ef9438..757abf6 100644
--- a/messagecomposer/src/job/signjob.h
+++ b/messagecomposer/src/job/signjob.h
@@ -24,7 +24,7 @@
#include "contentjobbase.h"
#include "part/infopart.h"
#include "messagecomposer_export.h"
-#include "Libkleo/Enum"
+#include <Libkleo/Enum>
#include <gpgme++/key.h>
#include <vector>
diff --git a/messageviewer/autotests/CMakeLists.txt b/messageviewer/autotests/CMakeLists.txt
index 308bcf6..fa62fea 100644
--- a/messageviewer/autotests/CMakeLists.txt
+++ b/messageviewer/autotests/CMakeLists.txt
@@ -6,7 +6,7 @@ macro(add_messageviewer_unittest _source)
ecm_add_test(${_source}
TEST_NAME ${_name}
NAME_PREFIX "messageviewer-"
- LINK_LIBRARIES KF5::MessageViewer KF5::Libkleo KF5::QGpgme Qt5::Test KF5::KIOCore KF5::Mime KF5::AkonadiCore KF5::AkonadiNotes KF5::CalendarCore
+ LINK_LIBRARIES KF5::MessageViewer KF5::Libkleo QGpgme Qt5::Test KF5::KIOCore KF5::Mime KF5::AkonadiCore KF5::AkonadiNotes KF5::CalendarCore
)
endmacro ()
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index 50deaa2..0606cf6 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -235,12 +235,9 @@ target_link_libraries(KF5MessageViewer
Grantlee5::TextDocument
Grantlee5::Templates
Qt5::PrintSupport
+ Gpgmepp
)
-if (WIN32)
- target_link_libraries(KF5MessageViewer PUBLIC KF5::Gpgmepp)
-else()
- target_link_libraries(KF5MessageViewer PUBLIC KF5::Gpgmepp-pthread)
-endif()
+
if (KDEPIM_KF5SYNTAXHIGHLIGHTING_SUPPORT)
target_link_libraries(KF5MessageViewer PRIVATE KF5::SyntaxHighlighting)
endif()
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
index 4cc7a3b..36250c8 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
@@ -34,8 +34,7 @@
#include <MimeTreeParser/ObjectTreeParser>
#include <GrantleeTheme/QtResourceTemplateLoader>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include <MessageCore/StringUtil>
@@ -63,7 +62,7 @@ using namespace MimeTreeParser;
using namespace MessageViewer;
Q_DECLARE_METATYPE(GpgME::DecryptionResult::Recipient)
-Q_DECLARE_METATYPE(const Kleo::CryptoBackend::Protocol *)
+Q_DECLARE_METATYPE(const QGpgME::Protocol *)
static QString iconToDataUrl(const QString &iconPath)
{
@@ -158,7 +157,7 @@ static const int SIG_FRAME_COL_UNDEF = 99;
#define SIG_FRAME_COL_RED -1
#define SIG_FRAME_COL_YELLOW 0
#define SIG_FRAME_COL_GREEN 1
-QString sigStatusToString(const Kleo::CryptoBackend::Protocol *cryptProto,
+QString sigStatusToString(const QGpgME::Protocol *cryptProto,
int status_code,
GpgME::Signature::Summary summary,
int &frameColor,
@@ -170,7 +169,7 @@ QString sigStatusToString(const Kleo::CryptoBackend::Protocol *cryptProto,
showKeyInfos = true;
QString result;
if (cryptProto) {
- if (cryptProto == Kleo::CryptoBackendFactory::instance()->openpgp()) {
+ if (cryptProto == QGpgME::openpgp()) {
// process enum according to it's definition to be read in
// GNU Privacy Guard CVS repository /gpgme/gpgme/gpgme.h
switch (status_code) {
@@ -207,7 +206,7 @@ QString sigStatusToString(const Kleo::CryptoBackend::Protocol *cryptProto,
result.clear(); // do *not* return a default text here !
break;
}
- } else if (cryptProto == Kleo::CryptoBackendFactory::instance()->smime()) {
+ } else if (cryptProto == QGpgME::smime()) {
// process status bits according to SigStatus_...
// definitions in kdenetwork/libkdenetwork/cryptplug.h
@@ -667,7 +666,7 @@ public:
QString quotedHTML(const QString &s)
{
- assert(cssHelper());
+ Q_ASSERT(cssHelper());
KTextToHTML::Options convertFlags = KTextToHTML::PreserveSpaces | KTextToHTML::HighlightText;
if (source()->showEmoticons()) {
@@ -974,7 +973,7 @@ public:
const auto metaData = mp->mMetaData;
auto cryptoProto = mp->mCryptoProto;
- const bool isSMIME = cryptoProto && (cryptoProto == Kleo::CryptoBackendFactory::instance()->smime());
+ const bool isSMIME = cryptoProto && (cryptoProto == QGpgME::smime());
Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/signedmessagepart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp b/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp
index 37f7378..3dd0658 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp
+++ b/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp
@@ -28,8 +28,7 @@
#include <gpgme++/verificationresult.h>
#include <gpgme++/decryptionresult.h>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include <grantlee/context.h>
#include <grantlee/engine.h>
@@ -37,7 +36,7 @@
#include <grantlee/templateloader.h>
Q_DECLARE_METATYPE(GpgME::DecryptionResult::Recipient)
-Q_DECLARE_METATYPE(const Kleo::CryptoBackend::Protocol *)
+Q_DECLARE_METATYPE(const QGpgME::Protocol *)
// Read-only introspection of GpgME::DecryptionResult::Recipient object.
GRANTLEE_BEGIN_LOOKUP(GpgME::DecryptionResult::Recipient)
if (property == QStringLiteral("keyID"))
@@ -45,11 +44,11 @@ if (property == QStringLiteral("keyID"))
return QString::fromLatin1(object.keyID());
}
GRANTLEE_END_LOOKUP
-// Read-only introspection of Kleo::CryptoBackend::Protocol object.
+// Read-only introspection of QGpgME::Protocol object.
namespace Grantlee
{
template<>
-inline QVariant TypeAccessor<const Kleo::CryptoBackend::Protocol *>::lookUp(const Kleo::CryptoBackend::Protocol *const object, const QString &property)
+inline QVariant TypeAccessor<const QGpgME::Protocol *>::lookUp(const QGpgME::Protocol *const object, const QString &property)
{
if (property == QStringLiteral("name")) {
return object->name();
@@ -100,7 +99,7 @@ MessageViewer::MessagePartRendererManager *MessagePartRendererManager::self()
void MessagePartRendererManager::initializeRenderer()
{
Grantlee::registerMetaType<GpgME::DecryptionResult::Recipient>();
- Grantlee::registerMetaType<const Kleo::CryptoBackend::Protocol *>();
+ Grantlee::registerMetaType<const QGpgME::Protocol *>();
m_engine = new GrantleeTheme::Engine;
m_engine->localizer()->setApplicationDomain(QByteArrayLiteral("libmessageviewer"));
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index a2cac38..35817d4 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -75,9 +75,6 @@
#include <AkonadiCore/ItemModifyJob>
#include <AkonadiCore/ItemCreateJob>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-
#include <MailTransport/mailtransport/errorattribute.h>
//Qt includes
diff --git a/messageviewer/src/viewer/webengine/autotests/CMakeLists.txt b/messageviewer/src/viewer/webengine/autotests/CMakeLists.txt
index 1d0d37c..9cc0c9d 100644
--- a/messageviewer/src/viewer/webengine/autotests/CMakeLists.txt
+++ b/messageviewer/src/viewer/webengine/autotests/CMakeLists.txt
@@ -4,7 +4,7 @@ macro(add_messageviewer_webengine_unittest _source)
ecm_add_test(${_source}
TEST_NAME ${_name}
NAME_PREFIX "messageviewer-"
- LINK_LIBRARIES KF5::MessageViewer KF5::Libkleo KF5::QGpgme Qt5::Test KF5::KIOCore KF5::Mime KF5::AkonadiCore KF5::AkonadiNotes KF5::CalendarCore
+ LINK_LIBRARIES KF5::MessageViewer KF5::Libkleo QGpgme Qt5::Test KF5::KIOCore KF5::Mime KF5::AkonadiCore KF5::AkonadiNotes KF5::CalendarCore
)
endmacro ()
diff --git a/mimetreeparser/src/CMakeLists.txt b/mimetreeparser/src/CMakeLists.txt
index 70679a9..6440ada 100644
--- a/mimetreeparser/src/CMakeLists.txt
+++ b/mimetreeparser/src/CMakeLists.txt
@@ -24,7 +24,7 @@ set(libmimetreeparser_main_SRCS
interfaces/bodypart.cpp
interfaces/htmlwriter.cpp
interfaces/messagepartrenderer.cpp
- job/kleojobexecutor.cpp
+ job/qgpgmejobexecutor.cpp
utils/util.cpp
viewer/attachmentstrategy.cpp
viewer/bodypartformatter.cpp
@@ -154,6 +154,7 @@ target_link_libraries(KF5MimeTreeParser
PUBLIC
KF5::Libkleo
PRIVATE
+ QGpgme
KF5::Codecs
KF5::I18n
KF5::Mime
diff --git a/mimetreeparser/src/bodyformatter/applicationpgpencrypted.cpp b/mimetreeparser/src/bodyformatter/applicationpgpencrypted.cpp
index 417c520..f6e2426 100644
--- a/mimetreeparser/src/bodyformatter/applicationpgpencrypted.cpp
+++ b/mimetreeparser/src/bodyformatter/applicationpgpencrypted.cpp
@@ -24,7 +24,7 @@
#include "viewer/objecttreeparser.h"
#include "viewer/messagepart.h"
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include <KMime/Content>
@@ -75,7 +75,7 @@ Interface::MessagePart::Ptr ApplicationPGPEncryptedBodyPartFormatter::process(In
part.nodeHelper()->setEncryptionState(node, KMMsgFullyEncrypted);
EncryptedMessagePart::Ptr mp(new EncryptedMessagePart(part.objectTreeParser(),
- data->decodedText(), Kleo::CryptoBackendFactory::instance()->openpgp(),
+ data->decodedText(), QGpgME::openpgp(),
NodeHelper::fromAsString(data), node));
mp->setIsEncrypted(true);
mp->setDecryptMessage(part.source()->decryptMessage());
diff --git a/mimetreeparser/src/bodyformatter/applicationpkcs7mime.cpp b/mimetreeparser/src/bodyformatter/applicationpkcs7mime.cpp
index a296f00..d91ba1f 100644
--- a/mimetreeparser/src/bodyformatter/applicationpkcs7mime.cpp
+++ b/mimetreeparser/src/bodyformatter/applicationpkcs7mime.cpp
@@ -25,7 +25,7 @@
#include "viewer/objecttreeparser.h"
#include "viewer/messagepart.h"
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include <KMime/Content>
@@ -64,7 +64,7 @@ Interface::MessagePart::Ptr ApplicationPkcs7MimeBodyPartFormatter::process(Inter
return MessagePart::Ptr();
}
- const Kleo::CryptoBackend::Protocol *smimeCrypto = Kleo::CryptoBackendFactory::instance()->smime();
+ const auto smimeCrypto = QGpgME::smime();
if (!smimeCrypto) {
return MessagePart::Ptr();
}
diff --git a/mimetreeparser/src/bodyformatter/multipartencrypted.cpp b/mimetreeparser/src/bodyformatter/multipartencrypted.cpp
index a66f6f1..f4f370e 100644
--- a/mimetreeparser/src/bodyformatter/multipartencrypted.cpp
+++ b/mimetreeparser/src/bodyformatter/multipartencrypted.cpp
@@ -26,7 +26,7 @@
#include <KMime/Content>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include "mimetreeparser_debug.h"
@@ -62,19 +62,19 @@ Interface::MessagePart::Ptr MultiPartEncryptedBodyPartFormatter::process(Interfa
return MessagePart::Ptr();
}
- const Kleo::CryptoBackend::Protocol *useThisCryptProto = Q_NULLPTR;
+ const QGpgME::Protocol *useThisCryptProto = Q_NULLPTR;
/*
ATTENTION: This code is to be replaced by the new 'auto-detect' feature. --------------------------------------
*/
KMime::Content *data = findTypeInDirectChilds(node, "application/octet-stream");
if (data) {
- useThisCryptProto = Kleo::CryptoBackendFactory::instance()->openpgp();
+ useThisCryptProto = QGpgME::openpgp();
}
if (!data) {
data = findTypeInDirectChilds(node, "application/pkcs7-mime");
if (data) {
- useThisCryptProto = Kleo::CryptoBackendFactory::instance()->smime();
+ useThisCryptProto = QGpgME::smime();
}
}
/*
diff --git a/mimetreeparser/src/bodyformatter/multipartsigned.cpp b/mimetreeparser/src/bodyformatter/multipartsigned.cpp
index ea9960c..d82aea3 100644
--- a/mimetreeparser/src/bodyformatter/multipartsigned.cpp
+++ b/mimetreeparser/src/bodyformatter/multipartsigned.cpp
@@ -24,7 +24,7 @@
#include <KMime/Content>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
#include "mimetreeparser_debug.h"
@@ -68,8 +68,8 @@ Interface::MessagePart::Ptr MultiPartSignedBodyPartFormatter::process(Interface:
KMime::Content *signedData = node->contents().at(0);
KMime::Content *signature = node->contents().at(1);
- assert(signedData);
- assert(signature);
+ Q_ASSERT(signedData);
+ Q_ASSERT(signature);
QString protocolContentType = node->contentType()->parameter(QStringLiteral("protocol")).toLower();
const QString signatureContentType = QLatin1String(signature->contentType()->mimeType().toLower());
@@ -79,13 +79,13 @@ Interface::MessagePart::Ptr MultiPartSignedBodyPartFormatter::process(Interface:
protocolContentType = signatureContentType;
}
- const Kleo::CryptoBackend::Protocol *protocol = Q_NULLPTR;
+ const QGpgME::Protocol *protocol = Q_NULLPTR;
if (protocolContentType == QLatin1String("application/pkcs7-signature") ||
protocolContentType == QLatin1String("application/x-pkcs7-signature")) {
- protocol = Kleo::CryptoBackendFactory::instance()->smime();
+ protocol = QGpgME::smime();
} else if (protocolContentType == QLatin1String("application/pgp-signature") ||
protocolContentType == QLatin1String("application/x-pgp-signature")) {
- protocol = Kleo::CryptoBackendFactory::instance()->openpgp();
+ protocol = QGpgME::openpgp();
}
if (!protocol) {
diff --git a/mimetreeparser/src/job/kleojobexecutor.cpp b/mimetreeparser/src/job/qgpgmejobexecutor.cpp
index bb6d7ca..1f45334 100644
--- a/mimetreeparser/src/job/kleojobexecutor.cpp
+++ b/mimetreeparser/src/job/qgpgmejobexecutor.cpp
@@ -16,30 +16,29 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "kleojobexecutor.h"
+#include "qgpgmejobexecutor.h"
#include "mimetreeparser_debug.h"
-#include <Libkleo/DecryptVerifyJob>
-#include <Libkleo/ImportJob>
-#include <Libkleo/VerifyDetachedJob>
-#include <Libkleo/VerifyOpaqueJob>
+
+#include <QGpgME/DecryptVerifyJob>
+#include <QGpgME/ImportJob>
+#include <QGpgME/VerifyDetachedJob>
+#include <QGpgME/VerifyOpaqueJob>
#include <QEventLoop>
#include <cassert>
-using namespace Kleo;
using namespace GpgME;
using namespace MimeTreeParser;
-using boost::shared_ptr;
-KleoJobExecutor::KleoJobExecutor(QObject *parent) : QObject(parent)
+QGpgMEJobExecutor::QGpgMEJobExecutor(QObject *parent) : QObject(parent)
{
setObjectName(QStringLiteral("KleoJobExecutor"));
mEventLoop = new QEventLoop(this);
}
-GpgME::VerificationResult KleoJobExecutor::exec(
- Kleo::VerifyDetachedJob *job,
+GpgME::VerificationResult QGpgMEJobExecutor::exec(
+ QGpgME::VerifyDetachedJob *job,
const QByteArray &signature,
const QByteArray &signedData)
{
@@ -53,8 +52,8 @@ GpgME::VerificationResult KleoJobExecutor::exec(
return mVerificationResult;
}
-GpgME::VerificationResult KleoJobExecutor::exec(
- Kleo::VerifyOpaqueJob *job,
+GpgME::VerificationResult QGpgMEJobExecutor::exec(
+ QGpgME::VerifyOpaqueJob *job,
const QByteArray &signedData,
QByteArray &plainText)
{
@@ -70,13 +69,13 @@ GpgME::VerificationResult KleoJobExecutor::exec(
return mVerificationResult;
}
-std::pair< GpgME::DecryptionResult, GpgME::VerificationResult > KleoJobExecutor::exec(
- Kleo::DecryptVerifyJob *job,
+std::pair< GpgME::DecryptionResult, GpgME::VerificationResult > QGpgMEJobExecutor::exec(
+ QGpgME::DecryptVerifyJob *job,
const QByteArray &cipherText,
QByteArray &plainText)
{
qCDebug(MIMETREEPARSER_LOG) << "Starting decryption job";
- connect(job, &DecryptVerifyJob::result, this, &KleoJobExecutor::decryptResult);
+ connect(job, &QGpgME::DecryptVerifyJob::result, this, &QGpgMEJobExecutor::decryptResult);
GpgME::Error err = job->start(cipherText);
if (err) {
plainText.clear();
@@ -87,7 +86,7 @@ std::pair< GpgME::DecryptionResult, GpgME::VerificationResult > KleoJobExecutor:
return std::make_pair(mDecryptResult, mVerificationResult);
}
-GpgME::ImportResult KleoJobExecutor::exec(Kleo::ImportJob *job, const QByteArray &certData)
+GpgME::ImportResult QGpgMEJobExecutor::exec(QGpgME::ImportJob *job, const QByteArray &certData)
{
connect(job, SIGNAL(result(GpgME::ImportResult)), SLOT(importResult(GpgME::ImportResult)));
GpgME::Error err = job->start(certData);
@@ -98,15 +97,15 @@ GpgME::ImportResult KleoJobExecutor::exec(Kleo::ImportJob *job, const QByteArray
return mImportResult;
}
-Error KleoJobExecutor::auditLogError() const
+Error QGpgMEJobExecutor::auditLogError() const
{
return mAuditLogError;
}
-void KleoJobExecutor::verificationResult(const GpgME::VerificationResult &result)
+void QGpgMEJobExecutor::verificationResult(const GpgME::VerificationResult &result)
{
qCDebug(MIMETREEPARSER_LOG) << "Detached verification job finished";
- Kleo::Job *job = qobject_cast<Kleo::Job *>(sender());
+ QGpgME::Job *job = qobject_cast<QGpgME::Job *>(sender());
assert(job);
mVerificationResult = result;
mAuditLogError = job->auditLogError();
@@ -114,10 +113,10 @@ void KleoJobExecutor::verificationResult(const GpgME::VerificationResult &result
mEventLoop->quit();
}
-void KleoJobExecutor::verificationResult(const GpgME::VerificationResult &result, const QByteArray &plainText)
+void QGpgMEJobExecutor::verificationResult(const GpgME::VerificationResult &result, const QByteArray &plainText)
{
qCDebug(MIMETREEPARSER_LOG) << "Opaque verification job finished";
- Kleo::Job *job = qobject_cast<Kleo::Job *>(sender());
+ QGpgME::Job *job = qobject_cast<QGpgME::Job *>(sender());
assert(job);
mVerificationResult = result;
mData = plainText;
@@ -126,13 +125,13 @@ void KleoJobExecutor::verificationResult(const GpgME::VerificationResult &result
mEventLoop->quit();
}
-void KleoJobExecutor::decryptResult(
+void QGpgMEJobExecutor::decryptResult(
const GpgME::DecryptionResult &decryptionresult,
const GpgME::VerificationResult &verificationresult,
const QByteArray &plainText)
{
qCDebug(MIMETREEPARSER_LOG) << "Decryption job finished";
- Kleo::Job *job = qobject_cast<Kleo::Job *>(sender());
+ QGpgME::Job *job = qobject_cast<QGpgME::Job *>(sender());
assert(job);
mVerificationResult = verificationresult;
mDecryptResult = decryptionresult;
@@ -142,9 +141,9 @@ void KleoJobExecutor::decryptResult(
mEventLoop->quit();
}
-void KleoJobExecutor::importResult(const GpgME::ImportResult &result)
+void QGpgMEJobExecutor::importResult(const GpgME::ImportResult &result)
{
- Kleo::Job *job = qobject_cast<Kleo::Job *>(sender());
+ QGpgME::Job *job = qobject_cast<QGpgME::Job *>(sender());
assert(job);
mImportResult = result;
mAuditLogError = job->auditLogError();
@@ -152,7 +151,7 @@ void KleoJobExecutor::importResult(const GpgME::ImportResult &result)
mEventLoop->quit();
}
-QString KleoJobExecutor::auditLogAsHtml() const
+QString QGpgMEJobExecutor::auditLogAsHtml() const
{
return mAuditLog;
}
diff --git a/mimetreeparser/src/job/kleojobexecutor.h b/mimetreeparser/src/job/qgpgmejobexecutor.h
index cc407c4..aab937d 100644
--- a/mimetreeparser/src/job/kleojobexecutor.h
+++ b/mimetreeparser/src/job/qgpgmejobexecutor.h
@@ -29,7 +29,7 @@
class QEventLoop;
-namespace Kleo
+namespace QGpgME
{
class DecryptVerifyJob;
class ImportJob;
@@ -43,22 +43,22 @@ namespace MimeTreeParser
/**
Helper class for synchronous execution of Kleo crypto jobs.
*/
-class KleoJobExecutor : public QObject
+class QGpgMEJobExecutor : public QObject
{
Q_OBJECT
public:
- explicit KleoJobExecutor(QObject *parent = Q_NULLPTR);
+ explicit QGpgMEJobExecutor(QObject *parent = Q_NULLPTR);
- GpgME::VerificationResult exec(Kleo::VerifyDetachedJob *job,
+ GpgME::VerificationResult exec(QGpgME::VerifyDetachedJob *job,
const QByteArray &signature,
const QByteArray &signedData);
- GpgME::VerificationResult exec(Kleo::VerifyOpaqueJob *job,
+ GpgME::VerificationResult exec(QGpgME::VerifyOpaqueJob *job,
const QByteArray &signedData,
QByteArray &plainText);
- std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> exec(Kleo::DecryptVerifyJob *job,
+ std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> exec(QGpgME::DecryptVerifyJob *job,
const QByteArray &cipherText,
QByteArray &plainText);
- GpgME::ImportResult exec(Kleo::ImportJob *job, const QByteArray &certData);
+ GpgME::ImportResult exec(QGpgME::ImportJob *job, const QByteArray &certData);
GpgME::Error auditLogError() const;
QString auditLogAsHtml() const;
diff --git a/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.cpp b/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.cpp
index 4c00f6a..4565d10 100644
--- a/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.cpp
+++ b/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.cpp
@@ -17,11 +17,11 @@
#include "decryptverifybodypartmemento.h"
-#include <Libkleo/DecryptVerifyJob>
+#include <QGpgME/DecryptVerifyJob>
#include <qstringlist.h>
-using namespace Kleo;
+using namespace QGpgME;
using namespace GpgME;
using namespace MimeTreeParser;
@@ -30,7 +30,7 @@ DecryptVerifyBodyPartMemento::DecryptVerifyBodyPartMemento(DecryptVerifyJob *job
m_cipherText(cipherText),
m_job(job)
{
- assert(m_job);
+ Q_ASSERT(m_job);
}
DecryptVerifyBodyPartMemento::~DecryptVerifyBodyPartMemento()
@@ -42,7 +42,7 @@ DecryptVerifyBodyPartMemento::~DecryptVerifyBodyPartMemento()
bool DecryptVerifyBodyPartMemento::start()
{
- assert(m_job);
+ Q_ASSERT(m_job);
if (const Error err = m_job->start(m_cipherText)) {
m_dr = DecryptionResult(err);
return false;
@@ -55,7 +55,7 @@ bool DecryptVerifyBodyPartMemento::start()
void DecryptVerifyBodyPartMemento::exec()
{
- assert(m_job);
+ Q_ASSERT(m_job);
QByteArray plainText;
setRunning(true);
const std::pair<DecryptionResult, VerificationResult> p = m_job->exec(m_cipherText, plainText);
@@ -68,7 +68,7 @@ void DecryptVerifyBodyPartMemento::saveResult(const DecryptionResult &dr,
const VerificationResult &vr,
const QByteArray &plainText)
{
- assert(m_job);
+ Q_ASSERT(m_job);
setRunning(false);
m_dr = dr;
m_vr = vr;
diff --git a/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.h b/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.h
index 9a42e8e..327d971 100644
--- a/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.h
+++ b/mimetreeparser/src/viewer/memento/decryptverifybodypartmemento.h
@@ -27,7 +27,7 @@
#include "interfaces/bodypart.h"
-namespace Kleo
+namespace QGpgME
{
class DecryptVerifyJob;
}
@@ -40,7 +40,7 @@ class DecryptVerifyBodyPartMemento
{
Q_OBJECT
public:
- DecryptVerifyBodyPartMemento(Kleo::DecryptVerifyJob *job, const QByteArray &cipherText);
+ DecryptVerifyBodyPartMemento(QGpgME::DecryptVerifyJob *job, const QByteArray &cipherText);
~DecryptVerifyBodyPartMemento();
bool start() Q_DECL_OVERRIDE;
@@ -71,7 +71,7 @@ private:
private:
// input:
const QByteArray m_cipherText;
- QPointer<Kleo::DecryptVerifyJob> m_job;
+ QPointer<QGpgME::DecryptVerifyJob> m_job;
// output:
GpgME::DecryptionResult m_dr;
GpgME::VerificationResult m_vr;
diff --git a/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.cpp b/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.cpp
index afba81b..019782d 100644
--- a/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.cpp
+++ b/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.cpp
@@ -18,8 +18,8 @@
#include "verifydetachedbodypartmemento.h"
#include "mimetreeparser_debug.h"
-#include <Libkleo/VerifyDetachedJob>
-#include <Libkleo/KeyListJob>
+#include <QGpgME/VerifyDetachedJob>
+#include <QGpgME/KeyListJob>
#include <gpgme++/keylistresult.h>
@@ -27,7 +27,7 @@
#include <cassert>
-using namespace Kleo;
+using namespace QGpgME;
using namespace GpgME;
using namespace MimeTreeParser;
diff --git a/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.h b/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.h
index fe04d0c..4c41eaa 100644
--- a/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.h
+++ b/mimetreeparser/src/viewer/memento/verifydetachedbodypartmemento.h
@@ -27,7 +27,7 @@
#include "interfaces/bodypart.h"
-namespace Kleo
+namespace QGpgME
{
class VerifyDetachedJob;
class KeyListJob;
@@ -43,8 +43,8 @@ class VerifyDetachedBodyPartMemento
{
Q_OBJECT
public:
- VerifyDetachedBodyPartMemento(Kleo::VerifyDetachedJob *job,
- Kleo::KeyListJob *klj,
+ VerifyDetachedBodyPartMemento(QGpgME::VerifyDetachedJob *job,
+ QGpgME::KeyListJob *klj,
const QByteArray &signature,
const QByteArray &plainText);
~VerifyDetachedBodyPartMemento();
@@ -75,8 +75,8 @@ private:
// input:
const QByteArray m_signature;
const QByteArray m_plainText;
- QPointer<Kleo::VerifyDetachedJob> m_job;
- QPointer<Kleo::KeyListJob> m_keylistjob;
+ QPointer<QGpgME::VerifyDetachedJob> m_job;
+ QPointer<QGpgME::KeyListJob> m_keylistjob;
// output:
GpgME::VerificationResult m_vr;
GpgME::Key m_key;
diff --git a/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.cpp b/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.cpp
index b935bc4..ab5672b 100644
--- a/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.cpp
+++ b/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.cpp
@@ -18,8 +18,8 @@
#include "verifyopaquebodypartmemento.h"
#include "mimetreeparser_debug.h"
-#include <Libkleo/VerifyOpaqueJob>
-#include <Libkleo/KeyListJob>
+#include <QGpgME/VerifyOpaqueJob>
+#include <QGpgME/KeyListJob>
#include <gpgme++/keylistresult.h>
@@ -27,7 +27,7 @@
#include <cassert>
-using namespace Kleo;
+using namespace QGpgME;
using namespace GpgME;
using namespace MimeTreeParser;
diff --git a/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.h b/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.h
index 74b5b8e..05899d3 100644
--- a/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.h
+++ b/mimetreeparser/src/viewer/memento/verifyopaquebodypartmemento.h
@@ -28,7 +28,7 @@
#include "interfaces/bodypart.h"
-namespace Kleo
+namespace QGpgME
{
class VerifyOpaqueJob;
class KeyListJob;
@@ -44,8 +44,8 @@ class VerifyOpaqueBodyPartMemento
{
Q_OBJECT
public:
- VerifyOpaqueBodyPartMemento(Kleo::VerifyOpaqueJob *job,
- Kleo::KeyListJob *klj,
+ VerifyOpaqueBodyPartMemento(QGpgME::VerifyOpaqueJob *job,
+ QGpgME::KeyListJob *klj,
const QByteArray &signature);
~VerifyOpaqueBodyPartMemento();
@@ -80,8 +80,8 @@ private:
private:
// input:
const QByteArray m_signature;
- QPointer<Kleo::VerifyOpaqueJob> m_job;
- QPointer<Kleo::KeyListJob> m_keylistjob;
+ QPointer<QGpgME::VerifyOpaqueJob> m_job;
+ QPointer<QGpgME::KeyListJob> m_keylistjob;
// output:
GpgME::VerificationResult m_vr;
QByteArray m_plainText;
diff --git a/mimetreeparser/src/viewer/messagepart.cpp b/mimetreeparser/src/viewer/messagepart.cpp
index 3524bbd..b6b07af 100644
--- a/mimetreeparser/src/viewer/messagepart.cpp
+++ b/mimetreeparser/src/viewer/messagepart.cpp
@@ -23,7 +23,7 @@
#include "cryptohelper.h"
#include "objecttreeparser.h"
#include "interfaces/htmlwriter.h"
-#include "job/kleojobexecutor.h"
+#include "job/qgpgmejobexecutor.h"
#include "memento/cryptobodypartmemento.h"
#include "memento/decryptverifybodypartmemento.h"
#include "memento/verifydetachedbodypartmemento.h"
@@ -34,11 +34,12 @@
#include <KMime/Content>
#include <Libkleo/Dn>
-#include <Libkleo/ImportJob>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/VerifyDetachedJob>
-#include <Libkleo/VerifyOpaqueJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/ImportJob>
+#include <QGpgME/KeyListJob>
+#include <QGpgME/VerifyDetachedJob>
+#include <QGpgME/VerifyOpaqueJob>
#include <gpgme++/key.h>
#include <gpgme++/keylistresult.h>
@@ -249,7 +250,7 @@ void TextMessagePart::parseContent()
mEncryptionState = KMMsgNotEncrypted;
const auto blocks = prepareMessageForDecryption(mNode->decodedContent());
- const auto cryptProto = Kleo::CryptoBackendFactory::instance()->openpgp();
+ const auto cryptProto = QGpgME::openpgp();
if (!blocks.isEmpty()) {
@@ -675,7 +676,7 @@ QString AlternativeMessagePart::htmlContent() const
//-----CertMessageBlock----------------------
-CertMessagePart::CertMessagePart(ObjectTreeParser *otp, KMime::Content *node, const Kleo::CryptoBackend::Protocol *cryptoProto, bool autoImport)
+CertMessagePart::CertMessagePart(ObjectTreeParser *otp, KMime::Content *node, const QGpgME::Protocol *cryptoProto, bool autoImport)
: MessagePart(otp, QString())
, mNode(node)
, mAutoImport(autoImport)
@@ -692,8 +693,8 @@ CertMessagePart::CertMessagePart(ObjectTreeParser *otp, KMime::Content *node, co
const QByteArray certData = node->decodedContent();
- Kleo::ImportJob *import = mCryptoProto->importJob();
- KleoJobExecutor executor;
+ QGpgME::ImportJob *import = mCryptoProto->importJob();
+ QGpgMEJobExecutor executor;
mImportResult = executor.exec(import, certData);
}
@@ -710,7 +711,7 @@ QString CertMessagePart::text() const
//-----SignedMessageBlock---------------------
SignedMessagePart::SignedMessagePart(ObjectTreeParser *otp,
const QString &text,
- const Kleo::CryptoBackend::Protocol *cryptoProto,
+ const QGpgME::Protocol *cryptoProto,
const QString &fromAddress,
KMime::Content *node)
: MessagePart(otp, text)
@@ -755,16 +756,16 @@ bool SignedMessagePart::okVerify(const QByteArray &data, const QByteArray &signa
const QByteArray mementoName = "verification";
CryptoBodyPartMemento *m = dynamic_cast<CryptoBodyPartMemento *>(nodeHelper->bodyPartMemento(mNode, mementoName));
- assert(!m || mCryptoProto); //No CryptoPlugin and having a bodyPartMemento -> there is something completely wrong
+ Q_ASSERT(!m || mCryptoProto); //No CryptoPlugin and having a bodyPartMemento -> there is something completely wrong
if (!m && mCryptoProto) {
if (!signature.isEmpty()) {
- Kleo::VerifyDetachedJob *job = mCryptoProto->verifyDetachedJob();
+ QGpgME::VerifyDetachedJob *job = mCryptoProto->verifyDetachedJob();
if (job) {
m = new VerifyDetachedBodyPartMemento(job, mCryptoProto->keyListJob(), signature, data);
}
} else {
- Kleo::VerifyOpaqueJob *job = mCryptoProto->verifyOpaqueJob();
+ QGpgME::VerifyOpaqueJob *job = mCryptoProto->verifyOpaqueJob();
if (job) {
m = new VerifyOpaqueBodyPartMemento(job, mCryptoProto->keyListJob(), data);
}
@@ -864,7 +865,7 @@ void SignedMessagePart::sigStatusToMetaData()
if (mMetaData.isGoodSignature && !key.keyID()) {
// Search for the key by it's fingerprint so that we can check for
// trust etc.
- Kleo::KeyListJob *job = mCryptoProto->keyListJob(false); // local, no sigs
+ QGpgME::KeyListJob *job = mCryptoProto->keyListJob(false); // local, no sigs
if (!job) {
qCDebug(MIMETREEPARSER_LOG) << "The Crypto backend does not support listing keys. ";
} else {
@@ -1029,7 +1030,7 @@ QString SignedMessagePart::htmlContent() const
//-----CryptMessageBlock---------------------
EncryptedMessagePart::EncryptedMessagePart(ObjectTreeParser *otp,
const QString &text,
- const Kleo::CryptoBackend::Protocol *cryptoProto,
+ const QGpgME::Protocol *cryptoProto,
const QString &fromAddress,
KMime::Content *node)
: MessagePart(otp, text)
@@ -1114,16 +1115,16 @@ bool EncryptedMessagePart::okDecryptMIME(KMime::Content &data)
Interface::ObjectTreeSource *_source = source();
NodeHelper *nodeHelper = mOtp->nodeHelper();
- assert(decryptMessage());
+ Q_ASSERT(decryptMessage());
// Check whether the memento contains a result from last time:
const DecryptVerifyBodyPartMemento *m
= dynamic_cast<DecryptVerifyBodyPartMemento *>(nodeHelper->bodyPartMemento(&data, "decryptverify"));
- assert(!m || mCryptoProto); //No CryptoPlugin and having a bodyPartMemento -> there is something completely wrong
+ Q_ASSERT(!m || mCryptoProto); //No CryptoPlugin and having a bodyPartMemento -> there is something completely wrong
if (!m && mCryptoProto) {
- Kleo::DecryptVerifyJob *job = mCryptoProto->decryptVerifyJob();
+ QGpgME::DecryptVerifyJob *job = mCryptoProto->decryptVerifyJob();
if (!job) {
cannotDecrypt = true;
} else {
diff --git a/mimetreeparser/src/viewer/messagepart.h b/mimetreeparser/src/viewer/messagepart.h
index 98ef0c9..f9cb2b2 100644
--- a/mimetreeparser/src/viewer/messagepart.h
+++ b/mimetreeparser/src/viewer/messagepart.h
@@ -27,7 +27,6 @@
#include <KMime/Message>
-#include <Libkleo/CryptoBackend>
#include <gpgme++/verificationresult.h>
#include <gpgme++/decryptionresult.h>
#include <importresult.h>
@@ -42,6 +41,11 @@ namespace GpgME
class ImportResult;
}
+namespace QGpgME
+{
+class Protocol;
+}
+
namespace KMime
{
class Content;
@@ -273,7 +277,7 @@ class MIMETREEPARSER_EXPORT CertMessagePart : public MessagePart
Q_OBJECT
public:
typedef QSharedPointer<CertMessagePart> Ptr;
- CertMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, const Kleo::CryptoBackend::Protocol *cryptoProto, bool autoImport);
+ CertMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, const QGpgME::Protocol *cryptoProto, bool autoImport);
virtual ~CertMessagePart();
QString text() const Q_DECL_OVERRIDE;
@@ -282,7 +286,7 @@ private:
KMime::Content *mNode;
bool mAutoImport;
GpgME::ImportResult mImportResult;
- const Kleo::CryptoBackend::Protocol *mCryptoProto;
+ const QGpgME::Protocol *mCryptoProto;
friend class DefaultRendererPrivate;
};
@@ -315,7 +319,7 @@ public:
typedef QSharedPointer<EncryptedMessagePart> Ptr;
EncryptedMessagePart(ObjectTreeParser *otp,
const QString &text,
- const Kleo::CryptoBackend::Protocol *cryptoProto,
+ const QGpgME::Protocol *cryptoProto,
const QString &fromAddress,
KMime::Content *node);
@@ -349,7 +353,7 @@ private:
protected:
bool mPassphraseError;
bool mNoSecKey;
- const Kleo::CryptoBackend::Protocol *mCryptoProto;
+ const QGpgME::Protocol *mCryptoProto;
QString mFromAddress;
KMime::Content *mNode;
bool mDecryptMessage;
@@ -367,7 +371,7 @@ public:
typedef QSharedPointer<SignedMessagePart> Ptr;
SignedMessagePart(ObjectTreeParser *otp,
const QString &text,
- const Kleo::CryptoBackend::Protocol *cryptoProto,
+ const QGpgME::Protocol *cryptoProto,
const QString &fromAddress,
KMime::Content *node);
@@ -397,7 +401,7 @@ private:
void setVerificationResult(const CryptoBodyPartMemento *m, KMime::Content *textNode);
protected:
- const Kleo::CryptoBackend::Protocol *mCryptoProto;
+ const QGpgME::Protocol *mCryptoProto;
QString mFromAddress;
KMime::Content *mNode;
QByteArray mVerifiedText;
diff --git a/mimetreeparser/src/viewer/objecttreeparser.cpp b/mimetreeparser/src/viewer/objecttreeparser.cpp
index 5e54c7f..414ad4e 100644
--- a/mimetreeparser/src/viewer/objecttreeparser.cpp
+++ b/mimetreeparser/src/viewer/objecttreeparser.cpp
@@ -97,7 +97,7 @@ ObjectTreeParser::ObjectTreeParser(Interface::ObjectTreeSource *source,
void ObjectTreeParser::init()
{
- assert(mSource);
+ Q_ASSERT(mSource);
if (!attachmentStrategy()) {
mAttachmentStrategy = mSource->attachmentStrategy();
}
@@ -135,7 +135,7 @@ ObjectTreeParser::~ObjectTreeParser()
void ObjectTreeParser::setAllowAsync(bool allow)
{
- assert(!mHasPendingAsyncJobs);
+ Q_ASSERT(!mHasPendingAsyncJobs);
mAllowAsync = allow;
}
@@ -462,7 +462,7 @@ void ObjectTreeParser::setPlainTextContent(QString plainTextContent)
const QTextCodec *ObjectTreeParser::codecFor(KMime::Content *node) const
{
- assert(node);
+ Q_ASSERT(node);
if (mSource->overrideCodec()) {
return mSource->overrideCodec();
}
diff --git a/mimetreeparser/src/viewer/objecttreeparser.h b/mimetreeparser/src/viewer/objecttreeparser.h
index 0b1df0c..8ebe3e8 100644
--- a/mimetreeparser/src/viewer/objecttreeparser.h
+++ b/mimetreeparser/src/viewer/objecttreeparser.h
@@ -39,7 +39,6 @@
#include "mimetreeparser/nodehelper.h"
#include "mimetreeparser/objecttreesource.h"
-#include <Libkleo/CryptoBackend>
#include <gpgme++/verificationresult.h>
class QString;
diff --git a/templateparser/autotests/CMakeLists.txt b/templateparser/autotests/CMakeLists.txt
index a70f739..e08bfa6 100644
--- a/templateparser/autotests/CMakeLists.txt
+++ b/templateparser/autotests/CMakeLists.txt
@@ -15,7 +15,7 @@ macro(add_templateparser_unittest _source)
KF5::Libkleo
KF5::TemplateParser
KF5::MessageViewer
- KF5::QGpgme
+ QGpgme
Qt5::Test
KF5::KIOCore
KF5::Mime