summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-10-11 17:48:20 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-10-12 17:19:11 (GMT)
commit920027ccdaad7420c37057cbb244095e898ca7d8 (patch)
tree58a30900d801cd815fb2e5c58ef1c97f88397c7f
parent252cac8f325bd5bbf73ab719d773cbef0c5d8391 (diff)
Port Kleopatra to new gpgme 1.7
This also includes lots of boost::shared_ptr -> std::shared_ptr changes, but there are still places where boost is used. We should definitely do a second round of clean up later on.
-rw-r--r--CMakeLists.txt8
-rw-r--r--src/commands/adduseridcommand.cpp13
-rw-r--r--src/commands/certifycertificatecommand.cpp11
-rw-r--r--src/commands/changeexpirycommand.cpp9
-rw-r--r--src/commands/changeownertrustcommand.cpp9
-rw-r--r--src/commands/changepassphrasecommand.cpp9
-rw-r--r--src/commands/checksumcreatefilescommand.cpp2
-rw-r--r--src/commands/checksumverifyfilescommand.cpp2
-rw-r--r--src/commands/decryptverifyclipboardcommand.cpp7
-rw-r--r--src/commands/decryptverifyfilescommand.cpp2
-rw-r--r--src/commands/deletecertificatescommand.cpp13
-rw-r--r--src/commands/encryptclipboardcommand.cpp5
-rw-r--r--src/commands/exportcertificatecommand.cpp11
-rw-r--r--src/commands/exportopenpgpcertstoservercommand.cpp8
-rw-r--r--src/commands/importcertificatefromfilecommand.cpp6
-rw-r--r--src/commands/importcertificatescommand.cpp19
-rw-r--r--src/commands/importcertificatescommand_p.h4
-rw-r--r--src/commands/lookupcertificatescommand.cpp23
-rw-r--r--src/commands/refreshopenpgpcertscommand.cpp9
-rw-r--r--src/commands/signclipboardcommand.cpp5
-rw-r--r--src/commands/signencryptfilescommand.cpp2
-rw-r--r--src/conf/appearanceconfigwidget.cpp6
-rw-r--r--src/conf/cryptooperationsconfigwidget.cpp19
-rw-r--r--src/conf/dirservconfigpage.cpp27
-rw-r--r--src/conf/dirservconfigpage.h28
-rw-r--r--src/conf/gnupgsystemconfigurationpage.cpp8
-rw-r--r--src/conf/smimevalidationconfigurationwidget.cpp9
-rw-r--r--src/crypto/autodecryptverifyfilescontroller.cpp39
-rw-r--r--src/crypto/autodecryptverifyfilescontroller.h7
-rw-r--r--src/crypto/controller.cpp11
-rw-r--r--src/crypto/controller.h10
-rw-r--r--src/crypto/createchecksumscontroller.cpp30
-rw-r--r--src/crypto/createchecksumscontroller.h5
-rw-r--r--src/crypto/decryptverifyemailcontroller.cpp65
-rw-r--r--src/crypto/decryptverifyemailcontroller.h19
-rw-r--r--src/crypto/decryptverifyfilescontroller.cpp65
-rw-r--r--src/crypto/decryptverifyfilescontroller.h11
-rw-r--r--src/crypto/decryptverifytask.cpp125
-rw-r--r--src/crypto/decryptverifytask.h38
-rw-r--r--src/crypto/encryptemailcontroller.cpp47
-rw-r--r--src/crypto/encryptemailcontroller.h18
-rw-r--r--src/crypto/encryptemailtask.cpp32
-rw-r--r--src/crypto/encryptemailtask.h6
-rw-r--r--src/crypto/gui/decryptverifyfilesdialog.cpp8
-rw-r--r--src/crypto/gui/decryptverifyfilesdialog.h8
-rw-r--r--src/crypto/gui/decryptverifyfileswizard.cpp5
-rw-r--r--src/crypto/gui/decryptverifyfileswizard.h4
-rw-r--r--src/crypto/gui/decryptverifyoperationwidget.cpp19
-rw-r--r--src/crypto/gui/decryptverifyoperationwidget.h13
-rw-r--r--src/crypto/gui/newresultpage.cpp24
-rw-r--r--src/crypto/gui/newresultpage.h13
-rw-r--r--src/crypto/gui/resolverecipientspage.cpp17
-rw-r--r--src/crypto/gui/resolverecipientspage.h7
-rw-r--r--src/crypto/gui/resultitemwidget.cpp9
-rw-r--r--src/crypto/gui/resultitemwidget.h4
-rw-r--r--src/crypto/gui/resultlistwidget.cpp22
-rw-r--r--src/crypto/gui/resultlistwidget.h10
-rw-r--r--src/crypto/gui/resultpage.cpp23
-rw-r--r--src/crypto/gui/resultpage.h8
-rw-r--r--src/crypto/gui/signemailwizard.cpp2
-rw-r--r--src/crypto/gui/signencryptfileswizard.cpp4
-rw-r--r--src/crypto/gui/signencryptfileswizard.h4
-rw-r--r--src/crypto/gui/signencryptwidget.cpp3
-rw-r--r--src/crypto/gui/signencryptwizard.cpp10
-rw-r--r--src/crypto/gui/signencryptwizard.h7
-rw-r--r--src/crypto/gui/signerresolvepage.cpp13
-rw-r--r--src/crypto/gui/signerresolvepage.h11
-rw-r--r--src/crypto/newsignencryptemailcontroller.cpp51
-rw-r--r--src/crypto/newsignencryptemailcontroller.h18
-rw-r--r--src/crypto/signemailcontroller.cpp42
-rw-r--r--src/crypto/signemailcontroller.h18
-rw-r--r--src/crypto/signemailtask.cpp30
-rw-r--r--src/crypto/signemailtask.h7
-rw-r--r--src/crypto/signencryptfilescontroller.cpp65
-rw-r--r--src/crypto/signencryptfilescontroller.h7
-rw-r--r--src/crypto/signencryptfilestask.cpp79
-rw-r--r--src/crypto/signencryptfilestask.h10
-rw-r--r--src/crypto/task.cpp10
-rw-r--r--src/crypto/task.h10
-rw-r--r--src/crypto/task_p.h4
-rw-r--r--src/crypto/taskcollection.cpp37
-rw-r--r--src/crypto/taskcollection.h14
-rw-r--r--src/crypto/verifychecksumscontroller.cpp22
-rw-r--r--src/crypto/verifychecksumscontroller.h5
-rw-r--r--src/dialogs/certificatedetailsdialog.cpp12
-rw-r--r--src/dialogs/certifycertificatedialog.cpp2
-rw-r--r--src/dialogs/certifycertificatedialog.h5
-rw-r--r--src/dialogs/certifycertificatedialog_p.h2
-rw-r--r--src/kleopatraapplication.cpp2
-rw-r--r--src/kwatchgnupg/kwatchgnupgmainwin.cpp12
-rw-r--r--src/main.cpp16
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/newcertificatewizard/newcertificatewizard.cpp12
-rw-r--r--src/selftest/gpgagentcheck.cpp18
-rw-r--r--src/smartcard/readerstatus.cpp56
-rw-r--r--src/uiserver/assuancommand.h38
-rw-r--r--src/uiserver/assuanserverconnection.cpp72
-rw-r--r--src/uiserver/assuanserverconnection.h5
-rw-r--r--src/uiserver/createchecksumscommand.cpp3
-rw-r--r--src/uiserver/decryptverifycommandemailbase.cpp9
-rw-r--r--src/uiserver/echocommand.cpp14
-rw-r--r--src/uiserver/encryptcommand.cpp13
-rw-r--r--src/uiserver/importfilescommand.cpp2
-rw-r--r--src/uiserver/prepencryptcommand.cpp7
-rw-r--r--src/uiserver/prepsigncommand.cpp11
-rw-r--r--src/uiserver/sessiondata.cpp20
-rw-r--r--src/uiserver/sessiondata.h13
-rw-r--r--src/uiserver/signcommand.cpp17
-rw-r--r--src/uiserver/signencryptfilescommand.cpp3
-rw-r--r--src/uiserver/uiserver.cpp6
-rw-r--r--src/uiserver/uiserver.h5
-rw-r--r--src/uiserver/uiserver_p.h5
-rw-r--r--src/uiserver/verifychecksumscommand.cpp3
-rw-r--r--src/utils/archivedefinition.cpp59
-rw-r--r--src/utils/archivedefinition.h16
-rw-r--r--src/utils/auditlog.cpp4
-rw-r--r--src/utils/auditlog.h4
-rw-r--r--src/utils/input.cpp69
-rw-r--r--src/utils/input.h24
-rw-r--r--src/utils/iodevicelogger.cpp19
-rw-r--r--src/utils/iodevicelogger.h8
-rw-r--r--src/utils/log.cpp20
-rw-r--r--src/utils/log.h8
-rw-r--r--src/utils/output.cpp55
-rw-r--r--src/utils/output.h18
-rw-r--r--src/utils/types.cpp18
-rw-r--r--src/utils/types.h13
-rw-r--r--tests/CMakeLists.txt6
-rw-r--r--tests/test_verify.cpp45
129 files changed, 1068 insertions, 1186 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 053b2b5..37ffd24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,9 +7,8 @@ option(DISABLE_KWATCHGNUPG "Don't build the kwatchgnupg tool [default=OFF]" OFF)
# Standalone build. Find / include everything neccessary.
set(KF5_VERSION "5.17.0")
-set(GPGMEPP_VERSION "5.3.43")
set(KMIME_VERSION "5.1.40")
-set(LIBKLEO_VERSION "5.3.44")
+set(LIBKLEO_VERSION "5.3.46")
set(QT_REQUIRED_VERSION "5.4.0")
find_package(ECM ${KF5_VERSION} REQUIRED NO_MODULE)
@@ -68,10 +67,11 @@ endif()
set(HAVE_QDBUS ${Qt5DBus_FOUND})
+find_package(Gpgmepp "1.7.1" CONFIG REQUIRED)
+
# Kdepimlibs packages
find_package(KF5Libkleo ${LIBKLEO_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_VERSION} CONFIG REQUIRED)
-find_package(KF5Gpgmepp ${GPGMEPP_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test Network PrintSupport)
@@ -79,6 +79,8 @@ find_package(Assuan2 REQUIRED)
set(HAVE_KCMUTILS ${KF5KCMUtils_FOUND})
+
+
find_package(Boost 1.34.0 REQUIRED)
find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
diff --git a/src/commands/adduseridcommand.cpp b/src/commands/adduseridcommand.cpp
index b409233..9e2b383 100644
--- a/src/commands/adduseridcommand.cpp
+++ b/src/commands/adduseridcommand.cpp
@@ -39,9 +39,8 @@
#include <dialogs/adduseriddialog.h>
#include <Libkleo/Formatting>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/AddUserIDJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/AddUserIDJob>
#include <gpgme++/key.h>
@@ -82,7 +81,7 @@ private:
private:
GpgME::Key key;
QPointer<AddUserIDDialog> dialog;
- QPointer<AddUserIDJob> job;
+ QPointer<QGpgME::AddUserIDJob> job;
};
AddUserIDCommand::Private *AddUserIDCommand::d_func()
@@ -223,17 +222,17 @@ void AddUserIDCommand::Private::createJob()
{
assert(!job);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(key.protocol());
+ const auto backend = (key.protocol() == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!backend) {
return;
}
- AddUserIDJob *const j = backend->addUserIDJob();
+ QGpgME::AddUserIDJob *const j = backend->addUserIDJob();
if (!j) {
return;
}
- connect(j, &Job::progress,
+ connect(j, &QGpgME::Job::progress,
q, &Command::progress);
connect(j, SIGNAL(result(GpgME::Error)),
q, SLOT(slotResult(GpgME::Error)));
diff --git a/src/commands/certifycertificatecommand.cpp b/src/commands/certifycertificatecommand.cpp
index efe0681..2f1749b 100644
--- a/src/commands/certifycertificatecommand.cpp
+++ b/src/commands/certifycertificatecommand.cpp
@@ -41,9 +41,9 @@
#include <Libkleo/KeyCache>
#include <Libkleo/Formatting>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/SignKeyJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/SignKeyJob>
#include <gpgme++/key.h>
@@ -56,6 +56,7 @@ using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Dialogs;
using namespace GpgME;
+using namespace QGpgME;
class CertifyCertificateCommand::Private : public Command::Private
{
@@ -82,7 +83,7 @@ private:
private:
std::vector<UserID> uids;
QPointer<CertifyCertificateDialog> dialog;
- QPointer<SignKeyJob> job;
+ QPointer<QGpgME::SignKeyJob> job;
};
CertifyCertificateCommand::Private *CertifyCertificateCommand::d_func()
@@ -290,7 +291,7 @@ void CertifyCertificateCommand::Private::createJob()
assert(!job);
assert(key().protocol() == OpenPGP);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(key().protocol());
+ const auto backend = QGpgME::openpgp();
if (!backend) {
return;
}
diff --git a/src/commands/changeexpirycommand.cpp b/src/commands/changeexpirycommand.cpp
index ba87de6..aedf01d 100644
--- a/src/commands/changeexpirycommand.cpp
+++ b/src/commands/changeexpirycommand.cpp
@@ -39,9 +39,9 @@
#include <dialogs/expirydialog.h>
#include <Libkleo/Formatting>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/ChangeExpiryJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/ChangeExpiryJob>
#include <gpgme++/key.h>
@@ -56,6 +56,7 @@ using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Dialogs;
using namespace GpgME;
+using namespace QGpgME;
class ChangeExpiryCommand::Private : public Command::Private
{
@@ -226,7 +227,7 @@ void ChangeExpiryCommand::Private::createJob()
{
assert(!job);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(key.protocol());
+ const auto backend = (key.protocol() == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!backend) {
return;
}
diff --git a/src/commands/changeownertrustcommand.cpp b/src/commands/changeownertrustcommand.cpp
index 178136a..0300381 100644
--- a/src/commands/changeownertrustcommand.cpp
+++ b/src/commands/changeownertrustcommand.cpp
@@ -39,9 +39,9 @@
#include <dialogs/ownertrustdialog.h>
#include <Libkleo/Formatting>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/ChangeOwnerTrustJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/ChangeOwnerTrustJob>
#include <gpgme++/key.h>
@@ -54,6 +54,7 @@ using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Dialogs;
using namespace GpgME;
+using namespace QGpgME;
class ChangeOwnerTrustCommand::Private : public Command::Private
{
@@ -223,7 +224,7 @@ void ChangeOwnerTrustCommand::Private::createJob()
{
assert(!job);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(key().protocol());
+ const auto backend = (key().protocol() == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!backend) {
return;
}
diff --git a/src/commands/changepassphrasecommand.cpp b/src/commands/changepassphrasecommand.cpp
index fa7b0b0..3616ab1 100644
--- a/src/commands/changepassphrasecommand.cpp
+++ b/src/commands/changepassphrasecommand.cpp
@@ -37,9 +37,9 @@
#include "command_p.h"
#include <Libkleo/Formatting>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/ChangePasswdJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/ChangePasswdJob>
#include <gpgme++/key.h>
@@ -53,6 +53,7 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace GpgME;
+using namespace QGpgME;
class ChangePassphraseCommand::Private : public Command::Private
{
@@ -186,7 +187,7 @@ void ChangePassphraseCommand::Private::createJob()
{
assert(!job);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(key.protocol());
+ const auto backend = (key.protocol() == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!backend) {
return;
}
diff --git a/src/commands/checksumcreatefilescommand.cpp b/src/commands/checksumcreatefilescommand.cpp
index c3c7a5b..1d20568 100644
--- a/src/commands/checksumcreatefilescommand.cpp
+++ b/src/commands/checksumcreatefilescommand.cpp
@@ -81,7 +81,7 @@ private:
private:
QStringList files;
- shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<const ExecutionContext> shared_qq;
CreateChecksumsController controller;
};
diff --git a/src/commands/checksumverifyfilescommand.cpp b/src/commands/checksumverifyfilescommand.cpp
index 0f16e0a..fcfa8ff 100644
--- a/src/commands/checksumverifyfilescommand.cpp
+++ b/src/commands/checksumverifyfilescommand.cpp
@@ -81,7 +81,7 @@ private:
private:
QStringList files;
- shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<const ExecutionContext> shared_qq;
VerifyChecksumsController controller;
};
diff --git a/src/commands/decryptverifyclipboardcommand.cpp b/src/commands/decryptverifyclipboardcommand.cpp
index 3a06ef4..a8bbe0f 100644
--- a/src/commands/decryptverifyclipboardcommand.cpp
+++ b/src/commands/decryptverifyclipboardcommand.cpp
@@ -57,7 +57,6 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class DecryptVerifyClipboardCommand::Private : public Command::Private
{
@@ -83,8 +82,8 @@ private:
}
private:
- shared_ptr<const ExecutionContext> shared_qq;
- shared_ptr<Input> input;
+ std::shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<Input> input;
DecryptVerifyEMailController controller;
};
@@ -153,7 +152,7 @@ void DecryptVerifyClipboardCommand::doStart()
try {
- const shared_ptr<Input> input = Input::createFromClipboard();
+ const std::shared_ptr<Input> input = Input::createFromClipboard();
const unsigned int classification = input->classification();
diff --git a/src/commands/decryptverifyfilescommand.cpp b/src/commands/decryptverifyfilescommand.cpp
index a4c118c..df29453 100644
--- a/src/commands/decryptverifyfilescommand.cpp
+++ b/src/commands/decryptverifyfilescommand.cpp
@@ -85,7 +85,7 @@ private:
private:
QStringList files;
- shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<const ExecutionContext> shared_qq;
DecryptVerifyFilesController *mController;
};
diff --git a/src/commands/deletecertificatescommand.cpp b/src/commands/deletecertificatescommand.cpp
index b5692bd..e9094e1 100644
--- a/src/commands/deletecertificatescommand.cpp
+++ b/src/commands/deletecertificatescommand.cpp
@@ -42,10 +42,10 @@
#include <Libkleo/Predicates>
#include <Libkleo/Stl_Util>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/MultiDeleteJob>
-#include <Libkleo/DeleteJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/MultiDeleteJob>
+#include <QGpgME/DeleteJob>
#include <gpgme++/key.h>
@@ -64,6 +64,7 @@ using namespace boost;
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Dialogs;
+using namespace QGpgME;
class DeleteCertificatesCommand::Private : public Command::Private
{
@@ -85,7 +86,7 @@ public:
bool canDelete(GpgME::Protocol proto) const
{
- if (const CryptoBackend::Protocol *const cbp = CryptoBackendFactory::instance()->protocol(proto))
+ if (const auto cbp = (proto == GpgME::OpenPGP ? QGpgME::openpgp() : QGpgME::smime()))
if (DeleteJob *const job = cbp->deleteJob()) {
job->slotCancel();
return true;
@@ -364,7 +365,7 @@ void DeleteCertificatesCommand::Private::startDeleteJob(GpgME::Protocol protocol
const std::vector<Key> &keys = protocol == CMS ? cmsKeys : pgpKeys;
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(protocol);
+ const auto backend = (protocol == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
assert(backend);
std::unique_ptr<MultiDeleteJob> job(new MultiDeleteJob(backend));
diff --git a/src/commands/encryptclipboardcommand.cpp b/src/commands/encryptclipboardcommand.cpp
index 83d6d30..73adb7a 100644
--- a/src/commands/encryptclipboardcommand.cpp
+++ b/src/commands/encryptclipboardcommand.cpp
@@ -57,7 +57,6 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class EncryptClipboardCommand::Private : public Command::Private
{
@@ -84,8 +83,8 @@ private:
}
private:
- shared_ptr<const ExecutionContext> shared_qq;
- shared_ptr<Input> input;
+ std::shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<Input> input;
EncryptEMailController controller;
};
diff --git a/src/commands/exportcertificatecommand.cpp b/src/commands/exportcertificatecommand.cpp
index 1b0dfaf..d96a4b1 100644
--- a/src/commands/exportcertificatecommand.cpp
+++ b/src/commands/exportcertificatecommand.cpp
@@ -41,11 +41,11 @@
#include <utils/filedialog.h>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/ExportJob>
#include <Libkleo/Classify>
+#include <QGpgME/Protocol>
+#include <QGpgME/ExportJob>
+
#include <gpgme++/key.h>
#include <KLocalizedString>
@@ -63,6 +63,7 @@ using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace GpgME;
using namespace boost;
+using namespace QGpgME;
class ExportCertificateCommand::Private : public Command::Private
{
@@ -79,7 +80,7 @@ public:
void exportResult(const GpgME::Error &, const QByteArray &);
void showError(const GpgME::Error &error);
- bool requestFileNames(Protocol prot);
+ bool requestFileNames(GpgME::Protocol prot);
void finishedIfLastJob();
private:
@@ -235,7 +236,7 @@ void ExportCertificateCommand::Private::startExportJob(GpgME::Protocol protocol,
{
assert(protocol != GpgME::UnknownProtocol);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(protocol);
+ const QGpgME::Protocol *const backend = (protocol == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
assert(backend);
const QString fileName = fileNames[protocol];
const bool binary = protocol == GpgME::OpenPGP
diff --git a/src/commands/exportopenpgpcertstoservercommand.cpp b/src/commands/exportopenpgpcertstoservercommand.cpp
index 4efd8ee..4c92439 100644
--- a/src/commands/exportopenpgpcertstoservercommand.cpp
+++ b/src/commands/exportopenpgpcertstoservercommand.cpp
@@ -38,8 +38,8 @@
#include <utils/gnupg-helper.h>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoConfig>
+#include <QGpgME/Protocol>
+#include <QGpgME/CryptoConfig>
#include <gpgme++/key.h>
@@ -52,11 +52,11 @@ using namespace GpgME;
static bool haveKeyserverConfigured()
{
- const Kleo::CryptoConfig *const config = Kleo::CryptoBackendFactory::instance()->config();
+ const QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
return false;
}
- const Kleo::CryptoConfigEntry *const entry = config->entry(QStringLiteral("gpg"), QStringLiteral("Keyserver"), QStringLiteral("keyserver"));
+ const QGpgME::CryptoConfigEntry *const entry = config->entry(QStringLiteral("gpg"), QStringLiteral("Keyserver"), QStringLiteral("keyserver"));
return entry && !entry->stringValue().isEmpty();
}
diff --git a/src/commands/importcertificatefromfilecommand.cpp b/src/commands/importcertificatefromfilecommand.cpp
index 1a1a67b..5f7f860 100644
--- a/src/commands/importcertificatefromfilecommand.cpp
+++ b/src/commands/importcertificatefromfilecommand.cpp
@@ -37,8 +37,9 @@
#include "utils/filedialog.h"
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/ImportJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/ImportJob>
+
#include <Libkleo/Classify>
#include <gpgme++/global.h>
@@ -60,6 +61,7 @@
using namespace GpgME;
using namespace Kleo;
+using namespace QGpgME;
class ImportCertificateFromFileCommand::Private : public ImportCertificatesCommand::Private
{
diff --git a/src/commands/importcertificatescommand.cpp b/src/commands/importcertificatescommand.cpp
index 35acb58..9616bf7 100644
--- a/src/commands/importcertificatescommand.cpp
+++ b/src/commands/importcertificatescommand.cpp
@@ -41,10 +41,11 @@
#include <Libkleo/Predicates>
#include <Libkleo/Formatting>
#include <Libkleo/Stl_Util>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/ImportJob>
-#include <Libkleo/ImportFromKeyserverJob>
-#include <Libkleo/ChangeOwnerTrustJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/ImportJob>
+#include <QGpgME/ImportFromKeyserverJob>
+#include <QGpgME/ChangeOwnerTrustJob>
#include <gpgme++/global.h>
#include <gpgme++/importresult.h>
@@ -71,6 +72,7 @@
using namespace GpgME;
using namespace Kleo;
using namespace boost;
+using namespace QGpgME;
namespace
{
@@ -417,7 +419,7 @@ void ImportCertificatesCommand::Private::tryToFinish()
const char *fingerPr = result.imports()[0].fingerprint();
GpgME::Error err;
QScopedPointer<Context>
- ctx(Context::createForProtocol(Protocol::OpenPGP));
+ ctx(Context::createForProtocol(GpgME::Protocol::OpenPGP));
if (!ctx){
qCWarning(KLEOPATRA_LOG) << "Failed to get context";
@@ -453,8 +455,7 @@ void ImportCertificatesCommand::Private::tryToFinish()
if (k == KMessageBox::Yes) {
//To use the ChangeOwnerTrustJob over
//the CryptoBackendFactory
- const CryptoBackend::Protocol *const backend =
- CryptoBackendFactory::instance()->protocol(Protocol::OpenPGP);
+ const QGpgME::Protocol *const backend = QGpgME::openpgp();
if (!backend){
qCWarning(KLEOPATRA_LOG) << "Failed to get CryptoBackend";
@@ -474,7 +475,7 @@ void ImportCertificatesCommand::Private::tryToFinish()
static std::unique_ptr<ImportJob> get_import_job(GpgME::Protocol protocol)
{
assert(protocol != UnknownProtocol);
- if (const Kleo::CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(protocol)) {
+ if (const auto backend = (protocol == GpgME::OpenPGP ? QGpgME::openpgp() : QGpgME::smime())) {
return std::unique_ptr<ImportJob>(backend->importJob());
} else {
return std::unique_ptr<ImportJob>();
@@ -515,7 +516,7 @@ void ImportCertificatesCommand::Private::startImport(GpgME::Protocol protocol, c
static std::unique_ptr<ImportFromKeyserverJob> get_import_from_keyserver_job(GpgME::Protocol protocol)
{
assert(protocol != UnknownProtocol);
- if (const Kleo::CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(protocol)) {
+ if (const auto backend = (protocol == GpgME::OpenPGP ? QGpgME::openpgp() : QGpgME::smime())) {
return std::unique_ptr<ImportFromKeyserverJob>(backend->importFromKeyserverJob());
} else {
return std::unique_ptr<ImportFromKeyserverJob>();
diff --git a/src/commands/importcertificatescommand_p.h b/src/commands/importcertificatescommand_p.h
index c9b8ca4..bf1a677 100644
--- a/src/commands/importcertificatescommand_p.h
+++ b/src/commands/importcertificatescommand_p.h
@@ -47,7 +47,7 @@ class ImportResult;
class Error;
}
-namespace Kleo
+namespace QGpgME
{
class AbstractImportJob;
}
@@ -87,7 +87,7 @@ private:
bool waitForMoreJobs;
std::vector<GpgME::Protocol> nonWorkingProtocols;
std::map<QObject *, QString> idsByJob;
- std::vector<Kleo::AbstractImportJob *> jobs;
+ std::vector<QGpgME::AbstractImportJob *> jobs;
std::vector<GpgME::ImportResult> results;
QStringList ids;
};
diff --git a/src/commands/lookupcertificatescommand.cpp b/src/commands/lookupcertificatescommand.cpp
index d57147c..9250fd1 100644
--- a/src/commands/lookupcertificatescommand.cpp
+++ b/src/commands/lookupcertificatescommand.cpp
@@ -42,11 +42,11 @@
#include <Libkleo/Formatting>
#include <Libkleo/Stl_Util>
-#include <Libkleo/ImportFromKeyserverJob>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/CryptoConfig>
+
+#include <QGpgME/CryptoConfig>
+#include <QGpgME/Protocol>
+#include <QGpgME/KeyListJob>
+#include <QGpgME/ImportFromKeyserverJob>
#include <gpgme++/key.h>
#include <gpgme++/keylistresult.h>
@@ -71,6 +71,7 @@ using namespace Kleo::Commands;
using namespace Kleo::Dialogs;
using namespace GpgME;
using namespace boost;
+using namespace QGpgME;
class LookupCertificatesCommand::Private : public ImportCertificatesCommand::Private
{
@@ -109,12 +110,12 @@ private:
void createDialog();
KeyListJob *createKeyListJob(GpgME::Protocol proto) const
{
- const CryptoBackend::Protocol *const cbp = CryptoBackendFactory::instance()->protocol(proto);
+ const auto cbp = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
return cbp ? cbp->keyListJob(true) : 0;
}
ImportFromKeyserverJob *createImportJob(GpgME::Protocol proto) const
{
- const CryptoBackend::Protocol *const cbp = CryptoBackendFactory::instance()->protocol(proto);
+ const auto cbp = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
return cbp ? cbp->importFromKeyserverJob() : 0;
}
void startKeyListJob(GpgME::Protocol proto, const QString &str);
@@ -394,21 +395,21 @@ void LookupCertificatesCommand::Private::showResult(QWidget *parent, const KeyLi
static bool haveOpenPGPKeyserverConfigured()
{
- const Kleo::CryptoConfig *const config = Kleo::CryptoBackendFactory::instance()->config();
+ const QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
return false;
}
- const Kleo::CryptoConfigEntry *const entry = config->entry(QStringLiteral("gpg"), QStringLiteral("Keyserver"), QStringLiteral("keyserver"));
+ const QGpgME::CryptoConfigEntry *const entry = config->entry(QStringLiteral("gpg"), QStringLiteral("Keyserver"), QStringLiteral("keyserver"));
return entry && !entry->stringValue().isEmpty();
}
static bool haveX509DirectoryServerConfigured()
{
- const Kleo::CryptoConfig *const config = Kleo::CryptoBackendFactory::instance()->config();
+ const QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
return false;
}
- const Kleo::CryptoConfigEntry *entry = config->entry(QStringLiteral("dirmngr"), QStringLiteral("LDAP"), QStringLiteral("LDAP Server"));
+ const QGpgME::CryptoConfigEntry *entry = config->entry(QStringLiteral("dirmngr"), QStringLiteral("LDAP"), QStringLiteral("LDAP Server"));
bool entriesExist = entry && !entry->urlValueList().empty();
entry = config->entry(QStringLiteral("gpgsm"), QStringLiteral("Configuration"), QStringLiteral("keyserver"));
entriesExist |= entry && !entry->urlValueList().empty();
diff --git a/src/commands/refreshopenpgpcertscommand.cpp b/src/commands/refreshopenpgpcertscommand.cpp
index 65f577b..a7aa1ca 100644
--- a/src/commands/refreshopenpgpcertscommand.cpp
+++ b/src/commands/refreshopenpgpcertscommand.cpp
@@ -36,22 +36,23 @@
#include <utils/gnupg-helper.h>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoConfig>
+#include <QGpgME/Protocol>
+#include <QGpgME/CryptoConfig>
#include <KLocalizedString>
#include <KMessageBox>
using namespace Kleo;
using namespace Kleo::Commands;
+using namespace QGpgME;
static bool haveKeyserverConfigured()
{
- const Kleo::CryptoConfig *const config = Kleo::CryptoBackendFactory::instance()->config();
+ const QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
return false;
}
- const Kleo::CryptoConfigEntry *const entry = config->entry(QStringLiteral("gpg"), QStringLiteral("Keyserver"), QStringLiteral("keyserver"));
+ const QGpgME::CryptoConfigEntry *const entry = config->entry(QStringLiteral("gpg"), QStringLiteral("Keyserver"), QStringLiteral("keyserver"));
return entry && !entry->stringValue().isEmpty();
}
diff --git a/src/commands/signclipboardcommand.cpp b/src/commands/signclipboardcommand.cpp
index 8a133f8..ddb14cd 100644
--- a/src/commands/signclipboardcommand.cpp
+++ b/src/commands/signclipboardcommand.cpp
@@ -57,7 +57,6 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class SignClipboardCommand::Private : public Command::Private
{
@@ -84,8 +83,8 @@ private:
}
private:
- shared_ptr<const ExecutionContext> shared_qq;
- shared_ptr<Input> input;
+ std::shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<Input> input;
SignEMailController controller;
};
diff --git a/src/commands/signencryptfilescommand.cpp b/src/commands/signencryptfilescommand.cpp
index a859338..6d63789 100644
--- a/src/commands/signencryptfilescommand.cpp
+++ b/src/commands/signencryptfilescommand.cpp
@@ -81,7 +81,7 @@ private:
private:
QStringList files;
- shared_ptr<const ExecutionContext> shared_qq;
+ std::shared_ptr<const ExecutionContext> shared_qq;
SignEncryptFilesController controller;
};
diff --git a/src/conf/appearanceconfigwidget.cpp b/src/conf/appearanceconfigwidget.cpp
index a48d376..b51332a 100644
--- a/src/conf/appearanceconfigwidget.cpp
+++ b/src/conf/appearanceconfigwidget.cpp
@@ -38,7 +38,7 @@
#include "tooltippreferences.h"
-#include "Libkleo/CryptoBackendFactory"
+#include <QGpgME/Protocol>
#include "Libkleo/KeyFilterManager"
#include "Libkleo/Dn"
#include "Libkleo/DNAttributeOrderConfigWidget"
@@ -463,7 +463,7 @@ void AppearanceConfigWidget::load()
d->dnOrderWidget->load();
d->categoriesLV->clear();
- KConfig *const config = CryptoBackendFactory::instance()->configObject();
+ KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("libkleopatrarc"));
if (!config) {
return;
}
@@ -490,7 +490,7 @@ void AppearanceConfigWidget::save()
prefs.setShowCertificateDetails(d->tooltipDetailsCheckBox->isChecked());
prefs.save();
- KConfig *const config = CryptoBackendFactory::instance()->configObject();
+ KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("libkleopatrarc"));
if (!config) {
return;
}
diff --git a/src/conf/cryptooperationsconfigwidget.cpp b/src/conf/cryptooperationsconfigwidget.cpp
index e20c241..b837bd4 100644
--- a/src/conf/cryptooperationsconfigwidget.cpp
+++ b/src/conf/cryptooperationsconfigwidget.cpp
@@ -38,13 +38,15 @@
#include "fileoperationspreferences.h"
#include <Libkleo/ChecksumDefinition>
-#include <Libkleo/CryptoBackendFactory>
+
+#include <QGpgME/Protocol>
#include <gpgme++/context.h>
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
+#include <KSharedConfig>
#include <QCheckBox>
#include <QComboBox>
@@ -55,11 +57,10 @@
#include <QLabel>
#include <QRegularExpression>
-#include <boost/shared_ptr.hpp>
+#include <memory>
using namespace Kleo;
using namespace Kleo::Config;
-using namespace boost;
CryptoOperationsConfigWidget::CryptoOperationsConfigWidget(QWidget *p, Qt::WindowFlags f)
: QWidget(p, f)
@@ -152,7 +153,7 @@ void CryptoOperationsConfigWidget::defaults()
}
}
-Q_DECLARE_METATYPE(boost::shared_ptr<Kleo::ChecksumDefinition>)
+Q_DECLARE_METATYPE(std::shared_ptr<Kleo::ChecksumDefinition>)
void CryptoOperationsConfigWidget::load()
{
@@ -166,13 +167,13 @@ void CryptoOperationsConfigWidget::load()
mAutoDecryptVerifyCB->setChecked(filePrefs.autoDecryptVerify());
mASCIIArmorCB->setChecked(filePrefs.addASCIIArmor());
- const std::vector< shared_ptr<ChecksumDefinition> > cds = ChecksumDefinition::getChecksumDefinitions();
- const shared_ptr<ChecksumDefinition> default_cd = ChecksumDefinition::getDefaultChecksumDefinition(cds);
+ const std::vector< std::shared_ptr<ChecksumDefinition> > cds = ChecksumDefinition::getChecksumDefinitions();
+ const std::shared_ptr<ChecksumDefinition> default_cd = ChecksumDefinition::getDefaultChecksumDefinition(cds);
mChecksumDefinitionCB->clear();
mArchiveDefinitionCB->clear();
- Q_FOREACH (const shared_ptr<ChecksumDefinition> &cd, cds) {
+ Q_FOREACH (const std::shared_ptr<ChecksumDefinition> &cd, cds) {
mChecksumDefinitionCB->addItem(cd->label(), qVariantFromValue(cd));
if (cd == default_cd) {
mChecksumDefinitionCB->setCurrentIndex(mChecksumDefinitionCB->count() - 1);
@@ -184,7 +185,7 @@ void CryptoOperationsConfigWidget::load()
// This is a weird hack but because we are a KCM we can't link
// against ArchiveDefinition which pulls in loads of other classes.
// So we do the parsing which archive definitions exist here ourself.
- if (KConfig *config = CryptoBackendFactory::instance()->configObject()) {
+ if (KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("libkleopatrarc"))) {
const QStringList groups = config->groupList().filter(QRegularExpression(QStringLiteral("^Archive Definition #")));
Q_FOREACH (const QString &group, groups) {
const KConfigGroup cGroup(config, group);
@@ -214,7 +215,7 @@ void CryptoOperationsConfigWidget::save()
const int idx = mChecksumDefinitionCB->currentIndex();
if (idx >= 0) {
- const shared_ptr<ChecksumDefinition> cd = qvariant_cast< shared_ptr<ChecksumDefinition> >(mChecksumDefinitionCB->itemData(idx));
+ const std::shared_ptr<ChecksumDefinition> cd = qvariant_cast< std::shared_ptr<ChecksumDefinition> >(mChecksumDefinitionCB->itemData(idx));
ChecksumDefinition::setDefaultChecksumDefinition(cd);
}
diff --git a/src/conf/dirservconfigpage.cpp b/src/conf/dirservconfigpage.cpp
index bbc06e7..6722f99 100644
--- a/src/conf/dirservconfigpage.cpp
+++ b/src/conf/dirservconfigpage.cpp
@@ -33,9 +33,10 @@
#include <config-kleopatra.h>
#include "dirservconfigpage.h"
-#include "Libkleo/DirectoryServicesWidget"
-#include "Libkleo/CryptoConfigModule"
-#include "Libkleo/CryptoBackendFactory"
+#include <Libkleo/DirectoryServicesWidget>
+#include <Libkleo/CryptoConfigModule>
+
+#include <QGpgME/Protocol>
#include <kmessagebox.h>
#include <KLocalizedString>
@@ -157,7 +158,7 @@ static const char s_addnewservers_entryName[] = "add-servers";
DirectoryServicesConfigurationPage::DirectoryServicesConfigurationPage(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
- mConfig = Kleo::CryptoBackendFactory::instance()->config();
+ mConfig = QGpgME::cryptoConfig();
QGridLayout *glay = new QGridLayout(this);
glay->setMargin(0);
@@ -219,17 +220,17 @@ void DirectoryServicesConfigurationPage::load()
// gpgsm/Configuration/keyserver is not provided by older gpgconf versions;
if ((mX509ServicesEntry = configEntry(s_x509services_new_componentName, s_x509services_new_groupName, s_x509services_new_entryName,
- Kleo::CryptoConfigEntry::ArgType_LDAPURL, /*isList=*/true, /*showError=*/false))) {
+ QGpgME::CryptoConfigEntry::ArgType_LDAPURL, /*isList=*/true, /*showError=*/false))) {
mWidget->addX509Services(mX509ServicesEntry->urlValueList());
} else if ((mX509ServicesEntry = configEntry(s_x509services_componentName, s_x509services_groupName, s_x509services_entryName,
- Kleo::CryptoConfigEntry::ArgType_LDAPURL, true))) {
+ QGpgME::CryptoConfigEntry::ArgType_LDAPURL, true))) {
mWidget->addX509Services(mX509ServicesEntry->urlValueList());
}
mWidget->setX509ReadOnly(mX509ServicesEntry && mX509ServicesEntry->isReadOnly());
mOpenPGPServiceEntry = configEntry(s_pgpservice_componentName, s_pgpservice_groupName, s_pgpservice_entryName,
- Kleo::CryptoConfigEntry::ArgType_String, false);
+ QGpgME::CryptoConfigEntry::ArgType_String, false);
if (mOpenPGPServiceEntry) {
mWidget->addOpenPGPServices(string2urls(parseKeyserver(mOpenPGPServiceEntry->stringValue()).url));
}
@@ -253,14 +254,14 @@ void DirectoryServicesConfigurationPage::load()
readOnlyProtocols = DirectoryServicesWidget::X509Protocol;
}
- mTimeoutConfigEntry = configEntry(s_timeout_componentName, s_timeout_groupName, s_timeout_entryName, Kleo::CryptoConfigEntry::ArgType_UInt, false);
+ mTimeoutConfigEntry = configEntry(s_timeout_componentName, s_timeout_groupName, s_timeout_entryName, QGpgME::CryptoConfigEntry::ArgType_UInt, false);
if (mTimeoutConfigEntry) {
QTime time = QTime().addSecs(mTimeoutConfigEntry->uintValue());
//qCDebug(KLEOPATRA_LOG) <<"timeout:" << mTimeoutConfigEntry->uintValue() <<" ->" << time;
mTimeout->setTime(time);
}
- mMaxItemsConfigEntry = configEntry(s_maxitems_componentName, s_maxitems_groupName, s_maxitems_entryName, Kleo::CryptoConfigEntry::ArgType_UInt, false);
+ mMaxItemsConfigEntry = configEntry(s_maxitems_componentName, s_maxitems_groupName, s_maxitems_entryName, QGpgME::CryptoConfigEntry::ArgType_UInt, false);
if (mMaxItemsConfigEntry) {
mMaxItems->blockSignals(true); // KNumInput emits valueChanged from setValue!
mMaxItems->setValue(mMaxItemsConfigEntry->uintValue());
@@ -271,7 +272,7 @@ void DirectoryServicesConfigurationPage::load()
mMaxItemsLabel->setEnabled(maxItemsEnabled);
#ifdef NOT_USEFUL_CURRENTLY
- mAddNewServersConfigEntry = configEntry(s_addnewservers_componentName, s_addnewservers_groupName, s_addnewservers_entryName, Kleo::CryptoConfigEntry::ArgType_None, false);
+ mAddNewServersConfigEntry = configEntry(s_addnewservers_componentName, s_addnewservers_groupName, s_addnewservers_entryName, QGpgME::CryptoConfigEntry::ArgType_None, false);
if (mAddNewServersConfigEntry) {
mAddNewServersCB->setChecked(mAddNewServersConfigEntry->boolValue());
}
@@ -367,14 +368,14 @@ extern "C"
}
// Find config entry for ldap servers. Implements runtime checks on the configuration option.
-Kleo::CryptoConfigEntry *DirectoryServicesConfigurationPage::configEntry(const char *componentName,
+QGpgME::CryptoConfigEntry *DirectoryServicesConfigurationPage::configEntry(const char *componentName,
const char *groupName,
const char *entryName,
- Kleo::CryptoConfigEntry::ArgType argType,
+ QGpgME::CryptoConfigEntry::ArgType argType,
bool isList,
bool showError)
{
- Kleo::CryptoConfigEntry *entry = mConfig->entry(QLatin1String(componentName), QLatin1String(groupName), QLatin1String(entryName));
+ QGpgME::CryptoConfigEntry *entry = mConfig->entry(QLatin1String(componentName), QLatin1String(groupName), QLatin1String(entryName));
if (!entry) {
if (showError) {
diff --git a/src/conf/dirservconfigpage.h b/src/conf/dirservconfigpage.h
index 5660208..905deb4 100644
--- a/src/conf/dirservconfigpage.h
+++ b/src/conf/dirservconfigpage.h
@@ -35,7 +35,7 @@
#include <KCModule>
-#include "Libkleo/CryptoConfig"
+#include <QGpgME/CryptoConfig>
class QCheckBox;
class QLabel;
@@ -43,8 +43,6 @@ class QTimeEdit;
class QSpinBox;
namespace Kleo
{
-class CryptoConfig;
-class CryptoConfigEntry;
class DirectoryServicesWidget;
}
@@ -64,12 +62,12 @@ public:
void defaults() Q_DECL_OVERRIDE;
private:
- Kleo::CryptoConfigEntry *configEntry(const char *componentName,
- const char *groupName,
- const char *entryName,
- Kleo::CryptoConfigEntry::ArgType argType,
- bool isList,
- bool showError = true);
+ QGpgME::CryptoConfigEntry *configEntry(const char *componentName,
+ const char *groupName,
+ const char *entryName,
+ QGpgME::CryptoConfigEntry::ArgType argType,
+ bool isList,
+ bool showError = true);
Kleo::DirectoryServicesWidget *mWidget;
QTimeEdit *mTimeout;
@@ -77,13 +75,13 @@ private:
QLabel *mMaxItemsLabel;
QCheckBox *mAddNewServersCB;
- Kleo::CryptoConfigEntry *mX509ServicesEntry;
- Kleo::CryptoConfigEntry *mOpenPGPServiceEntry;
- Kleo::CryptoConfigEntry *mTimeoutConfigEntry;
- Kleo::CryptoConfigEntry *mMaxItemsConfigEntry;
- Kleo::CryptoConfigEntry *mAddNewServersConfigEntry;
+ QGpgME::CryptoConfigEntry *mX509ServicesEntry;
+ QGpgME::CryptoConfigEntry *mOpenPGPServiceEntry;
+ QGpgME::CryptoConfigEntry *mTimeoutConfigEntry;
+ QGpgME::CryptoConfigEntry *mMaxItemsConfigEntry;
+ QGpgME::CryptoConfigEntry *mAddNewServersConfigEntry;
- Kleo::CryptoConfig *mConfig;
+ QGpgME::CryptoConfig *mConfig;
};
#endif
diff --git a/src/conf/gnupgsystemconfigurationpage.cpp b/src/conf/gnupgsystemconfigurationpage.cpp
index 8fdcef0..8d5ceec 100644
--- a/src/conf/gnupgsystemconfigurationpage.cpp
+++ b/src/conf/gnupgsystemconfigurationpage.cpp
@@ -35,8 +35,8 @@
#include "gnupgsystemconfigurationpage.h"
#include <libkleo/cryptoconfigmodule.h>
-#include <Libkleo/CryptoConfig>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
+#include <QGpgME/CryptoConfig>
#include <QVBoxLayout>
@@ -48,7 +48,7 @@ GnuPGSystemConfigurationPage::GnuPGSystemConfigurationPage(QWidget *parent, cons
QVBoxLayout *lay = new QVBoxLayout(this);
lay->setMargin(0);
- CryptoConfig *const config = CryptoBackendFactory::instance()->config();
+ QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
mWidget = new CryptoConfigModule(config,
CryptoConfigModule::TabbedLayout,
@@ -63,7 +63,7 @@ GnuPGSystemConfigurationPage::GnuPGSystemConfigurationPage(QWidget *parent, cons
GnuPGSystemConfigurationPage::~GnuPGSystemConfigurationPage()
{
// ### correct here?
- if (CryptoConfig *const config = CryptoBackendFactory::instance()->config()) {
+ if (QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig()) {
config->clear();
}
}
diff --git a/src/conf/smimevalidationconfigurationwidget.cpp b/src/conf/smimevalidationconfigurationwidget.cpp
index e3ba39f..137003d 100644
--- a/src/conf/smimevalidationconfigurationwidget.cpp
+++ b/src/conf/smimevalidationconfigurationwidget.cpp
@@ -38,8 +38,8 @@
#include "smimevalidationpreferences.h"
-#include <Libkleo/CryptoConfig>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/CryptoConfig>
+#include <QGpgME/Protocol>
#include <KLocalizedString>
#include "kleopatra_debug.h"
@@ -50,6 +50,7 @@
using namespace Kleo;
using namespace Kleo::Config;
+using namespace QGpgME;
class SMimeValidationConfigurationWidget::Private
{
@@ -222,7 +223,7 @@ void SMimeValidationConfigurationWidget::load()
d->ui.intervalRefreshCB->setChecked(refreshInterval > 0);
d->ui.intervalRefreshSB->setValue(refreshInterval);
- CryptoConfig *const config = CryptoBackendFactory::instance()->config();
+ CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
setEnabled(false);
return;
@@ -321,7 +322,7 @@ static void saveCheckBoxToKleoEntry(QCheckBox *cb, CryptoConfigEntry *entry)
void SMimeValidationConfigurationWidget::save() const
{
- CryptoConfig *const config = CryptoBackendFactory::instance()->config();
+ CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
return;
}
diff --git a/src/crypto/autodecryptverifyfilescontroller.cpp b/src/crypto/autodecryptverifyfilescontroller.cpp
index d058c22..5c69676 100644
--- a/src/crypto/autodecryptverifyfilescontroller.cpp
+++ b/src/crypto/autodecryptverifyfilescontroller.cpp
@@ -63,12 +63,9 @@
#include <QFileDialog>
#include <QTemporaryDir>
-#include <boost/shared_ptr.hpp>
-
#include <memory>
#include <vector>
-using namespace boost;
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Crypto;
@@ -85,7 +82,7 @@ public:
void schedule();
void exec();
- std::vector<shared_ptr<Task> > buildTasks(const QStringList &, QStringList &);
+ std::vector<std::shared_ptr<Task> > buildTasks(const QStringList &, QStringList &);
void reportError(int err, const QString &details)
{
@@ -95,9 +92,9 @@ public:
void cancelAllTasks();
QStringList m_passedFiles, m_filesAfterPreparation;
- std::vector<shared_ptr<const DecryptVerifyResult> > m_results;
- std::vector<shared_ptr<Task> > m_runnableTasks, m_completedTasks;
- shared_ptr<Task> m_runningTask;
+ std::vector<std::shared_ptr<const DecryptVerifyResult> > m_results;
+ std::vector<std::shared_ptr<Task> > m_runnableTasks, m_completedTasks;
+ std::shared_ptr<Task> m_runningTask;
bool m_errorDetected;
DecryptVerifyOperation m_operation;
DecryptVerifyFilesDialog *m_dialog;
@@ -120,14 +117,14 @@ void AutoDecryptVerifyFilesController::Private::slotDialogCanceled()
void AutoDecryptVerifyFilesController::Private::schedule()
{
if (!m_runningTask && !m_runnableTasks.empty()) {
- const shared_ptr<Task> t = m_runnableTasks.back();
+ const std::shared_ptr<Task> t = m_runnableTasks.back();
m_runnableTasks.pop_back();
t->start();
m_runningTask = t;
}
if (!m_runningTask) {
kleo_assert(m_runnableTasks.empty());
- Q_FOREACH (const shared_ptr<const DecryptVerifyResult> &i, m_results) {
+ Q_FOREACH (const std::shared_ptr<const DecryptVerifyResult> &i, m_results) {
Q_EMIT q->verificationResult(i->verificationResult());
}
}
@@ -138,7 +135,7 @@ void AutoDecryptVerifyFilesController::Private::exec()
Q_ASSERT(!m_dialog);
QStringList undetected;
- std::vector<shared_ptr<Task> > tasks = buildTasks(m_passedFiles, undetected);
+ std::vector<std::shared_ptr<Task> > tasks = buildTasks(m_passedFiles, undetected);
if (!undetected.isEmpty()) {
// Since GpgME 1.7.0 Classification is supposed to be reliable
@@ -157,8 +154,8 @@ void AutoDecryptVerifyFilesController::Private::exec()
Q_ASSERT(m_runnableTasks.empty());
m_runnableTasks.swap(tasks);
- shared_ptr<TaskCollection> coll(new TaskCollection);
- Q_FOREACH (const shared_ptr<Task> &i, m_runnableTasks) {
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ Q_FOREACH (const std::shared_ptr<Task> &i, m_runnableTasks) {
q->connectTask(i);
}
coll->setTasks(m_runnableTasks);
@@ -213,9 +210,9 @@ void AutoDecryptVerifyFilesController::Private::exec()
return;
}
-std::vector< shared_ptr<Task> > AutoDecryptVerifyFilesController::Private::buildTasks(const QStringList &fileNames, QStringList &undetected)
+std::vector< std::shared_ptr<Task> > AutoDecryptVerifyFilesController::Private::buildTasks(const QStringList &fileNames, QStringList &undetected)
{
- std::vector<shared_ptr<Task> > tasks;
+ std::vector<std::shared_ptr<Task> > tasks;
Q_FOREACH (const QString &fName, fileNames) {
const auto classification = classify(fName);
const auto proto = findProtocol(classification);
@@ -244,7 +241,7 @@ std::vector< shared_ptr<Task> > AutoDecryptVerifyFilesController::Private::build
continue;
}
qCDebug(KLEOPATRA_LOG) << "Detached verify: " << fName << " Data: " << signedDataFileName;
- shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
+ std::shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
t->setInput(Input::createFromFile(fName));
t->setSignedData(Input::createFromFile(signedDataFileName));
t->setProtocol(proto);
@@ -255,7 +252,7 @@ std::vector< shared_ptr<Task> > AutoDecryptVerifyFilesController::Private::build
if (!signatures.empty()) {
Q_FOREACH (const QString &sig, signatures) {
qCDebug(KLEOPATRA_LOG) << "Guessing: " << sig << " is a signature for: " << fName;
- shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
+ std::shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
t->setInput(Input::createFromFile(sig));
t->setSignedData(Input::createFromFile(fName));
t->setProtocol(proto);
@@ -280,7 +277,7 @@ std::vector< shared_ptr<Task> > AutoDecryptVerifyFilesController::Private::build
if (isOpaqueSignature(classification)) {
qCDebug(KLEOPATRA_LOG) << "creating a VerifyOpaqueTask";
- shared_ptr<VerifyOpaqueTask> t(new VerifyOpaqueTask);
+ std::shared_ptr<VerifyOpaqueTask> t(new VerifyOpaqueTask);
t->setInput(input);
t->setOutput(output);
t->setProtocol(proto);
@@ -290,7 +287,7 @@ std::vector< shared_ptr<Task> > AutoDecryptVerifyFilesController::Private::build
// decrypted. Verify we always do because we can't know if
// an encrypted message is also signed.
qCDebug(KLEOPATRA_LOG) << "creating a DecryptVerifyTask";
- shared_ptr<DecryptVerifyTask> t(new DecryptVerifyTask);
+ std::shared_ptr<DecryptVerifyTask> t(new DecryptVerifyTask);
t->setInput(input);
t->setOutput(output);
t->setProtocol(proto);
@@ -312,7 +309,7 @@ AutoDecryptVerifyFilesController::AutoDecryptVerifyFilesController(QObject *pare
{
}
-AutoDecryptVerifyFilesController::AutoDecryptVerifyFilesController(const shared_ptr<const ExecutionContext> &ctx, QObject *parent) :
+AutoDecryptVerifyFilesController::AutoDecryptVerifyFilesController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent) :
DecryptVerifyFilesController(ctx, parent), d(new Private(this))
{
}
@@ -364,7 +361,7 @@ void AutoDecryptVerifyFilesController::cancel()
}
}
-void AutoDecryptVerifyFilesController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void AutoDecryptVerifyFilesController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
assert(task);
assert(task == d->m_runningTask.get());
@@ -378,7 +375,7 @@ void AutoDecryptVerifyFilesController::doTaskDone(const Task *task, const shared
d->m_completedTasks.push_back(d->m_runningTask);
d->m_runningTask.reset();
- if (const shared_ptr<const DecryptVerifyResult> &dvr = boost::dynamic_pointer_cast<const DecryptVerifyResult>(result)) {
+ if (const std::shared_ptr<const DecryptVerifyResult> &dvr = std::dynamic_pointer_cast<const DecryptVerifyResult>(result)) {
d->m_results.push_back(dvr);
}
diff --git a/src/crypto/autodecryptverifyfilescontroller.h b/src/crypto/autodecryptverifyfilescontroller.h
index 76332fc..370abb7 100644
--- a/src/crypto/autodecryptverifyfilescontroller.h
+++ b/src/crypto/autodecryptverifyfilescontroller.h
@@ -40,8 +40,7 @@
#include <QMetaType>
-#include<boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace GpgME
@@ -59,7 +58,7 @@ class AutoDecryptVerifyFilesController : public DecryptVerifyFilesController
Q_OBJECT
public:
explicit AutoDecryptVerifyFilesController(QObject *parent = Q_NULLPTR);
- explicit AutoDecryptVerifyFilesController(const boost::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
+ explicit AutoDecryptVerifyFilesController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
~AutoDecryptVerifyFilesController();
@@ -72,7 +71,7 @@ public Q_SLOTS:
void cancel() Q_DECL_OVERRIDE;
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Task::Result> &) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &) Q_DECL_OVERRIDE;
private:
class Private;
diff --git a/src/crypto/controller.cpp b/src/crypto/controller.cpp
index 3ab4e61..c7c9b25 100644
--- a/src/crypto/controller.cpp
+++ b/src/crypto/controller.cpp
@@ -34,9 +34,10 @@
#include "controller.h"
+#include <cassert>
+
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class Controller::Private
{
@@ -62,7 +63,7 @@ Controller::Controller(QObject *parent)
}
-Controller::Controller(const shared_ptr<const ExecutionContext> &ctx, QObject *parent)
+Controller::Controller(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent)
: QObject(parent), ExecutionContextUser(ctx), d(new Private(this))
{
@@ -70,7 +71,7 @@ Controller::Controller(const shared_ptr<const ExecutionContext> &ctx, QObject *p
Controller::~Controller() {}
-void Controller::taskDone(const boost::shared_ptr<const Task::Result> &result)
+void Controller::taskDone(const std::shared_ptr<const Task::Result> &result)
{
if (result->hasError()) {
d->lastError = result->errorCode();
@@ -81,9 +82,9 @@ void Controller::taskDone(const boost::shared_ptr<const Task::Result> &result)
doTaskDone(task, result);
}
-void Controller::doTaskDone(const Task *, const shared_ptr<const Task::Result> &) {}
+void Controller::doTaskDone(const Task *, const std::shared_ptr<const Task::Result> &) {}
-void Controller::connectTask(const shared_ptr<Task> &task)
+void Controller::connectTask(const std::shared_ptr<Task> &task)
{
assert(task);
connect(task.get(), SIGNAL(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)),
diff --git a/src/crypto/controller.h b/src/crypto/controller.h
index b9e92d3..c89a1a9 100644
--- a/src/crypto/controller.h
+++ b/src/crypto/controller.h
@@ -40,7 +40,7 @@
#include <utils/pimpl_ptr.h>
#include <utils/types.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace Kleo
{
@@ -52,7 +52,7 @@ class Controller : public QObject, protected ExecutionContextUser
Q_OBJECT
public:
explicit Controller(QObject *parent = Q_NULLPTR);
- explicit Controller(const boost::shared_ptr<const ExecutionContext> &cmd, QObject *parent = Q_NULLPTR);
+ explicit Controller(const std::shared_ptr<const ExecutionContext> &cmd, QObject *parent = Q_NULLPTR);
~Controller();
using ExecutionContextUser::setExecutionContext;
@@ -63,12 +63,12 @@ Q_SIGNALS:
protected:
void emitDoneOrError();
void setLastError(int err, const QString &details);
- void connectTask(const boost::shared_ptr<Task> &task);
+ void connectTask(const std::shared_ptr<Task> &task);
- virtual void doTaskDone(const Task *task, const boost::shared_ptr<const Task::Result> &result);
+ virtual void doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result);
protected Q_SLOTS:
- void taskDone(const boost::shared_ptr<const Kleo::Crypto::Task::Result> &);
+ void taskDone(const std::shared_ptr<const Kleo::Crypto::Task::Result> &);
Q_SIGNALS:
diff --git a/src/crypto/createchecksumscontroller.cpp b/src/crypto/createchecksumscontroller.cpp
index 70b0ae2..5669ee1 100644
--- a/src/crypto/createchecksumscontroller.cpp
+++ b/src/crypto/createchecksumscontroller.cpp
@@ -187,10 +187,10 @@ static QStringList fs_intersect(QStringList l1, QStringList l2)
return result;
}
-static QList<QRegExp> get_patterns(const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+static QList<QRegExp> get_patterns(const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
QList<QRegExp> result;
- Q_FOREACH (const shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
+ Q_FOREACH (const std::shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
if (cd)
Q_FOREACH (const QString &pattern, cd->patterns()) {
result.push_back(QRegExp(pattern, fs_cs));
@@ -260,8 +260,8 @@ private:
QPointer<QProgressDialog> progressDialog;
#endif
mutable QMutex mutex;
- const std::vector< shared_ptr<ChecksumDefinition> > checksumDefinitions;
- shared_ptr<ChecksumDefinition> checksumDefinition;
+ const std::vector< std::shared_ptr<ChecksumDefinition> > checksumDefinitions;
+ std::shared_ptr<ChecksumDefinition> checksumDefinition;
QStringList files;
QStringList errors, created;
bool allowAddition;
@@ -301,7 +301,7 @@ CreateChecksumsController::CreateChecksumsController(QObject *p)
}
-CreateChecksumsController::CreateChecksumsController(const shared_ptr<const ExecutionContext> &ctx, QObject *p)
+CreateChecksumsController::CreateChecksumsController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *p)
: Controller(ctx, p), d(new Private(this))
{
@@ -377,7 +377,7 @@ struct Dir {
QString sumFile;
QStringList inputFiles;
quint64 totalSize;
- shared_ptr<ChecksumDefinition> checksumDefinition;
+ std::shared_ptr<ChecksumDefinition> checksumDefinition;
};
}
@@ -459,21 +459,21 @@ static quint64 aggregate_size(const QDir &dir, const QStringList &files)
return n;
}
-static shared_ptr<ChecksumDefinition> filename2definition(const QString &fileName,
- const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+static std::shared_ptr<ChecksumDefinition> filename2definition(const QString &fileName,
+ const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
- Q_FOREACH (const shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
+ Q_FOREACH (const std::shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
if (cd)
Q_FOREACH (const QString &pattern, cd->patterns())
if (QRegExp(pattern, fs_cs).exactMatch(fileName)) {
return cd;
}
- return shared_ptr<ChecksumDefinition>();
+ return std::shared_ptr<ChecksumDefinition>();
}
static std::vector<Dir> find_dirs_by_sum_files(const QStringList &files, bool allowAddition,
const function<void(int)> &progress,
- const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+ const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
const QList<QRegExp> patterns = get_patterns(checksumDefinitions);
@@ -527,9 +527,9 @@ struct less_dir : std::binary_function<QDir, QDir, bool> {
};
}
-static std::vector<Dir> find_dirs_by_input_files(const QStringList &files, const shared_ptr<ChecksumDefinition> &checksumDefinition, bool allowAddition,
+static std::vector<Dir> find_dirs_by_input_files(const QStringList &files, const std::shared_ptr<ChecksumDefinition> &checksumDefinition, bool allowAddition,
const function<void(int)> &progress,
- const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+ const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
Q_UNUSED(allowAddition);
if (!checksumDefinition) {
@@ -642,8 +642,8 @@ void CreateChecksumsController::Private::run()
QMutexLocker locker(&mutex);
const QStringList files = this->files;
- const std::vector< shared_ptr<ChecksumDefinition> > checksumDefinitions = this->checksumDefinitions;
- const shared_ptr<ChecksumDefinition> checksumDefinition = this->checksumDefinition;
+ const std::vector< std::shared_ptr<ChecksumDefinition> > checksumDefinitions = this->checksumDefinitions;
+ const std::shared_ptr<ChecksumDefinition> checksumDefinition = this->checksumDefinition;
const bool allowAddition = this->allowAddition;
locker.unlock();
diff --git a/src/crypto/createchecksumscontroller.h b/src/crypto/createchecksumscontroller.h
index f01911f..9fb3592 100644
--- a/src/crypto/createchecksumscontroller.h
+++ b/src/crypto/createchecksumscontroller.h
@@ -40,8 +40,7 @@
#include <gpgme++/global.h>
#include <kmime/kmime_header_parsing.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace Kleo
@@ -54,7 +53,7 @@ class CreateChecksumsController : public Controller
Q_OBJECT
public:
explicit CreateChecksumsController(QObject *parent = Q_NULLPTR);
- explicit CreateChecksumsController(const boost::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
+ explicit CreateChecksumsController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
~CreateChecksumsController();
void setAllowAddition(bool allow);
diff --git a/src/crypto/decryptverifyemailcontroller.cpp b/src/crypto/decryptverifyemailcontroller.cpp
index 83656cb..07f2ce3 100644
--- a/src/crypto/decryptverifyemailcontroller.cpp
+++ b/src/crypto/decryptverifyemailcontroller.cpp
@@ -45,7 +45,8 @@
#include <utils/output.h>
#include <utils/kleo_assert.h>
-#include <Libkleo/CryptoBackendFactory>
+#include <QGpgME/Protocol>
+
#include <Libkleo/Formatting>
#include <Libkleo/Classify>
@@ -57,12 +58,8 @@
#include <QPointer>
#include <QTimer>
-#include <boost/shared_ptr.hpp>
-
-#include <memory>
#include <vector>
-using namespace boost;
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Crypto;
@@ -87,7 +84,7 @@ public:
addPage(&m_resultPage);
}
- void addTaskCollection(const shared_ptr<TaskCollection> &coll)
+ void addTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
m_resultPage.addTaskCollection(coll);
}
@@ -116,7 +113,7 @@ public:
void slotWizardCanceled();
void schedule();
- std::vector<shared_ptr<AbstractDecryptVerifyTask> > buildTasks();
+ std::vector<std::shared_ptr<AbstractDecryptVerifyTask> > buildTasks();
static DecryptVerifyEMailWizard *findOrCreateWizard(unsigned int id);
@@ -130,14 +127,14 @@ public:
void cancelAllTasks();
- std::vector<shared_ptr<Input> > m_inputs, m_signedDatas;
- std::vector<shared_ptr<Output> > m_outputs;
+ std::vector<std::shared_ptr<Input> > m_inputs, m_signedDatas;
+ std::vector<std::shared_ptr<Output> > m_outputs;
unsigned int m_sessionId;
QPointer<DecryptVerifyEMailWizard> m_wizard;
- std::vector<shared_ptr<const DecryptVerifyResult> > m_results;
- std::vector<shared_ptr<AbstractDecryptVerifyTask> > m_runnableTasks, m_completedTasks;
- shared_ptr<AbstractDecryptVerifyTask> m_runningTask;
+ std::vector<std::shared_ptr<const DecryptVerifyResult> > m_results;
+ std::vector<std::shared_ptr<AbstractDecryptVerifyTask> > m_runnableTasks, m_completedTasks;
+ std::shared_ptr<AbstractDecryptVerifyTask> m_runningTask;
bool m_silent;
bool m_operationCompleted;
DecryptVerifyOperation m_operation;
@@ -166,7 +163,7 @@ void DecryptVerifyEMailController::Private::slotWizardCanceled()
}
}
-void DecryptVerifyEMailController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void DecryptVerifyEMailController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
assert(task);
@@ -177,7 +174,7 @@ void DecryptVerifyEMailController::doTaskDone(const Task *task, const shared_ptr
if (task == d->m_runningTask.get()) {
d->m_completedTasks.push_back(d->m_runningTask);
- const shared_ptr<const DecryptVerifyResult> &dvr = boost::dynamic_pointer_cast<const DecryptVerifyResult>(result);
+ const std::shared_ptr<const DecryptVerifyResult> &dvr = std::dynamic_pointer_cast<const DecryptVerifyResult>(result);
assert(dvr);
d->m_results.push_back(dvr);
d->m_runningTask.reset();
@@ -190,14 +187,14 @@ void DecryptVerifyEMailController::doTaskDone(const Task *task, const shared_ptr
void DecryptVerifyEMailController::Private::schedule()
{
if (!m_runningTask && !m_runnableTasks.empty()) {
- const shared_ptr<AbstractDecryptVerifyTask> t = m_runnableTasks.back();
+ const std::shared_ptr<AbstractDecryptVerifyTask> t = m_runnableTasks.back();
m_runnableTasks.pop_back();
t->start();
m_runningTask = t;
}
if (!m_runningTask) {
kleo_assert(m_runnableTasks.empty());
- Q_FOREACH (const shared_ptr<const DecryptVerifyResult> &i, m_results) {
+ Q_FOREACH (const std::shared_ptr<const DecryptVerifyResult> &i, m_results) {
Q_EMIT q->verificationResult(i->verificationResult());
}
// if there is a popup, wait for either the client cancel or the user closing the popup.
@@ -270,7 +267,7 @@ DecryptVerifyEMailWizard *DecryptVerifyEMailController::Private::findOrCreateWiz
return w;
}
-std::vector< shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailController::Private::buildTasks()
+std::vector< std::shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailController::Private::buildTasks()
{
const uint numInputs = m_inputs.size();
const uint numMessages = m_signedDatas.size();
@@ -306,7 +303,7 @@ std::vector< shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailControlle
kleo_assert(m_protocol != UnknownProtocol);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(m_protocol);
+ const QGpgME::Protocol *const backend = (m_protocol == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!backend) {
throw Kleo::Exception(makeGnuPGError(GPG_ERR_UNSUPPORTED_PROTOCOL), i18n("No backend support for %1", Formatting::displayName(m_protocol)));
}
@@ -315,13 +312,13 @@ std::vector< shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailControlle
ensureWizardVisible();
}
- std::vector< shared_ptr<AbstractDecryptVerifyTask> > tasks;
+ std::vector< std::shared_ptr<AbstractDecryptVerifyTask> > tasks;
for (unsigned int i = 0; i < numInputs; ++i) {
- shared_ptr<AbstractDecryptVerifyTask> task;
+ std::shared_ptr<AbstractDecryptVerifyTask> task;
switch (m_operation) {
case Decrypt: {
- shared_ptr<DecryptTask> t(new DecryptTask);
+ std::shared_ptr<DecryptTask> t(new DecryptTask);
t->setInput(m_inputs.at(i));
assert(numOutputs);
t->setOutput(m_outputs.at(i));
@@ -331,7 +328,7 @@ std::vector< shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailControlle
break;
case Verify: {
if (m_verificationMode == Detached) {
- shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
+ std::shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
t->setInput(m_inputs.at(i));
t->setSignedData(m_signedDatas.at(i));
if (numInformativeSenders > 0) {
@@ -340,7 +337,7 @@ std::vector< shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailControlle
t->setProtocol(m_protocol);
task = t;
} else {
- shared_ptr<VerifyOpaqueTask> t(new VerifyOpaqueTask);
+ std::shared_ptr<VerifyOpaqueTask> t(new VerifyOpaqueTask);
t->setInput(m_inputs.at(i));
if (numOutputs) {
t->setOutput(m_outputs.at(i));
@@ -354,7 +351,7 @@ std::vector< shared_ptr<AbstractDecryptVerifyTask> > DecryptVerifyEMailControlle
}
break;
case DecryptVerify: {
- shared_ptr<DecryptVerifyTask> t(new DecryptVerifyTask);
+ std::shared_ptr<DecryptVerifyTask> t(new DecryptVerifyTask);
t->setInput(m_inputs.at(i));
assert(numOutputs);
t->setOutput(m_outputs.at(i));
@@ -383,7 +380,7 @@ DecryptVerifyEMailController::DecryptVerifyEMailController(QObject *parent) : Co
{
}
-DecryptVerifyEMailController::DecryptVerifyEMailController(const shared_ptr<const ExecutionContext> &ctx, QObject *parent) : Controller(ctx, parent), d(new Private(this))
+DecryptVerifyEMailController::DecryptVerifyEMailController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent) : Controller(ctx, parent), d(new Private(this))
{
}
@@ -396,9 +393,9 @@ void DecryptVerifyEMailController::start()
{
d->m_runnableTasks = d->buildTasks();
- const shared_ptr<TaskCollection> coll(new TaskCollection);
- std::vector<shared_ptr<Task> > tsks;
- Q_FOREACH (const shared_ptr<Task> &i, d->m_runnableTasks) {
+ const std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ std::vector<std::shared_ptr<Task> > tsks;
+ Q_FOREACH (const std::shared_ptr<Task> &i, d->m_runnableTasks) {
connectTask(i);
tsks.push_back(i);
}
@@ -410,32 +407,32 @@ void DecryptVerifyEMailController::start()
QTimer::singleShot(0, this, SLOT(schedule()));
}
-void DecryptVerifyEMailController::setInput(const shared_ptr<Input> &input)
+void DecryptVerifyEMailController::setInput(const std::shared_ptr<Input> &input)
{
d->m_inputs.resize(1, input);
}
-void DecryptVerifyEMailController::setInputs(const std::vector<shared_ptr<Input> > &inputs)
+void DecryptVerifyEMailController::setInputs(const std::vector<std::shared_ptr<Input> > &inputs)
{
d->m_inputs = inputs;
}
-void DecryptVerifyEMailController::setSignedData(const shared_ptr<Input> &data)
+void DecryptVerifyEMailController::setSignedData(const std::shared_ptr<Input> &data)
{
d->m_signedDatas.resize(1, data);
}
-void DecryptVerifyEMailController::setSignedData(const std::vector<shared_ptr<Input> > &data)
+void DecryptVerifyEMailController::setSignedData(const std::vector<std::shared_ptr<Input> > &data)
{
d->m_signedDatas = data;
}
-void DecryptVerifyEMailController::setOutput(const shared_ptr<Output> &output)
+void DecryptVerifyEMailController::setOutput(const std::shared_ptr<Output> &output)
{
d->m_outputs.resize(1, output);
}
-void DecryptVerifyEMailController::setOutputs(const std::vector<shared_ptr<Output> > &outputs)
+void DecryptVerifyEMailController::setOutputs(const std::vector<std::shared_ptr<Output> > &outputs)
{
d->m_outputs = outputs;
}
diff --git a/src/crypto/decryptverifyemailcontroller.h b/src/crypto/decryptverifyemailcontroller.h
index 4055163..6a7db4b 100644
--- a/src/crypto/decryptverifyemailcontroller.h
+++ b/src/crypto/decryptverifyemailcontroller.h
@@ -41,8 +41,7 @@
#include <QMetaType>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace KMime
@@ -71,18 +70,18 @@ class DecryptVerifyEMailController : public Controller
Q_OBJECT
public:
explicit DecryptVerifyEMailController(QObject *parent = Q_NULLPTR);
- explicit DecryptVerifyEMailController(const boost::shared_ptr<const ExecutionContext> &cmd, QObject *parent = Q_NULLPTR);
+ explicit DecryptVerifyEMailController(const std::shared_ptr<const ExecutionContext> &cmd, QObject *parent = Q_NULLPTR);
~DecryptVerifyEMailController();
- void setInput(const boost::shared_ptr<Input> &input);
- void setInputs(const std::vector<boost::shared_ptr<Input> > &inputs);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setInputs(const std::vector<std::shared_ptr<Input> > &inputs);
- void setSignedData(const boost::shared_ptr<Input> &data);
- void setSignedData(const std::vector<boost::shared_ptr<Input> > &data);
+ void setSignedData(const std::shared_ptr<Input> &data);
+ void setSignedData(const std::vector<std::shared_ptr<Input> > &data);
- void setOutput(const boost::shared_ptr<Output> &output);
- void setOutputs(const std::vector<boost::shared_ptr<Output> > &outputs);
+ void setOutput(const std::shared_ptr<Output> &output);
+ void setOutputs(const std::vector<std::shared_ptr<Output> > &outputs);
void setInformativeSenders(const std::vector<KMime::Types::Mailbox> &senders);
@@ -103,7 +102,7 @@ Q_SIGNALS:
void verificationResult(const GpgME::VerificationResult &);
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Task::Result> &result) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result) Q_DECL_OVERRIDE;
class Private;
kdtools::pimpl_ptr<Private> d;
diff --git a/src/crypto/decryptverifyfilescontroller.cpp b/src/crypto/decryptverifyfilescontroller.cpp
index e26db00..1801964 100644
--- a/src/crypto/decryptverifyfilescontroller.cpp
+++ b/src/crypto/decryptverifyfilescontroller.cpp
@@ -57,12 +57,9 @@
#include <QPointer>
#include <QTimer>
-#include <boost/shared_ptr.hpp>
-
#include <memory>
#include <vector>
-using namespace boost;
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Crypto;
@@ -73,7 +70,7 @@ class DecryptVerifyFilesController::Private
DecryptVerifyFilesController *const q;
public:
- static shared_ptr<AbstractDecryptVerifyTask> taskFromOperationWidget(const DecryptVerifyOperationWidget *w, const QString &fileName, const QDir &outDir, const shared_ptr<OverwritePolicy> &overwritePolicy);
+ static std::shared_ptr<AbstractDecryptVerifyTask> taskFromOperationWidget(const DecryptVerifyOperationWidget *w, const QString &fileName, const QDir &outDir, const std::shared_ptr<OverwritePolicy> &overwritePolicy);
explicit Private(DecryptVerifyFilesController *qq);
@@ -82,7 +79,7 @@ public:
void schedule();
QStringList prepareWizardFromPassedFiles();
- std::vector<shared_ptr<Task> > buildTasks(const QStringList &, const shared_ptr<OverwritePolicy> &);
+ std::vector<std::shared_ptr<Task> > buildTasks(const QStringList &, const std::shared_ptr<OverwritePolicy> &);
void ensureWizardCreated();
void ensureWizardVisible();
@@ -95,25 +92,25 @@ public:
QStringList m_passedFiles, m_filesAfterPreparation;
QPointer<DecryptVerifyFilesWizard> m_wizard;
- std::vector<shared_ptr<const DecryptVerifyResult> > m_results;
- std::vector<shared_ptr<Task> > m_runnableTasks, m_completedTasks;
- shared_ptr<Task> m_runningTask;
+ std::vector<std::shared_ptr<const DecryptVerifyResult> > m_results;
+ std::vector<std::shared_ptr<Task> > m_runnableTasks, m_completedTasks;
+ std::shared_ptr<Task> m_runningTask;
bool m_errorDetected;
DecryptVerifyOperation m_operation;
};
// static
-shared_ptr<AbstractDecryptVerifyTask> DecryptVerifyFilesController::Private::taskFromOperationWidget(const DecryptVerifyOperationWidget *w, const QString &fileName, const QDir &outDir, const shared_ptr<OverwritePolicy> &overwritePolicy)
+std::shared_ptr<AbstractDecryptVerifyTask> DecryptVerifyFilesController::Private::taskFromOperationWidget(const DecryptVerifyOperationWidget *w, const QString &fileName, const QDir &outDir, const std::shared_ptr<OverwritePolicy> &overwritePolicy)
{
kleo_assert(w);
- shared_ptr<AbstractDecryptVerifyTask> task;
+ std::shared_ptr<AbstractDecryptVerifyTask> task;
switch (w->mode()) {
case DecryptVerifyOperationWidget::VerifyDetachedWithSignature: {
- shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
+ std::shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
t->setInput(Input::createFromFile(fileName));
t->setSignedData(Input::createFromFile(w->signedDataFileName()));
task = t;
@@ -122,7 +119,7 @@ shared_ptr<AbstractDecryptVerifyTask> DecryptVerifyFilesController::Private::tas
}
break;
case DecryptVerifyOperationWidget::VerifyDetachedWithSignedData: {
- shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
+ std::shared_ptr<VerifyDetachedTask> t(new VerifyDetachedTask);
t->setInput(Input::createFromFile(w->inputFileName()));
t->setSignedData(Input::createFromFile(fileName));
task = t;
@@ -134,7 +131,7 @@ shared_ptr<AbstractDecryptVerifyTask> DecryptVerifyFilesController::Private::tas
const unsigned int classification = classify(fileName);
qCDebug(KLEOPATRA_LOG) << "classified" << fileName << "as" << printableClassification(classification);
- const shared_ptr<ArchiveDefinition> ad = w->selectedArchiveDefinition();
+ const std::shared_ptr<ArchiveDefinition> ad = w->selectedArchiveDefinition();
const Protocol proto =
isOpenPGP(classification) ? OpenPGP :
@@ -142,20 +139,20 @@ shared_ptr<AbstractDecryptVerifyTask> DecryptVerifyFilesController::Private::tas
ad /* _needs_ the info */ ? throw Exception(gpg_error(GPG_ERR_CONFLICT), i18n("Cannot determine whether input data is OpenPGP or CMS")) :
/* else we don't care */ UnknownProtocol;
- const shared_ptr<Input> input = Input::createFromFile(fileName);
- const shared_ptr<Output> output =
+ const std::shared_ptr<Input> input = Input::createFromFile(fileName);
+ const std::shared_ptr<Output> output =
ad ? ad->createOutputFromUnpackCommand(proto, fileName, outDir) :
/*else*/ Output::createFromFile(outDir.absoluteFilePath(outputFileName(QFileInfo(fileName).fileName())), overwritePolicy);
if (mayBeCipherText(classification)) {
qCDebug(KLEOPATRA_LOG) << "creating a DecryptVerifyTask";
- shared_ptr<DecryptVerifyTask> t(new DecryptVerifyTask);
+ std::shared_ptr<DecryptVerifyTask> t(new DecryptVerifyTask);
t->setInput(input);
t->setOutput(output);
task = t;
} else {
qCDebug(KLEOPATRA_LOG) << "creating a VerifyOpaqueTask";
- shared_ptr<VerifyOpaqueTask> t(new VerifyOpaqueTask);
+ std::shared_ptr<VerifyOpaqueTask> t(new VerifyOpaqueTask);
t->setInput(input);
t->setOutput(output);
task = t;
@@ -178,15 +175,15 @@ DecryptVerifyFilesController::Private::Private(DecryptVerifyFilesController *qq)
void DecryptVerifyFilesController::Private::slotWizardOperationPrepared()
{
ensureWizardCreated();
- std::vector<shared_ptr<Task> > tasks = buildTasks(m_filesAfterPreparation, shared_ptr<OverwritePolicy>(new OverwritePolicy(m_wizard)));
+ std::vector<std::shared_ptr<Task> > tasks = buildTasks(m_filesAfterPreparation, std::shared_ptr<OverwritePolicy>(new OverwritePolicy(m_wizard)));
if (tasks.empty()) {
reportError(makeGnuPGError(GPG_ERR_ASS_NO_INPUT), i18n("No usable inputs found"));
}
kleo_assert(m_runnableTasks.empty());
m_runnableTasks.swap(tasks);
- shared_ptr<TaskCollection> coll(new TaskCollection);
- Q_FOREACH (const shared_ptr<Task> &i, m_runnableTasks) {
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ Q_FOREACH (const std::shared_ptr<Task> &i, m_runnableTasks) {
q->connectTask(i);
}
coll->setTasks(m_runnableTasks);
@@ -200,7 +197,7 @@ void DecryptVerifyFilesController::Private::slotWizardCanceled()
qCDebug(KLEOPATRA_LOG);
}
-void DecryptVerifyFilesController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void DecryptVerifyFilesController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
assert(task);
assert(task == d->m_runningTask.get());
@@ -214,7 +211,7 @@ void DecryptVerifyFilesController::doTaskDone(const Task *task, const shared_ptr
d->m_completedTasks.push_back(d->m_runningTask);
d->m_runningTask.reset();
- if (const shared_ptr<const DecryptVerifyResult> &dvr = boost::dynamic_pointer_cast<const DecryptVerifyResult>(result)) {
+ if (const std::shared_ptr<const DecryptVerifyResult> &dvr = std::dynamic_pointer_cast<const DecryptVerifyResult>(result)) {
d->m_results.push_back(dvr);
}
@@ -224,14 +221,14 @@ void DecryptVerifyFilesController::doTaskDone(const Task *task, const shared_ptr
void DecryptVerifyFilesController::Private::schedule()
{
if (!m_runningTask && !m_runnableTasks.empty()) {
- const shared_ptr<Task> t = m_runnableTasks.back();
+ const std::shared_ptr<Task> t = m_runnableTasks.back();
m_runnableTasks.pop_back();
t->start();
m_runningTask = t;
}
if (!m_runningTask) {
kleo_assert(m_runnableTasks.empty());
- Q_FOREACH (const shared_ptr<const DecryptVerifyResult> &i, m_results) {
+ Q_FOREACH (const std::shared_ptr<const DecryptVerifyResult> &i, m_results) {
Q_EMIT q->verificationResult(i->verificationResult());
}
q->emitDoneOrError();
@@ -256,11 +253,11 @@ void DecryptVerifyFilesController::Private::ensureWizardCreated()
namespace
{
-struct FindExtension : std::unary_function<shared_ptr<ArchiveDefinition>, bool> {
+struct FindExtension : std::unary_function<std::shared_ptr<ArchiveDefinition>, bool> {
const QString ext;
const Protocol proto;
FindExtension(const QString &ext, Protocol proto) : ext(ext), proto(proto) {}
- bool operator()(const shared_ptr<ArchiveDefinition> &ad) const
+ bool operator()(const std::shared_ptr<ArchiveDefinition> &ad) const
{
qCDebug(KLEOPATRA_LOG) << " considering" << (ad ? ad->label() : QStringLiteral("<null>")) << "for" << ext;
bool result;
@@ -275,13 +272,13 @@ struct FindExtension : std::unary_function<shared_ptr<ArchiveDefinition>, bool>
};
}
-shared_ptr<ArchiveDefinition> DecryptVerifyFilesController::pick_archive_definition(GpgME::Protocol proto, const std::vector< shared_ptr<ArchiveDefinition> > &ads, const QString &filename)
+std::shared_ptr<ArchiveDefinition> DecryptVerifyFilesController::pick_archive_definition(GpgME::Protocol proto, const std::vector< std::shared_ptr<ArchiveDefinition> > &ads, const QString &filename)
{
const QFileInfo fi(outputFileName(filename));
QString extension = fi.completeSuffix();
if (extension == QLatin1String("out")) { // added by outputFileName() -> useless
- return shared_ptr<ArchiveDefinition>();
+ return std::shared_ptr<ArchiveDefinition>();
}
if (extension.endsWith(QStringLiteral(".out"))) { // added by outputFileName() -> remove
@@ -289,14 +286,14 @@ shared_ptr<ArchiveDefinition> DecryptVerifyFilesController::pick_archive_definit
}
for (;;) {
- const std::vector<shared_ptr<ArchiveDefinition> >::const_iterator it
+ const std::vector<std::shared_ptr<ArchiveDefinition> >::const_iterator it
= std::find_if(ads.begin(), ads.end(), FindExtension(extension, proto));
if (it != ads.end()) {
return *it;
}
const int idx = extension.indexOf(QLatin1Char('.'));
if (idx < 0) {
- return shared_ptr<ArchiveDefinition>();
+ return std::shared_ptr<ArchiveDefinition>();
}
extension = extension.mid(idx + 1);
}
@@ -306,7 +303,7 @@ QStringList DecryptVerifyFilesController::Private::prepareWizardFromPassedFiles(
{
ensureWizardCreated();
- const std::vector< shared_ptr<ArchiveDefinition> > archiveDefinitions = ArchiveDefinition::getArchiveDefinitions();
+ const std::vector< std::shared_ptr<ArchiveDefinition> > archiveDefinitions = ArchiveDefinition::getArchiveDefinitions();
QStringList fileNames;
unsigned int counter = 0;
@@ -385,7 +382,7 @@ QStringList DecryptVerifyFilesController::Private::prepareWizardFromPassedFiles(
return fileNames;
}
-std::vector< shared_ptr<Task> > DecryptVerifyFilesController::Private::buildTasks(const QStringList &fileNames, const shared_ptr<OverwritePolicy> &overwritePolicy)
+std::vector< std::shared_ptr<Task> > DecryptVerifyFilesController::Private::buildTasks(const QStringList &fileNames, const std::shared_ptr<OverwritePolicy> &overwritePolicy)
{
const bool useOutDir = m_wizard->useOutputDirectory();
const QFileInfo outDirInfo(m_wizard->outputDirectory());
@@ -395,7 +392,7 @@ std::vector< shared_ptr<Task> > DecryptVerifyFilesController::Private::buildTask
const QDir outDir(outDirInfo.absoluteFilePath());
kleo_assert(!useOutDir || outDir.exists());
- std::vector<shared_ptr<Task> > tasks;
+ std::vector<std::shared_ptr<Task> > tasks;
for (unsigned int i = 0, end = fileNames.size(); i != end; ++i)
try {
const QDir fileDir = QFileInfo(fileNames[i]).absoluteDir();
@@ -423,7 +420,7 @@ DecryptVerifyFilesController::DecryptVerifyFilesController(QObject *parent) : Co
{
}
-DecryptVerifyFilesController::DecryptVerifyFilesController(const shared_ptr<const ExecutionContext> &ctx, QObject *parent) : Controller(ctx, parent), d(new Private(this))
+DecryptVerifyFilesController::DecryptVerifyFilesController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent) : Controller(ctx, parent), d(new Private(this))
{
}
diff --git a/src/crypto/decryptverifyfilescontroller.h b/src/crypto/decryptverifyfilescontroller.h
index f59679f..dc3de59 100644
--- a/src/crypto/decryptverifyfilescontroller.h
+++ b/src/crypto/decryptverifyfilescontroller.h
@@ -40,8 +40,7 @@
#include <QMetaType>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace GpgME
@@ -59,7 +58,7 @@ class DecryptVerifyFilesController : public Controller
Q_OBJECT
public:
explicit DecryptVerifyFilesController(QObject *parent = Q_NULLPTR);
- explicit DecryptVerifyFilesController(const boost::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
+ explicit DecryptVerifyFilesController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
~DecryptVerifyFilesController();
@@ -72,14 +71,14 @@ public Q_SLOTS:
virtual void cancel();
protected:
- boost::shared_ptr<ArchiveDefinition> pick_archive_definition(GpgME::Protocol proto,
- const std::vector< boost::shared_ptr<ArchiveDefinition> > &ads, const QString &filename);
+ std::shared_ptr<ArchiveDefinition> pick_archive_definition(GpgME::Protocol proto,
+ const std::vector< std::shared_ptr<ArchiveDefinition> > &ads, const QString &filename);
Q_SIGNALS:
virtual void verificationResult(const GpgME::VerificationResult &);
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Task::Result> &) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &) Q_DECL_OVERRIDE;
private:
class Private;
diff --git a/src/crypto/decryptverifytask.cpp b/src/crypto/decryptverifytask.cpp
index 7695677..813848b 100644
--- a/src/crypto/decryptverifytask.cpp
+++ b/src/crypto/decryptverifytask.cpp
@@ -34,11 +34,12 @@
#include "decryptverifytask.h"
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/VerifyOpaqueJob>
-#include <Libkleo/VerifyDetachedJob>
-#include <Libkleo/DecryptJob>
-#include <Libkleo/DecryptVerifyJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/VerifyOpaqueJob>
+#include <QGpgME/VerifyDetachedJob>
+#include <QGpgME/DecryptJob>
+#include <QGpgME/DecryptVerifyJob>
+
#include <Libkleo/Dn>
#include <Libkleo/Exception>
#include <Libkleo/Stl_Util>
@@ -93,7 +94,7 @@ static Error make_error(const gpg_err_code_t code)
static AuditLog auditLogFromSender(QObject *sender)
{
- return AuditLog::fromJob(qobject_cast<const Job *>(sender));
+ return AuditLog::fromJob(qobject_cast<const QGpgME::Job *>(sender));
}
static bool addrspec_equal(const AddrSpec &lhs, const AddrSpec &rhs, Qt::CaseSensitivity cs)
@@ -645,9 +646,9 @@ DecryptVerifyResult::SenderInfo DecryptVerifyResult::Private::makeSenderInfo() c
return SenderInfo(m_informativeSender, KeyCache::instance()->findSigners(m_verificationResult));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResult(const DecryptionResult &dr, const QByteArray &plaintext, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResult(const DecryptionResult &dr, const QByteArray &plaintext, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
Decrypt,
VerificationResult(),
dr,
@@ -660,9 +661,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResult(con
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResult(const GpgME::Error &err, const QString &what, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResult(const GpgME::Error &err, const QString &what, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
Decrypt,
VerificationResult(),
DecryptionResult(err),
@@ -675,9 +676,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResult(con
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResult(const DecryptionResult &dr, const VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResult(const DecryptionResult &dr, const VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
DecryptVerify,
vr,
dr,
@@ -690,9 +691,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResu
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
DecryptVerify,
VerificationResult(),
DecryptionResult(err),
@@ -705,9 +706,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResu
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaqueResult(const VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaqueResult(const VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
Verify,
vr,
DecryptionResult(),
@@ -719,9 +720,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaqueResul
auditLog,
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
Verify,
VerificationResult(err),
DecryptionResult(),
@@ -734,9 +735,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaqueResul
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetachedResult(const VerificationResult &vr, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetachedResult(const VerificationResult &vr, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
Verify,
vr,
DecryptionResult(),
@@ -748,9 +749,9 @@ shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetachedRes
auditLog,
informativeSender()));
}
-shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetachedResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog)
+std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetachedResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog)
{
- return shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
+ return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
Verify,
VerificationResult(err),
DecryptionResult(),
@@ -877,7 +878,7 @@ public:
void slotResult(const DecryptionResult &, const VerificationResult &, const QByteArray &);
- void registerJob(DecryptVerifyJob *job)
+ void registerJob(QGpgME::DecryptVerifyJob *job)
{
q->connect(job, SIGNAL(result(GpgME::DecryptionResult,GpgME::VerificationResult,QByteArray)),
q, SLOT(slotResult(GpgME::DecryptionResult,GpgME::VerificationResult,QByteArray)));
@@ -885,15 +886,15 @@ public:
q, SLOT(setProgress(QString,int,int)));
}
- void emitResult(const shared_ptr<DecryptVerifyResult> &result);
+ void emitResult(const std::shared_ptr<DecryptVerifyResult> &result);
- shared_ptr<Input> m_input;
- shared_ptr<Output> m_output;
- const CryptoBackend::Protocol *m_backend;
+ std::shared_ptr<Input> m_input;
+ std::shared_ptr<Output> m_output;
+ const QGpgME::Protocol *m_backend;
Protocol m_protocol;
};
-void DecryptVerifyTask::Private::emitResult(const shared_ptr<DecryptVerifyResult> &result)
+void DecryptVerifyTask::Private::emitResult(const std::shared_ptr<DecryptVerifyResult> &result)
{
q->emitResult(result);
Q_EMIT q->decryptVerifyResult(result);
@@ -942,13 +943,13 @@ DecryptVerifyTask::~DecryptVerifyTask()
{
}
-void DecryptVerifyTask::setInput(const shared_ptr<Input> &input)
+void DecryptVerifyTask::setInput(const std::shared_ptr<Input> &input)
{
d->m_input = input;
kleo_assert(d->m_input && d->m_input->ioDevice());
}
-void DecryptVerifyTask::setOutput(const shared_ptr<Output> &output)
+void DecryptVerifyTask::setOutput(const std::shared_ptr<Output> &output)
{
d->m_output = output;
kleo_assert(d->m_output && d->m_output->ioDevice());
@@ -958,7 +959,7 @@ void DecryptVerifyTask::setProtocol(Protocol prot)
{
kleo_assert(prot != UnknownProtocol);
d->m_protocol = prot;
- d->m_backend = CryptoBackendFactory::instance()->protocol(prot);
+ d->m_backend = prot == GpgME::OpenPGP ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(d->m_backend);
}
@@ -1008,7 +1009,7 @@ void DecryptVerifyTask::doStart()
{
kleo_assert(d->m_backend);
try {
- DecryptVerifyJob *const job = d->m_backend->decryptVerifyJob();
+ QGpgME::DecryptVerifyJob *const job = d->m_backend->decryptVerifyJob();
kleo_assert(job);
d->registerJob(job);
job->start(d->m_input->ioDevice(), d->m_output->ioDevice());
@@ -1030,7 +1031,7 @@ public:
void slotResult(const DecryptionResult &, const QByteArray &);
- void registerJob(DecryptJob *job)
+ void registerJob(QGpgME::DecryptJob *job)
{
q->connect(job, SIGNAL(result(GpgME::DecryptionResult,QByteArray)),
q, SLOT(slotResult(GpgME::DecryptionResult,QByteArray)));
@@ -1038,15 +1039,15 @@ public:
q, SLOT(setProgress(QString,int,int)));
}
- void emitResult(const shared_ptr<DecryptVerifyResult> &result);
+ void emitResult(const std::shared_ptr<DecryptVerifyResult> &result);
- shared_ptr<Input> m_input;
- shared_ptr<Output> m_output;
- const CryptoBackend::Protocol *m_backend;
+ std::shared_ptr<Input> m_input;
+ std::shared_ptr<Output> m_output;
+ const QGpgME::Protocol *m_backend;
Protocol m_protocol;
};
-void DecryptTask::Private::emitResult(const shared_ptr<DecryptVerifyResult> &result)
+void DecryptTask::Private::emitResult(const std::shared_ptr<DecryptVerifyResult> &result)
{
q->emitResult(result);
Q_EMIT q->decryptVerifyResult(result);
@@ -1096,13 +1097,13 @@ DecryptTask::~DecryptTask()
{
}
-void DecryptTask::setInput(const shared_ptr<Input> &input)
+void DecryptTask::setInput(const std::shared_ptr<Input> &input)
{
d->m_input = input;
kleo_assert(d->m_input && d->m_input->ioDevice());
}
-void DecryptTask::setOutput(const shared_ptr<Output> &output)
+void DecryptTask::setOutput(const std::shared_ptr<Output> &output)
{
d->m_output = output;
kleo_assert(d->m_output && d->m_output->ioDevice());
@@ -1112,7 +1113,7 @@ void DecryptTask::setProtocol(Protocol prot)
{
kleo_assert(prot != UnknownProtocol);
d->m_protocol = prot;
- d->m_backend = CryptoBackendFactory::instance()->protocol(prot);
+ d->m_backend = (prot == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(d->m_backend);
}
@@ -1164,7 +1165,7 @@ void DecryptTask::doStart()
kleo_assert(d->m_backend);
try {
- DecryptJob *const job = d->m_backend->decryptJob();
+ QGpgME::DecryptJob *const job = d->m_backend->decryptJob();
kleo_assert(job);
d->registerJob(job);
job->start(d->m_input->ioDevice(), d->m_output->ioDevice());
@@ -1185,7 +1186,7 @@ public:
void slotResult(const VerificationResult &, const QByteArray &);
- void registerJob(VerifyOpaqueJob *job)
+ void registerJob(QGpgME::VerifyOpaqueJob *job)
{
q->connect(job, SIGNAL(result(GpgME::VerificationResult,QByteArray)),
q, SLOT(slotResult(GpgME::VerificationResult,QByteArray)));
@@ -1193,15 +1194,15 @@ public:
q, SLOT(setProgress(QString,int,int)));
}
- void emitResult(const shared_ptr<DecryptVerifyResult> &result);
+ void emitResult(const std::shared_ptr<DecryptVerifyResult> &result);
- shared_ptr<Input> m_input;
- shared_ptr<Output> m_output;
- const CryptoBackend::Protocol *m_backend;
+ std::shared_ptr<Input> m_input;
+ std::shared_ptr<Output> m_output;
+ const QGpgME::Protocol *m_backend;
Protocol m_protocol;
};
-void VerifyOpaqueTask::Private::emitResult(const shared_ptr<DecryptVerifyResult> &result)
+void VerifyOpaqueTask::Private::emitResult(const std::shared_ptr<DecryptVerifyResult> &result)
{
q->emitResult(result);
Q_EMIT q->decryptVerifyResult(result);
@@ -1251,13 +1252,13 @@ VerifyOpaqueTask::~VerifyOpaqueTask()
{
}
-void VerifyOpaqueTask::setInput(const shared_ptr<Input> &input)
+void VerifyOpaqueTask::setInput(const std::shared_ptr<Input> &input)
{
d->m_input = input;
kleo_assert(d->m_input && d->m_input->ioDevice());
}
-void VerifyOpaqueTask::setOutput(const shared_ptr<Output> &output)
+void VerifyOpaqueTask::setOutput(const std::shared_ptr<Output> &output)
{
d->m_output = output;
kleo_assert(d->m_output && d->m_output->ioDevice());
@@ -1267,7 +1268,7 @@ void VerifyOpaqueTask::setProtocol(Protocol prot)
{
kleo_assert(prot != UnknownProtocol);
d->m_protocol = prot;
- d->m_backend = CryptoBackendFactory::instance()->protocol(prot);
+ d->m_backend = (prot == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(d->m_backend);
}
@@ -1318,10 +1319,10 @@ void VerifyOpaqueTask::doStart()
kleo_assert(d->m_backend);
try {
- VerifyOpaqueJob *const job = d->m_backend->verifyOpaqueJob();
+ QGpgME::VerifyOpaqueJob *const job = d->m_backend->verifyOpaqueJob();
kleo_assert(job);
d->registerJob(job);
- job->start(d->m_input->ioDevice(), d->m_output ? d->m_output->ioDevice() : shared_ptr<QIODevice>());
+ job->start(d->m_input->ioDevice(), d->m_output ? d->m_output->ioDevice() : std::shared_ptr<QIODevice>());
} catch (const GpgME::Exception &e) {
d->emitResult(fromVerifyOpaqueResult(e.error(), QString::fromLocal8Bit(e.what()), AuditLog()));
} catch (const std::exception &e) {
@@ -1339,7 +1340,7 @@ public:
void slotResult(const VerificationResult &);
- void registerJob(VerifyDetachedJob *job)
+ void registerJob(QGpgME::VerifyDetachedJob *job)
{
q->connect(job, SIGNAL(result(GpgME::VerificationResult)),
q, SLOT(slotResult(GpgME::VerificationResult)));
@@ -1347,14 +1348,14 @@ public:
q, SLOT(setProgress(QString,int,int)));
}
- void emitResult(const shared_ptr<DecryptVerifyResult> &result);
+ void emitResult(const std::shared_ptr<DecryptVerifyResult> &result);
- shared_ptr<Input> m_input, m_signedData;
- const CryptoBackend::Protocol *m_backend;
+ std::shared_ptr<Input> m_input, m_signedData;
+ const QGpgME::Protocol *m_backend;
Protocol m_protocol;
};
-void VerifyDetachedTask::Private::emitResult(const shared_ptr<DecryptVerifyResult> &result)
+void VerifyDetachedTask::Private::emitResult(const std::shared_ptr<DecryptVerifyResult> &result)
{
q->emitResult(result);
Q_EMIT q->decryptVerifyResult(result);
@@ -1388,13 +1389,13 @@ VerifyDetachedTask::~VerifyDetachedTask()
{
}
-void VerifyDetachedTask::setInput(const shared_ptr<Input> &input)
+void VerifyDetachedTask::setInput(const std::shared_ptr<Input> &input)
{
d->m_input = input;
kleo_assert(d->m_input && d->m_input->ioDevice());
}
-void VerifyDetachedTask::setSignedData(const shared_ptr<Input> &signedData)
+void VerifyDetachedTask::setSignedData(const std::shared_ptr<Input> &signedData)
{
d->m_signedData = signedData;
kleo_assert(d->m_signedData && d->m_signedData->ioDevice());
@@ -1404,7 +1405,7 @@ void VerifyDetachedTask::setProtocol(Protocol prot)
{
kleo_assert(prot != UnknownProtocol);
d->m_protocol = prot;
- d->m_backend = CryptoBackendFactory::instance()->protocol(prot);
+ d->m_backend = (prot == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(d->m_backend);
}
@@ -1471,7 +1472,7 @@ void VerifyDetachedTask::doStart()
{
kleo_assert(d->m_backend);
try {
- VerifyDetachedJob *const job = d->m_backend->verifyDetachedJob();
+ QGpgME::VerifyDetachedJob *const job = d->m_backend->verifyDetachedJob();
kleo_assert(job);
d->registerJob(job);
job->start(d->m_input->ioDevice(), d->m_signedData->ioDevice());
diff --git a/src/crypto/decryptverifytask.h b/src/crypto/decryptverifytask.h
index 800b7ac..b98ffc3 100644
--- a/src/crypto/decryptverifytask.h
+++ b/src/crypto/decryptverifytask.h
@@ -39,7 +39,7 @@
#include <gpgme++/verificationresult.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace KMime
{
@@ -82,17 +82,17 @@ public:
void setInformativeSender(const KMime::Types::Mailbox &senders);
Q_SIGNALS:
- void decryptVerifyResult(const boost::shared_ptr<const Kleo::Crypto::DecryptVerifyResult> &);
+ void decryptVerifyResult(const std::shared_ptr<const Kleo::Crypto::DecryptVerifyResult> &);
protected:
- boost::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::DecryptionResult &dr, const QByteArray &plaintext, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::DecryptionResult &dr, const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::Error &err, const QString &what, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromVerifyDetachedResult(const GpgME::VerificationResult &vr, const AuditLog &auditLog);
- boost::shared_ptr<DecryptVerifyResult> fromVerifyDetachedResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::DecryptionResult &dr, const QByteArray &plaintext, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::DecryptionResult &dr, const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::Error &err, const QString &what, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromVerifyDetachedResult(const GpgME::VerificationResult &vr, const AuditLog &auditLog);
+ std::shared_ptr<DecryptVerifyResult> fromVerifyDetachedResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
virtual QString inputLabel() const = 0;
virtual QString outputLabel() const = 0;
@@ -109,8 +109,8 @@ public:
explicit DecryptTask(QObject *parent = Q_NULLPTR);
~DecryptTask();
- void setInput(const boost::shared_ptr<Input> &input);
- void setOutput(const boost::shared_ptr<Output> &output);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setOutput(const std::shared_ptr<Output> &output);
void setProtocol(GpgME::Protocol prot);
void autodetectProtocolFromInput() Q_DECL_OVERRIDE;
@@ -141,8 +141,8 @@ public:
explicit VerifyDetachedTask(QObject *parent = Q_NULLPTR);
~VerifyDetachedTask();
- void setInput(const boost::shared_ptr<Input> &input);
- void setSignedData(const boost::shared_ptr<Input> &signedData);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setSignedData(const std::shared_ptr<Input> &signedData);
void setProtocol(GpgME::Protocol prot);
void autodetectProtocolFromInput() Q_DECL_OVERRIDE;
@@ -173,8 +173,8 @@ public:
explicit VerifyOpaqueTask(QObject *parent = Q_NULLPTR);
~VerifyOpaqueTask();
- void setInput(const boost::shared_ptr<Input> &input);
- void setOutput(const boost::shared_ptr<Output> &output);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setOutput(const std::shared_ptr<Output> &output);
void setProtocol(GpgME::Protocol prot);
void autodetectProtocolFromInput()Q_DECL_OVERRIDE;
@@ -204,9 +204,9 @@ public:
explicit DecryptVerifyTask(QObject *parent = Q_NULLPTR);
~DecryptVerifyTask();
- void setInput(const boost::shared_ptr<Input> &input);
- void setSignedData(const boost::shared_ptr<Input> &signedData);
- void setOutput(const boost::shared_ptr<Output> &output);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setSignedData(const std::shared_ptr<Input> &signedData);
+ void setOutput(const std::shared_ptr<Output> &output);
void setProtocol(GpgME::Protocol prot);
void autodetectProtocolFromInput() Q_DECL_OVERRIDE;
diff --git a/src/crypto/encryptemailcontroller.cpp b/src/crypto/encryptemailcontroller.cpp
index 85f86be..d52b5f4 100644
--- a/src/crypto/encryptemailcontroller.cpp
+++ b/src/crypto/encryptemailcontroller.cpp
@@ -57,13 +57,9 @@
#include <QPointer>
#include <QTimer>
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
using namespace GpgME;
using namespace KMime::Types;
@@ -84,12 +80,12 @@ private:
void cancelAllTasks();
void schedule();
- shared_ptr<EncryptEMailTask> takeRunnable(GpgME::Protocol proto);
+ std::shared_ptr<EncryptEMailTask> takeRunnable(GpgME::Protocol proto);
private:
const Mode mode;
- std::vector< shared_ptr<EncryptEMailTask> > runnable, completed;
- shared_ptr<EncryptEMailTask> cms, openpgp;
+ std::vector< std::shared_ptr<EncryptEMailTask> > runnable, completed;
+ std::shared_ptr<EncryptEMailTask> cms, openpgp;
mutable QPointer<EncryptEMailWizard> wizard;
};
@@ -104,7 +100,7 @@ EncryptEMailController::Private::Private(Mode m, EncryptEMailController *qq)
}
-EncryptEMailController::EncryptEMailController(const shared_ptr<ExecutionContext> &xc, Mode mode, QObject *p)
+EncryptEMailController::EncryptEMailController(const std::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *p)
: Controller(xc, p), d(new Private(mode, this))
{
@@ -179,18 +175,18 @@ void EncryptEMailController::Private::slotWizardCanceled()
q->emitDoneOrError();
}
-void EncryptEMailController::setInputAndOutput(const shared_ptr<Input> &input, const shared_ptr<Output> &output)
+void EncryptEMailController::setInputAndOutput(const std::shared_ptr<Input> &input, const std::shared_ptr<Output> &output)
{
- setInputsAndOutputs(std::vector< shared_ptr<Input> >(1, input), std::vector< shared_ptr<Output> >(1, output));
+ setInputsAndOutputs(std::vector< std::shared_ptr<Input> >(1, input), std::vector< std::shared_ptr<Output> >(1, output));
}
-void EncryptEMailController::setInputsAndOutputs(const std::vector< shared_ptr<Input> > &inputs, const std::vector< shared_ptr<Output> > &outputs)
+void EncryptEMailController::setInputsAndOutputs(const std::vector< std::shared_ptr<Input> > &inputs, const std::vector< std::shared_ptr<Output> > &outputs)
{
kleo_assert(!inputs.empty());
kleo_assert(outputs.size() == inputs.size());
- std::vector< shared_ptr<EncryptEMailTask> > tasks;
+ std::vector< std::shared_ptr<EncryptEMailTask> > tasks;
tasks.reserve(inputs.size());
d->ensureWizardCreated();
@@ -200,7 +196,7 @@ void EncryptEMailController::setInputsAndOutputs(const std::vector< shared_ptr<I
for (unsigned int i = 0, end = inputs.size(); i < end; ++i) {
- const shared_ptr<EncryptEMailTask> task(new EncryptEMailTask);
+ const std::shared_ptr<EncryptEMailTask> task(new EncryptEMailTask);
task->setInput(inputs[i]);
task->setOutput(outputs[i]);
if (d->mode == ClipboardMode) {
@@ -216,13 +212,13 @@ void EncryptEMailController::setInputsAndOutputs(const std::vector< shared_ptr<I
void EncryptEMailController::start()
{
- shared_ptr<TaskCollection> coll(new TaskCollection);
- std::vector<shared_ptr<Task> > tmp;
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ std::vector<std::shared_ptr<Task> > tmp;
std::copy(d->runnable.begin(), d->runnable.end(), std::back_inserter(tmp));
coll->setTasks(tmp);
d->ensureWizardCreated();
d->wizard->setTaskCollection(coll);
- Q_FOREACH (const shared_ptr<Task> &t, tmp) {
+ Q_FOREACH (const std::shared_ptr<Task> &t, tmp) {
connectTask(t);
}
d->schedule();
@@ -232,13 +228,13 @@ void EncryptEMailController::Private::schedule()
{
if (!cms)
- if (const shared_ptr<EncryptEMailTask> t = takeRunnable(CMS)) {
+ if (const std::shared_ptr<EncryptEMailTask> t = takeRunnable(CMS)) {
t->start();
cms = t;
}
if (!openpgp)
- if (const shared_ptr<EncryptEMailTask> t = takeRunnable(OpenPGP)) {
+ if (const std::shared_ptr<EncryptEMailTask> t = takeRunnable(OpenPGP)) {
t->start();
openpgp = t;
}
@@ -250,21 +246,22 @@ void EncryptEMailController::Private::schedule()
q->emitDoneOrError();
}
-shared_ptr<EncryptEMailTask> EncryptEMailController::Private::takeRunnable(GpgME::Protocol proto)
+std::shared_ptr<EncryptEMailTask> EncryptEMailController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< shared_ptr<EncryptEMailTask> >::iterator it
- = std::find_if(runnable.begin(), runnable.end(),
- boost::bind(&Task::protocol, _1) == proto);
+ const auto it = std::find_if(runnable.begin(), runnable.end(),
+ [proto](const std::shared_ptr<Kleo::Crypto::EncryptEMailTask> &task) {
+ return task->protocol() == proto;
+ });
if (it == runnable.end()) {
- return shared_ptr<EncryptEMailTask>();
+ return std::shared_ptr<EncryptEMailTask>();
}
- const shared_ptr<EncryptEMailTask> result = *it;
+ const std::shared_ptr<EncryptEMailTask> result = *it;
runnable.erase(it);
return result;
}
-void EncryptEMailController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void EncryptEMailController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
Q_UNUSED(result);
assert(task);
diff --git a/src/crypto/encryptemailcontroller.h b/src/crypto/encryptemailcontroller.h
index 25c90d7..2e09b90 100644
--- a/src/crypto/encryptemailcontroller.h
+++ b/src/crypto/encryptemailcontroller.h
@@ -39,6 +39,7 @@
#include <gpgme++/global.h>
+#include <memory>
#include <vector>
namespace KMime
@@ -49,11 +50,6 @@ class Mailbox;
}
}
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
@@ -75,7 +71,7 @@ public:
};
explicit EncryptEMailController(Mode mode, QObject *parent = Q_NULLPTR);
- explicit EncryptEMailController(const boost::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *parent = Q_NULLPTR);
+ explicit EncryptEMailController(const std::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *parent = Q_NULLPTR);
~EncryptEMailController();
Mode mode() const;
@@ -92,10 +88,10 @@ public:
void startResolveRecipients();
void startResolveRecipients(const std::vector<KMime::Types::Mailbox> &recipients, const std::vector<KMime::Types::Mailbox> &senders);
- void setInputAndOutput(const boost::shared_ptr<Kleo::Input> &input,
- const boost::shared_ptr<Kleo::Output> &output);
- void setInputsAndOutputs(const std::vector< boost::shared_ptr<Kleo::Input> > &inputs,
- const std::vector< boost::shared_ptr<Kleo::Output> > &outputs);
+ void setInputAndOutput(const std::shared_ptr<Kleo::Input> &input,
+ const std::shared_ptr<Kleo::Output> &output);
+ void setInputsAndOutputs(const std::vector< std::shared_ptr<Kleo::Input> > &inputs,
+ const std::vector< std::shared_ptr<Kleo::Output> > &outputs);
void start();
@@ -107,7 +103,7 @@ Q_SIGNALS:
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Kleo::Crypto::Task::Result> &) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Kleo::Crypto::Task::Result> &) Q_DECL_OVERRIDE;
class Private;
kdtools::pimpl_ptr<Private> d;
diff --git a/src/crypto/encryptemailtask.cpp b/src/crypto/encryptemailtask.cpp
index 314fb4e..72dac33 100644
--- a/src/crypto/encryptemailtask.cpp
+++ b/src/crypto/encryptemailtask.cpp
@@ -40,9 +40,8 @@
#include <utils/auditlog.h>
#include <Libkleo/Stl_Util>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/EncryptJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/EncryptJob>
#include <gpgme++/encryptionresult.h>
#include <gpgme++/key.h>
@@ -52,11 +51,8 @@
#include <QPointer>
#include <QTextDocument> // for Qt::escape
-#include <boost/bind.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
using namespace GpgME;
namespace
@@ -103,17 +99,17 @@ public:
explicit Private(EncryptEMailTask *qq);
private:
- std::unique_ptr<Kleo::EncryptJob> createJob(GpgME::Protocol proto);
+ std::unique_ptr<QGpgME::EncryptJob> createJob(GpgME::Protocol proto);
private:
void slotResult(const EncryptionResult &);
private:
- shared_ptr<Input> input;
- shared_ptr<Output> output;
+ std::shared_ptr<Input> input;
+ std::shared_ptr<Output> output;
std::vector<Key> recipients;
- QPointer<Kleo::EncryptJob> job;
+ QPointer<QGpgME::EncryptJob> job;
};
EncryptEMailTask::Private::Private(EncryptEMailTask *qq)
@@ -133,14 +129,14 @@ EncryptEMailTask::EncryptEMailTask(QObject *p)
EncryptEMailTask::~EncryptEMailTask() {}
-void EncryptEMailTask::setInput(const shared_ptr<Input> &input)
+void EncryptEMailTask::setInput(const std::shared_ptr<Input> &input)
{
kleo_assert(!d->job);
kleo_assert(input);
d->input = input;
}
-void EncryptEMailTask::setOutput(const shared_ptr<Output> &output)
+void EncryptEMailTask::setOutput(const std::shared_ptr<Output> &output)
{
kleo_assert(!d->job);
kleo_assert(output);
@@ -177,7 +173,7 @@ void EncryptEMailTask::doStart()
kleo_assert(d->output);
kleo_assert(!d->recipients.empty());
- std::unique_ptr<Kleo::EncryptJob> job = d->createJob(protocol());
+ std::unique_ptr<QGpgME::EncryptJob> job = d->createJob(protocol());
kleo_assert(job.get());
job->start(d->recipients,
@@ -194,12 +190,12 @@ void EncryptEMailTask::cancel()
}
}
-std::unique_ptr<Kleo::EncryptJob> EncryptEMailTask::Private::createJob(GpgME::Protocol proto)
+std::unique_ptr<QGpgME::EncryptJob> EncryptEMailTask::Private::createJob(GpgME::Protocol proto)
{
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(proto);
+ const QGpgME::Protocol *const backend = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(backend);
bool shouldArmor = (proto == OpenPGP || q->asciiArmor()) && !output->binaryOpt();
- std::unique_ptr<Kleo::EncryptJob> encryptJob(backend->encryptJob(shouldArmor, /*textmode=*/false));
+ std::unique_ptr<QGpgME::EncryptJob> encryptJob(backend->encryptJob(shouldArmor, /*textmode=*/false));
kleo_assert(encryptJob.get());
if (proto == CMS && !q->asciiArmor() && !output->binaryOpt()) {
encryptJob->setOutputIsBase64Encoded(true);
@@ -213,13 +209,13 @@ std::unique_ptr<Kleo::EncryptJob> EncryptEMailTask::Private::createJob(GpgME::Pr
void EncryptEMailTask::Private::slotResult(const EncryptionResult &result)
{
- const Job *const job = qobject_cast<const Job *>(q->sender());
+ const QGpgME::Job *const job = qobject_cast<const QGpgME::Job *>(q->sender());
if (result.error().code()) {
output->cancel();
} else {
output->finalize();
}
- q->emitResult(shared_ptr<Result>(new EncryptEMailResult(result, AuditLog::fromJob(job))));
+ q->emitResult(std::shared_ptr<Result>(new EncryptEMailResult(result, AuditLog::fromJob(job))));
}
QString EncryptEMailResult::overview() const
diff --git a/src/crypto/encryptemailtask.h b/src/crypto/encryptemailtask.h
index c06ef81..f769166 100644
--- a/src/crypto/encryptemailtask.h
+++ b/src/crypto/encryptemailtask.h
@@ -39,8 +39,6 @@
#include <gpgme++/global.h>
-#include <boost/shared_ptr.hpp>
-
#include <vector>
namespace GpgME
@@ -66,8 +64,8 @@ public:
explicit EncryptEMailTask(QObject *parent = Q_NULLPTR);
~EncryptEMailTask();
- void setInput(const boost::shared_ptr<Input> &input);
- void setOutput(const boost::shared_ptr<Output> &output);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setOutput(const std::shared_ptr<Output> &output);
void setRecipients(const std::vector<GpgME::Key> &recipients);
GpgME::Protocol protocol() const Q_DECL_OVERRIDE;
diff --git a/src/crypto/gui/decryptverifyfilesdialog.cpp b/src/crypto/gui/decryptverifyfilesdialog.cpp
index 658f562..37fbf41 100644
--- a/src/crypto/gui/decryptverifyfilesdialog.cpp
+++ b/src/crypto/gui/decryptverifyfilesdialog.cpp
@@ -48,7 +48,7 @@
#include <QPushButton>
#include <vector>
-#include <boost/shared_ptr.hpp>
+#include <cassert>
#include <KLocalizedString>
#include <KMessageBox>
@@ -59,7 +59,7 @@ using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-DecryptVerifyFilesDialog::DecryptVerifyFilesDialog(const boost::shared_ptr<TaskCollection> &coll, QWidget *parent)
+DecryptVerifyFilesDialog::DecryptVerifyFilesDialog(const std::shared_ptr<TaskCollection> &coll, QWidget *parent)
: QDialog(parent), m_tasks(coll), m_saveButton(QDialogButtonBox::NoButton), m_buttonBox(new QDialogButtonBox)
{
readConfig();
@@ -97,7 +97,7 @@ DecryptVerifyFilesDialog::DecryptVerifyFilesDialog(const boost::shared_ptr<TaskC
layout()->addWidget(m_buttonBox);
bool hasOutputs = false;
- Q_FOREACH (const boost::shared_ptr<Task> t, coll->tasks()) {
+ Q_FOREACH (const std::shared_ptr<Task> t, coll->tasks()) {
if (!qobject_cast<VerifyDetachedTask *>(t.get())) {
hasOutputs = true;
break;
@@ -149,7 +149,7 @@ void DecryptVerifyFilesDialog::allDone()
}
}
-void DecryptVerifyFilesDialog::started(const boost::shared_ptr<Task> &task)
+void DecryptVerifyFilesDialog::started(const std::shared_ptr<Task> &task)
{
Q_ASSERT(task);
const auto tag = task->tag();
diff --git a/src/crypto/gui/decryptverifyfilesdialog.h b/src/crypto/gui/decryptverifyfilesdialog.h
index 087e45b..df8f05c 100644
--- a/src/crypto/gui/decryptverifyfilesdialog.h
+++ b/src/crypto/gui/decryptverifyfilesdialog.h
@@ -32,8 +32,6 @@
#ifndef CRYPTO_GUI_DECRYPTVERIFYFILESDIALOG_H
#define CRYPTO_GUI_DECRYPTVERIFYFILESDIALOG_H
-#include <boost/shared_ptr.hpp>
-
#include <QDialog>
#include <QString>
#include <QDialogButtonBox>
@@ -60,7 +58,7 @@ class DecryptVerifyFilesDialog : public QDialog
{
Q_OBJECT
public:
- explicit DecryptVerifyFilesDialog(const boost::shared_ptr<TaskCollection> &coll,
+ explicit DecryptVerifyFilesDialog(const std::shared_ptr<TaskCollection> &coll,
QWidget *parent = Q_NULLPTR);
~DecryptVerifyFilesDialog();
@@ -69,7 +67,7 @@ public:
protected Q_SLOTS:
void progress(const QString &msg, int progress, int total);
- void started(const boost::shared_ptr<Task> &result);
+ void started(const std::shared_ptr<Task> &result);
void allDone();
void btnClicked(QAbstractButton *btn);
void checkAccept();
@@ -82,7 +80,7 @@ protected:
QLabel *labelForTag(const QString &tag);
private:
- boost::shared_ptr<TaskCollection> m_tasks;
+ std::shared_ptr<TaskCollection> m_tasks;
QProgressBar *m_progressBar;
QHash<QString, QLabel *> m_progressLabelByTag;
QVBoxLayout *m_progressLabelLayout;
diff --git a/src/crypto/gui/decryptverifyfileswizard.cpp b/src/crypto/gui/decryptverifyfileswizard.cpp
index 3a5f25a..d2d732c 100644
--- a/src/crypto/gui/decryptverifyfileswizard.cpp
+++ b/src/crypto/gui/decryptverifyfileswizard.cpp
@@ -57,15 +57,12 @@
#include <QTimer>
#include <QTreeView>
-#include <boost/bind.hpp>
-
#include <vector>
#include <cassert>
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
namespace
{
@@ -185,7 +182,7 @@ void DecryptVerifyFilesWizard::onNext(int id)
Wizard::onNext(id);
}
-void DecryptVerifyFilesWizard::setTaskCollection(const shared_ptr<TaskCollection> &coll)
+void DecryptVerifyFilesWizard::setTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
kleo_assert(coll);
d->resultPage.setTaskCollection(coll);
diff --git a/src/crypto/gui/decryptverifyfileswizard.h b/src/crypto/gui/decryptverifyfileswizard.h
index f5df5ad..29b81cf 100644
--- a/src/crypto/gui/decryptverifyfileswizard.h
+++ b/src/crypto/gui/decryptverifyfileswizard.h
@@ -37,7 +37,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace Kleo
{
@@ -66,7 +66,7 @@ public:
QString outputDirectory() const;
bool useOutputDirectory() const;
- void setTaskCollection(const boost::shared_ptr<TaskCollection> &coll);
+ void setTaskCollection(const std::shared_ptr<TaskCollection> &coll);
DecryptVerifyOperationWidget *operationWidget(unsigned int idx);
diff --git a/src/crypto/gui/decryptverifyoperationwidget.cpp b/src/crypto/gui/decryptverifyoperationwidget.cpp
index 6e54c2d..9683b5a 100644
--- a/src/crypto/gui/decryptverifyoperationwidget.cpp
+++ b/src/crypto/gui/decryptverifyoperationwidget.cpp
@@ -45,11 +45,8 @@
#include <QStackedLayout>
#include <QComboBox>
-#include <boost/shared_ptr.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
class DecryptVerifyOperationWidget::Private
{
@@ -167,20 +164,20 @@ DecryptVerifyOperationWidget::DecryptVerifyOperationWidget(QWidget *p)
DecryptVerifyOperationWidget::~DecryptVerifyOperationWidget() {}
-void DecryptVerifyOperationWidget::setArchiveDefinitions(const std::vector< shared_ptr<ArchiveDefinition> > &archiveDefinitions)
+void DecryptVerifyOperationWidget::setArchiveDefinitions(const std::vector< std::shared_ptr<ArchiveDefinition> > &archiveDefinitions)
{
d->ui.archivesCB.clear();
- Q_FOREACH (const shared_ptr<ArchiveDefinition> &ad, archiveDefinitions) {
+ Q_FOREACH (const std::shared_ptr<ArchiveDefinition> &ad, archiveDefinitions) {
d->ui.archivesCB.addItem(ad->label(), qVariantFromValue(ad));
}
}
void DecryptVerifyOperationWidget::setMode(Mode mode)
{
- setMode(mode, shared_ptr<ArchiveDefinition>());
+ setMode(mode, std::shared_ptr<ArchiveDefinition>());
}
-void DecryptVerifyOperationWidget::setMode(Mode mode, const shared_ptr<ArchiveDefinition> &ad)
+void DecryptVerifyOperationWidget::setMode(Mode mode, const std::shared_ptr<ArchiveDefinition> &ad)
{
d->ui.verifyDetachedCB.setChecked(mode != DecryptVerifyOpaque);
@@ -202,7 +199,7 @@ void DecryptVerifyOperationWidget::setMode(Mode mode, const shared_ptr<ArchiveDe
d->ui.archiveCB.setChecked(ad.get() != 0);
for (int i = 0, end = d->ui.archivesCB.count(); i != end; ++i)
- if (ad == d->ui.archivesCB.itemData(i).value< shared_ptr<ArchiveDefinition> >()) {
+ if (ad == d->ui.archivesCB.itemData(i).value< std::shared_ptr<ArchiveDefinition> >()) {
d->ui.archivesCB.setCurrentIndex(i);
return;
}
@@ -251,12 +248,12 @@ QString DecryptVerifyOperationWidget::signedDataFileName() const
}
}
-shared_ptr<ArchiveDefinition> DecryptVerifyOperationWidget::selectedArchiveDefinition() const
+std::shared_ptr<ArchiveDefinition> DecryptVerifyOperationWidget::selectedArchiveDefinition() const
{
if (mode() == DecryptVerifyOpaque && d->ui.archiveCB.isChecked()) {
- return d->ui.archivesCB.itemData(d->ui.archivesCB.currentIndex()).value< shared_ptr<ArchiveDefinition> >();
+ return d->ui.archivesCB.itemData(d->ui.archivesCB.currentIndex()).value< std::shared_ptr<ArchiveDefinition> >();
} else {
- return shared_ptr<ArchiveDefinition>();
+ return std::shared_ptr<ArchiveDefinition>();
}
}
diff --git a/src/crypto/gui/decryptverifyoperationwidget.h b/src/crypto/gui/decryptverifyoperationwidget.h
index 5f8c26f..944a8d9 100644
--- a/src/crypto/gui/decryptverifyoperationwidget.h
+++ b/src/crypto/gui/decryptverifyoperationwidget.h
@@ -37,6 +37,7 @@
#include <utils/pimpl_ptr.h>
+#include <memory>
#include <vector>
namespace Kleo
@@ -44,12 +45,6 @@ namespace Kleo
class ArchiveDefinition;
}
-namespace boost
-{
-template <typename T>
-class shared_ptr;
-}
-
namespace Kleo
{
namespace Crypto
@@ -73,7 +68,7 @@ public:
VerifyDetachedWithSignedData,
DecryptVerifyOpaque
};
- void setMode(Mode mode, const boost::shared_ptr<ArchiveDefinition> &ad);
+ void setMode(Mode mode, const std::shared_ptr<ArchiveDefinition> &ad);
void setMode(Mode mode);
Mode mode() const;
@@ -83,8 +78,8 @@ public:
void setSignedDataFileName(const QString &name);
QString signedDataFileName() const;
- void setArchiveDefinitions(const std::vector< boost::shared_ptr<ArchiveDefinition> > &ads);
- boost::shared_ptr<ArchiveDefinition> selectedArchiveDefinition() const;
+ void setArchiveDefinitions(const std::vector< std::shared_ptr<ArchiveDefinition> > &ads);
+ std::shared_ptr<ArchiveDefinition> selectedArchiveDefinition() const;
private:
class Private;
diff --git a/src/crypto/gui/newresultpage.cpp b/src/crypto/gui/newresultpage.cpp
index 9a6a03d..a5d0fb8 100644
--- a/src/crypto/gui/newresultpage.cpp
+++ b/src/crypto/gui/newresultpage.cpp
@@ -68,12 +68,12 @@ public:
explicit Private(NewResultPage *qq);
void progress(const QString &msg, int progress, int total);
- void result(const shared_ptr<const Task::Result> &result);
- void started(const shared_ptr<Task> &result);
+ void result(const std::shared_ptr<const Task::Result> &result);
+ void started(const std::shared_ptr<Task> &result);
void allDone();
QLabel *labelForTag(const QString &tag);
- std::vector< shared_ptr<TaskCollection> > m_collections;
+ std::vector< std::shared_ptr<TaskCollection> > m_collections;
QTimer m_hideProgressTimer;
QProgressBar *m_progressBar;
QHash<QString, QLabel *> m_progressLabelByTag;
@@ -132,11 +132,11 @@ void NewResultPage::Private::allDone()
m_hideProgressTimer.start();
}
-void NewResultPage::Private::result(const shared_ptr<const Task::Result> &)
+void NewResultPage::Private::result(const std::shared_ptr<const Task::Result> &)
{
}
-void NewResultPage::Private::started(const shared_ptr<Task> &task)
+void NewResultPage::Private::started(const std::shared_ptr<Task> &task)
{
assert(task);
const QString tag = task->tag();
@@ -158,13 +158,13 @@ NewResultPage::~NewResultPage()
{
}
-void NewResultPage::setTaskCollection(const shared_ptr<TaskCollection> &coll)
+void NewResultPage::setTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
//clear(); ### PENDING(marc) implement
addTaskCollection(coll);
}
-void NewResultPage::addTaskCollection(const shared_ptr<TaskCollection> &coll)
+void NewResultPage::addTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
assert(coll);
if (kdtools::contains(d->m_collections, coll)) {
@@ -178,12 +178,12 @@ void NewResultPage::addTaskCollection(const shared_ptr<TaskCollection> &coll)
this, SLOT(progress(QString,int,int)));
connect(coll.get(), SIGNAL(done()),
this, SLOT(allDone()));
- connect(coll.get(), SIGNAL(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)),
- this, SLOT(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)));
- connect(coll.get(), SIGNAL(started(boost::shared_ptr<Kleo::Crypto::Task>)),
- this, SLOT(started(boost::shared_ptr<Kleo::Crypto::Task>)));
+ connect(coll.get(), SIGNAL(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(coll.get(), SIGNAL(started(boost::std::shared_ptr<Kleo::Crypto::Task>)),
+ this, SLOT(started(boost::std::shared_ptr<Kleo::Crypto::Task>)));
- Q_FOREACH (const shared_ptr<Task> &i, coll->tasks()) { // create labels for all tags in collection
+ Q_FOREACH (const std::shared_ptr<Task> &i, coll->tasks()) { // create labels for all tags in collection
assert(i);
QLabel *l = d->labelForTag(i->tag());
assert(l); (void)l;
diff --git a/src/crypto/gui/newresultpage.h b/src/crypto/gui/newresultpage.h
index 104a312..c69bd36 100644
--- a/src/crypto/gui/newresultpage.h
+++ b/src/crypto/gui/newresultpage.h
@@ -37,10 +37,7 @@
#include <utils/pimpl_ptr.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
@@ -65,8 +62,8 @@ public:
explicit NewResultPage(QWidget *parent = Q_NULLPTR);
~NewResultPage();
- void setTaskCollection(const boost::shared_ptr<TaskCollection> &coll);
- void addTaskCollection(const boost::shared_ptr<TaskCollection> &coll);
+ void setTaskCollection(const std::shared_ptr<TaskCollection> &coll);
+ void addTaskCollection(const std::shared_ptr<TaskCollection> &coll);
bool isComplete() const Q_DECL_OVERRIDE;
@@ -77,8 +74,8 @@ private:
class Private;
kdtools::pimpl_ptr<Private> d;
Q_PRIVATE_SLOT(d, void progress(QString, int, int))
- Q_PRIVATE_SLOT(d, void result(boost::shared_ptr<const Kleo::Crypto::Task::Result>))
- Q_PRIVATE_SLOT(d, void started(boost::shared_ptr<Kleo::Crypto::Task>))
+ Q_PRIVATE_SLOT(d, void result(std::shared_ptr<const Kleo::Crypto::Task::Result>))
+ Q_PRIVATE_SLOT(d, void started(std::shared_ptr<Kleo::Crypto::Task>))
Q_PRIVATE_SLOT(d, void allDone())
};
diff --git a/src/crypto/gui/resolverecipientspage.cpp b/src/crypto/gui/resolverecipientspage.cpp
index c6446a1..f5d8127 100644
--- a/src/crypto/gui/resolverecipientspage.cpp
+++ b/src/crypto/gui/resolverecipientspage.cpp
@@ -60,13 +60,9 @@
#include <QStringList>
#include <QVBoxLayout>
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
using namespace GpgME;
-using namespace boost;
using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace Kleo::Crypto;
@@ -399,7 +395,7 @@ private:
Protocol m_presetProtocol;
Protocol m_selectedProtocol;
bool m_multipleProtocolsAllowed;
- boost::shared_ptr<RecipientPreferences> m_recipientPreferences;
+ std::shared_ptr<RecipientPreferences> m_recipientPreferences;
};
ResolveRecipientsPage::Private::Private(ResolveRecipientsPage *qq)
@@ -453,7 +449,10 @@ void ResolveRecipientsPage::Private::completeChangedInternal()
{
const bool isComplete = q->isComplete();
const std::vector<Key> keys = q->resolvedCertificates();
- const bool haveSecret = std::find_if(keys.begin(), keys.end(), boost::bind(&Key::hasSecret, _1)) != keys.end();
+ const bool haveSecret = std::find_if(keys.begin(), keys.end(),
+ [](const Key &key) {
+ return key.hasSecret();
+ }) != keys.end();
if (isComplete && !haveSecret) {
q->setExplanation(i18n("<b>Warning:</b> None of the selected certificates seem to be your own. You will not be able to decrypt the encrypted data again."));
} else {
@@ -592,7 +591,7 @@ void ResolveRecipientsPage::Private::addRecipient()
namespace
{
-std::vector<Key> makeSuggestions(const boost::shared_ptr<RecipientPreferences> &prefs, const Mailbox &mb, GpgME::Protocol prot)
+std::vector<Key> makeSuggestions(const std::shared_ptr<RecipientPreferences> &prefs, const Mailbox &mb, GpgME::Protocol prot)
{
std::vector<Key> suggestions;
const Key remembered = prefs ? prefs->preferredCertificate(mb, prot) : Key();
@@ -688,12 +687,12 @@ bool ResolveRecipientsPage::recipientsUserMutable() const
return d->m_addButton->isVisible();
}
-boost::shared_ptr<RecipientPreferences> ResolveRecipientsPage::recipientPreferences() const
+std::shared_ptr<RecipientPreferences> ResolveRecipientsPage::recipientPreferences() const
{
return d->m_recipientPreferences;
}
-void ResolveRecipientsPage::setRecipientPreferences(const boost::shared_ptr<RecipientPreferences> &prefs)
+void ResolveRecipientsPage::setRecipientPreferences(const std::shared_ptr<RecipientPreferences> &prefs)
{
d->m_recipientPreferences = prefs;
}
diff --git a/src/crypto/gui/resolverecipientspage.h b/src/crypto/gui/resolverecipientspage.h
index 74cc431..7216e1a 100644
--- a/src/crypto/gui/resolverecipientspage.h
+++ b/src/crypto/gui/resolverecipientspage.h
@@ -39,8 +39,7 @@
#include <gpgme++/global.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace GpgME
@@ -107,8 +106,8 @@ public:
void setRecipients(const std::vector<KMime::Types::Mailbox> &recipients, const std::vector<KMime::Types::Mailbox> &encryptToSelfRecipients);
std::vector<GpgME::Key> resolvedCertificates() const;
- boost::shared_ptr<RecipientPreferences> recipientPreferences() const;
- void setRecipientPreferences(const boost::shared_ptr<RecipientPreferences> &prefs);
+ std::shared_ptr<RecipientPreferences> recipientPreferences() const;
+ void setRecipientPreferences(const std::shared_ptr<RecipientPreferences> &prefs);
Q_SIGNALS:
void selectedProtocolChanged();
diff --git a/src/crypto/gui/resultitemwidget.cpp b/src/crypto/gui/resultitemwidget.cpp
index 774cc8b..ca698d9 100644
--- a/src/crypto/gui/resultitemwidget.cpp
+++ b/src/crypto/gui/resultitemwidget.cpp
@@ -52,10 +52,11 @@
#include <KGuiItem>
#include <KColorScheme>
+#include <cassert>
+
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
namespace
{
@@ -96,7 +97,7 @@ class ResultItemWidget::Private
{
ResultItemWidget *const q;
public:
- explicit Private(const shared_ptr<const Task::Result> result, ResultItemWidget *qq) : q(qq), m_result(result), m_detailsLabel(0), m_showDetailsLabel(0), m_closeButton(0)
+ explicit Private(const std::shared_ptr<const Task::Result> result, ResultItemWidget *qq) : q(qq), m_result(result), m_detailsLabel(0), m_showDetailsLabel(0), m_closeButton(0)
{
assert(m_result);
}
@@ -104,7 +105,7 @@ public:
void slotLinkActivated(const QString &);
void updateShowDetailsLabel();
- const shared_ptr<const Task::Result> m_result;
+ const std::shared_ptr<const Task::Result> m_result;
QLabel *m_detailsLabel;
QLabel *m_showDetailsLabel;
QPushButton *m_closeButton;
@@ -128,7 +129,7 @@ void ResultItemWidget::Private::updateShowDetailsLabel()
m_showDetailsLabel->setAccessibleDescription(detailsVisible ? i18n("Hide Details") : i18n("Show Details"));
}
-ResultItemWidget::ResultItemWidget(const shared_ptr<const Task::Result> &result, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags), d(new Private(result, this))
+ResultItemWidget::ResultItemWidget(const std::shared_ptr<const Task::Result> &result, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags), d(new Private(result, this))
{
const QColor color = colorForVisualCode(d->m_result->code());
const QColor txtColor = txtColorForVisualCode(d->m_result->code());
diff --git a/src/crypto/gui/resultitemwidget.h b/src/crypto/gui/resultitemwidget.h
index 5105588..dcc1187 100644
--- a/src/crypto/gui/resultitemwidget.h
+++ b/src/crypto/gui/resultitemwidget.h
@@ -39,7 +39,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class QString;
@@ -57,7 +57,7 @@ class ResultItemWidget : public QWidget
{
Q_OBJECT
public:
- explicit ResultItemWidget(const boost::shared_ptr<const Task::Result> &result, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
+ explicit ResultItemWidget(const std::shared_ptr<const Task::Result> &result, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
~ResultItemWidget();
bool detailsVisible() const;
diff --git a/src/crypto/gui/resultlistwidget.cpp b/src/crypto/gui/resultlistwidget.cpp
index 4df4991..d87942e 100644
--- a/src/crypto/gui/resultlistwidget.cpp
+++ b/src/crypto/gui/resultlistwidget.cpp
@@ -67,8 +67,8 @@ class ResultListWidget::Private
public:
explicit Private(ResultListWidget *qq);
- void result(const shared_ptr<const Task::Result> &result);
- void started(const shared_ptr<Task> &task);
+ void result(const std::shared_ptr<const Task::Result> &result);
+ void started(const std::shared_ptr<Task> &task);
void detailsToggled(bool);
void allTasksDone();
@@ -77,7 +77,7 @@ public:
void setupMulti();
void resizeIfStandalone();
- std::vector< shared_ptr<TaskCollection> > m_collections;
+ std::vector< std::shared_ptr<TaskCollection> > m_collections;
bool m_standaloneMode;
int m_lastErrorItemIndex;
ScrollArea *m_scrollArea;
@@ -177,7 +177,7 @@ void ResultListWidget::Private::allTasksDone()
Q_EMIT q->completeChanged();
}
-void ResultListWidget::Private::result(const shared_ptr<const Task::Result> &result)
+void ResultListWidget::Private::result(const std::shared_ptr<const Task::Result> &result)
{
assert(result);
assert(kdtools::any(m_collections, !boost::bind(&TaskCollection::isEmpty, _1)));
@@ -203,20 +203,20 @@ unsigned int ResultListWidget::numberOfCompletedTasks() const
return kdtools::accumulate_transform(d->m_collections, mem_fn(&TaskCollection::numberOfCompletedTasks), 0U);
}
-void ResultListWidget::setTaskCollection(const shared_ptr<TaskCollection> &coll)
+void ResultListWidget::setTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
//clear(); ### PENDING(marc) implement
addTaskCollection(coll);
}
-void ResultListWidget::addTaskCollection(const shared_ptr<TaskCollection> &coll)
+void ResultListWidget::addTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
assert(coll); assert(!coll->isEmpty());
d->m_collections.push_back(coll);
- connect(coll.get(), SIGNAL(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)),
- this, SLOT(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)));
- connect(coll.get(), SIGNAL(started(boost::shared_ptr<Kleo::Crypto::Task>)),
- this, SLOT(started(boost::shared_ptr<Kleo::Crypto::Task>)));
+ connect(coll.get(), SIGNAL(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(coll.get(), SIGNAL(started(boost::std::shared_ptr<Kleo::Crypto::Task>)),
+ this, SLOT(started(boost::std::shared_ptr<Kleo::Crypto::Task>)));
connect(coll.get(), SIGNAL(done()), this, SLOT(allTasksDone()));
d->setupMulti();
setStandaloneMode(d->m_standaloneMode);
@@ -227,7 +227,7 @@ void ResultListWidget::Private::detailsToggled(bool)
resizeIfStandalone();
}
-void ResultListWidget::Private::started(const shared_ptr<Task> &task)
+void ResultListWidget::Private::started(const std::shared_ptr<Task> &task)
{
assert(task);
assert(m_progressLabel);
diff --git a/src/crypto/gui/resultlistwidget.h b/src/crypto/gui/resultlistwidget.h
index 90acf81..77d64fc 100644
--- a/src/crypto/gui/resultlistwidget.h
+++ b/src/crypto/gui/resultlistwidget.h
@@ -39,7 +39,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class QString;
@@ -60,8 +60,8 @@ public:
explicit ResultListWidget(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
~ResultListWidget();
- void setTaskCollection(const boost::shared_ptr<TaskCollection> &coll);
- void addTaskCollection(const boost::shared_ptr<TaskCollection> &coll);
+ void setTaskCollection(const std::shared_ptr<TaskCollection> &coll);
+ void addTaskCollection(const std::shared_ptr<TaskCollection> &coll);
void setStandaloneMode(bool standalone);
@@ -77,8 +77,8 @@ Q_SIGNALS:
private:
class Private;
kdtools::pimpl_ptr<Private> d;
- Q_PRIVATE_SLOT(d, void result(boost::shared_ptr<const Kleo::Crypto::Task::Result>))
- Q_PRIVATE_SLOT(d, void started(boost::shared_ptr<Kleo::Crypto::Task>))
+ Q_PRIVATE_SLOT(d, void result(std::shared_ptr<const Kleo::Crypto::Task::Result>))
+ Q_PRIVATE_SLOT(d, void started(std::shared_ptr<Kleo::Crypto::Task>))
Q_PRIVATE_SLOT(d, void detailsToggled(bool))
Q_PRIVATE_SLOT(d, void allTasksDone())
};
diff --git a/src/crypto/gui/resultpage.cpp b/src/crypto/gui/resultpage.cpp
index 4f9b6a4..a9671ab 100644
--- a/src/crypto/gui/resultpage.cpp
+++ b/src/crypto/gui/resultpage.cpp
@@ -53,7 +53,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
class ResultPage::Private
{
@@ -62,13 +61,13 @@ public:
explicit Private(ResultPage *qq);
void progress(const QString &msg, int progress, int total);
- void result(const shared_ptr<const Task::Result> &result);
- void started(const shared_ptr<Task> &result);
+ void result(const std::shared_ptr<const Task::Result> &result);
+ void started(const std::shared_ptr<Task> &result);
void allDone();
void keepOpenWhenDone(bool keep);
QLabel *labelForTag(const QString &tag);
- shared_ptr<TaskCollection> m_tasks;
+ std::shared_ptr<TaskCollection> m_tasks;
QProgressBar *m_progressBar;
QHash<QString, QLabel *> m_progressLabelByTag;
QVBoxLayout *m_progressLabelLayout;
@@ -124,11 +123,11 @@ void ResultPage::Private::allDone()
Q_EMIT q->completeChanged();
}
-void ResultPage::Private::result(const shared_ptr<const Task::Result> &)
+void ResultPage::Private::result(const std::shared_ptr<const Task::Result> &)
{
}
-void ResultPage::Private::started(const shared_ptr<Task> &task)
+void ResultPage::Private::started(const std::shared_ptr<Task> &task)
{
assert(task);
const QString tag = task->tag();
@@ -160,7 +159,7 @@ void ResultPage::setKeepOpenWhenDone(bool keep)
d->m_keepOpenCB->setChecked(keep);
}
-void ResultPage::setTaskCollection(const shared_ptr<TaskCollection> &coll)
+void ResultPage::setTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
assert(!d->m_tasks);
if (d->m_tasks == coll) {
@@ -173,12 +172,12 @@ void ResultPage::setTaskCollection(const shared_ptr<TaskCollection> &coll)
this, SLOT(progress(QString,int,int)));
connect(d->m_tasks.get(), SIGNAL(done()),
this, SLOT(allDone()));
- connect(d->m_tasks.get(), SIGNAL(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)),
- this, SLOT(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)));
- connect(d->m_tasks.get(), SIGNAL(started(boost::shared_ptr<Kleo::Crypto::Task>)),
- this, SLOT(started(boost::shared_ptr<Kleo::Crypto::Task>)));
+ connect(d->m_tasks.get(), SIGNAL(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(d->m_tasks.get(), SIGNAL(started(boost::std::shared_ptr<Kleo::Crypto::Task>)),
+ this, SLOT(started(boost::std::shared_ptr<Kleo::Crypto::Task>)));
- Q_FOREACH (const shared_ptr<Task> &i, d->m_tasks->tasks()) { // create labels for all tags in collection
+ Q_FOREACH (const std::shared_ptr<Task> &i, d->m_tasks->tasks()) { // create labels for all tags in collection
assert(i && d->labelForTag(i->tag()));
Q_UNUSED(i);
}
diff --git a/src/crypto/gui/resultpage.h b/src/crypto/gui/resultpage.h
index 029321d..3cb2deb 100644
--- a/src/crypto/gui/resultpage.h
+++ b/src/crypto/gui/resultpage.h
@@ -38,7 +38,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace Kleo
{
@@ -58,7 +58,7 @@ public:
explicit ResultPage(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
~ResultPage();
- void setTaskCollection(const boost::shared_ptr<TaskCollection> &coll);
+ void setTaskCollection(const std::shared_ptr<TaskCollection> &coll);
bool isComplete() const Q_DECL_OVERRIDE;
@@ -69,8 +69,8 @@ private:
class Private;
kdtools::pimpl_ptr<Private> d;
Q_PRIVATE_SLOT(d, void progress(QString, int, int))
- Q_PRIVATE_SLOT(d, void result(boost::shared_ptr<const Kleo::Crypto::Task::Result>))
- Q_PRIVATE_SLOT(d, void started(boost::shared_ptr<Kleo::Crypto::Task>))
+ Q_PRIVATE_SLOT(d, void result(std::shared_ptr<const Kleo::Crypto::Task::Result>))
+ Q_PRIVATE_SLOT(d, void started(std::shared_ptr<Kleo::Crypto::Task>))
Q_PRIVATE_SLOT(d, void keepOpenWhenDone(bool))
Q_PRIVATE_SLOT(d, void allDone())
};
diff --git a/src/crypto/gui/signemailwizard.cpp b/src/crypto/gui/signemailwizard.cpp
index b87dff3..bbc7d04 100644
--- a/src/crypto/gui/signemailwizard.cpp
+++ b/src/crypto/gui/signemailwizard.cpp
@@ -129,7 +129,7 @@ SignEMailWizard::Private::Private(SignEMailWizard *qq)
q->setWindowTitle(i18n("Sign Mail Message"));
std::vector<int> pageOrder;
- q->setSignerResolvePageValidator(boost::shared_ptr<SignerResolveValidator>(new SignerResolveValidator(q->signerResolvePage())));
+ q->setSignerResolvePageValidator(std::shared_ptr<SignerResolveValidator>(new SignerResolveValidator(q->signerResolvePage())));
pageOrder.push_back(SignEncryptWizard::ResolveSignerPage);
pageOrder.push_back(SignEncryptWizard::ResultPage);
q->setPageOrder(pageOrder);
diff --git a/src/crypto/gui/signencryptfileswizard.cpp b/src/crypto/gui/signencryptfileswizard.cpp
index 7855668..9bc2bed 100644
--- a/src/crypto/gui/signencryptfileswizard.cpp
+++ b/src/crypto/gui/signencryptfileswizard.cpp
@@ -56,6 +56,8 @@
#include <gpgme++/key.h>
+#include <cassert>
+
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Crypto::Gui;
@@ -397,7 +399,7 @@ QVector<Key> SignEncryptFilesWizard::resolvedSigners() const
return mSigEncPage->signers();
}
-void SignEncryptFilesWizard::setTaskCollection(const boost::shared_ptr<Kleo::Crypto::TaskCollection> &coll)
+void SignEncryptFilesWizard::setTaskCollection(const std::shared_ptr<Kleo::Crypto::TaskCollection> &coll)
{
mResultPage->setTaskCollection(coll);
}
diff --git a/src/crypto/gui/signencryptfileswizard.h b/src/crypto/gui/signencryptfileswizard.h
index 284eead..76dc642 100644
--- a/src/crypto/gui/signencryptfileswizard.h
+++ b/src/crypto/gui/signencryptfileswizard.h
@@ -42,7 +42,7 @@
#include <QVector>
#include <QMap>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class QStringList;
@@ -93,7 +93,7 @@ public:
void setOutputNames(const QMap<int, QString> &nameMap) const;
QMap<int, QString> outputNames() const;
- void setTaskCollection(const boost::shared_ptr<Kleo::Crypto::TaskCollection> &coll);
+ void setTaskCollection(const std::shared_ptr<Kleo::Crypto::TaskCollection> &coll);
// Outputs
QVector<GpgME::Key> resolvedRecipients() const;
diff --git a/src/crypto/gui/signencryptwidget.cpp b/src/crypto/gui/signencryptwidget.cpp
index 2a657f6..90c5ac2 100644
--- a/src/crypto/gui/signencryptwidget.cpp
+++ b/src/crypto/gui/signencryptwidget.cpp
@@ -167,7 +167,10 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent)
"Using a password is <b>less secure</b> then public key cryptography. Even if you pick a very strong password."));
encBoxLay->addWidget(mSymmetric);
+#warning GPGME_PORT
+#if 0
mSymmetric->setVisible(GpgME::hasFeature(0, GpgME::EncryptSymmetric));
+#endif
// Connect it
connect(encBox, &QGroupBox::toggled, recipientWidget, &QWidget::setEnabled);
diff --git a/src/crypto/gui/signencryptwizard.cpp b/src/crypto/gui/signencryptwizard.cpp
index ae002ec..5b9de4b 100644
--- a/src/crypto/gui/signencryptwizard.cpp
+++ b/src/crypto/gui/signencryptwizard.cpp
@@ -54,13 +54,11 @@
#include <QFileInfo>
#include <QTimer>
-#include <boost/bind.hpp>
#include <KSharedConfig>
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
using namespace GpgME;
using namespace KMime::Types;
@@ -92,8 +90,8 @@ SignEncryptWizard::Private::Private(SignEncryptWizard *qq)
q->setPage(SignEncryptWizard::ResolveRecipientsPage, recipientResolvePage);
q->setPage(SignEncryptWizard::ResultPage, resultPage);
//TODO: move the RecipientPreferences creation out of here, don't create a new instance for each wizard
- recipientResolvePage->setRecipientPreferences(shared_ptr<RecipientPreferences>(new KConfigBasedRecipientPreferences(KSharedConfig::openConfig())));
- signerResolvePage->setSigningPreferences(shared_ptr<SigningPreferences>(new KConfigBasedSigningPreferences(KSharedConfig::openConfig())));
+ recipientResolvePage->setRecipientPreferences(std::shared_ptr<RecipientPreferences>(new KConfigBasedRecipientPreferences(KSharedConfig::openConfig())));
+ signerResolvePage->setSigningPreferences(std::shared_ptr<SigningPreferences>(new KConfigBasedSigningPreferences(KSharedConfig::openConfig())));
q->resize(QSize(640, 480).expandedTo(q->sizeHint()));
}
@@ -230,7 +228,7 @@ void SignEncryptWizard::setSignersAndCandidates(const std::vector<Mailbox> &sign
d->signerResolvePage->setSignersAndCandidates(signers, keys);
}
-void SignEncryptWizard::setTaskCollection(const shared_ptr<TaskCollection> &coll)
+void SignEncryptWizard::setTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
kleo_assert(coll);
d->resultPage->setTaskCollection(coll);
@@ -266,7 +264,7 @@ void SignEncryptWizard::setRecipientsUserMutable(bool isMutable)
d->recipientResolvePage->setRecipientsUserMutable(isMutable);
}
-void SignEncryptWizard::setSignerResolvePageValidator(const boost::shared_ptr<SignerResolvePage::Validator> &validator)
+void SignEncryptWizard::setSignerResolvePageValidator(const std::shared_ptr<SignerResolvePage::Validator> &validator)
{
d->signerResolvePage->setValidator(validator);
}
diff --git a/src/crypto/gui/signencryptwizard.h b/src/crypto/gui/signencryptwizard.h
index a9dafe1..61af710 100644
--- a/src/crypto/gui/signencryptwizard.h
+++ b/src/crypto/gui/signencryptwizard.h
@@ -42,8 +42,7 @@
#include <gpgme++/global.h>
#include <kmime/kmime_header_parsing.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace GpgME
@@ -125,7 +124,7 @@ public:
void setSignersAndCandidates(const std::vector<KMime::Types::Mailbox> &signers, const std::vector< std::vector<GpgME::Key> > &keys);
- void setTaskCollection(const boost::shared_ptr<TaskCollection> &tasks);
+ void setTaskCollection(const std::shared_ptr<TaskCollection> &tasks);
std::vector<GpgME::Key> resolvedCertificates() const;
std::vector<GpgME::Key> resolvedSigners() const;
@@ -153,7 +152,7 @@ protected:
Gui::ResultPage *resultPage();
Gui::ResolveRecipientsPage *resolveRecipientsPage();
- void setSignerResolvePageValidator(const boost::shared_ptr<SignerResolvePage::Validator> &validator);
+ void setSignerResolvePageValidator(const std::shared_ptr<SignerResolvePage::Validator> &validator);
private:
class Private;
diff --git a/src/crypto/gui/signerresolvepage.cpp b/src/crypto/gui/signerresolvepage.cpp
index 1c10839..e256695 100644
--- a/src/crypto/gui/signerresolvepage.cpp
+++ b/src/crypto/gui/signerresolvepage.cpp
@@ -68,7 +68,6 @@ using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
namespace
{
@@ -284,8 +283,8 @@ private:
bool multipleProtocolsAllowed;
bool protocolSelectionUserMutable;
QMap<GpgME::Protocol, GpgME::Key> certificates;
- shared_ptr<SignerResolvePage::Validator> validator;
- shared_ptr<SigningPreferences> signingPreferences;
+ std::shared_ptr<SignerResolvePage::Validator> validator;
+ std::shared_ptr<SigningPreferences> signingPreferences;
};
bool SignerResolvePage::Private::protocolSelectionActuallyUserMutable() const
@@ -363,14 +362,14 @@ SignerResolvePage::Private::Private(SignerResolvePage *qq)
layout->addStretch();
}
-void SignerResolvePage::setValidator(const boost::shared_ptr<SignerResolvePage::Validator> &validator)
+void SignerResolvePage::setValidator(const std::shared_ptr<SignerResolvePage::Validator> &validator)
{
assert(validator);
d->validator = validator;
d->updateUi();
}
-shared_ptr<SignerResolvePage::Validator> SignerResolvePage::validator() const
+std::shared_ptr<SignerResolvePage::Validator> SignerResolvePage::validator() const
{
return d->validator;
}
@@ -669,7 +668,7 @@ void SignerResolvePage::setAsciiArmorEnabled(bool enabled)
d->textArmorCO->setChecked(enabled);
}
-void SignerResolvePage::setSigningPreferences(const boost::shared_ptr<SigningPreferences> &prefs)
+void SignerResolvePage::setSigningPreferences(const std::shared_ptr<SigningPreferences> &prefs)
{
d->signingPreferences = prefs;
QMap<Protocol, Key> map;
@@ -678,7 +677,7 @@ void SignerResolvePage::setSigningPreferences(const boost::shared_ptr<SigningPre
d->setCertificates(map);
}
-shared_ptr<SigningPreferences> SignerResolvePage::signingPreferences() const
+std::shared_ptr<SigningPreferences> SignerResolvePage::signingPreferences() const
{
return d->signingPreferences;
}
diff --git a/src/crypto/gui/signerresolvepage.h b/src/crypto/gui/signerresolvepage.h
index 9362ab5..6bd5268 100644
--- a/src/crypto/gui/signerresolvepage.h
+++ b/src/crypto/gui/signerresolvepage.h
@@ -40,8 +40,7 @@
#include <gpgme++/global.h>
#include <kmime/kmime_header_parsing.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace GpgME
@@ -124,11 +123,11 @@ public:
virtual QString customWindowTitle() const = 0;
};
- void setValidator(const boost::shared_ptr<Validator> &);
- boost::shared_ptr<Validator> validator() const;
+ void setValidator(const std::shared_ptr<Validator> &);
+ std::shared_ptr<Validator> validator() const;
- void setSigningPreferences(const boost::shared_ptr<SigningPreferences> &prefs);
- boost::shared_ptr<SigningPreferences> signingPreferences() const;
+ void setSigningPreferences(const std::shared_ptr<SigningPreferences> &prefs);
+ std::shared_ptr<SigningPreferences> signingPreferences() const;
private:
void onNext() Q_DECL_OVERRIDE;
diff --git a/src/crypto/newsignencryptemailcontroller.cpp b/src/crypto/newsignencryptemailcontroller.cpp
index 34b3ccf..787d2a2 100644
--- a/src/crypto/newsignencryptemailcontroller.cpp
+++ b/src/crypto/newsignencryptemailcontroller.cpp
@@ -63,7 +63,6 @@
#include <QTimer>
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
using namespace Kleo;
using namespace Kleo::Crypto;
@@ -238,7 +237,7 @@ private:
void startSigning();
void startEncryption();
void schedule();
- shared_ptr<Task> takeRunnable(GpgME::Protocol proto);
+ std::shared_ptr<Task> takeRunnable(GpgME::Protocol proto);
private:
bool sign : 1;
@@ -248,8 +247,8 @@ private:
bool detached : 1;
Protocol presetProtocol;
std::vector<Key> signers, recipients;
- std::vector< shared_ptr<Task> > runnable, completed;
- shared_ptr<Task> cms, openpgp;
+ std::vector< std::shared_ptr<Task> > runnable, completed;
+ std::shared_ptr<Task> cms, openpgp;
QPointer<SignEncryptEMailConflictDialog> dialog;
};
@@ -277,7 +276,7 @@ NewSignEncryptEMailController::Private::~Private()
delete dialog;
}
-NewSignEncryptEMailController::NewSignEncryptEMailController(const shared_ptr<ExecutionContext> &xc, QObject *p)
+NewSignEncryptEMailController::NewSignEncryptEMailController(const std::shared_ptr<ExecutionContext> &xc, QObject *p)
: Controller(xc, p), d(new Private(this))
{
@@ -419,7 +418,7 @@ void NewSignEncryptEMailController::Private::slotDialogRejected()
Q_ARG(QString, i18n("User cancel")));
}
-void NewSignEncryptEMailController::startEncryption(const std::vector< shared_ptr<Input> > &inputs, const std::vector< shared_ptr<Output> > &outputs)
+void NewSignEncryptEMailController::startEncryption(const std::vector< std::shared_ptr<Input> > &inputs, const std::vector< std::shared_ptr<Output> > &outputs)
{
kleo_assert(d->encrypt);
@@ -428,14 +427,14 @@ void NewSignEncryptEMailController::startEncryption(const std::vector< shared_pt
kleo_assert(!inputs.empty());
kleo_assert(outputs.size() == inputs.size());
- std::vector< shared_ptr<Task> > tasks;
+ std::vector< std::shared_ptr<Task> > tasks;
tasks.reserve(inputs.size());
kleo_assert(!d->recipients.empty());
for (unsigned int i = 0, end = inputs.size(); i < end; ++i) {
- const shared_ptr<EncryptEMailTask> task(new EncryptEMailTask);
+ const std::shared_ptr<EncryptEMailTask> task(new EncryptEMailTask);
task->setInput(inputs[i]);
task->setOutput(outputs[i]);
@@ -452,22 +451,22 @@ void NewSignEncryptEMailController::startEncryption(const std::vector< shared_pt
void NewSignEncryptEMailController::Private::startEncryption()
{
- shared_ptr<TaskCollection> coll(new TaskCollection);
- const std::vector<shared_ptr<Task> > tmp
- = kdtools::copy< std::vector<shared_ptr<Task> > >(runnable);
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ const std::vector<std::shared_ptr<Task> > tmp
+ = kdtools::copy< std::vector<std::shared_ptr<Task> > >(runnable);
coll->setTasks(tmp);
#if 0
#warning use a new result dialog
// ### use a new result dialog
dialog->setTaskCollection(coll);
#endif
- Q_FOREACH (const shared_ptr<Task> &t, tmp) {
+ Q_FOREACH (const std::shared_ptr<Task> &t, tmp) {
q->connectTask(t);
}
schedule();
}
-void NewSignEncryptEMailController::startSigning(const std::vector< shared_ptr<Input> > &inputs, const std::vector< shared_ptr<Output> > &outputs)
+void NewSignEncryptEMailController::startSigning(const std::vector< std::shared_ptr<Input> > &inputs, const std::vector< std::shared_ptr<Output> > &outputs)
{
kleo_assert(d->sign);
@@ -476,7 +475,7 @@ void NewSignEncryptEMailController::startSigning(const std::vector< shared_ptr<I
kleo_assert(!inputs.empty());
kleo_assert(!outputs.empty());
- std::vector< shared_ptr<Task> > tasks;
+ std::vector< std::shared_ptr<Task> > tasks;
tasks.reserve(inputs.size());
kleo_assert(!d->signers.empty());
@@ -484,7 +483,7 @@ void NewSignEncryptEMailController::startSigning(const std::vector< shared_ptr<I
for (unsigned int i = 0, end = inputs.size(); i < end; ++i) {
- const shared_ptr<SignEMailTask> task(new SignEMailTask);
+ const std::shared_ptr<SignEMailTask> task(new SignEMailTask);
task->setInput(inputs[i]);
task->setOutput(outputs[i]);
@@ -502,16 +501,16 @@ void NewSignEncryptEMailController::startSigning(const std::vector< shared_ptr<I
void NewSignEncryptEMailController::Private::startSigning()
{
- shared_ptr<TaskCollection> coll(new TaskCollection);
- const std::vector<shared_ptr<Task> > tmp
- = kdtools::copy< std::vector<shared_ptr<Task> > >(runnable);
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ const std::vector<std::shared_ptr<Task> > tmp
+ = kdtools::copy< std::vector<std::shared_ptr<Task> > >(runnable);
coll->setTasks(tmp);
#if 0
#warning use a new result dialog
// ### use a new result dialog
dialog->setTaskCollection(coll);
#endif
- Q_FOREACH (const shared_ptr<Task> &t, tmp) {
+ Q_FOREACH (const std::shared_ptr<Task> &t, tmp) {
q->connectTask(t);
}
schedule();
@@ -521,13 +520,13 @@ void NewSignEncryptEMailController::Private::schedule()
{
if (!cms)
- if (const shared_ptr<Task> t = takeRunnable(CMS)) {
+ if (const std::shared_ptr<Task> t = takeRunnable(CMS)) {
t->start();
cms = t;
}
if (!openpgp)
- if (const shared_ptr<Task> t = takeRunnable(OpenPGP)) {
+ if (const std::shared_ptr<Task> t = takeRunnable(OpenPGP)) {
t->start();
openpgp = t;
}
@@ -539,21 +538,21 @@ void NewSignEncryptEMailController::Private::schedule()
q->emitDoneOrError();
}
-shared_ptr<Task> NewSignEncryptEMailController::Private::takeRunnable(GpgME::Protocol proto)
+std::shared_ptr<Task> NewSignEncryptEMailController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< shared_ptr<Task> >::iterator it
+ const std::vector< std::shared_ptr<Task> >::iterator it
= std::find_if(runnable.begin(), runnable.end(),
boost::bind(&Task::protocol, _1) == proto);
if (it == runnable.end()) {
- return shared_ptr<Task>();
+ return std::shared_ptr<Task>();
}
- const shared_ptr<Task> result = *it;
+ const std::shared_ptr<Task> result = *it;
runnable.erase(it);
return result;
}
-void NewSignEncryptEMailController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void NewSignEncryptEMailController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
assert(task);
diff --git a/src/crypto/newsignencryptemailcontroller.h b/src/crypto/newsignencryptemailcontroller.h
index 26868ac..a51d337 100644
--- a/src/crypto/newsignencryptemailcontroller.h
+++ b/src/crypto/newsignencryptemailcontroller.h
@@ -39,6 +39,7 @@
#include <gpgme++/global.h>
+#include <memory>
#include <vector>
#include <utility>
@@ -54,11 +55,6 @@ namespace GpgME
{
}
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
@@ -73,7 +69,7 @@ class NewSignEncryptEMailController : public Controller
Q_OBJECT
public:
explicit NewSignEncryptEMailController(QObject *parent = Q_NULLPTR);
- explicit NewSignEncryptEMailController(const boost::shared_ptr<ExecutionContext> &xc, QObject *parent = Q_NULLPTR);
+ explicit NewSignEncryptEMailController(const std::shared_ptr<ExecutionContext> &xc, QObject *parent = Q_NULLPTR);
~NewSignEncryptEMailController();
static const char *mementoName()
@@ -103,11 +99,11 @@ public:
void setDetachedSignature(bool detached);
- void startSigning(const std::vector< boost::shared_ptr<Kleo::Input> > &inputs,
- const std::vector< boost::shared_ptr<Kleo::Output> > &outputs);
+ void startSigning(const std::vector< std::shared_ptr<Kleo::Input> > &inputs,
+ const std::vector< std::shared_ptr<Kleo::Output> > &outputs);
- void startEncryption(const std::vector< boost::shared_ptr<Kleo::Input> > &inputs,
- const std::vector< boost::shared_ptr<Kleo::Output> > &outputs);
+ void startEncryption(const std::vector< std::shared_ptr<Kleo::Input> > &inputs,
+ const std::vector< std::shared_ptr<Kleo::Output> > &outputs);
public Q_SLOTS:
void cancel();
@@ -118,7 +114,7 @@ Q_SIGNALS:
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Kleo::Crypto::Task::Result> &) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Kleo::Crypto::Task::Result> &) Q_DECL_OVERRIDE;
class Private;
kdtools::pimpl_ptr<Private> d;
diff --git a/src/crypto/signemailcontroller.cpp b/src/crypto/signemailcontroller.cpp
index eb0d3b1..a29ec82 100644
--- a/src/crypto/signemailcontroller.cpp
+++ b/src/crypto/signemailcontroller.cpp
@@ -56,12 +56,10 @@
#include <QTimer>
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
using namespace GpgME;
using namespace KMime::Types;
@@ -83,12 +81,12 @@ private:
void cancelAllJobs(); // ### extract to base
void schedule(); // ### extract to base
- shared_ptr<SignEMailTask> takeRunnable(GpgME::Protocol proto); // ### extract to base
+ std::shared_ptr<SignEMailTask> takeRunnable(GpgME::Protocol proto); // ### extract to base
private:
const Mode mode;
- std::vector< shared_ptr<SignEMailTask> > runnable, completed; // ### extract to base
- shared_ptr<SignEMailTask> cms, openpgp; // ### extract to base
+ std::vector< std::shared_ptr<SignEMailTask> > runnable, completed; // ### extract to base
+ std::shared_ptr<SignEMailTask> cms, openpgp; // ### extract to base
QPointer<SignEMailWizard> wizard; // ### extract to base
Protocol protocol; // ### extract to base
bool detached : 1;
@@ -115,7 +113,7 @@ SignEMailController::SignEMailController(Mode mode, QObject *p)
}
-SignEMailController::SignEMailController(const boost::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *p)
+SignEMailController::SignEMailController(const std::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *p)
: Controller(xc, p), d(new Private(mode, this))
{
@@ -192,18 +190,18 @@ void SignEMailController::Private::slotWizardCanceled()
q->emitDoneOrError();
}
-void SignEMailController::setInputAndOutput(const shared_ptr<Input> &input, const shared_ptr<Output> &output)
+void SignEMailController::setInputAndOutput(const std::shared_ptr<Input> &input, const std::shared_ptr<Output> &output)
{
- setInputsAndOutputs(std::vector< shared_ptr<Input> >(1, input), std::vector< shared_ptr<Output> >(1, output));
+ setInputsAndOutputs(std::vector< std::shared_ptr<Input> >(1, input), std::vector< std::shared_ptr<Output> >(1, output));
}
// ### extract to base
-void SignEMailController::setInputsAndOutputs(const std::vector< shared_ptr<Input> > &inputs, const std::vector< shared_ptr<Output> > &outputs)
+void SignEMailController::setInputsAndOutputs(const std::vector< std::shared_ptr<Input> > &inputs, const std::vector< std::shared_ptr<Output> > &outputs)
{
kleo_assert(!inputs.empty());
kleo_assert(!outputs.empty());
- std::vector< shared_ptr<SignEMailTask> > tasks;
+ std::vector< std::shared_ptr<SignEMailTask> > tasks;
tasks.reserve(inputs.size());
d->ensureWizardCreated();
@@ -213,7 +211,7 @@ void SignEMailController::setInputsAndOutputs(const std::vector< shared_ptr<Inpu
for (unsigned int i = 0, end = inputs.size(); i < end; ++i) {
- const shared_ptr<SignEMailTask> task(new SignEMailTask);
+ const std::shared_ptr<SignEMailTask> task(new SignEMailTask);
task->setInput(inputs[i]);
task->setOutput(outputs[i]);
task->setSigners(keys);
@@ -235,13 +233,13 @@ void SignEMailController::setInputsAndOutputs(const std::vector< shared_ptr<Inpu
// ### extract to base
void SignEMailController::start()
{
- shared_ptr<TaskCollection> coll(new TaskCollection);
- std::vector<shared_ptr<Task> > tmp;
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
+ std::vector<std::shared_ptr<Task> > tmp;
std::copy(d->runnable.begin(), d->runnable.end(), std::back_inserter(tmp));
coll->setTasks(tmp);
d->ensureWizardCreated();
d->wizard->setTaskCollection(coll);
- Q_FOREACH (const shared_ptr<Task> &t, tmp) {
+ Q_FOREACH (const std::shared_ptr<Task> &t, tmp) {
connectTask(t);
}
@@ -253,13 +251,13 @@ void SignEMailController::Private::schedule()
{
if (!cms)
- if (const shared_ptr<SignEMailTask> t = takeRunnable(CMS)) {
+ if (const std::shared_ptr<SignEMailTask> t = takeRunnable(CMS)) {
t->start();
cms = t;
}
if (!openpgp)
- if (const shared_ptr<SignEMailTask> t = takeRunnable(OpenPGP)) {
+ if (const std::shared_ptr<SignEMailTask> t = takeRunnable(OpenPGP)) {
t->start();
openpgp = t;
}
@@ -267,7 +265,7 @@ void SignEMailController::Private::schedule()
if (!cms && !openpgp) {
kleo_assert(runnable.empty());
QPointer<QObject> Q = q;
- Q_FOREACH (const shared_ptr<SignEMailTask> t, completed) {
+ Q_FOREACH (const std::shared_ptr<SignEMailTask> t, completed) {
Q_EMIT q->reportMicAlg(t->micAlg());
if (!Q) {
return;
@@ -278,22 +276,22 @@ void SignEMailController::Private::schedule()
}
// ### extract to base
-shared_ptr<SignEMailTask> SignEMailController::Private::takeRunnable(GpgME::Protocol proto)
+std::shared_ptr<SignEMailTask> SignEMailController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< shared_ptr<SignEMailTask> >::iterator it
+ const std::vector< std::shared_ptr<SignEMailTask> >::iterator it
= std::find_if(runnable.begin(), runnable.end(),
boost::bind(&Task::protocol, _1) == proto);
if (it == runnable.end()) {
- return shared_ptr<SignEMailTask>();
+ return std::shared_ptr<SignEMailTask>();
}
- const shared_ptr<SignEMailTask> result = *it;
+ const std::shared_ptr<SignEMailTask> result = *it;
runnable.erase(it);
return result;
}
// ### extract to base
-void SignEMailController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void SignEMailController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
Q_UNUSED(result);
assert(task);
diff --git a/src/crypto/signemailcontroller.h b/src/crypto/signemailcontroller.h
index 672fe32..4ebc35b 100644
--- a/src/crypto/signemailcontroller.h
+++ b/src/crypto/signemailcontroller.h
@@ -39,6 +39,7 @@
#include <gpgme++/global.h>
+#include <memory>
#include <vector>
namespace KMime
@@ -49,11 +50,6 @@ class Mailbox;
}
}
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
@@ -75,7 +71,7 @@ public:
};
explicit SignEMailController(Mode mode, QObject *parent = Q_NULLPTR);
- explicit SignEMailController(const boost::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *parent = Q_NULLPTR);
+ explicit SignEMailController(const std::shared_ptr<ExecutionContext> &xc, Mode mode, QObject *parent = Q_NULLPTR);
~SignEMailController();
Mode mode() const;
@@ -89,10 +85,10 @@ public:
void setDetachedSignature(bool detached);
- void setInputAndOutput(const boost::shared_ptr<Kleo::Input> &input,
- const boost::shared_ptr<Kleo::Output> &output);
- void setInputsAndOutputs(const std::vector< boost::shared_ptr<Kleo::Input> > &inputs,
- const std::vector< boost::shared_ptr<Kleo::Output> > &outputs);
+ void setInputAndOutput(const std::shared_ptr<Kleo::Input> &input,
+ const std::shared_ptr<Kleo::Output> &output);
+ void setInputsAndOutputs(const std::vector< std::shared_ptr<Kleo::Input> > &inputs,
+ const std::vector< std::shared_ptr<Kleo::Output> > &outputs);
void start();
@@ -104,7 +100,7 @@ Q_SIGNALS:
void reportMicAlg(const QString &micalg);
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Task::Result> &result) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result) Q_DECL_OVERRIDE;
class Private;
kdtools::pimpl_ptr<Private> d;
diff --git a/src/crypto/signemailtask.cpp b/src/crypto/signemailtask.cpp
index 0345342..18038e8 100644
--- a/src/crypto/signemailtask.cpp
+++ b/src/crypto/signemailtask.cpp
@@ -40,9 +40,9 @@
#include <utils/auditlog.h>
#include <Libkleo/Stl_Util>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/SignJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/SignJob>
#include <gpgme++/signingresult.h>
#include <gpgme++/key.h>
@@ -103,21 +103,21 @@ public:
explicit Private(SignEMailTask *qq);
private:
- std::unique_ptr<Kleo::SignJob> createJob(GpgME::Protocol proto);
+ std::unique_ptr<QGpgME::SignJob> createJob(GpgME::Protocol proto);
private:
void slotResult(const SigningResult &);
private:
- shared_ptr<Input> input;
- shared_ptr<Output> output;
+ std::shared_ptr<Input> input;
+ std::shared_ptr<Output> output;
std::vector<Key> signers;
bool detached;
bool clearsign;
QString micAlg;
- QPointer<Kleo::SignJob> job;
+ QPointer<QGpgME::SignJob> job;
};
SignEMailTask::Private::Private(SignEMailTask *qq)
@@ -141,14 +141,14 @@ SignEMailTask::SignEMailTask(QObject *p)
SignEMailTask::~SignEMailTask() {}
-void SignEMailTask::setInput(const shared_ptr<Input> &input)
+void SignEMailTask::setInput(const std::shared_ptr<Input> &input)
{
kleo_assert(!d->job);
kleo_assert(input);
d->input = input;
}
-void SignEMailTask::setOutput(const shared_ptr<Output> &output)
+void SignEMailTask::setOutput(const std::shared_ptr<Output> &output)
{
kleo_assert(!d->job);
kleo_assert(output);
@@ -202,7 +202,7 @@ void SignEMailTask::doStart()
d->micAlg.clear();
- std::unique_ptr<Kleo::SignJob> job = d->createJob(protocol());
+ std::unique_ptr<QGpgME::SignJob> job = d->createJob(protocol());
kleo_assert(job.get());
job->start(d->signers,
@@ -219,12 +219,12 @@ void SignEMailTask::cancel()
}
}
-std::unique_ptr<Kleo::SignJob> SignEMailTask::Private::createJob(GpgME::Protocol proto)
+std::unique_ptr<QGpgME::SignJob> SignEMailTask::Private::createJob(GpgME::Protocol proto)
{
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(proto);
+ const QGpgME::Protocol *const backend = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(backend);
bool shouldArmor = (proto == OpenPGP || q->asciiArmor()) && !output->binaryOpt();
- std::unique_ptr<Kleo::SignJob> signJob(backend->signJob(/*armor=*/ shouldArmor, /*textmode=*/false));
+ std::unique_ptr<QGpgME::SignJob> signJob(backend->signJob(/*armor=*/ shouldArmor, /*textmode=*/false));
kleo_assert(signJob.get());
if (proto == CMS && !q->asciiArmor() && !output->binaryOpt()) {
signJob->setOutputIsBase64Encoded(true);
@@ -260,14 +260,14 @@ static QString collect_micalgs(const GpgME::SigningResult &result, GpgME::Protoc
void SignEMailTask::Private::slotResult(const SigningResult &result)
{
- const Job *const job = qobject_cast<const Job *>(q->sender());
+ const QGpgME::Job *const job = qobject_cast<const QGpgME::Job *>(q->sender());
if (result.error().code()) {
output->cancel();
} else {
output->finalize();
micAlg = collect_micalgs(result, q->protocol());
}
- q->emitResult(shared_ptr<Result>(new SignEMailResult(result, AuditLog::fromJob(job))));
+ q->emitResult(std::shared_ptr<Result>(new SignEMailResult(result, AuditLog::fromJob(job))));
}
QString SignEMailTask::micAlg() const
diff --git a/src/crypto/signemailtask.h b/src/crypto/signemailtask.h
index 2e383f5..be093a3 100644
--- a/src/crypto/signemailtask.h
+++ b/src/crypto/signemailtask.h
@@ -39,8 +39,7 @@
#include <gpgme++/global.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace GpgME
@@ -66,8 +65,8 @@ public:
explicit SignEMailTask(QObject *parent = Q_NULLPTR);
~SignEMailTask();
- void setInput(const boost::shared_ptr<Input> &input);
- void setOutput(const boost::shared_ptr<Output> &output);
+ void setInput(const std::shared_ptr<Input> &input);
+ void setOutput(const std::shared_ptr<Output> &output);
void setSigners(const std::vector<GpgME::Key> &recipients);
void setDetachedSignature(bool detached);
diff --git a/src/crypto/signencryptfilescontroller.cpp b/src/crypto/signencryptfilescontroller.cpp
index e234bd0..66edd90 100644
--- a/src/crypto/signencryptfilescontroller.cpp
+++ b/src/crypto/signencryptfilescontroller.cpp
@@ -67,7 +67,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
using namespace GpgME;
using namespace KMime::Types;
@@ -95,13 +94,13 @@ private:
}
void schedule();
- shared_ptr<SignEncryptFilesTask> takeRunnable(GpgME::Protocol proto);
+ std::shared_ptr<SignEncryptFilesTask> takeRunnable(GpgME::Protocol proto);
static void assertValidOperation(unsigned int);
static QString titleForOperation(unsigned int op);
private:
- std::vector< shared_ptr<SignEncryptFilesTask> > runnable, completed;
- shared_ptr<SignEncryptFilesTask> cms, openpgp;
+ std::vector< std::shared_ptr<SignEncryptFilesTask> > runnable, completed;
+ std::shared_ptr<SignEncryptFilesTask> cms, openpgp;
QPointer<SignEncryptFilesWizard> wizard;
QStringList files;
unsigned int operation;
@@ -163,7 +162,7 @@ SignEncryptFilesController::SignEncryptFilesController(QObject *p)
}
-SignEncryptFilesController::SignEncryptFilesController(const shared_ptr<const ExecutionContext> &ctx, QObject *p)
+SignEncryptFilesController::SignEncryptFilesController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *p)
: Controller(ctx, p), d(new Private(this))
{
@@ -272,13 +271,13 @@ static const char *extension(bool pgp, bool sign, bool encrypt, bool ascii, bool
}
}
-static boost::shared_ptr<ArchiveDefinition> getDefaultAd()
+static std::shared_ptr<ArchiveDefinition> getDefaultAd()
{
- std::vector<boost::shared_ptr<ArchiveDefinition> > ads = ArchiveDefinition::getArchiveDefinitions();
+ std::vector<std::shared_ptr<ArchiveDefinition> > ads = ArchiveDefinition::getArchiveDefinitions();
assert(!ads.empty());
- boost::shared_ptr<ArchiveDefinition> ad = ads.front();
+ std::shared_ptr<ArchiveDefinition> ad = ads.front();
const FileOperationsPreferences prefs;
- Q_FOREACH (const boost::shared_ptr<ArchiveDefinition> toCheck, ads) {
+ Q_FOREACH (const std::shared_ptr<ArchiveDefinition> toCheck, ads) {
if (toCheck->id() == prefs.archiveCommand()) {
ad = toCheck;
break;
@@ -342,12 +341,12 @@ void SignEncryptFilesController::start()
d->ensureWizardVisible();
}
-static shared_ptr<SignEncryptFilesTask>
+static std::shared_ptr<SignEncryptFilesTask>
createSignEncryptTaskForFileInfo(const QFileInfo &fi, bool ascii,
const std::vector<Key> &recipients, const std::vector<Key> &signers,
const QString &outputName, bool symmetric)
{
- const shared_ptr<SignEncryptFilesTask> task(new SignEncryptFilesTask);
+ const std::shared_ptr<SignEncryptFilesTask> task(new SignEncryptFilesTask);
Q_ASSERT(!signers.empty() || !recipients.empty() || symmetric);
task->setAsciiArmor(ascii);
if (!signers.empty()) {
@@ -374,13 +373,13 @@ createSignEncryptTaskForFileInfo(const QFileInfo &fi, bool ascii,
return task;
}
-static shared_ptr<SignEncryptFilesTask>
+static std::shared_ptr<SignEncryptFilesTask>
createArchiveSignEncryptTaskForFiles(const QStringList &files,
- const shared_ptr<ArchiveDefinition> &ad, bool pgp, bool ascii,
+ const std::shared_ptr<ArchiveDefinition> &ad, bool pgp, bool ascii,
const std::vector<Key> &recipients, const std::vector<Key> &signers,
const QString& outputName, bool symmetric)
{
- const shared_ptr<SignEncryptFilesTask> task(new SignEncryptFilesTask);
+ const std::shared_ptr<SignEncryptFilesTask> task(new SignEncryptFilesTask);
task->setEncryptSymmetric(symmetric);
Q_ASSERT(!signers.empty() || !recipients.empty() || symmetric);
task->setAsciiArmor(ascii);
@@ -410,12 +409,12 @@ createArchiveSignEncryptTaskForFiles(const QStringList &files,
return task;
}
-static std::vector< shared_ptr<SignEncryptFilesTask> >
+static std::vector< std::shared_ptr<SignEncryptFilesTask> >
createSignEncryptTasksForFileInfo(const QFileInfo &fi, bool ascii, const std::vector<Key> &pgpRecipients, const std::vector<Key> &pgpSigners,
const std::vector<Key> &cmsRecipients, const std::vector<Key> &cmsSigners, const QMap<int, QString> outputNames,
bool symmetric)
{
- std::vector< shared_ptr<SignEncryptFilesTask> > result;
+ std::vector< std::shared_ptr<SignEncryptFilesTask> > result;
const bool pgp = !pgpSigners.empty() || !pgpRecipients.empty();
@@ -454,13 +453,13 @@ createSignEncryptTasksForFileInfo(const QFileInfo &fi, bool ascii, const std::ve
return result;
}
-static std::vector< shared_ptr<SignEncryptFilesTask> >
-createArchiveSignEncryptTasksForFiles(const QStringList &files, const shared_ptr<ArchiveDefinition> &ad,
+static std::vector< std::shared_ptr<SignEncryptFilesTask> >
+createArchiveSignEncryptTasksForFiles(const QStringList &files, const std::shared_ptr<ArchiveDefinition> &ad,
bool ascii, const std::vector<Key> &pgpRecipients,
const std::vector<Key> &pgpSigners, const std::vector<Key> &cmsRecipients, const std::vector<Key> &cmsSigners,
const QMap<int, QString> outputNames, bool symmetric)
{
- std::vector< shared_ptr<SignEncryptFilesTask> > result;
+ std::vector< std::shared_ptr<SignEncryptFilesTask> > result;
const bool pgp = !pgpSigners.empty() || !pgpRecipients.empty();
@@ -526,7 +525,7 @@ void SignEncryptFilesController::Private::slotWizardOperationPrepared()
}
}
- std::vector< shared_ptr<SignEncryptFilesTask> > tasks;
+ std::vector< std::shared_ptr<SignEncryptFilesTask> > tasks;
if (!archive) {
tasks.reserve(files.size());
}
@@ -544,7 +543,7 @@ void SignEncryptFilesController::Private::slotWizardOperationPrepared()
} else {
Q_FOREACH (const QString &file, files) {
- const std::vector< shared_ptr<SignEncryptFilesTask> > created =
+ const std::vector< std::shared_ptr<SignEncryptFilesTask> > created =
createSignEncryptTasksForFileInfo(QFileInfo(file), ascii,
pgpRecipients.toStdVector(),
pgpSigners.toStdVector(),
@@ -556,8 +555,8 @@ void SignEncryptFilesController::Private::slotWizardOperationPrepared()
}
}
- const shared_ptr<OverwritePolicy> overwritePolicy(new OverwritePolicy(wizard));
- Q_FOREACH (const shared_ptr<SignEncryptFilesTask> &i, tasks) {
+ const std::shared_ptr<OverwritePolicy> overwritePolicy(new OverwritePolicy(wizard));
+ Q_FOREACH (const std::shared_ptr<SignEncryptFilesTask> &i, tasks) {
i->setOverwritePolicy(overwritePolicy);
}
@@ -565,13 +564,13 @@ void SignEncryptFilesController::Private::slotWizardOperationPrepared()
runnable.swap(tasks);
- Q_FOREACH (const shared_ptr<Task> &task, runnable) {
+ Q_FOREACH (const std::shared_ptr<Task> &task, runnable) {
q->connectTask(task);
}
- boost::shared_ptr<TaskCollection> coll(new TaskCollection);
+ std::shared_ptr<TaskCollection> coll(new TaskCollection);
- std::vector<shared_ptr<Task> > tmp;
+ std::vector<std::shared_ptr<Task> > tmp;
std::copy(runnable.begin(), runnable.end(), std::back_inserter(tmp));
coll->setTasks(tmp);
wizard->setTaskCollection(coll);
@@ -594,13 +593,13 @@ void SignEncryptFilesController::Private::schedule()
{
if (!cms)
- if (const shared_ptr<SignEncryptFilesTask> t = takeRunnable(CMS)) {
+ if (const std::shared_ptr<SignEncryptFilesTask> t = takeRunnable(CMS)) {
t->start();
cms = t;
}
if (!openpgp)
- if (const shared_ptr<SignEncryptFilesTask> t = takeRunnable(OpenPGP)) {
+ if (const std::shared_ptr<SignEncryptFilesTask> t = takeRunnable(OpenPGP)) {
t->start();
openpgp = t;
}
@@ -611,21 +610,21 @@ void SignEncryptFilesController::Private::schedule()
}
}
-shared_ptr<SignEncryptFilesTask> SignEncryptFilesController::Private::takeRunnable(GpgME::Protocol proto)
+std::shared_ptr<SignEncryptFilesTask> SignEncryptFilesController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< shared_ptr<SignEncryptFilesTask> >::iterator it
+ const std::vector< std::shared_ptr<SignEncryptFilesTask> >::iterator it
= std::find_if(runnable.begin(), runnable.end(),
boost::bind(&Task::protocol, _1) == proto);
if (it == runnable.end()) {
- return shared_ptr<SignEncryptFilesTask>();
+ return std::shared_ptr<SignEncryptFilesTask>();
}
- const shared_ptr<SignEncryptFilesTask> result = *it;
+ const std::shared_ptr<SignEncryptFilesTask> result = *it;
runnable.erase(it);
return result;
}
-void SignEncryptFilesController::doTaskDone(const Task *task, const shared_ptr<const Task::Result> &result)
+void SignEncryptFilesController::doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &result)
{
Q_UNUSED(result)
assert(task);
diff --git a/src/crypto/signencryptfilescontroller.h b/src/crypto/signencryptfilescontroller.h
index 0685de4..106f340 100644
--- a/src/crypto/signencryptfilescontroller.h
+++ b/src/crypto/signencryptfilescontroller.h
@@ -40,8 +40,7 @@
#include <gpgme++/global.h>
#include <kmime/kmime_header_parsing.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace Kleo
@@ -54,7 +53,7 @@ class SignEncryptFilesController : public Controller
Q_OBJECT
public:
explicit SignEncryptFilesController(QObject *parent = Q_NULLPTR);
- explicit SignEncryptFilesController(const boost::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
+ explicit SignEncryptFilesController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
~SignEncryptFilesController();
void setProtocol(GpgME::Protocol proto);
@@ -91,7 +90,7 @@ public Q_SLOTS:
void cancel();
private:
- void doTaskDone(const Task *task, const boost::shared_ptr<const Task::Result> &) Q_DECL_OVERRIDE;
+ void doTaskDone(const Task *task, const std::shared_ptr<const Task::Result> &) Q_DECL_OVERRIDE;
class Private;
kdtools::pimpl_ptr<Private> d;
diff --git a/src/crypto/signencryptfilestask.cpp b/src/crypto/signencryptfilestask.cpp
index 27b8b77..199a1ed 100644
--- a/src/crypto/signencryptfilestask.cpp
+++ b/src/crypto/signencryptfilestask.cpp
@@ -43,11 +43,11 @@
#include <Libkleo/Formatting>
#include <Libkleo/Stl_Util>
#include <Libkleo/Exception>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/SignJob>
-#include <Libkleo/SignEncryptJob>
-#include <Libkleo/EncryptJob>
+
+#include <QGpgME/Protocol>
+#include <QGpgME/SignJob>
+#include <QGpgME/SignEncryptJob>
+#include <QGpgME/EncryptJob>
#include <gpgme++/signingresult.h>
#include <gpgme++/encryptionresult.h>
@@ -59,11 +59,8 @@
#include <QPointer>
#include <QTextDocument> // for Qt::escape
-#include <boost/bind.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
using namespace GpgME;
namespace
@@ -113,7 +110,7 @@ private:
class SignEncryptFilesResult : public Task::Result
{
public:
- SignEncryptFilesResult(const SigningResult &sr, const shared_ptr<Input> &input, const shared_ptr<Output> &output, bool outputCreated, const AuditLog &auditLog)
+ SignEncryptFilesResult(const SigningResult &sr, const std::shared_ptr<Input> &input, const std::shared_ptr<Output> &output, bool outputCreated, const AuditLog &auditLog)
: Task::Result(),
m_sresult(sr),
m_inputLabel(input ? input->label() : QString()),
@@ -128,7 +125,7 @@ public:
<< "outputError:" << m_outputErrorString;
assert(!m_sresult.isNull());
}
- SignEncryptFilesResult(const EncryptionResult &er, const shared_ptr<Input> &input, const shared_ptr<Output> &output, bool outputCreated, const AuditLog &auditLog)
+ SignEncryptFilesResult(const EncryptionResult &er, const std::shared_ptr<Input> &input, const std::shared_ptr<Output> &output, bool outputCreated, const AuditLog &auditLog)
: Task::Result(),
m_eresult(er),
m_inputLabel(input ? input->label() : QString()),
@@ -143,7 +140,7 @@ public:
<< "outputError:" << m_outputErrorString;
assert(!m_eresult.isNull());
}
- SignEncryptFilesResult(const SigningResult &sr, const EncryptionResult &er, const shared_ptr<Input> &input, const shared_ptr<Output> &output, bool outputCreated, const AuditLog &auditLog)
+ SignEncryptFilesResult(const SigningResult &sr, const EncryptionResult &er, const std::shared_ptr<Input> &input, const std::shared_ptr<Output> &output, bool outputCreated, const AuditLog &auditLog)
: Task::Result(),
m_sresult(sr),
m_eresult(er),
@@ -302,10 +299,10 @@ public:
explicit Private(SignEncryptFilesTask *qq);
private:
- std::unique_ptr<Kleo::SignJob> createSignJob(GpgME::Protocol proto);
- std::unique_ptr<Kleo::SignEncryptJob> createSignEncryptJob(GpgME::Protocol proto);
- std::unique_ptr<Kleo::EncryptJob> createEncryptJob(GpgME::Protocol proto);
- shared_ptr<const Task::Result> makeErrorResult(const Error &err, const QString &errStr, const AuditLog &auditLog);
+ std::unique_ptr<QGpgME::SignJob> createSignJob(GpgME::Protocol proto);
+ std::unique_ptr<QGpgME::SignEncryptJob> createSignEncryptJob(GpgME::Protocol proto);
+ std::unique_ptr<QGpgME::EncryptJob> createEncryptJob(GpgME::Protocol proto);
+ std::shared_ptr<const Task::Result> makeErrorResult(const Error &err, const QString &errStr, const AuditLog &auditLog);
private:
void slotResult(const SigningResult &);
@@ -313,8 +310,8 @@ private:
void slotResult(const EncryptionResult &);
private:
- shared_ptr<Input> input;
- shared_ptr<Output> output;
+ std::shared_ptr<Input> input;
+ std::shared_ptr<Output> output;
QStringList inputFileNames;
QString outputFileName;
std::vector<Key> signers;
@@ -325,8 +322,8 @@ private:
bool detached : 1;
bool symmetric: 1;
- QPointer<Kleo::Job> job;
- shared_ptr<OverwritePolicy> m_overwritePolicy;
+ QPointer<QGpgME::Job> job;
+ std::shared_ptr<OverwritePolicy> m_overwritePolicy;
};
SignEncryptFilesTask::Private::Private(SignEncryptFilesTask *qq)
@@ -346,9 +343,9 @@ SignEncryptFilesTask::Private::Private(SignEncryptFilesTask *qq)
q->setAsciiArmor(true);
}
-shared_ptr<const Task::Result> SignEncryptFilesTask::Private::makeErrorResult(const Error &err, const QString &errStr, const AuditLog &auditLog)
+std::shared_ptr<const Task::Result> SignEncryptFilesTask::Private::makeErrorResult(const Error &err, const QString &errStr, const AuditLog &auditLog)
{
- return shared_ptr<const ErrorResult>(new ErrorResult(sign, encrypt, err, errStr, input->label(), output->label(), auditLog));
+ return std::shared_ptr<const ErrorResult>(new ErrorResult(sign, encrypt, err, errStr, input->label(), output->label(), auditLog));
}
SignEncryptFilesTask::SignEncryptFilesTask(QObject *p)
@@ -373,7 +370,7 @@ void SignEncryptFilesTask::setInputFileNames(const QStringList &fileNames)
d->inputFileNames = fileNames;
}
-void SignEncryptFilesTask::setInput(const shared_ptr<Input> &input)
+void SignEncryptFilesTask::setInput(const std::shared_ptr<Input> &input)
{
kleo_assert(!d->job);
kleo_assert(input);
@@ -399,7 +396,7 @@ void SignEncryptFilesTask::setRecipients(const std::vector<Key> &recipients)
d->recipients = recipients;
}
-void SignEncryptFilesTask::setOverwritePolicy(const shared_ptr<OverwritePolicy> &policy)
+void SignEncryptFilesTask::setOverwritePolicy(const std::shared_ptr<OverwritePolicy> &policy)
{
kleo_assert(!d->job);
d->m_overwritePolicy = policy;
@@ -477,7 +474,7 @@ void SignEncryptFilesTask::doStart()
qDebug() << "Adding symmetric flag";
}
if (d->sign) {
- std::unique_ptr<Kleo::SignEncryptJob> job = d->createSignEncryptJob(protocol());
+ std::unique_ptr<QGpgME::SignEncryptJob> job = d->createSignEncryptJob(protocol());
kleo_assert(job.get());
job->start(d->signers, d->recipients,
@@ -485,7 +482,7 @@ void SignEncryptFilesTask::doStart()
d->job = job.release();
} else {
- std::unique_ptr<Kleo::EncryptJob> job = d->createEncryptJob(protocol());
+ std::unique_ptr<QGpgME::EncryptJob> job = d->createEncryptJob(protocol());
kleo_assert(job.get());
job->start(d->recipients, d->input->ioDevice(), d->output->ioDevice(), flags);
@@ -493,7 +490,7 @@ void SignEncryptFilesTask::doStart()
d->job = job.release();
}
} else if (d->sign) {
- std::unique_ptr<Kleo::SignJob> job = d->createSignJob(protocol());
+ std::unique_ptr<QGpgME::SignJob> job = d->createSignJob(protocol());
kleo_assert(job.get());
job->start(d->signers,
@@ -513,11 +510,11 @@ void SignEncryptFilesTask::cancel()
}
}
-std::unique_ptr<Kleo::SignJob> SignEncryptFilesTask::Private::createSignJob(GpgME::Protocol proto)
+std::unique_ptr<QGpgME::SignJob> SignEncryptFilesTask::Private::createSignJob(GpgME::Protocol proto)
{
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(proto);
+ const QGpgME::Protocol *const backend = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(backend);
- std::unique_ptr<Kleo::SignJob> signJob(backend->signJob(q->asciiArmor(), /*textmode=*/false));
+ std::unique_ptr<QGpgME::SignJob> signJob(backend->signJob(q->asciiArmor(), /*textmode=*/false));
kleo_assert(signJob.get());
connect(signJob.get(), SIGNAL(progress(QString,int,int)),
q, SLOT(setProgress(QString,int,int)));
@@ -526,11 +523,11 @@ std::unique_ptr<Kleo::SignJob> SignEncryptFilesTask::Private::createSignJob(GpgM
return signJob;
}
-std::unique_ptr<Kleo::SignEncryptJob> SignEncryptFilesTask::Private::createSignEncryptJob(GpgME::Protocol proto)
+std::unique_ptr<QGpgME::SignEncryptJob> SignEncryptFilesTask::Private::createSignEncryptJob(GpgME::Protocol proto)
{
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(proto);
+ const QGpgME::Protocol *const backend = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(backend);
- std::unique_ptr<Kleo::SignEncryptJob> signEncryptJob(backend->signEncryptJob(q->asciiArmor(), /*textmode=*/false));
+ std::unique_ptr<QGpgME::SignEncryptJob> signEncryptJob(backend->signEncryptJob(q->asciiArmor(), /*textmode=*/false));
kleo_assert(signEncryptJob.get());
connect(signEncryptJob.get(), SIGNAL(progress(QString,int,int)),
q, SLOT(setProgress(QString,int,int)));
@@ -539,11 +536,11 @@ std::unique_ptr<Kleo::SignEncryptJob> SignEncryptFilesTask::Private::createSignE
return signEncryptJob;
}
-std::unique_ptr<Kleo::EncryptJob> SignEncryptFilesTask::Private::createEncryptJob(GpgME::Protocol proto)
+std::unique_ptr<QGpgME::EncryptJob> SignEncryptFilesTask::Private::createEncryptJob(GpgME::Protocol proto)
{
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(proto);
+ const QGpgME::Protocol *const backend = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
kleo_assert(backend);
- std::unique_ptr<Kleo::EncryptJob> encryptJob(backend->encryptJob(q->asciiArmor(), /*textmode=*/false));
+ std::unique_ptr<QGpgME::EncryptJob> encryptJob(backend->encryptJob(q->asciiArmor(), /*textmode=*/false));
kleo_assert(encryptJob.get());
connect(encryptJob.get(), SIGNAL(progress(QString,int,int)),
q, SLOT(setProgress(QString,int,int)));
@@ -554,7 +551,7 @@ std::unique_ptr<Kleo::EncryptJob> SignEncryptFilesTask::Private::createEncryptJo
void SignEncryptFilesTask::Private::slotResult(const SigningResult &result)
{
- const Job *const job = qobject_cast<const Job *>(q->sender());
+ const QGpgME::Job *const job = qobject_cast<const QGpgME::Job *>(q->sender());
const AuditLog auditLog = AuditLog::fromJob(job);
bool outputCreated = false;
if (result.error().code()) {
@@ -571,12 +568,12 @@ void SignEncryptFilesTask::Private::slotResult(const SigningResult &result)
}
}
- q->emitResult(shared_ptr<Result>(new SignEncryptFilesResult(result, input, output, outputCreated, auditLog)));
+ q->emitResult(std::shared_ptr<Result>(new SignEncryptFilesResult(result, input, output, outputCreated, auditLog)));
}
void SignEncryptFilesTask::Private::slotResult(const SigningResult &sresult, const EncryptionResult &eresult)
{
- const Job *const job = qobject_cast<const Job *>(q->sender());
+ const QGpgME::Job *const job = qobject_cast<const QGpgME::Job *>(q->sender());
const AuditLog auditLog = AuditLog::fromJob(job);
bool outputCreated = false;
if (sresult.error().code() || eresult.error().code()) {
@@ -593,12 +590,12 @@ void SignEncryptFilesTask::Private::slotResult(const SigningResult &sresult, con
}
}
- q->emitResult(shared_ptr<Result>(new SignEncryptFilesResult(sresult, eresult, input, output, outputCreated, auditLog)));
+ q->emitResult(std::shared_ptr<Result>(new SignEncryptFilesResult(sresult, eresult, input, output, outputCreated, auditLog)));
}
void SignEncryptFilesTask::Private::slotResult(const EncryptionResult &result)
{
- const Job *const job = qobject_cast<const Job *>(q->sender());
+ const QGpgME::Job *const job = qobject_cast<const QGpgME::Job *>(q->sender());
const AuditLog auditLog = AuditLog::fromJob(job);
bool outputCreated = false;
if (result.error().code()) {
@@ -614,7 +611,7 @@ void SignEncryptFilesTask::Private::slotResult(const EncryptionResult &result)
return;
}
}
- q->emitResult(shared_ptr<Result>(new SignEncryptFilesResult(result, input, output, outputCreated, auditLog)));
+ q->emitResult(std::shared_ptr<Result>(new SignEncryptFilesResult(result, input, output, outputCreated, auditLog)));
}
QString SignEncryptFilesResult::overview() const
diff --git a/src/crypto/signencryptfilestask.h b/src/crypto/signencryptfilestask.h
index 85c4f0e..6a5a004 100644
--- a/src/crypto/signencryptfilestask.h
+++ b/src/crypto/signencryptfilestask.h
@@ -39,6 +39,7 @@
#include <gpgme++/global.h>
+#include <memory>
#include <vector>
class QString;
@@ -54,11 +55,6 @@ class OverwritePolicy;
class Input;
}
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
namespace Crypto
@@ -73,7 +69,7 @@ public:
void setInputFileName(const QString &fileName);
void setInputFileNames(const QStringList &fileNames);
- void setInput(const boost::shared_ptr<Input> &input);
+ void setInput(const std::shared_ptr<Input> &input);
void setOutputFileName(const QString &fileName);
void setSigners(const std::vector<GpgME::Key> &singners);
void setRecipients(const std::vector<GpgME::Key> &recipients);
@@ -83,7 +79,7 @@ public:
void setDetachedSignature(bool detached);
void setEncryptSymmetric(bool symmetric);
- void setOverwritePolicy(const boost::shared_ptr<OverwritePolicy> &policy);
+ void setOverwritePolicy(const std::shared_ptr<OverwritePolicy> &policy);
GpgME::Protocol protocol() const Q_DECL_OVERRIDE;
void cancel() Q_DECL_OVERRIDE;
diff --git a/src/crypto/task.cpp b/src/crypto/task.cpp
index 2822b84..5b6f2d1 100644
--- a/src/crypto/task.cpp
+++ b/src/crypto/task.cpp
@@ -141,9 +141,9 @@ bool Task::asciiArmor() const
return d->m_asciiArmor;
}
-shared_ptr<Task> Task::makeErrorTask(int code, const QString &details, const QString &label)
+std::shared_ptr<Task> Task::makeErrorTask(int code, const QString &details, const QString &label)
{
- const shared_ptr<SimpleTask> t(new SimpleTask(label));
+ const std::shared_ptr<SimpleTask> t(new SimpleTask(label));
t->setResult(t->makeErrorResult(code, details));
return t;
}
@@ -202,16 +202,16 @@ void Task::emitError(int errCode, const QString &details)
emitResult(makeErrorResult(errCode, details));
}
-void Task::emitResult(const shared_ptr<const Task::Result> &r)
+void Task::emitResult(const std::shared_ptr<const Task::Result> &r)
{
d->m_progress = d->m_totalProgress;
Q_EMIT progress(progressLabel(), currentProgress(), totalProgress());
Q_EMIT result(r);
}
-shared_ptr<Task::Result> Task::makeErrorResult(int errCode, const QString &details)
+std::shared_ptr<Task::Result> Task::makeErrorResult(int errCode, const QString &details)
{
- return shared_ptr<Task::Result>(new ErrorResult(errCode, details));
+ return std::shared_ptr<Task::Result>(new ErrorResult(errCode, details));
}
class Task::Result::Private
diff --git a/src/crypto/task.h b/src/crypto/task.h
index 8b0289a..146f8a7 100644
--- a/src/crypto/task.h
+++ b/src/crypto/task.h
@@ -40,7 +40,7 @@
#include <gpgme++/global.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace Kleo
{
@@ -78,7 +78,7 @@ public:
int id() const;
- static boost::shared_ptr<Task> makeErrorTask(int code, const QString &details, const QString &label);
+ static std::shared_ptr<Task> makeErrorTask(int code, const QString &details, const QString &label);
public Q_SLOTS:
virtual void cancel() = 0;
@@ -91,13 +91,13 @@ private: // don't tell moc, but those signals are in fact private
#endif
#endif
void progress(const QString &what, int processed, int total);
- void result(const boost::shared_ptr<const Kleo::Crypto::Task::Result> &);
+ void result(const std::shared_ptr<const Kleo::Crypto::Task::Result> &);
void started();
protected:
- boost::shared_ptr<Result> makeErrorResult(int errCode, const QString &details);
+ std::shared_ptr<Result> makeErrorResult(int errCode, const QString &details);
- void emitResult(const boost::shared_ptr<const Task::Result> &result);
+ void emitResult(const std::shared_ptr<const Task::Result> &result);
protected Q_SLOTS:
void setProgress(const QString &msg, int processed, int total);
diff --git a/src/crypto/task_p.h b/src/crypto/task_p.h
index 2557bbb..276f28f 100644
--- a/src/crypto/task_p.h
+++ b/src/crypto/task_p.h
@@ -49,7 +49,7 @@ class SimpleTask : public Task
public:
explicit SimpleTask(const QString &label) : m_result(), m_label(label) {}
- void setResult(const boost::shared_ptr<const Task::Result> &res)
+ void setResult(const std::shared_ptr<const Task::Result> &res)
{
m_result = res;
}
@@ -77,7 +77,7 @@ private Q_SLOTS:
emitResult(m_result);
}
private:
- boost::shared_ptr<const Task::Result> m_result;
+ std::shared_ptr<const Task::Result> m_result;
QString m_label;
};
}
diff --git a/src/crypto/taskcollection.cpp b/src/crypto/taskcollection.cpp
index 8cb6e5a..a0aa012 100644
--- a/src/crypto/taskcollection.cpp
+++ b/src/crypto/taskcollection.cpp
@@ -39,8 +39,6 @@
#include "crypto/task.h"
#include "utils/gnupg-helper.h"
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <map>
@@ -49,7 +47,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class TaskCollection::Private
{
@@ -58,11 +55,11 @@ public:
explicit Private(TaskCollection *qq);
void taskProgress(const QString &, int, int);
- void taskResult(const shared_ptr<const Task::Result> &);
+ void taskResult(const std::shared_ptr<const Task::Result> &);
void taskStarted();
void calculateAndEmitProgress();
- std::map<int, shared_ptr<Task> > m_tasks;
+ std::map<int, std::shared_ptr<Task> > m_tasks;
mutable quint64 m_totalProgress;
mutable quint64 m_progress;
unsigned int m_nCompleted;
@@ -97,7 +94,7 @@ void TaskCollection::Private::taskProgress(const QString &msg, int, int)
calculateAndEmitProgress();
}
-void TaskCollection::Private::taskResult(const shared_ptr<const Task::Result> &result)
+void TaskCollection::Private::taskResult(const std::shared_ptr<const Task::Result> &result)
{
assert(result);
++m_nCompleted;
@@ -122,12 +119,16 @@ void TaskCollection::Private::taskStarted()
void TaskCollection::Private::calculateAndEmitProgress()
{
- typedef std::map<int, shared_ptr<Task> >::const_iterator ConstIterator;
+ typedef std::map<int, std::shared_ptr<Task> >::const_iterator ConstIterator;
quint64 total = 0;
quint64 processed = 0;
+#if 0
static bool haveWorkingProgress = hasFeature(0, GpgME::ProgressForCallbacks) && engineIsVersion(2, 1, 15);
+#endif
+#warning PORTME_GPGME
+ static bool haveWorkingProgress = true && engineIsVersion(2, 1, 15);
if (!haveWorkingProgress) {
// GnuPG before 2.1.15 would overflow on progress values > max int.
// and did not emit a total for our Qt data types.
@@ -144,7 +145,7 @@ void TaskCollection::Private::calculateAndEmitProgress()
bool unknowable = false;
for (ConstIterator it = m_tasks.begin(), end = m_tasks.end(); it != end; ++it) {
// Sum up progress and totals
- const shared_ptr<Task> &i = it->second;
+ const std::shared_ptr<Task> &i = it->second;
assert(i);
if (!i->totalProgress()) {
// There still might be jobs for which we don't know the progress.
@@ -190,16 +191,16 @@ bool TaskCollection::errorOccurred() const
return d->m_errorOccurred;
}
-shared_ptr<Task> TaskCollection::taskById(int id) const
+std::shared_ptr<Task> TaskCollection::taskById(int id) const
{
- const std::map<int, shared_ptr<Task> >::const_iterator it = d->m_tasks.find(id);
- return it != d->m_tasks.end() ? it->second : shared_ptr<Task>();
+ const std::map<int, std::shared_ptr<Task> >::const_iterator it = d->m_tasks.find(id);
+ return it != d->m_tasks.end() ? it->second : std::shared_ptr<Task>();
}
-std::vector<shared_ptr<Task> > TaskCollection::tasks() const
+std::vector<std::shared_ptr<Task> > TaskCollection::tasks() const
{
- typedef std::map<int, shared_ptr<Task> >::const_iterator ConstIterator;
- std::vector<shared_ptr<Task> > res;
+ typedef std::map<int, std::shared_ptr<Task> >::const_iterator ConstIterator;
+ std::vector<std::shared_ptr<Task> > res;
res.reserve(d->m_tasks.size());
for (ConstIterator it = d->m_tasks.begin(), end = d->m_tasks.end(); it != end; ++it) {
res.push_back(it->second);
@@ -207,15 +208,15 @@ std::vector<shared_ptr<Task> > TaskCollection::tasks() const
return res;
}
-void TaskCollection::setTasks(const std::vector<shared_ptr<Task> > &tasks)
+void TaskCollection::setTasks(const std::vector<std::shared_ptr<Task> > &tasks)
{
- Q_FOREACH (const shared_ptr<Task> &i, tasks) {
+ Q_FOREACH (const std::shared_ptr<Task> &i, tasks) {
assert(i);
d->m_tasks[i->id()] = i;
connect(i.get(), SIGNAL(progress(QString,int,int)),
this, SLOT(taskProgress(QString,int,int)));
- connect(i.get(), SIGNAL(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)),
- this, SLOT(taskResult(boost::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(i.get(), SIGNAL(result(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(taskResult(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)));
connect(i.get(), SIGNAL(started()),
this, SLOT(taskStarted()));
}
diff --git a/src/crypto/taskcollection.h b/src/crypto/taskcollection.h
index 935646d..906495f 100644
--- a/src/crypto/taskcollection.h
+++ b/src/crypto/taskcollection.h
@@ -39,7 +39,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <vector>
@@ -55,10 +55,10 @@ public:
explicit TaskCollection(QObject *parent = Q_NULLPTR);
~TaskCollection();
- std::vector<boost::shared_ptr<Task> > tasks() const;
- boost::shared_ptr<Task> taskById(int id) const;
+ std::vector<std::shared_ptr<Task> > tasks() const;
+ std::shared_ptr<Task> taskById(int id) const;
- void setTasks(const std::vector<boost::shared_ptr<Task> > &tasks);
+ void setTasks(const std::vector<std::shared_ptr<Task> > &tasks);
bool isEmpty() const;
size_t size() const;
@@ -69,15 +69,15 @@ public:
Q_SIGNALS:
void progress(const QString &msg, int processed, int total);
- void result(const boost::shared_ptr<const Kleo::Crypto::Task::Result> &result);
- void started(const boost::shared_ptr<Kleo::Crypto::Task> &task);
+ void result(const std::shared_ptr<const Kleo::Crypto::Task::Result> &result);
+ void started(const std::shared_ptr<Kleo::Crypto::Task> &task);
void done();
private:
class Private;
kdtools::pimpl_ptr<Private> d;
Q_PRIVATE_SLOT(d, void taskProgress(QString, int, int))
- Q_PRIVATE_SLOT(d, void taskResult(boost::shared_ptr<const Kleo::Crypto::Task::Result>))
+ Q_PRIVATE_SLOT(d, void taskResult(std::shared_ptr<const Kleo::Crypto::Task::Result>))
Q_PRIVATE_SLOT(d, void taskStarted())
};
}
diff --git a/src/crypto/verifychecksumscontroller.cpp b/src/crypto/verifychecksumscontroller.cpp
index 6fe16ea..ce41c9b 100644
--- a/src/crypto/verifychecksumscontroller.cpp
+++ b/src/crypto/verifychecksumscontroller.cpp
@@ -103,10 +103,10 @@ static QStringList fs_intersect(QStringList l1, QStringList l2)
}
#endif
-static QList<QRegExp> get_patterns(const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+static QList<QRegExp> get_patterns(const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
QList<QRegExp> result;
- Q_FOREACH (const shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
+ Q_FOREACH (const std::shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
if (cd)
Q_FOREACH (const QString &pattern, cd->patterns()) {
result.push_back(QRegExp(pattern, fs_cs));
@@ -168,7 +168,7 @@ private:
private:
QPointer<VerifyChecksumsDialog> dialog;
mutable QMutex mutex;
- const std::vector< shared_ptr<ChecksumDefinition> > checksumDefinitions;
+ const std::vector< std::shared_ptr<ChecksumDefinition> > checksumDefinitions;
QStringList files;
QStringList errors;
volatile bool canceled;
@@ -200,7 +200,7 @@ VerifyChecksumsController::VerifyChecksumsController(QObject *p)
}
-VerifyChecksumsController::VerifyChecksumsController(const shared_ptr<const ExecutionContext> &ctx, QObject *p)
+VerifyChecksumsController::VerifyChecksumsController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *p)
: Controller(ctx, p), d(new Private(this))
{
@@ -262,7 +262,7 @@ struct SumFile {
QDir dir;
QString sumFile;
quint64 totalSize;
- shared_ptr<ChecksumDefinition> checksumDefinition;
+ std::shared_ptr<ChecksumDefinition> checksumDefinition;
};
}
@@ -342,16 +342,16 @@ static quint64 aggregate_size(const QDir &dir, const QStringList &files)
return n;
}
-static shared_ptr<ChecksumDefinition> filename2definition(const QString &fileName,
- const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+static std::shared_ptr<ChecksumDefinition> filename2definition(const QString &fileName,
+ const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
- Q_FOREACH (const shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
+ Q_FOREACH (const std::shared_ptr<ChecksumDefinition> &cd, checksumDefinitions)
if (cd)
Q_FOREACH (const QString &pattern, cd->patterns())
if (QRegExp(pattern, fs_cs).exactMatch(fileName)) {
return cd;
}
- return shared_ptr<ChecksumDefinition>();
+ return std::shared_ptr<ChecksumDefinition>();
}
namespace
@@ -438,7 +438,7 @@ static QStringList find_base_directiories(const QStringList &files)
static std::vector<SumFile> find_sums_by_input_files(const QStringList &files, QStringList &errors,
const function<void(int)> &progress,
- const std::vector< shared_ptr<ChecksumDefinition> > &checksumDefinitions)
+ const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
const QList<QRegExp> patterns = get_patterns(checksumDefinitions);
@@ -615,7 +615,7 @@ void VerifyChecksumsController::Private::run()
QMutexLocker locker(&mutex);
const QStringList files = this->files;
- const std::vector< shared_ptr<ChecksumDefinition> > checksumDefinitions = this->checksumDefinitions;
+ const std::vector< std::shared_ptr<ChecksumDefinition> > checksumDefinitions = this->checksumDefinitions;
locker.unlock();
diff --git a/src/crypto/verifychecksumscontroller.h b/src/crypto/verifychecksumscontroller.h
index 7c72a4a..019f915 100644
--- a/src/crypto/verifychecksumscontroller.h
+++ b/src/crypto/verifychecksumscontroller.h
@@ -42,8 +42,7 @@
#include <gpgme++/global.h>
#include <kmime/kmime_header_parsing.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace Kleo
@@ -56,7 +55,7 @@ class VerifyChecksumsController : public Controller
Q_OBJECT
public:
explicit VerifyChecksumsController(QObject *parent = Q_NULLPTR);
- explicit VerifyChecksumsController(const boost::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
+ explicit VerifyChecksumsController(const std::shared_ptr<const ExecutionContext> &ctx, QObject *parent = Q_NULLPTR);
~VerifyChecksumsController();
void setFiles(const QStringList &files);
diff --git a/src/dialogs/certificatedetailsdialog.cpp b/src/dialogs/certificatedetailsdialog.cpp
index 4c03ad2..c05fa6b 100644
--- a/src/dialogs/certificatedetailsdialog.cpp
+++ b/src/dialogs/certificatedetailsdialog.cpp
@@ -50,11 +50,11 @@
#include <Libkleo/SubkeyListModel>
#include <Libkleo/KeyCache>
#include <Libkleo/Formatting>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/KeyListJob>
#include <Libkleo/Dn>
+#include <QGpgME/Protocol>
+#include <QGpgME/KeyListJob>
+
#include <gpgme++/key.h>
#include <gpgme++/keylistresult.h>
@@ -244,11 +244,11 @@ private:
if (keyListJob) {
return;
}
- const CryptoBackend::Protocol *const protocol = CryptoBackendFactory::instance()->protocol(key.protocol());
+ const QGpgME::Protocol *const protocol = (key.protocol() == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!protocol) {
return;
}
- KeyListJob *const job = protocol->keyListJob(/*remote*/false, /*includeSigs*/true, /*validate*/true);
+ QGpgME::KeyListJob *const job = protocol->keyListJob(/*remote*/false, /*includeSigs*/true, /*validate*/true);
if (!job) {
return;
}
@@ -463,7 +463,7 @@ private:
QPointer<DumpCertificateCommand> dumpCertificateCommand;
- QPointer<KeyListJob> keyListJob;
+ QPointer<QGpgME::KeyListJob> keyListJob;
struct UI : public Ui_CertificateDetailsDialog {
explicit UI(Dialogs::CertificateDetailsDialog *qq)
diff --git a/src/dialogs/certifycertificatedialog.cpp b/src/dialogs/certifycertificatedialog.cpp
index 6872f3c..c2f3405 100644
--- a/src/dialogs/certifycertificatedialog.cpp
+++ b/src/dialogs/certifycertificatedialog.cpp
@@ -443,7 +443,7 @@ unsigned int CertifyCertificateDialog::selectedCheckLevel() const
return 0;
}
-void CertifyCertificateDialog::connectJob(SignKeyJob *job)
+void CertifyCertificateDialog::connectJob(QGpgME::SignKeyJob *job)
{
connect(job, SIGNAL(result(GpgME::Error)), this, SLOT(certificationResult(GpgME::Error)));
d->summaryPage->setSummary(d->createSummary());
diff --git a/src/dialogs/certifycertificatedialog.h b/src/dialogs/certifycertificatedialog.h
index e31531f..cab8eae 100644
--- a/src/dialogs/certifycertificatedialog.h
+++ b/src/dialogs/certifycertificatedialog.h
@@ -35,7 +35,7 @@
#include <QWizard>
-#include <Libkleo/SignKeyJob>
+#include <QGpgME/SignKeyJob>
#include <gpgme++/key.h>
@@ -48,7 +48,6 @@ class Error;
namespace Kleo
{
-class SignKeyJob;
namespace Dialogs
{
@@ -78,7 +77,7 @@ public:
void setCertificateToCertify(const GpgME::Key &key);
- void connectJob(Kleo::SignKeyJob *job);
+ void connectJob(QGpgME::SignKeyJob *job);
void setError(const GpgME::Error &error);
Q_SIGNALS:
diff --git a/src/dialogs/certifycertificatedialog_p.h b/src/dialogs/certifycertificatedialog_p.h
index e07c3ca..d5bdf54 100644
--- a/src/dialogs/certifycertificatedialog_p.h
+++ b/src/dialogs/certifycertificatedialog_p.h
@@ -36,7 +36,7 @@
#include "ui_selectchecklevelwidget.h"
#include "ui_certificationoptionswidget.h"
-#include <libkleo/signkeyjob.h>
+#include <qgpgme/signkeyjob.h>
#include <gpgme++/key.h>
diff --git a/src/kleopatraapplication.cpp b/src/kleopatraapplication.cpp
index 203a4c8..4be1109 100644
--- a/src/kleopatraapplication.cpp
+++ b/src/kleopatraapplication.cpp
@@ -148,7 +148,7 @@ public:
SysTrayIcon *sysTray;
#endif
shared_ptr<KeyCache> keyCache;
- shared_ptr<Log> log;
+ std::shared_ptr<Log> log;
shared_ptr<FileSystemWatcher> watcher;
public:
diff --git a/src/kwatchgnupg/kwatchgnupgmainwin.cpp b/src/kwatchgnupg/kwatchgnupgmainwin.cpp
index 7dae4e2..9d412d2 100644
--- a/src/kwatchgnupg/kwatchgnupgmainwin.cpp
+++ b/src/kwatchgnupg/kwatchgnupgmainwin.cpp
@@ -37,8 +37,8 @@
#include "kwatchgnupg.h"
#include "tray.h"
-#include "Libkleo/CryptoBackendFactory"
-#include "Libkleo/CryptoConfig"
+#include <QGpgME/Protocol>
+#include <QGpgME/CryptoConfig>
#include "utils/kdlogtextwidget.h"
@@ -162,7 +162,7 @@ void KWatchGnuPGMainWindow::setGnuPGConfig()
{
QStringList logclients;
// Get config object
- Kleo::CryptoConfig *cconfig = Kleo::CryptoBackendFactory::instance()->config();
+ QGpgME::CryptoConfig *cconfig = QGpgME::cryptoConfig();
if (!cconfig) {
return;
}
@@ -170,12 +170,12 @@ void KWatchGnuPGMainWindow::setGnuPGConfig()
KConfigGroup config(KSharedConfig::openConfig(), "WatchGnuPG");
const QStringList comps = cconfig->componentList();
for (QStringList::const_iterator it = comps.constBegin(); it != comps.constEnd(); ++it) {
- Kleo::CryptoConfigComponent *comp = cconfig->component(*it);
+ QGpgME::CryptoConfigComponent *comp = cconfig->component(*it);
Q_ASSERT(comp);
// Look for log-file entry in Debug group
- Kleo::CryptoConfigGroup *group = comp->group(QStringLiteral("Debug"));
+ QGpgME::CryptoConfigGroup *group = comp->group(QStringLiteral("Debug"));
if (group) {
- Kleo::CryptoConfigEntry *entry = group->entry(QStringLiteral("log-file"));
+ QGpgME::CryptoConfigEntry *entry = group->entry(QStringLiteral("log-file"));
if (entry) {
entry->setStringValue(QLatin1String("socket://") + config.readEntry("Socket", WATCHGNUPGSOCKET));
logclients << QStringLiteral("%1 (%2)").arg(*it, comp->description());
diff --git a/src/main.cpp b/src/main.cpp
index 2fd02fb..b455e3b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -82,23 +82,11 @@
#include <gpgme++/global.h>
#include <gpgme++/error.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <cassert>
#include <iostream>
#include <QCommandLineParser>
-using namespace boost;
-
-namespace
-{
-template <typename T>
-boost::shared_ptr<T> make_shared_ptr(T *t)
-{
- return t ? boost::shared_ptr<T>(t) : boost::shared_ptr<T>();
-}
-}
-
static bool selfCheck()
{
Kleo::Commands::SelfTestCommand cmd(0);
@@ -194,7 +182,7 @@ int main(int argc, char **argv)
QObject::connect(&server, &Kleo::UiServer::startConfigDialogRequested, &app, &KleopatraApplication::openOrRaiseConfigDialog);
-#define REGISTER( Command ) server.registerCommandFactory( boost::shared_ptr<Kleo::AssuanCommandFactory>( new Kleo::GenericAssuanCommandFactory<Kleo::Command> ) )
+#define REGISTER( Command ) server.registerCommandFactory( std::shared_ptr<Kleo::AssuanCommandFactory>( new Kleo::GenericAssuanCommandFactory<Kleo::Command> ) )
REGISTER(CreateChecksumsCommand);
REGISTER(DecryptCommand);
REGISTER(DecryptFilesCommand);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6b5ab0a..223c106 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -81,10 +81,10 @@
#include <Libkleo/KeyListModel>
#include <Libkleo/KeyListSortFilterProxyModel>
#include <libkleo/cryptoconfigdialog.h>
-#include <Libkleo/CryptoConfig>
#include <Libkleo/Stl_Util>
-#include <Libkleo/CryptoBackendFactory>
#include <Libkleo/Classify>
+#include <QGpgME/CryptoConfig>
+#include <QGpgME/Protocol>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
@@ -366,7 +366,7 @@ void MainWindow::Private::setupActions()
void MainWindow::Private::configureBackend()
{
- Kleo::CryptoConfig *const config = Kleo::CryptoBackendFactory::instance()->config();
+ QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
KMessageBox::error(q, i18n("Could not configure the cryptography backend (gpgconf tool not found)"), i18n("Configuration Error"));
return;
diff --git a/src/newcertificatewizard/newcertificatewizard.cpp b/src/newcertificatewizard/newcertificatewizard.cpp
index 0d36b01..43f7cba 100644
--- a/src/newcertificatewizard/newcertificatewizard.cpp
+++ b/src/newcertificatewizard/newcertificatewizard.cpp
@@ -54,12 +54,12 @@
#include <Libkleo/Stl_Util>
#include <Libkleo/Dn>
#include <Libkleo/OidMap>
-#include <Libkleo/KeyGenerationJob>
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
#include <Libkleo/KeyCache>
#include <Libkleo/Formatting>
+#include <QGpgME/KeyGenerationJob>
+#include <QGpgME/Protocol>
+
#include <gpgme++/global.h>
#include <gpgme++/keygenerationresult.h>
@@ -781,11 +781,11 @@ public:
private:
void startJob()
{
- const CryptoBackend::Protocol *const proto = CryptoBackendFactory::instance()->protocol(pgp() ? OpenPGP : CMS);
+ const auto proto = (pgp() == OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!proto) {
return;
}
- KeyGenerationJob *const j = proto->keyGenerationJob();
+ QGpgME::KeyGenerationJob *const j = proto->keyGenerationJob();
if (!j) {
return;
}
@@ -840,7 +840,7 @@ private Q_SLOTS:
}
private:
- QPointer<KeyGenerationJob> job;
+ QPointer<QGpgME::KeyGenerationJob> job;
Ui_KeyCreationPage ui;
};
diff --git a/src/selftest/gpgagentcheck.cpp b/src/selftest/gpgagentcheck.cpp
index 952fe4e..abdbbf8 100644
--- a/src/selftest/gpgagentcheck.cpp
+++ b/src/selftest/gpgagentcheck.cpp
@@ -39,7 +39,6 @@
#include <utils/getpid.h>
#include <gpgme++/context.h>
-#include <gpgme++/assuanresult.h>
#include <gpgme++/gpgagentgetinfoassuantransaction.h>
#include <QTextDocument> // for Qt::escape
@@ -90,7 +89,7 @@ public:
} else {
Error error;
- const std::auto_ptr<Context> ctx = Context::createForEngine(AssuanEngine, &error);
+ const std::unique_ptr<Context> ctx = Context::createForEngine(AssuanEngine, &error);
if (!ctx.get()) {
m_error = i18n("GpgME does not support gpg-agent");
m_explaination = xi18nc("@info",
@@ -104,24 +103,15 @@ public:
m_skipped = false;
- const AssuanResult result = ctx->assuanTransact("GETINFO version");
- if (result.error()) {
- m_passed = false;
- m_error = i18n("not reachable");
- m_explaination = xi18nc("@info",
- "Could not connect to GpgAgent: <message>%1</message>",
- QString::fromLocal8Bit(result.error().asString()).toHtmlEscaped());
- m_proposedFix = xi18nc("@info",
- "<para>Check that gpg-agent is running and that the "
- "<environment>GPG_AGENT_INFO</environment> variable is set and up-to-date.</para>");
- } else if (result.assuanError()) {
+ const Error error = ctx->assuanTransact("GETINFO version");
+ if (error) {
m_passed = false;
m_error = i18n("unexpected error");
m_explaination = xi18nc("@info",
"<para>Unexpected error while asking <application>gpg-agent</application> "
"for its version.</para>"
"<para>The error returned was: <message>%1</message>.</para>",
- QString::fromLocal8Bit(result.assuanError().asString()).toHtmlEscaped());
+ QString::fromLocal8Bit(error.asString()).toHtmlEscaped());
// PENDING(marc) proposed fix?
} else {
m_passed = true;
diff --git a/src/smartcard/readerstatus.cpp b/src/smartcard/readerstatus.cpp
index 3bb5dff..eeefc41 100644
--- a/src/smartcard/readerstatus.cpp
+++ b/src/smartcard/readerstatus.cpp
@@ -40,7 +40,6 @@
#include <Libkleo/Stl_Util>
#include <gpgme++/context.h>
-#include <gpgme++/assuanresult.h>
#include <gpgme++/defaultassuantransaction.h>
#include <gpgme++/key.h>
#include <gpgme++/keylistresult.h>
@@ -63,8 +62,8 @@
#include <boost/static_assert.hpp>
#include <boost/range.hpp>
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <vector>
#include <set>
#include <list>
@@ -155,17 +154,6 @@ static unsigned int parseFileName(const QString &fileName, bool *ok)
namespace
{
-template <typename T_Target, typename T_Source>
-std::auto_ptr<T_Target> dynamic_pointer_cast(std::auto_ptr<T_Source> &in)
-{
- if (T_Target *const target = dynamic_cast<T_Target *>(in.get())) {
- in.release();
- return std::auto_ptr<T_Target>(target);
- } else {
- return std::auto_ptr<T_Target>();
- }
-}
-
template <typename T>
const T &_trace__impl(const T &t, const char *msg)
{
@@ -227,16 +215,12 @@ static ReaderStatus::PinState parse_pin_state(const std::string &s)
}
}
-static std::auto_ptr<DefaultAssuanTransaction> gpgagent_transact(shared_ptr<Context> &gpgAgent, const char *command, Error &err)
+static std::unique_ptr<DefaultAssuanTransaction> gpgagent_transact(std::shared_ptr<Context> &gpgAgent, const char *command, Error &err)
{
#ifdef DEBUG_SCREADER
qCDebug(KLEOPATRA_LOG) << "gpgagent_transact(" << command << ")";
#endif
- const AssuanResult res = gpgAgent->assuanTransact(command);
- err = res.error();
- if (!err.code()) {
- err = res.assuanError();
- }
+ err = gpgAgent->assuanTransact(command);
if (err.code()) {
#ifdef DEBUG_SCREADER
qCDebug(KLEOPATRA_LOG) << "gpgagent_transact(" << command << "):" << QString::fromLocal8Bit(err.asString());
@@ -245,18 +229,18 @@ static std::auto_ptr<DefaultAssuanTransaction> gpgagent_transact(shared_ptr<Cont
qCDebug(KLEOPATRA_LOG) << "Assuan problem, killing context";
gpgAgent.reset();
}
- return std::auto_ptr<DefaultAssuanTransaction>();
+ return std::unique_ptr<DefaultAssuanTransaction>();
}
- std::auto_ptr<AssuanTransaction> t = gpgAgent->takeLastAssuanTransaction();
- return dynamic_pointer_cast<DefaultAssuanTransaction>(t);
+ std::unique_ptr<AssuanTransaction> t = gpgAgent->takeLastAssuanTransaction();
+ return std::unique_ptr<DefaultAssuanTransaction>(dynamic_cast<DefaultAssuanTransaction*>(t.release()));
}
// returns const std::string so template deduction in boost::split works, and we don't need a temporary
-static const std::string scd_getattr_status(shared_ptr<Context> &gpgAgent, const char *what, Error &err)
+static const std::string scd_getattr_status(std::shared_ptr<Context> &gpgAgent, const char *what, Error &err)
{
std::string cmd = "SCD GETATTR ";
cmd += what;
- const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact(gpgAgent, cmd.c_str(), err);
+ const std::unique_ptr<DefaultAssuanTransaction> t = gpgagent_transact(gpgAgent, cmd.c_str(), err);
if (t.get()) {
qCDebug(KLEOPATRA_LOG) << "scd_getattr_status(" << what << "): got" << t->statusLines();
return t->firstStatusLine(what);
@@ -275,10 +259,10 @@ static unsigned int parse_event_counter(const std::string &str)
return -1;
}
-static unsigned int get_event_counter(shared_ptr<Context> &gpgAgent)
+static unsigned int get_event_counter(std::shared_ptr<Context> &gpgAgent)
{
Error err;
- const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact(gpgAgent, "GETEVENTCOUNTER", err);
+ const std::unique_ptr<DefaultAssuanTransaction> t = gpgagent_transact(gpgAgent, "GETEVENTCOUNTER", err);
if (err.code()) {
qCDebug(KLEOPATRA_LOG) << "get_event_counter(): got error" << err.asString();
}
@@ -294,9 +278,9 @@ static unsigned int get_event_counter(shared_ptr<Context> &gpgAgent)
}
// returns const std::string so template deduction in boost::split works, and we don't need a temporary
-static const std::string gpgagent_data(shared_ptr<Context> &gpgAgent, const char *what, Error &err)
+static const std::string gpgagent_data(std::shared_ptr<Context> &gpgAgent, const char *what, Error &err)
{
- const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact(gpgAgent, what, err);
+ const std::unique_ptr<DefaultAssuanTransaction> t = gpgagent_transact(gpgAgent, what, err);
if (t.get()) {
return t->data();
} else {
@@ -328,7 +312,7 @@ static bool parse_keypairinfo_and_lookup_key(Context *ctx, const std::string &kp
return !e && !key.isNull();
}
-static CardInfo get_card_status(const QString &fileName, unsigned int idx, shared_ptr<Context> &gpg_agent)
+static CardInfo get_card_status(const QString &fileName, unsigned int idx, std::shared_ptr<Context> &gpg_agent)
{
#ifdef DEBUG_SCREADER
qCDebug(KLEOPATRA_LOG) << "get_card_status(" << fileName << ',' << idx << ',' << gpg_agent.get() << ')';
@@ -381,7 +365,7 @@ static CardInfo get_card_status(const QString &fileName, unsigned int idx, share
}
// check for keys to learn:
- const std::auto_ptr<DefaultAssuanTransaction> result = gpgagent_transact(gpg_agent, "SCD LEARN --keypairinfo", err);
+ const std::unique_ptr<DefaultAssuanTransaction> result = gpgagent_transact(gpg_agent, "SCD LEARN --keypairinfo", err);
if (err.code() || !result.get()) {
return ci;
}
@@ -391,7 +375,7 @@ static CardInfo get_card_status(const QString &fileName, unsigned int idx, share
}
// check that any of the
- const std::auto_ptr<Context> klc(Context::createForProtocol(CMS)); // what about OpenPGP?
+ const std::unique_ptr<Context> klc(Context::createForProtocol(CMS)); // what about OpenPGP?
if (!klc.get()) {
return ci;
}
@@ -408,7 +392,7 @@ static CardInfo get_card_status(const QString &fileName, unsigned int idx, share
return ci;
}
-static std::vector<CardInfo> update_cardinfo(const QString &gnupgHomePath, shared_ptr<Context> &gpgAgent)
+static std::vector<CardInfo> update_cardinfo(const QString &gnupgHomePath, std::shared_ptr<Context> &gpgAgent)
{
#ifdef DEBUG_SCREADER
qCDebug(KLEOPATRA_LOG) << "<update_cardinfo>";
@@ -425,7 +409,7 @@ static std::vector<CardInfo> update_cardinfo(const QString &gnupgHomePath, share
return std::vector<CardInfo>(1, ci);
}
-static bool check_event_counter_changed(shared_ptr<Context> &gpg_agent, unsigned int &counter)
+static bool check_event_counter_changed(std::shared_ptr<Context> &gpg_agent, unsigned int &counter)
{
const unsigned int oldCounter = counter;
counter = get_event_counter(gpg_agent);
@@ -564,7 +548,7 @@ private Q_SLOTS:
private:
void run() Q_DECL_OVERRIDE {
- shared_ptr<Context> gpgAgent;
+ std::shared_ptr<Context> gpgAgent;
unsigned int eventCounter = -1;
while (true)
@@ -577,11 +561,11 @@ private:
if (!gpgAgent) {
Error err;
- std::auto_ptr<Context> c = Context::createForEngine(AssuanEngine, &err);
+ std::unique_ptr<Context> c = Context::createForEngine(AssuanEngine, &err);
if (err.code() == GPG_ERR_NOT_SUPPORTED) {
return;
}
- gpgAgent = c;
+ gpgAgent = std::shared_ptr<Context>(c.release());
}
KDAB_SYNCHRONIZED(m_mutex) {
diff --git a/src/uiserver/assuancommand.h b/src/uiserver/assuancommand.h
index c0727bd..8884f28 100644
--- a/src/uiserver/assuancommand.h
+++ b/src/uiserver/assuancommand.h
@@ -47,9 +47,7 @@
#include <qwindowdefs.h> // for WId
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-
+#include <memory>
#include <string>
#include <map>
#include <vector>
@@ -208,7 +206,7 @@ class AssuanCommandFactory;
\endcode
*/
-class AssuanCommand : public ExecutionContext, public boost::enable_shared_from_this<AssuanCommand>
+class AssuanCommand : public ExecutionContext, public std::enable_shared_from_this<AssuanCommand>
{
// defined in assuanserverconnection.cpp!
public:
@@ -244,9 +242,9 @@ public:
};
template <typename T>
- static boost::shared_ptr< TypedMemento<T> > make_typed_memento(const T &t)
+ static std::shared_ptr< TypedMemento<T> > make_typed_memento(const T &t)
{
- return boost::shared_ptr< TypedMemento<T> >(new TypedMemento<T>(t));
+ return std::shared_ptr< TypedMemento<T> >(new TypedMemento<T>(t));
}
static int makeError(int code);
@@ -281,19 +279,19 @@ public:
const std::vector<KMime::Types::Mailbox> &senders() const;
bool hasMemento(const QByteArray &tag) const;
- boost::shared_ptr<Memento> memento(const QByteArray &tag) const;
+ std::shared_ptr<Memento> memento(const QByteArray &tag) const;
template <typename T>
- boost::shared_ptr<T> mementoAs(const QByteArray &tag) const
+ std::shared_ptr<T> mementoAs(const QByteArray &tag) const
{
- return boost::dynamic_pointer_cast<T>(this->memento(tag));
+ return std::dynamic_pointer_cast<T>(this->memento(tag));
}
- QByteArray registerMemento(const boost::shared_ptr<Memento> &mem);
- QByteArray registerMemento(const QByteArray &tag, const boost::shared_ptr<Memento> &mem);
+ QByteArray registerMemento(const std::shared_ptr<Memento> &mem);
+ QByteArray registerMemento(const QByteArray &tag, const std::shared_ptr<Memento> &mem);
void removeMemento(const QByteArray &tag);
template <typename T>
T mementoContent(const QByteArray &tag) const
{
- if (boost::shared_ptr< TypedMemento<T> > m = mementoAs< TypedMemento<T> >(tag)) {
+ if (std::shared_ptr< TypedMemento<T> > m = mementoAs< TypedMemento<T> >(tag)) {
return m->get();
} else {
return T();
@@ -304,9 +302,9 @@ public:
QVariant option(const char *opt) const;
const std::map<std::string, QVariant> &options() const;
- const std::vector< boost::shared_ptr<Input> > &inputs() const;
- const std::vector< boost::shared_ptr<Input> > &messages() const;
- const std::vector< boost::shared_ptr<Output> > &outputs() const;
+ const std::vector< std::shared_ptr<Input> > &inputs() const;
+ const std::vector< std::shared_ptr<Input> > &messages() const;
+ const std::vector< std::shared_ptr<Output> > &outputs() const;
QStringList fileNames() const;
unsigned int numFiles() const;
@@ -336,7 +334,7 @@ private:
void doApplyWindowID(QWidget *w) const;
private:
- const std::map< QByteArray, boost::shared_ptr<Memento> > &mementos() const;
+ const std::map< QByteArray, std::shared_ptr<Memento> > &mementos() const;
private:
friend class ::Kleo::AssuanCommandFactory;
@@ -349,7 +347,7 @@ class AssuanCommandFactory
public:
virtual ~AssuanCommandFactory() {}
- virtual boost::shared_ptr<AssuanCommand> create() const = 0;
+ virtual std::shared_ptr<AssuanCommand> create() const = 0;
virtual const char *name() const = 0;
#ifndef HAVE_ASSUAN2
@@ -382,7 +380,7 @@ class GenericAssuanCommandFactory : public AssuanCommandFactory
#endif
return AssuanCommandFactory::_handle(_ctx, _line, Command::staticName());
}
- boost::shared_ptr<AssuanCommand> create() const Q_DECL_OVERRIDE
+ std::shared_ptr<AssuanCommand> create() const Q_DECL_OVERRIDE
{
return make();
}
@@ -391,9 +389,9 @@ class GenericAssuanCommandFactory : public AssuanCommandFactory
return Command::staticName();
}
public:
- static boost::shared_ptr<Command> make()
+ static std::shared_ptr<Command> make()
{
- return boost::shared_ptr<Command>(new Command);
+ return std::shared_ptr<Command>(new Command);
}
};
diff --git a/src/uiserver/assuanserverconnection.cpp b/src/uiserver/assuanserverconnection.cpp
index 53f4ed8..02c69c4 100644
--- a/src/uiserver/assuanserverconnection.cpp
+++ b/src/uiserver/assuanserverconnection.cpp
@@ -120,8 +120,8 @@ static void my_assuan_release(assuan_context_t ctx)
}
#endif
-// shared_ptr for assuan_context_t w/ deleter enforced to assuan_deinit_server:
-typedef shared_ptr< remove_pointer<assuan_context_t>::type > AssuanContextBase;
+// std::shared_ptr for assuan_context_t w/ deleter enforced to assuan_deinit_server:
+typedef std::shared_ptr< remove_pointer<assuan_context_t>::type > AssuanContextBase;
struct AssuanContext : AssuanContextBase {
AssuanContext() : AssuanContextBase() {}
#ifndef HAVE_ASSUAN2
@@ -258,7 +258,7 @@ class AssuanServerConnection::Private : public QObject
friend class ::Kleo::AssuanCommand;
AssuanServerConnection *const q;
public:
- Private(assuan_fd_t fd_, const std::vector< shared_ptr<AssuanCommandFactory> > &factories_, AssuanServerConnection *qq);
+ Private(assuan_fd_t fd_, const std::vector< std::shared_ptr<AssuanCommandFactory> > &factories_, AssuanServerConnection *qq);
~Private();
Q_SIGNALS:
@@ -291,9 +291,9 @@ public Q_SLOTS:
private:
void nohupDone(AssuanCommand *cmd)
{
- const std::vector< shared_ptr<AssuanCommand> >::iterator it
+ const std::vector< std::shared_ptr<AssuanCommand> >::iterator it
= std::find_if(nohupedCommands.begin(), nohupedCommands.end(),
- boost::bind(&shared_ptr<AssuanCommand>::get, _1) == cmd);
+ boost::bind(&std::shared_ptr<AssuanCommand>::get, _1) == cmd);
assert(it != nohupedCommands.end());
nohupedCommands.erase(it);
if (nohupedCommands.empty() && closed) {
@@ -536,7 +536,7 @@ private:
throw gpg_error(GPG_ERR_ASS_SYNTAX);
}
- shared_ptr< typename Input_or_Output<in>::type > io;
+ std::shared_ptr< typename Input_or_Output<in>::type > io;
if (options.count("FD")) {
@@ -829,7 +829,7 @@ private:
QByteArray dumpMementos() const
{
QByteArray result;
- for (std::map< QByteArray, shared_ptr<AssuanCommand::Memento> >::const_iterator it = mementos.begin(), end = mementos.end(); it != end; ++it) {
+ for (std::map< QByteArray, std::shared_ptr<AssuanCommand::Memento> >::const_iterator it = mementos.begin(), end = mementos.end(); it != end; ++it) {
char buf[2 + 2 * sizeof(void *) + 2];
sprintf(buf, "0x%p\n", (void *)it->second.get());
buf[sizeof(buf) - 1] = '\0';
@@ -878,16 +878,16 @@ private:
GpgME::Protocol bias;
QString sessionTitle;
unsigned int sessionId;
- std::vector< shared_ptr<QSocketNotifier> > notifiers;
- std::vector< shared_ptr<AssuanCommandFactory> > factories; // sorted: _detail::ByName<std::less>
- shared_ptr<AssuanCommand> currentCommand;
- std::vector< shared_ptr<AssuanCommand> > nohupedCommands;
+ std::vector< std::shared_ptr<QSocketNotifier> > notifiers;
+ std::vector< std::shared_ptr<AssuanCommandFactory> > factories; // sorted: _detail::ByName<std::less>
+ std::shared_ptr<AssuanCommand> currentCommand;
+ std::vector< std::shared_ptr<AssuanCommand> > nohupedCommands;
std::map<std::string, QVariant> options;
std::vector<KMime::Types::Mailbox> senders, recipients;
- std::vector< shared_ptr<Input> > inputs, messages;
- std::vector< shared_ptr<Output> > outputs;
+ std::vector< std::shared_ptr<Input> > inputs, messages;
+ std::vector< std::shared_ptr<Output> > outputs;
std::vector<QString> files;
- std::map< QByteArray, shared_ptr<AssuanCommand::Memento> > mementos;
+ std::map< QByteArray, std::shared_ptr<AssuanCommand::Memento> > mementos;
};
void AssuanServerConnection::Private::cleanup()
@@ -902,7 +902,7 @@ void AssuanServerConnection::Private::cleanup()
fd = ASSUAN_INVALID_FD;
}
-AssuanServerConnection::Private::Private(assuan_fd_t fd_, const std::vector< shared_ptr<AssuanCommandFactory> > &factories_, AssuanServerConnection *qq)
+AssuanServerConnection::Private::Private(assuan_fd_t fd_, const std::vector< std::shared_ptr<AssuanCommandFactory> > &factories_, AssuanServerConnection *qq)
: QObject(),
q(qq),
fd(fd_),
@@ -955,14 +955,14 @@ AssuanServerConnection::Private::Private(assuan_fd_t fd_, const std::vector< sha
assert(numFDs != -1); // == 1
if (!numFDs || fds[0] != fd) {
- const shared_ptr<QSocketNotifier> sn(new QSocketNotifier((intptr_t)fd, QSocketNotifier::Read), mem_fn(&QObject::deleteLater));
+ const std::shared_ptr<QSocketNotifier> sn(new QSocketNotifier((intptr_t)fd, QSocketNotifier::Read), mem_fn(&QObject::deleteLater));
connect(sn.get(), &QSocketNotifier::activated, this, &Private::slotReadActivity);
notifiers.push_back(sn);
}
notifiers.reserve(notifiers.size() + numFDs);
for (int i = 0; i < numFDs; ++i) {
- const shared_ptr<QSocketNotifier> sn(new QSocketNotifier((intptr_t)fds[i], QSocketNotifier::Read), mem_fn(&QObject::deleteLater));
+ const std::shared_ptr<QSocketNotifier> sn(new QSocketNotifier((intptr_t)fds[i], QSocketNotifier::Read), mem_fn(&QObject::deleteLater));
connect(sn.get(), &QSocketNotifier::activated, this, &Private::slotReadActivity);
notifiers.push_back(sn);
}
@@ -994,7 +994,7 @@ AssuanServerConnection::Private::Private(assuan_fd_t fd_, const std::vector< sha
throw Exception(err, "register \"FILE\" handler");
// register user-defined commands:
- Q_FOREACH (shared_ptr<AssuanCommandFactory> fac, factories)
+ Q_FOREACH (std::shared_ptr<AssuanCommandFactory> fac, factories)
#ifndef HAVE_ASSUAN2
if (const gpg_error_t err = assuan_register_command(ctx.get(), fac->name(), fac->_handler()))
#else
@@ -1069,7 +1069,7 @@ AssuanServerConnection::Private::~Private()
cleanup();
}
-AssuanServerConnection::AssuanServerConnection(assuan_fd_t fd, const std::vector< shared_ptr<AssuanCommandFactory> > &factories, QObject *p)
+AssuanServerConnection::AssuanServerConnection(assuan_fd_t fd, const std::vector< std::shared_ptr<AssuanCommandFactory> > &factories, QObject *p)
: QObject(p), d(new Private(fd, factories, this))
{
@@ -1169,8 +1169,8 @@ public:
}
std::map<std::string, QVariant> options;
- std::vector< shared_ptr<Input> > inputs, messages;
- std::vector< shared_ptr<Output> > outputs;
+ std::vector< std::shared_ptr<Input> > inputs, messages;
+ std::vector< std::shared_ptr<Output> > outputs;
std::vector<QString> files;
std::vector<KMime::Types::Mailbox> recipients, senders;
bool informativeRecipients, informativeSenders;
@@ -1271,7 +1271,7 @@ std::vector<U> keys(const std::map<U, V> &map)
}
}
-const std::map< QByteArray, shared_ptr<AssuanCommand::Memento> > &AssuanCommand::mementos() const
+const std::map< QByteArray, std::shared_ptr<AssuanCommand::Memento> > &AssuanCommand::mementos() const
{
// oh, hack :(
assert(assuan_get_pointer(d->ctx.get()));
@@ -1288,31 +1288,31 @@ bool AssuanCommand::hasMemento(const QByteArray &tag) const
}
}
-shared_ptr<AssuanCommand::Memento> AssuanCommand::memento(const QByteArray &tag) const
+std::shared_ptr<AssuanCommand::Memento> AssuanCommand::memento(const QByteArray &tag) const
{
if (const unsigned int id = sessionId()) {
- const shared_ptr<SessionDataHandler> sdh = SessionDataHandler::instance();
- const shared_ptr<SessionData> sd = sdh->sessionData(id);
- const std::map< QByteArray, shared_ptr<Memento> >::const_iterator it = sd->mementos.find(tag);
+ const std::shared_ptr<SessionDataHandler> sdh = SessionDataHandler::instance();
+ const std::shared_ptr<SessionData> sd = sdh->sessionData(id);
+ const std::map< QByteArray, std::shared_ptr<Memento> >::const_iterator it = sd->mementos.find(tag);
if (it != sd->mementos.end()) {
return it->second;
}
}
- const std::map< QByteArray, shared_ptr<Memento> >::const_iterator it = mementos().find(tag);
+ const std::map< QByteArray, std::shared_ptr<Memento> >::const_iterator it = mementos().find(tag);
if (it == mementos().end()) {
- return shared_ptr<Memento>();
+ return std::shared_ptr<Memento>();
} else {
return it->second;
}
}
-QByteArray AssuanCommand::registerMemento(const shared_ptr<Memento> &mem)
+QByteArray AssuanCommand::registerMemento(const std::shared_ptr<Memento> &mem)
{
const QByteArray tag = QByteArray::number(reinterpret_cast<qulonglong>(mem.get()), 36);
return registerMemento(tag, mem);
}
-QByteArray AssuanCommand::registerMemento(const QByteArray &tag, const shared_ptr<Memento> &mem)
+QByteArray AssuanCommand::registerMemento(const QByteArray &tag, const std::shared_ptr<Memento> &mem)
{
// oh, hack :(
assert(assuan_get_pointer(d->ctx.get()));
@@ -1338,17 +1338,17 @@ void AssuanCommand::removeMemento(const QByteArray &tag)
}
}
-const std::vector< shared_ptr<Input> > &AssuanCommand::inputs() const
+const std::vector< std::shared_ptr<Input> > &AssuanCommand::inputs() const
{
return d->inputs;
}
-const std::vector< shared_ptr<Input> > &AssuanCommand::messages() const
+const std::vector< std::shared_ptr<Input> > &AssuanCommand::messages() const
{
return d->messages;
}
-const std::vector< shared_ptr<Output> > &AssuanCommand::outputs() const
+const std::vector< std::shared_ptr<Output> > &AssuanCommand::outputs() const
{
return d->outputs;
}
@@ -1531,13 +1531,13 @@ gpg_error_t AssuanCommandFactory::_handle(assuan_context_t ctx, char *line, cons
try {
- const std::vector< shared_ptr<AssuanCommandFactory> >::const_iterator it
+ const std::vector< std::shared_ptr<AssuanCommandFactory> >::const_iterator it
= std::lower_bound(conn.factories.begin(), conn.factories.end(), commandName, _detail::ByName<std::less>());
kleo_assert(it != conn.factories.end());
kleo_assert(*it);
kleo_assert(qstricmp((*it)->name(), commandName) == 0);
- const shared_ptr<AssuanCommand> cmd = (*it)->create();
+ const std::shared_ptr<AssuanCommand> cmd = (*it)->create();
kleo_assert(cmd);
cmd->d->ctx = conn.ctx;
@@ -1593,7 +1593,7 @@ int AssuanServerConnection::Private::startCommandBottomHalf()
return 0;
}
- const shared_ptr<AssuanCommand> cmd = currentCommand;
+ const std::shared_ptr<AssuanCommand> cmd = currentCommand;
if (!cmd) {
return 0;
}
diff --git a/src/uiserver/assuanserverconnection.h b/src/uiserver/assuanserverconnection.h
index 3cc483b..7666934 100644
--- a/src/uiserver/assuanserverconnection.h
+++ b/src/uiserver/assuanserverconnection.h
@@ -39,8 +39,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <string>
#include <vector>
@@ -53,7 +52,7 @@ class AssuanServerConnection : public QObject
{
Q_OBJECT
public:
- AssuanServerConnection(assuan_fd_t fd, const std::vector< boost::shared_ptr<AssuanCommandFactory> > &factories, QObject *parent = Q_NULLPTR);
+ AssuanServerConnection(assuan_fd_t fd, const std::vector< std::shared_ptr<AssuanCommandFactory> > &factories, QObject *parent = Q_NULLPTR);
~AssuanServerConnection();
public Q_SLOTS:
diff --git a/src/uiserver/createchecksumscommand.cpp b/src/uiserver/createchecksumscommand.cpp
index 2c1f920..725d661 100644
--- a/src/uiserver/createchecksumscommand.cpp
+++ b/src/uiserver/createchecksumscommand.cpp
@@ -42,7 +42,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class CreateChecksumsCommand::Private
{
@@ -61,7 +60,7 @@ private:
void checkForErrors() const;
private:
- shared_ptr<CreateChecksumsController> controller;
+ std::shared_ptr<CreateChecksumsController> controller;
};
CreateChecksumsCommand::CreateChecksumsCommand()
diff --git a/src/uiserver/decryptverifycommandemailbase.cpp b/src/uiserver/decryptverifycommandemailbase.cpp
index 451f7b1..3f71911 100644
--- a/src/uiserver/decryptverifycommandemailbase.cpp
+++ b/src/uiserver/decryptverifycommandemailbase.cpp
@@ -43,10 +43,11 @@
#include <utils/kleo_assert.h>
#include <Libkleo/Exception>
-#include <Libkleo/CryptoBackendFactory>
#include <Libkleo/KeyCache>
#include <Libkleo/Formatting>
+#include <QGpgME/Protocol>
+
#include <gpgme++/error.h>
#include <gpgme++/key.h>
#include <gpgme++/verificationresult.h>
@@ -97,7 +98,7 @@ public Q_SLOTS:
public:
private:
- shared_ptr<DecryptVerifyEMailController> controller;
+ std::shared_ptr<DecryptVerifyEMailController> controller;
};
DecryptVerifyCommandEMailBase::DecryptVerifyCommandEMailBase()
@@ -117,7 +118,7 @@ int DecryptVerifyCommandEMailBase::doStart()
const QString st = sessionTitle();
if (!st.isEmpty())
- Q_FOREACH (const shared_ptr<Input> &i, inputs()) {
+ Q_FOREACH (const std::shared_ptr<Input> &i, inputs()) {
i->setLabel(st);
}
@@ -199,7 +200,7 @@ void DecryptVerifyCommandEMailBase::Private::checkForErrors() const
kleo_assert(proto != UnknownProtocol);
- const CryptoBackend::Protocol *const backend = CryptoBackendFactory::instance()->protocol(proto);
+ const auto backend = (proto == GpgME::OpenPGP) ? QGpgME::openpgp() : QGpgME::smime();
if (!backend)
throw Kleo::Exception(q->makeError(GPG_ERR_UNSUPPORTED_PROTOCOL),
proto == OpenPGP ? i18n("No backend support for OpenPGP") :
diff --git a/src/uiserver/echocommand.cpp b/src/uiserver/echocommand.cpp
index 379c2d6..2366278 100644
--- a/src/uiserver/echocommand.cpp
+++ b/src/uiserver/echocommand.cpp
@@ -49,9 +49,9 @@
#include <string>
#include <algorithm>
+#include <cassert>
using namespace Kleo;
-using namespace boost;
static const char option_prefix[] = "prefix";
@@ -72,8 +72,8 @@ EchoCommand::~EchoCommand() {}
int EchoCommand::doStart()
{
- const std::vector< shared_ptr<Input> > in = inputs(), msg = messages();
- const std::vector< shared_ptr<Output> > out = outputs();
+ const std::vector< std::shared_ptr<Input> > in = inputs(), msg = messages();
+ const std::vector< std::shared_ptr<Output> > out = outputs();
if (!in.empty() && out.empty()) {
return makeError(GPG_ERR_NOT_SUPPORTED);
@@ -113,8 +113,8 @@ int EchoCommand::doStart()
}
// 3. if INPUT was given, start the data pump for input->output
- if (const shared_ptr<QIODevice> i = in.at(0)->ioDevice()) {
- const shared_ptr<QIODevice> o = out.at(0)->ioDevice();
+ if (const std::shared_ptr<QIODevice> i = in.at(0)->ioDevice()) {
+ const std::shared_ptr<QIODevice> o = out.at(0)->ioDevice();
++d->operationsInFlight;
@@ -167,7 +167,7 @@ void EchoCommand::slotInquireData(int rc, const QByteArray &data)
void EchoCommand::slotInputReadyRead()
{
- const shared_ptr<QIODevice> in = inputs().at(0)->ioDevice();
+ const std::shared_ptr<QIODevice> in = inputs().at(0)->ioDevice();
assert(in);
QByteArray buffer;
@@ -189,7 +189,7 @@ void EchoCommand::slotInputReadyRead()
void EchoCommand::slotOutputBytesWritten()
{
- const shared_ptr<QIODevice> out = outputs().at(0)->ioDevice();
+ const std::shared_ptr<QIODevice> out = outputs().at(0)->ioDevice();
assert(out);
if (!d->buffer.isEmpty()) {
diff --git a/src/uiserver/encryptcommand.cpp b/src/uiserver/encryptcommand.cpp
index 52060ac..7ebcb5d 100644
--- a/src/uiserver/encryptcommand.cpp
+++ b/src/uiserver/encryptcommand.cpp
@@ -48,7 +48,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class EncryptCommand::Private : public QObject
{
@@ -73,7 +72,7 @@ private Q_SLOTS:
void slotRecipientsResolved();
private:
- shared_ptr<NewSignEncryptEMailController> controller;
+ std::shared_ptr<NewSignEncryptEMailController> controller;
};
EncryptCommand::EncryptCommand()
@@ -111,7 +110,7 @@ void EncryptCommand::Private::checkForErrors() const
throw Exception(makeError(GPG_ERR_INV_VALUE),
i18n("MESSAGE command is not allowed before ENCRYPT"));
- const shared_ptr<NewSignEncryptEMailController> m = q->mementoContent< shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
+ const std::shared_ptr<NewSignEncryptEMailController> m = q->mementoContent< std::shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
kleo_assert(m);
if (m && m->isEncrypting()) {
@@ -151,7 +150,7 @@ int EncryptCommand::doStart()
d->checkForErrors();
- const shared_ptr<NewSignEncryptEMailController> seec = mementoContent< shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
+ const std::shared_ptr<NewSignEncryptEMailController> seec = mementoContent< std::shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
if (seec && seec->isEncrypting()) {
// reuse the controller from a previous PREP_ENCRYPT, if available:
@@ -185,13 +184,13 @@ int EncryptCommand::doStart()
void EncryptCommand::Private::slotRecipientsResolved()
{
- //hold local shared_ptr to member as q->done() deletes *this
- const shared_ptr<NewSignEncryptEMailController> cont(controller);
+ //hold local std::shared_ptr to member as q->done() deletes *this
+ const std::shared_ptr<NewSignEncryptEMailController> cont(controller);
try {
const QString sessionTitle = q->sessionTitle();
if (!sessionTitle.isEmpty())
- Q_FOREACH (const shared_ptr<Input> &i, q->inputs()) {
+ Q_FOREACH (const std::shared_ptr<Input> &i, q->inputs()) {
i->setLabel(sessionTitle);
}
diff --git a/src/uiserver/importfilescommand.cpp b/src/uiserver/importfilescommand.cpp
index 2e89130..628d49a 100644
--- a/src/uiserver/importfilescommand.cpp
+++ b/src/uiserver/importfilescommand.cpp
@@ -48,7 +48,7 @@
#include <algorithm>
using namespace Kleo;
-using namespace boost;
+
class ImportFilesCommand::Private
{
diff --git a/src/uiserver/prepencryptcommand.cpp b/src/uiserver/prepencryptcommand.cpp
index b7a9265..684991d 100644
--- a/src/uiserver/prepencryptcommand.cpp
+++ b/src/uiserver/prepencryptcommand.cpp
@@ -44,7 +44,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class PrepEncryptCommand::Private : public QObject
{
@@ -64,7 +63,7 @@ public Q_SLOTS:
void slotError(int, const QString &);
private:
- shared_ptr<NewSignEncryptEMailController> controller;
+ std::shared_ptr<NewSignEncryptEMailController> controller;
};
PrepEncryptCommand::PrepEncryptCommand()
@@ -129,8 +128,8 @@ int PrepEncryptCommand::doStart()
void PrepEncryptCommand::Private::slotRecipientsResolved()
{
- //hold local shared_ptr to member as q->done() deletes *this
- const shared_ptr<NewSignEncryptEMailController> cont = controller;
+ //hold local std::shared_ptr to member as q->done() deletes *this
+ const std::shared_ptr<NewSignEncryptEMailController> cont = controller;
QPointer<Private> that(this);
try {
diff --git a/src/uiserver/prepsigncommand.cpp b/src/uiserver/prepsigncommand.cpp
index b3cf468..8809399 100644
--- a/src/uiserver/prepsigncommand.cpp
+++ b/src/uiserver/prepsigncommand.cpp
@@ -47,7 +47,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class PrepSignCommand::Private : public QObject
{
@@ -67,7 +66,7 @@ public Q_SLOTS:
void slotError(int, const QString &);
private:
- shared_ptr<NewSignEncryptEMailController> controller;
+ std::shared_ptr<NewSignEncryptEMailController> controller;
};
PrepSignCommand::PrepSignCommand()
@@ -93,7 +92,7 @@ void PrepSignCommand::Private::checkForErrors() const
throw Exception(makeError(GPG_ERR_CONFLICT),
i18n("No SENDER given"));
- const shared_ptr<NewSignEncryptEMailController> m = q->mementoContent< shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
+ const std::shared_ptr<NewSignEncryptEMailController> m = q->mementoContent< std::shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
if (m && m->isSigning()) {
@@ -121,7 +120,7 @@ int PrepSignCommand::doStart()
d->checkForErrors();
- const shared_ptr<NewSignEncryptEMailController> seec = mementoContent< shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
+ const std::shared_ptr<NewSignEncryptEMailController> seec = mementoContent< std::shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
if (seec && seec->isSigning()) {
// reuse the controller from a previous PREP_ENCRYPT --expect-sign, if available:
@@ -159,8 +158,8 @@ int PrepSignCommand::doStart()
void PrepSignCommand::Private::slotSignersResolved()
{
- //hold local shared_ptr to member as q->done() deletes *this
- const shared_ptr<NewSignEncryptEMailController> cont = controller;
+ //hold local std::shared_ptr to member as q->done() deletes *this
+ const std::shared_ptr<NewSignEncryptEMailController> cont = controller;
QPointer<Private> that(this);
try {
diff --git a/src/uiserver/sessiondata.cpp b/src/uiserver/sessiondata.cpp
index b4bf591..ebdcd26 100644
--- a/src/uiserver/sessiondata.cpp
+++ b/src/uiserver/sessiondata.cpp
@@ -40,6 +40,8 @@
#include <boost/bind.hpp>
+#include <cassert>
+
using namespace Kleo;
using namespace boost;
@@ -56,11 +58,11 @@ SessionData::SessionData()
}
// static
-shared_ptr<SessionDataHandler> SessionDataHandler::instance()
+std::shared_ptr<SessionDataHandler> SessionDataHandler::instance()
{
mutex.lock();
static SessionDataHandler handler;
- return shared_ptr<SessionDataHandler>(&handler, boost::bind(&QMutex::unlock, &mutex));
+ return std::shared_ptr<SessionDataHandler>(&handler, boost::bind(&QMutex::unlock, &mutex));
}
SessionDataHandler::SessionDataHandler()
@@ -75,7 +77,7 @@ SessionDataHandler::SessionDataHandler()
void SessionDataHandler::enterSession(unsigned int id)
{
qCDebug(KLEOPATRA_LOG) << id;
- const shared_ptr<SessionData> sd = sessionDataInternal(id);
+ const std::shared_ptr<SessionData> sd = sessionDataInternal(id);
assert(sd);
++sd->ref;
sd->ripe = false;
@@ -84,7 +86,7 @@ void SessionDataHandler::enterSession(unsigned int id)
void SessionDataHandler::exitSession(unsigned int id)
{
qCDebug(KLEOPATRA_LOG) << id;
- const shared_ptr<SessionData> sd = sessionDataInternal(id);
+ const std::shared_ptr<SessionData> sd = sessionDataInternal(id);
assert(sd);
if (--sd->ref <= 0) {
sd->ref = 0;
@@ -95,18 +97,18 @@ void SessionDataHandler::exitSession(unsigned int id)
}
}
-shared_ptr<SessionData> SessionDataHandler::sessionDataInternal(unsigned int id) const
+std::shared_ptr<SessionData> SessionDataHandler::sessionDataInternal(unsigned int id) const
{
- std::map< unsigned int, shared_ptr<SessionData> >::iterator
+ std::map< unsigned int, std::shared_ptr<SessionData> >::iterator
it = data.lower_bound(id);
if (it == data.end() || it->first != id) {
- const shared_ptr<SessionData> sd(new SessionData);
+ const std::shared_ptr<SessionData> sd(new SessionData);
it = data.insert(it, std::make_pair(id, sd));
}
return it->second;
}
-shared_ptr<SessionData> SessionDataHandler::sessionData(unsigned int id) const
+std::shared_ptr<SessionData> SessionDataHandler::sessionData(unsigned int id) const
{
return sessionDataInternal(id);
}
@@ -120,7 +122,7 @@ void SessionDataHandler::slotCollectGarbage()
{
const QMutexLocker locker(&mutex);
unsigned int alive = 0;
- std::map< unsigned int, shared_ptr<SessionData> >::iterator it = data.begin(), end = data.end();
+ std::map< unsigned int, std::shared_ptr<SessionData> >::iterator it = data.begin(), end = data.end();
while (it != end)
if (it->second->ripe) {
data.erase(it++);
diff --git a/src/uiserver/sessiondata.h b/src/uiserver/sessiondata.h
index 94909d5..ed081bc 100644
--- a/src/uiserver/sessiondata.h
+++ b/src/uiserver/sessiondata.h
@@ -39,8 +39,7 @@
#include <QTimer>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <map>
namespace Kleo
@@ -52,7 +51,7 @@ class SessionData
{
public:
- std::map< QByteArray, boost::shared_ptr<AssuanCommand::Memento> > mementos;
+ std::map< QByteArray, std::shared_ptr<AssuanCommand::Memento> > mementos;
private:
friend class ::Kleo::SessionDataHandler;
@@ -65,12 +64,12 @@ class SessionDataHandler : public QObject
{
public:
- static boost::shared_ptr<SessionDataHandler> instance();
+ static std::shared_ptr<SessionDataHandler> instance();
void enterSession(unsigned int id);
void exitSession(unsigned int id);
- boost::shared_ptr<SessionData> sessionData(unsigned int) const;
+ std::shared_ptr<SessionData> sessionData(unsigned int) const;
void clear();
@@ -78,11 +77,11 @@ private Q_SLOTS:
void slotCollectGarbage();
private:
- mutable std::map< unsigned int, boost::shared_ptr<SessionData> > data;
+ mutable std::map< unsigned int, std::shared_ptr<SessionData> > data;
QTimer timer;
private:
- boost::shared_ptr<SessionData> sessionDataInternal(unsigned int) const;
+ std::shared_ptr<SessionData> sessionDataInternal(unsigned int) const;
SessionDataHandler();
};
diff --git a/src/uiserver/signcommand.cpp b/src/uiserver/signcommand.cpp
index 49ca8a9..26a663e 100644
--- a/src/uiserver/signcommand.cpp
+++ b/src/uiserver/signcommand.cpp
@@ -48,7 +48,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class SignCommand::Private : public QObject
{
@@ -73,7 +72,7 @@ private Q_SLOTS:
void slotError(int, const QString &);
private:
- shared_ptr<NewSignEncryptEMailController> controller;
+ std::shared_ptr<NewSignEncryptEMailController> controller;
};
SignCommand::SignCommand()
@@ -107,7 +106,7 @@ void SignCommand::Private::checkForErrors() const
throw Exception(makeError(GPG_ERR_INV_VALUE),
i18n("MESSAGE command is not allowed before SIGN"));
- const shared_ptr<NewSignEncryptEMailController> m = q->mementoContent< shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
+ const std::shared_ptr<NewSignEncryptEMailController> m = q->mementoContent< std::shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
if (m && m->isSigning()) {
@@ -145,7 +144,7 @@ int SignCommand::doStart()
d->checkForErrors();
- const shared_ptr<NewSignEncryptEMailController> seec = mementoContent< shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
+ const std::shared_ptr<NewSignEncryptEMailController> seec = mementoContent< std::shared_ptr<NewSignEncryptEMailController> >(NewSignEncryptEMailController::mementoName());
if (seec && seec->isSigning()) {
// reuse the controller from a previous PREP_ENCRYPT --expect-sign, if available:
@@ -181,13 +180,13 @@ int SignCommand::doStart()
void SignCommand::Private::slotSignersResolved()
{
- //hold local shared_ptr to member as q->done() deletes *this
- const shared_ptr<NewSignEncryptEMailController> cont(controller);
+ //hold local std::shared_ptr to member as q->done() deletes *this
+ const std::shared_ptr<NewSignEncryptEMailController> cont(controller);
try {
const QString sessionTitle = q->sessionTitle();
if (!sessionTitle.isEmpty())
- Q_FOREACH (const shared_ptr<Input> &i, q->inputs()) {
+ Q_FOREACH (const std::shared_ptr<Input> &i, q->inputs()) {
i->setLabel(sessionTitle);
}
@@ -211,8 +210,8 @@ void SignCommand::Private::slotSignersResolved()
void SignCommand::Private::slotMicAlgDetermined(const QString &micalg)
{
- //hold local shared_ptr to member as q->done() deletes *this
- const shared_ptr<NewSignEncryptEMailController> cont(controller);
+ //hold local std::shared_ptr to member as q->done() deletes *this
+ const std::shared_ptr<NewSignEncryptEMailController> cont(controller);
try {
diff --git a/src/uiserver/signencryptfilescommand.cpp b/src/uiserver/signencryptfilescommand.cpp
index 32d3531..7628bc5 100644
--- a/src/uiserver/signencryptfilescommand.cpp
+++ b/src/uiserver/signencryptfilescommand.cpp
@@ -42,7 +42,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class SignEncryptFilesCommand::Private : public QObject
{
@@ -66,7 +65,7 @@ private Q_SLOTS:
void slotError(int, const QString &);
private:
- shared_ptr<SignEncryptFilesController> controller;
+ std::shared_ptr<SignEncryptFilesController> controller;
};
SignEncryptFilesCommand::SignEncryptFilesCommand()
diff --git a/src/uiserver/uiserver.cpp b/src/uiserver/uiserver.cpp
index 4ff6840..7c2af82 100644
--- a/src/uiserver/uiserver.cpp
+++ b/src/uiserver/uiserver.cpp
@@ -116,7 +116,7 @@ UiServer::~UiServer()
}
}
-bool UiServer::registerCommandFactory(const shared_ptr<AssuanCommandFactory> &cf)
+bool UiServer::registerCommandFactory(const std::shared_ptr<AssuanCommandFactory> &cf)
{
if (cf && empty(std::equal_range(d->factories.begin(), d->factories.end(), cf, _detail::ByName<std::less>()))) {
d->factories.push_back(cf);
@@ -198,7 +198,7 @@ void UiServer::Private::slotConnectionClosed(Kleo::AssuanServerConnection *conn)
{
qCDebug(KLEOPATRA_LOG) << "UiServer: connection " << (void *)conn << " closed";
connections.erase(std::remove_if(connections.begin(), connections.end(),
- boost::bind(&boost::shared_ptr<AssuanServerConnection>::get, _1) == conn),
+ boost::bind(&std::shared_ptr<AssuanServerConnection>::get, _1) == conn),
connections.end());
if (q->isStopped()) {
SessionDataHandler::instance()->clear();
@@ -217,7 +217,7 @@ void UiServer::Private::incomingConnection(qintptr fd)
return;
}
#endif
- const shared_ptr<AssuanServerConnection> c(new AssuanServerConnection((assuan_fd_t)fd, factories));
+ const std::shared_ptr<AssuanServerConnection> c(new AssuanServerConnection((assuan_fd_t)fd, factories));
connect(c.get(), &AssuanServerConnection::closed,
this, &Private::slotConnectionClosed);
connect(c.get(), &AssuanServerConnection::startKeyManagerRequested,
diff --git a/src/uiserver/uiserver.h b/src/uiserver/uiserver.h
index 8c7ef0c..63caae9 100644
--- a/src/uiserver/uiserver.h
+++ b/src/uiserver/uiserver.h
@@ -37,8 +37,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <cstdio>
class QString;
@@ -57,7 +56,7 @@ public:
static void setLogStream(FILE *file);
- bool registerCommandFactory(const boost::shared_ptr<AssuanCommandFactory> &cmdFactory);
+ bool registerCommandFactory(const std::shared_ptr<AssuanCommandFactory> &cmdFactory);
bool waitForStopped(unsigned int ms = 0xFFFFFFFF);
diff --git a/src/uiserver/uiserver_p.h b/src/uiserver/uiserver_p.h
index fbc3e44..dbb5df7 100644
--- a/src/uiserver/uiserver_p.h
+++ b/src/uiserver/uiserver_p.h
@@ -46,6 +46,7 @@
#include <boost/bind.hpp>
+#include <memory>
#include <algorithm>
#include <vector>
@@ -86,8 +87,8 @@ private Q_SLOTS:
private:
QFile file;
- std::vector< boost::shared_ptr<AssuanCommandFactory> > factories;
- std::vector< boost::shared_ptr<AssuanServerConnection> > connections;
+ std::vector< std::shared_ptr<AssuanCommandFactory> > factories;
+ std::vector< std::shared_ptr<AssuanServerConnection> > connections;
QString suggestedSocketName;
QString actualSocketName;
assuan_sock_nonce_t nonce;
diff --git a/src/uiserver/verifychecksumscommand.cpp b/src/uiserver/verifychecksumscommand.cpp
index 056b389..d5ab319 100644
--- a/src/uiserver/verifychecksumscommand.cpp
+++ b/src/uiserver/verifychecksumscommand.cpp
@@ -44,7 +44,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
class VerifyChecksumsCommand::Private
{
@@ -63,7 +62,7 @@ private:
void checkForErrors() const;
private:
- shared_ptr<VerifyChecksumsController> controller;
+ std::shared_ptr<VerifyChecksumsController> controller;
};
VerifyChecksumsCommand::VerifyChecksumsCommand()
diff --git a/src/utils/archivedefinition.cpp b/src/utils/archivedefinition.cpp
index a1a8547..d8e20b2 100644
--- a/src/utils/archivedefinition.cpp
+++ b/src/utils/archivedefinition.cpp
@@ -39,9 +39,9 @@
#include <utils/path-helper.h>
#include <utils/kleo_assert.h>
-#include <Libkleo/Exception>
-#include <Libkleo/CryptoBackendFactory>
+#include <gpgme++/exception.h>
+#include <KSharedConfig>
#include <KConfigGroup>
#include "kleopatra_debug.h"
#include <KLocalizedString>
@@ -55,12 +55,10 @@
#include <QCoreApplication>
#include <QRegularExpression>
-#include <boost/shared_ptr.hpp>
#include <QStandardPaths>
using namespace GpgME;
using namespace Kleo;
-using namespace boost;
static QMutex installPathMutex;
Q_GLOBAL_STATIC(QString, _installPath)
@@ -301,19 +299,19 @@ public:
}
private:
- QString doGetPackCommand(Protocol p) const Q_DECL_OVERRIDE
+ QString doGetPackCommand(GpgME::Protocol p) const Q_DECL_OVERRIDE
{
return m_packCommand[p];
}
- QString doGetUnpackCommand(Protocol p) const Q_DECL_OVERRIDE
+ QString doGetUnpackCommand(GpgME::Protocol p) const Q_DECL_OVERRIDE
{
return m_unpackCommand[p];
}
- QStringList doGetPackArguments(Protocol p, const QStringList &files) const Q_DECL_OVERRIDE
+ QStringList doGetPackArguments(GpgME::Protocol p, const QStringList &files) const Q_DECL_OVERRIDE
{
return m_packPrefixArguments[p] + files + m_packPostfixArguments[p];
}
- QStringList doGetUnpackArguments(Protocol p, const QString &file) const Q_DECL_OVERRIDE
+ QStringList doGetUnpackArguments(GpgME::Protocol p, const QString &file) const Q_DECL_OVERRIDE
{
QStringList copy = m_unpackArguments[p];
copy.replaceInStrings(FILE_PLACEHOLDER, file);
@@ -332,7 +330,7 @@ ArchiveDefinition::ArchiveDefinition(const QString &id, const QString &label)
: m_id(id),
m_label(label)
{
- m_packCommandMethod[OpenPGP] = m_packCommandMethod[CMS] = CommandLine;
+ m_packCommandMethod[GpgME::OpenPGP] = m_packCommandMethod[GpgME::CMS] = CommandLine;
}
ArchiveDefinition::~ArchiveDefinition() {}
@@ -347,7 +345,7 @@ static QByteArray make_input(const QStringList &files, char sep)
return result;
}
-shared_ptr<Input> ArchiveDefinition::createInputFromPackCommand(GpgME::Protocol p, const QStringList &files) const
+std::shared_ptr<Input> ArchiveDefinition::createInputFromPackCommand(GpgME::Protocol p, const QStringList &files) const
{
checkProtocol(p);
const QString base = heuristicBaseDirectory(files);
@@ -375,10 +373,10 @@ shared_ptr<Input> ArchiveDefinition::createInputFromPackCommand(GpgME::Protocol
case NumArgumentPassingMethods:
assert(!"Should not happen");
}
- return shared_ptr<Input>(); // make compiler happy
+ return std::shared_ptr<Input>(); // make compiler happy
}
-shared_ptr<Output> ArchiveDefinition::createOutputFromUnpackCommand(GpgME::Protocol p, const QString &file, const QDir &wd) const
+std::shared_ptr<Output> ArchiveDefinition::createOutputFromUnpackCommand(GpgME::Protocol p, const QString &file, const QDir &wd) const
{
checkProtocol(p);
const QFileInfo fi(file);
@@ -388,34 +386,33 @@ shared_ptr<Output> ArchiveDefinition::createOutputFromUnpackCommand(GpgME::Proto
}
// static
-std::vector< shared_ptr<ArchiveDefinition> > ArchiveDefinition::getArchiveDefinitions()
+std::vector< std::shared_ptr<ArchiveDefinition> > ArchiveDefinition::getArchiveDefinitions()
{
QStringList errors;
return getArchiveDefinitions(errors);
}
// static
-std::vector< shared_ptr<ArchiveDefinition> > ArchiveDefinition::getArchiveDefinitions(QStringList &errors)
+std::vector< std::shared_ptr<ArchiveDefinition> > ArchiveDefinition::getArchiveDefinitions(QStringList &errors)
{
- std::vector< shared_ptr<ArchiveDefinition> > result;
- if (KConfig *config = CryptoBackendFactory::instance()->configObject()) {
- const QStringList groups = config->groupList().filter(QRegularExpression(QStringLiteral("^Archive Definition #")));
- result.reserve(groups.size());
- Q_FOREACH (const QString &group, groups)
- try {
- const shared_ptr<ArchiveDefinition> ad(new KConfigBasedArchiveDefinition(KConfigGroup(config, group)));
- result.push_back(ad);
- } catch (const std::exception &e) {
- qCDebug(KLEOPATRA_LOG) << e.what();
- errors.push_back(QString::fromLocal8Bit(e.what()));
- } catch (...) {
- errors.push_back(i18n("Caught unknown exception in group %1", group));
- }
- }
+ std::vector< std::shared_ptr<ArchiveDefinition> > result;
+ KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("libkleopatrarc"));
+ const QStringList groups = config->groupList().filter(QRegularExpression(QStringLiteral("^Archive Definition #")));
+ result.reserve(groups.size());
+ Q_FOREACH (const QString &group, groups)
+ try {
+ const std::shared_ptr<ArchiveDefinition> ad(new KConfigBasedArchiveDefinition(KConfigGroup(config, group)));
+ result.push_back(ad);
+ } catch (const std::exception &e) {
+ qCDebug(KLEOPATRA_LOG) << e.what();
+ errors.push_back(QString::fromLocal8Bit(e.what()));
+ } catch (...) {
+ errors.push_back(i18n("Caught unknown exception in group %1", group));
+ }
return result;
}
-void ArchiveDefinition::checkProtocol(Protocol p) const
+void ArchiveDefinition::checkProtocol(GpgME::Protocol p) const
{
- kleo_assert(p == OpenPGP || p == CMS);
+ kleo_assert(p == GpgME::OpenPGP || p == GpgME::CMS);
}
diff --git a/src/utils/archivedefinition.h b/src/utils/archivedefinition.h
index 0bbfaa0..461a1cd 100644
--- a/src/utils/archivedefinition.h
+++ b/src/utils/archivedefinition.h
@@ -40,14 +40,10 @@
#include <gpgme++/global.h> // GpgME::Protocol
#include <vector>
+#include <memory>
class QDir;
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
class Input;
@@ -87,21 +83,21 @@ public:
return m_extensions[p];
}
- boost::shared_ptr<Input> createInputFromPackCommand(GpgME::Protocol p, const QStringList &files) const;
+ std::shared_ptr<Input> createInputFromPackCommand(GpgME::Protocol p, const QStringList &files) const;
ArgumentPassingMethod packCommandArgumentPassingMethod(GpgME::Protocol p) const
{
checkProtocol(p);
return m_packCommandMethod[p];
}
- boost::shared_ptr<Output> createOutputFromUnpackCommand(GpgME::Protocol p, const QString &file, const QDir &wd) const;
+ std::shared_ptr<Output> createOutputFromUnpackCommand(GpgME::Protocol p, const QString &file, const QDir &wd) const;
// unpack-command must use CommandLine ArgumentPassingMethod
static QString installPath();
static void setInstallPath(const QString &ip);
- static std::vector< boost::shared_ptr<ArchiveDefinition> > getArchiveDefinitions();
- static std::vector< boost::shared_ptr<ArchiveDefinition> > getArchiveDefinitions(QStringList &errors);
+ static std::vector< std::shared_ptr<ArchiveDefinition> > getArchiveDefinitions();
+ static std::vector< std::shared_ptr<ArchiveDefinition> > getArchiveDefinitions(QStringList &errors);
protected:
void setPackCommandArgumentPassingMethod(GpgME::Protocol p, ArgumentPassingMethod method)
@@ -132,7 +128,7 @@ private:
}
-Q_DECLARE_METATYPE(boost::shared_ptr<Kleo::ArchiveDefinition>)
+Q_DECLARE_METATYPE(std::shared_ptr<Kleo::ArchiveDefinition>)
#endif /* __KLEOPATRA_UTILS_ARCHIVEDEFINITION_H__ */
diff --git a/src/utils/auditlog.cpp b/src/utils/auditlog.cpp
index 38a9c5a..d33cd9b 100644
--- a/src/utils/auditlog.cpp
+++ b/src/utils/auditlog.cpp
@@ -34,7 +34,7 @@
#include "auditlog.h"
-#include <Libkleo/Job>
+#include <QGpgME/Job>
#include <QUrl>
#include <QUrlQuery>
@@ -43,7 +43,7 @@
using namespace Kleo;
-AuditLog AuditLog::fromJob(const Job *job)
+AuditLog AuditLog::fromJob(const QGpgME::Job *job)
{
if (job) {
return AuditLog(job->auditLogAsHtml(), job->auditLogError());
diff --git a/src/utils/auditlog.h b/src/utils/auditlog.h
index d59f470..76b1375 100644
--- a/src/utils/auditlog.h
+++ b/src/utils/auditlog.h
@@ -39,7 +39,7 @@
class QUrl;
-namespace Kleo
+namespace QGpgME
{
class Job;
}
@@ -56,7 +56,7 @@ public:
AuditLog(const QString &text, const GpgME::Error &error)
: m_text(text), m_error(error) {}
- static AuditLog fromJob(const Job *);
+ static AuditLog fromJob(const QGpgME::Job *);
GpgME::Error error() const
{
diff --git a/src/utils/input.cpp b/src/utils/input.cpp
index 2195ba1..20f2266 100644
--- a/src/utils/input.cpp
+++ b/src/utils/input.cpp
@@ -59,7 +59,6 @@
#include <errno.h>
using namespace Kleo;
-using namespace boost;
namespace
{
@@ -105,7 +104,7 @@ public:
private:
virtual QString doErrorString() const
{
- if (const shared_ptr<QIODevice> io = ioDevice()) {
+ if (const std::shared_ptr<QIODevice> io = ioDevice()) {
return io->errorString();
} else {
return i18n("No input device");
@@ -123,7 +122,7 @@ class PipeInput : public InputImplBase
public:
explicit PipeInput(assuan_fd_t fd);
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_io;
}
@@ -134,7 +133,7 @@ public:
}
private:
- shared_ptr<QIODevice> m_io;
+ std::shared_ptr<QIODevice> m_io;
};
class ProcessStdOutInput : public InputImplBase
@@ -142,7 +141,7 @@ class ProcessStdOutInput : public InputImplBase
public:
explicit ProcessStdOutInput(const QString &cmd, const QStringList &args, const QDir &wd, const QByteArray &stdin_ = QByteArray());
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_proc;
}
@@ -162,20 +161,20 @@ private:
private:
const QString m_command;
const QStringList m_arguments;
- const shared_ptr<Process> m_proc;
+ const std::shared_ptr<Process> m_proc;
};
class FileInput : public InputImplBase
{
public:
explicit FileInput(const QString &fileName);
- explicit FileInput(const shared_ptr<QFile> &file);
+ explicit FileInput(const std::shared_ptr<QFile> &file);
QString label() const Q_DECL_OVERRIDE
{
return m_io ? QFileInfo(m_fileName).fileName() : InputImplBase::label();
}
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_io;
}
@@ -186,7 +185,7 @@ public:
}
private:
- shared_ptr<QIODevice> m_io;
+ std::shared_ptr<QIODevice> m_io;
QString m_fileName;
};
@@ -198,7 +197,7 @@ public:
void setLabel(const QString &label) Q_DECL_OVERRIDE;
QString label() const Q_DECL_OVERRIDE;
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_buffer;
}
@@ -214,15 +213,15 @@ public:
private:
const QClipboard::Mode m_mode;
- shared_ptr<QBuffer> m_buffer;
+ std::shared_ptr<QBuffer> m_buffer;
};
#endif // QT_NO_CLIPBOARD
}
-shared_ptr<Input> Input::createFromPipeDevice(assuan_fd_t fd, const QString &label)
+std::shared_ptr<Input> Input::createFromPipeDevice(assuan_fd_t fd, const QString &label)
{
- shared_ptr<PipeInput> po(new PipeInput(fd));
+ std::shared_ptr<PipeInput> po(new PipeInput(fd));
po->setDefaultLabel(label);
return po;
}
@@ -231,7 +230,7 @@ PipeInput::PipeInput(assuan_fd_t fd)
: InputImplBase(),
m_io()
{
- shared_ptr<KDPipeIODevice> kdp(new KDPipeIODevice);
+ std::shared_ptr<KDPipeIODevice> kdp(new KDPipeIODevice);
errno = 0;
if (!kdp->open(fd, QIODevice::ReadOnly))
throw Exception(errno ? gpg_error_from_errno(errno) : gpg_error(GPG_ERR_EIO),
@@ -246,21 +245,21 @@ unsigned int PipeInput::classification() const
return 0;
}
-shared_ptr<Input> Input::createFromFile(const QString &fileName, bool)
+std::shared_ptr<Input> Input::createFromFile(const QString &fileName, bool)
{
- return shared_ptr<Input>(new FileInput(fileName));
+ return std::shared_ptr<Input>(new FileInput(fileName));
}
-shared_ptr<Input> Input::createFromFile(const shared_ptr<QFile> &file)
+std::shared_ptr<Input> Input::createFromFile(const std::shared_ptr<QFile> &file)
{
- return shared_ptr<Input>(new FileInput(file));
+ return std::shared_ptr<Input>(new FileInput(file));
}
FileInput::FileInput(const QString &fileName)
: InputImplBase(),
m_io(), m_fileName(fileName)
{
- shared_ptr<QFile> file(new QFile(fileName));
+ std::shared_ptr<QFile> file(new QFile(fileName));
errno = 0;
if (!file->open(QIODevice::ReadOnly))
@@ -270,7 +269,7 @@ FileInput::FileInput(const QString &fileName)
}
-FileInput::FileInput(const shared_ptr<QFile> &file)
+FileInput::FileInput(const std::shared_ptr<QFile> &file)
: InputImplBase(),
m_io(), m_fileName(file->fileName())
{
@@ -290,34 +289,34 @@ unsigned int FileInput::classification() const
return classify(m_fileName);
}
-shared_ptr<Input> Input::createFromProcessStdOut(const QString &command)
+std::shared_ptr<Input> Input::createFromProcessStdOut(const QString &command)
{
- return shared_ptr<Input>(new ProcessStdOutInput(command, QStringList(), QDir::current()));
+ return std::shared_ptr<Input>(new ProcessStdOutInput(command, QStringList(), QDir::current()));
}
-shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args)
+std::shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args)
{
- return shared_ptr<Input>(new ProcessStdOutInput(command, args, QDir::current()));
+ return std::shared_ptr<Input>(new ProcessStdOutInput(command, args, QDir::current()));
}
-shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &wd)
+std::shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &wd)
{
- return shared_ptr<Input>(new ProcessStdOutInput(command, args, wd));
+ return std::shared_ptr<Input>(new ProcessStdOutInput(command, args, wd));
}
-shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QByteArray &stdin_)
+std::shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QByteArray &stdin_)
{
- return shared_ptr<Input>(new ProcessStdOutInput(command, QStringList(), QDir::current(), stdin_));
+ return std::shared_ptr<Input>(new ProcessStdOutInput(command, QStringList(), QDir::current(), stdin_));
}
-shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args, const QByteArray &stdin_)
+std::shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args, const QByteArray &stdin_)
{
- return shared_ptr<Input>(new ProcessStdOutInput(command, args, QDir::current(), stdin_));
+ return std::shared_ptr<Input>(new ProcessStdOutInput(command, args, QDir::current(), stdin_));
}
-shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &wd, const QByteArray &stdin_)
+std::shared_ptr<Input> Input::createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &wd, const QByteArray &stdin_)
{
- return shared_ptr<Input>(new ProcessStdOutInput(command, args, wd, stdin_));
+ return std::shared_ptr<Input>(new ProcessStdOutInput(command, args, wd, stdin_));
}
namespace
@@ -390,9 +389,9 @@ QString ProcessStdOutInput::doErrorString() const
}
#ifndef QT_NO_CLIPBOARD
-shared_ptr<Input> Input::createFromClipboard()
+std::shared_ptr<Input> Input::createFromClipboard()
{
- return shared_ptr<Input>(new ClipboardInput(QClipboard::Clipboard));
+ return std::shared_ptr<Input>(new ClipboardInput(QClipboard::Clipboard));
}
static QByteArray dataFromClipboard(QClipboard::Mode mode)
@@ -444,7 +443,7 @@ Input::~Input() {}
void Input::finalize()
{
- if (const shared_ptr<QIODevice> io = ioDevice())
+ if (const std::shared_ptr<QIODevice> io = ioDevice())
if (io->isOpen()) {
io->close();
}
diff --git a/src/utils/input.h b/src/utils/input.h
index 9f77b91..2790658 100644
--- a/src/utils/input.h
+++ b/src/utils/input.h
@@ -35,7 +35,7 @@
#include <kleo-assuan.h> // for assuan_fd_t
-#include <boost/shared_ptr.hpp>
+#include <memory>
class QIODevice;
class QString;
@@ -54,23 +54,23 @@ public:
virtual QString label() const = 0;
virtual void setLabel(const QString &label) = 0;
- virtual boost::shared_ptr<QIODevice> ioDevice() const = 0;
+ virtual std::shared_ptr<QIODevice> ioDevice() const = 0;
virtual unsigned int classification() const = 0;
virtual unsigned long long size() const = 0;
virtual QString errorString() const = 0;
void finalize(); // equivalent to ioDevice()->close();
- static boost::shared_ptr<Input> createFromPipeDevice(assuan_fd_t fd, const QString &label);
- static boost::shared_ptr<Input> createFromFile(const QString &filename, bool dummy = false);
- static boost::shared_ptr<Input> createFromFile(const boost::shared_ptr<QFile> &file);
- static boost::shared_ptr<Input> createFromProcessStdOut(const QString &command);
- static boost::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args);
- static boost::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &workingDirectory);
- static boost::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QByteArray &stdin_);
- static boost::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args, const QByteArray &stdin_);
- static boost::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &workingDirectory, const QByteArray &stdin_);
+ static std::shared_ptr<Input> createFromPipeDevice(assuan_fd_t fd, const QString &label);
+ static std::shared_ptr<Input> createFromFile(const QString &filename, bool dummy = false);
+ static std::shared_ptr<Input> createFromFile(const std::shared_ptr<QFile> &file);
+ static std::shared_ptr<Input> createFromProcessStdOut(const QString &command);
+ static std::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args);
+ static std::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &workingDirectory);
+ static std::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QByteArray &stdin_);
+ static std::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args, const QByteArray &stdin_);
+ static std::shared_ptr<Input> createFromProcessStdOut(const QString &command, const QStringList &args, const QDir &workingDirectory, const QByteArray &stdin_);
#ifndef QT_NO_CLIPBOARD
- static boost::shared_ptr<Input> createFromClipboard();
+ static std::shared_ptr<Input> createFromClipboard();
#endif
};
}
diff --git a/src/utils/iodevicelogger.cpp b/src/utils/iodevicelogger.cpp
index 5f5f11c..c8afbaf 100644
--- a/src/utils/iodevicelogger.cpp
+++ b/src/utils/iodevicelogger.cpp
@@ -36,7 +36,6 @@
#include <cassert>
-using namespace boost;
using namespace Kleo;
class IODeviceLogger::Private
@@ -44,9 +43,9 @@ class IODeviceLogger::Private
IODeviceLogger *const q;
public:
- static bool write(const shared_ptr<QIODevice> &dev, const char *data, qint64 max);
+ static bool write(const std::shared_ptr<QIODevice> &dev, const char *data, qint64 max);
- explicit Private(const shared_ptr<QIODevice> &io_, IODeviceLogger *qq) : q(qq), io(io_), writeLog(), readLog()
+ explicit Private(const std::shared_ptr<QIODevice> &io_, IODeviceLogger *qq) : q(qq), io(io_), writeLog(), readLog()
{
assert(io);
connect(io.get(), &QIODevice::aboutToClose, q, &QIODevice::aboutToClose);
@@ -59,12 +58,12 @@ public:
{
}
- const shared_ptr<QIODevice> io;
- shared_ptr<QIODevice> writeLog;
- shared_ptr<QIODevice> readLog;
+ const std::shared_ptr<QIODevice> io;
+ std::shared_ptr<QIODevice> writeLog;
+ std::shared_ptr<QIODevice> readLog;
};
-bool IODeviceLogger::Private::write(const shared_ptr<QIODevice> &dev, const char *data, qint64 max)
+bool IODeviceLogger::Private::write(const std::shared_ptr<QIODevice> &dev, const char *data, qint64 max)
{
assert(dev);
assert(data);
@@ -80,7 +79,7 @@ bool IODeviceLogger::Private::write(const shared_ptr<QIODevice> &dev, const char
return true;
}
-IODeviceLogger::IODeviceLogger(const shared_ptr<QIODevice> &iod, QObject *parent) : QIODevice(parent), d(new Private(iod, this))
+IODeviceLogger::IODeviceLogger(const std::shared_ptr<QIODevice> &iod, QObject *parent) : QIODevice(parent), d(new Private(iod, this))
{
}
@@ -88,12 +87,12 @@ IODeviceLogger::~IODeviceLogger()
{
}
-void IODeviceLogger::setWriteLogDevice(const shared_ptr<QIODevice> &dev)
+void IODeviceLogger::setWriteLogDevice(const std::shared_ptr<QIODevice> &dev)
{
d->writeLog = dev;
}
-void IODeviceLogger::setReadLogDevice(const shared_ptr<QIODevice> &dev)
+void IODeviceLogger::setReadLogDevice(const std::shared_ptr<QIODevice> &dev)
{
d->readLog = dev;
}
diff --git a/src/utils/iodevicelogger.h b/src/utils/iodevicelogger.h
index 36e1e1f..8f4b491 100644
--- a/src/utils/iodevicelogger.h
+++ b/src/utils/iodevicelogger.h
@@ -37,7 +37,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace Kleo
{
@@ -46,11 +46,11 @@ class IODeviceLogger : public QIODevice
{
Q_OBJECT
public:
- explicit IODeviceLogger(const boost::shared_ptr<QIODevice> &iod, QObject *parent = Q_NULLPTR);
+ explicit IODeviceLogger(const std::shared_ptr<QIODevice> &iod, QObject *parent = Q_NULLPTR);
~IODeviceLogger();
- void setWriteLogDevice(const boost::shared_ptr<QIODevice> &dev);
- void setReadLogDevice(const boost::shared_ptr<QIODevice> &dev);
+ void setWriteLogDevice(const std::shared_ptr<QIODevice> &dev);
+ void setReadLogDevice(const std::shared_ptr<QIODevice> &dev);
bool atEnd() const Q_DECL_OVERRIDE;
qint64 bytesAvailable() const Q_DECL_OVERRIDE;
diff --git a/src/utils/log.cpp b/src/utils/log.cpp
index 859ed8e..cd8ca59 100644
--- a/src/utils/log.cpp
+++ b/src/utils/log.cpp
@@ -45,11 +45,9 @@
#include <QFile>
#include <QString>
-#include <boost/weak_ptr.hpp>
#include <cassert>
#include <cstdio>
-using namespace boost;
using namespace Kleo;
class Log::Private
@@ -94,18 +92,18 @@ void Log::messageHandler(QtMsgType type, const QMessageLogContext &ctx, const QS
fflush(file);
}
-shared_ptr<const Log> Log::instance()
+std::shared_ptr<const Log> Log::instance()
{
return mutableInstance();
}
-shared_ptr<Log> Log::mutableInstance()
+std::shared_ptr<Log> Log::mutableInstance()
{
- static weak_ptr<Log> self;
+ static std::weak_ptr<Log> self;
try {
- return shared_ptr<Log>(self);
- } catch (const bad_weak_ptr &) {
- const shared_ptr<Log> s(new Log);
+ return std::shared_ptr<Log>(self);
+ } catch (const std::bad_weak_ptr &) {
+ const std::shared_ptr<Log> s(new Log);
self = s;
return s;
}
@@ -151,18 +149,18 @@ void Log::setOutputDirectory(const QString &path)
assert(d->m_logFile);
}
-shared_ptr<QIODevice> Log::createIOLogger(const shared_ptr<QIODevice> &io, const QString &prefix, OpenMode mode) const
+std::shared_ptr<QIODevice> Log::createIOLogger(const std::shared_ptr<QIODevice> &io, const QString &prefix, OpenMode mode) const
{
if (!d->m_ioLoggingEnabled) {
return io;
}
- shared_ptr<IODeviceLogger> logger(new IODeviceLogger(io));
+ std::shared_ptr<IODeviceLogger> logger(new IODeviceLogger(io));
const QString timestamp = QDateTime::currentDateTime().toString(QStringLiteral("yyMMdd-hhmmss"));
const QString fn = d->m_outputDirectory + QLatin1Char('/') + prefix + QLatin1Char('-') + timestamp + QLatin1Char('-') + KRandom::randomString(4);
- shared_ptr<QFile> file(new QFile(fn));
+ std::shared_ptr<QFile> file(new QFile(fn));
if (!file->open(QIODevice::WriteOnly)) {
throw Exception(gpg_error(GPG_ERR_EIO), i18n("Log Error: Could not open log file \"%1\" for writing.", fn));
diff --git a/src/utils/log.h b/src/utils/log.h
index 138d985..9fff29d 100644
--- a/src/utils/log.h
+++ b/src/utils/log.h
@@ -35,7 +35,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <cstdio>
@@ -57,8 +57,8 @@ public:
static void messageHandler(QtMsgType type, const QMessageLogContext &ctx,
const QString &msg);
- static boost::shared_ptr<const Log> instance();
- static boost::shared_ptr<Log> mutableInstance();
+ static std::shared_ptr<const Log> instance();
+ static std::shared_ptr<Log> mutableInstance();
~Log();
@@ -68,7 +68,7 @@ public:
QString outputDirectory() const;
void setOutputDirectory(const QString &path);
- boost::shared_ptr<QIODevice> createIOLogger(const boost::shared_ptr<QIODevice> &wrapped, const QString &prefix, OpenMode mode) const;
+ std::shared_ptr<QIODevice> createIOLogger(const std::shared_ptr<QIODevice> &wrapped, const QString &prefix, OpenMode mode) const;
FILE *logFile() const;
diff --git a/src/utils/output.cpp b/src/utils/output.cpp
index 2b9d080..e59fc67 100644
--- a/src/utils/output.cpp
+++ b/src/utils/output.cpp
@@ -66,7 +66,6 @@
using namespace Kleo;
using namespace Kleo::_detail;
-using namespace boost;
static const int PROCESS_MAX_RUNTIME_TIMEOUT = -1; // no timeout
static const int PROCESS_TERMINATE_TIMEOUT = 5 * 1000; // 5s
@@ -265,7 +264,7 @@ public:
private:
virtual QString doErrorString() const
{
- if (shared_ptr<QIODevice> io = ioDevice()) {
+ if (std::shared_ptr<QIODevice> io = ioDevice()) {
return io->errorString();
} else {
return i18n("No output device");
@@ -289,7 +288,7 @@ class PipeOutput : public OutputImplBase
public:
explicit PipeOutput(assuan_fd_t fd);
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_io;
}
@@ -300,7 +299,7 @@ public:
doFinalize();
}
private:
- shared_ptr< inhibit_close<KDPipeIODevice> > m_io;
+ std::shared_ptr< inhibit_close<KDPipeIODevice> > m_io;
};
class ProcessStdInOutput : public OutputImplBase
@@ -308,7 +307,7 @@ class ProcessStdInOutput : public OutputImplBase
public:
explicit ProcessStdInOutput(const QString &cmd, const QStringList &args, const QDir &wd);
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_proc;
}
@@ -343,13 +342,13 @@ private:
private:
const QString m_command;
const QStringList m_arguments;
- const shared_ptr< redirect_close<QProcess> > m_proc;
+ const std::shared_ptr< redirect_close<QProcess> > m_proc;
};
class FileOutput : public OutputImplBase
{
public:
- explicit FileOutput(const QString &fileName, const shared_ptr<OverwritePolicy> &policy);
+ explicit FileOutput(const QString &fileName, const std::shared_ptr<OverwritePolicy> &policy);
~FileOutput()
{
qCDebug(KLEOPATRA_LOG) << this;
@@ -359,7 +358,7 @@ public:
{
return QFileInfo(m_fileName).fileName();
}
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_tmpFile;
}
@@ -372,8 +371,8 @@ private:
private:
const QString m_fileName;
- shared_ptr< TemporaryFile > m_tmpFile;
- const shared_ptr<OverwritePolicy> m_policy;
+ std::shared_ptr< TemporaryFile > m_tmpFile;
+ const std::shared_ptr<OverwritePolicy> m_policy;
};
#ifndef QT_NO_CLIPBOARD
@@ -383,7 +382,7 @@ public:
explicit ClipboardOutput(QClipboard::Mode mode);
QString label() const Q_DECL_OVERRIDE;
- shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
+ std::shared_ptr<QIODevice> ioDevice() const Q_DECL_OVERRIDE
{
return m_buffer;
}
@@ -397,15 +396,15 @@ private:
}
private:
const QClipboard::Mode m_mode;
- shared_ptr<QBuffer> m_buffer;
+ std::shared_ptr<QBuffer> m_buffer;
};
#endif // QT_NO_CLIPBOARD
}
-shared_ptr<Output> Output::createFromPipeDevice(assuan_fd_t fd, const QString &label)
+std::shared_ptr<Output> Output::createFromPipeDevice(assuan_fd_t fd, const QString &label)
{
- shared_ptr<PipeOutput> po(new PipeOutput(fd));
+ std::shared_ptr<PipeOutput> po(new PipeOutput(fd));
po->setDefaultLabel(label);
return po;
}
@@ -421,19 +420,19 @@ PipeOutput::PipeOutput(assuan_fd_t fd)
assuanFD2int(fd)));
}
-shared_ptr<Output> Output::createFromFile(const QString &fileName, bool forceOverwrite)
+std::shared_ptr<Output> Output::createFromFile(const QString &fileName, bool forceOverwrite)
{
- return createFromFile(fileName, shared_ptr<OverwritePolicy>(new OverwritePolicy(0, forceOverwrite ? OverwritePolicy::Allow : OverwritePolicy::Deny)));
+ return createFromFile(fileName, std::shared_ptr<OverwritePolicy>(new OverwritePolicy(0, forceOverwrite ? OverwritePolicy::Allow : OverwritePolicy::Deny)));
}
-shared_ptr<Output> Output::createFromFile(const QString &fileName, const shared_ptr<OverwritePolicy> &policy)
+std::shared_ptr<Output> Output::createFromFile(const QString &fileName, const std::shared_ptr<OverwritePolicy> &policy)
{
- shared_ptr<FileOutput> fo(new FileOutput(fileName, policy));
+ std::shared_ptr<FileOutput> fo(new FileOutput(fileName, policy));
qCDebug(KLEOPATRA_LOG) << fo.get();
return fo;
}
-FileOutput::FileOutput(const QString &fileName, const shared_ptr<OverwritePolicy> &policy)
+FileOutput::FileOutput(const QString &fileName, const std::shared_ptr<OverwritePolicy> &policy)
: OutputImplBase(),
m_fileName(fileName),
m_tmpFile(new TemporaryFile(fileName)),
@@ -488,7 +487,7 @@ void FileOutput::doFinalize()
m_tmpFile->setAutoRemove(false);
QPointer<QObject> guard = m_tmpFile.get();
m_tmpFile.reset(); // really close the file - needed on Windows for renaming :/
- kleo_assert(!guard); // if this triggers, we need to audit for holder of shared_ptr<QIODevice>s.
+ kleo_assert(!guard); // if this triggers, we need to audit for holder of std::shared_ptr<QIODevice>s.
qCDebug(KLEOPATRA_LOG) << this << " renaming " << tmpFileName << "->" << m_fileName;
@@ -523,19 +522,19 @@ void FileOutput::doFinalize()
tmpFileName, m_fileName));
}
-shared_ptr<Output> Output::createFromProcessStdIn(const QString &command)
+std::shared_ptr<Output> Output::createFromProcessStdIn(const QString &command)
{
- return shared_ptr<Output>(new ProcessStdInOutput(command, QStringList(), QDir::current()));
+ return std::shared_ptr<Output>(new ProcessStdInOutput(command, QStringList(), QDir::current()));
}
-shared_ptr<Output> Output::createFromProcessStdIn(const QString &command, const QStringList &args)
+std::shared_ptr<Output> Output::createFromProcessStdIn(const QString &command, const QStringList &args)
{
- return shared_ptr<Output>(new ProcessStdInOutput(command, args, QDir::current()));
+ return std::shared_ptr<Output>(new ProcessStdInOutput(command, args, QDir::current()));
}
-shared_ptr<Output> Output::createFromProcessStdIn(const QString &command, const QStringList &args, const QDir &wd)
+std::shared_ptr<Output> Output::createFromProcessStdIn(const QString &command, const QStringList &args, const QDir &wd)
{
- return shared_ptr<Output>(new ProcessStdInOutput(command, args, wd));
+ return std::shared_ptr<Output>(new ProcessStdInOutput(command, args, wd));
}
ProcessStdInOutput::ProcessStdInOutput(const QString &cmd, const QStringList &args, const QDir &wd)
@@ -585,9 +584,9 @@ QString ProcessStdInOutput::doErrorString() const
}
#ifndef QT_NO_CLIPBOARD
-shared_ptr<Output> Output::createFromClipboard()
+std::shared_ptr<Output> Output::createFromClipboard()
{
- return shared_ptr<Output>(new ClipboardOutput(QClipboard::Clipboard));
+ return std::shared_ptr<Output>(new ClipboardOutput(QClipboard::Clipboard));
}
ClipboardOutput::ClipboardOutput(QClipboard::Mode mode)
diff --git a/src/utils/output.h b/src/utils/output.h
index 1879c09..91c9d8e 100644
--- a/src/utils/output.h
+++ b/src/utils/output.h
@@ -37,7 +37,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class QIODevice;
class QString;
@@ -77,7 +77,7 @@ public:
virtual void setLabel(const QString &label) = 0;
virtual QString label() const = 0;
- virtual boost::shared_ptr<QIODevice> ioDevice() const = 0;
+ virtual std::shared_ptr<QIODevice> ioDevice() const = 0;
virtual QString errorString() const = 0;
virtual bool isFinalized() const = 0;
virtual void finalize() = 0;
@@ -85,14 +85,14 @@ public:
virtual bool binaryOpt() const = 0;
virtual void setBinaryOpt(bool value) = 0;
- static boost::shared_ptr<Output> createFromFile(const QString &fileName, const boost::shared_ptr<OverwritePolicy> &);
- static boost::shared_ptr<Output> createFromFile(const QString &fileName, bool forceOverwrite);
- static boost::shared_ptr<Output> createFromPipeDevice(assuan_fd_t fd, const QString &label);
- static boost::shared_ptr<Output> createFromProcessStdIn(const QString &command);
- static boost::shared_ptr<Output> createFromProcessStdIn(const QString &command, const QStringList &args);
- static boost::shared_ptr<Output> createFromProcessStdIn(const QString &command, const QStringList &args, const QDir &workingDirectory);
+ static std::shared_ptr<Output> createFromFile(const QString &fileName, const std::shared_ptr<OverwritePolicy> &);
+ static std::shared_ptr<Output> createFromFile(const QString &fileName, bool forceOverwrite);
+ static std::shared_ptr<Output> createFromPipeDevice(assuan_fd_t fd, const QString &label);
+ static std::shared_ptr<Output> createFromProcessStdIn(const QString &command);
+ static std::shared_ptr<Output> createFromProcessStdIn(const QString &command, const QStringList &args);
+ static std::shared_ptr<Output> createFromProcessStdIn(const QString &command, const QStringList &args, const QDir &workingDirectory);
#ifndef QT_NO_CLIPBOARD
- static boost::shared_ptr<Output> createFromClipboard();
+ static std::shared_ptr<Output> createFromClipboard();
#endif
};
}
diff --git a/src/utils/types.cpp b/src/utils/types.cpp
index c1786d0..c7b5edb 100644
--- a/src/utils/types.cpp
+++ b/src/utils/types.cpp
@@ -37,22 +37,18 @@
#include <QWidget>
#include <QVector>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-
#ifdef Q_OS_WIN
#include <windows.h>
#endif
using namespace Kleo;
-using namespace boost;
class ExecutionContextUser::Private
{
friend class ::Kleo::ExecutionContextUser;
ExecutionContextUser *const q;
public:
- explicit Private(const shared_ptr<const ExecutionContext> &ctx, ExecutionContextUser *qq)
+ explicit Private(const std::shared_ptr<const ExecutionContext> &ctx, ExecutionContextUser *qq)
: q(qq),
executionContext(ctx),
idApplied()
@@ -64,7 +60,7 @@ private:
void applyWindowID(QWidget *w);
private:
- weak_ptr<const ExecutionContext> executionContext;
+ std::weak_ptr<const ExecutionContext> executionContext;
QVector<QWidget *> idApplied;
};
@@ -73,19 +69,19 @@ void ExecutionContextUser::applyWindowID(QWidget *wid)
if (d->idApplied.contains(wid)) {
return;
}
- if (const shared_ptr<const ExecutionContext> ctx = d->executionContext.lock()) {
+ if (const std::shared_ptr<const ExecutionContext> ctx = d->executionContext.lock()) {
ctx->applyWindowID(wid);
d->idApplied.append(wid);
}
}
ExecutionContextUser::ExecutionContextUser()
- : d(new Private(shared_ptr<const ExecutionContext>(), this))
+ : d(new Private(std::shared_ptr<const ExecutionContext>(), this))
{
}
-ExecutionContextUser::ExecutionContextUser(const shared_ptr<const ExecutionContext> &ctx)
+ExecutionContextUser::ExecutionContextUser(const std::shared_ptr<const ExecutionContext> &ctx)
: d(new Private(ctx, this))
{
@@ -93,13 +89,13 @@ ExecutionContextUser::ExecutionContextUser(const shared_ptr<const ExecutionConte
ExecutionContextUser::~ExecutionContextUser() {}
-void ExecutionContextUser::setExecutionContext(const shared_ptr<const ExecutionContext> &ctx)
+void ExecutionContextUser::setExecutionContext(const std::shared_ptr<const ExecutionContext> &ctx)
{
d->executionContext = ctx;
d->idApplied.clear();
}
-shared_ptr<const ExecutionContext> ExecutionContextUser::executionContext() const
+std::shared_ptr<const ExecutionContext> ExecutionContextUser::executionContext() const
{
return d->executionContext.lock();
}
diff --git a/src/utils/types.h b/src/utils/types.h
index 30bfd16..727d140 100644
--- a/src/utils/types.h
+++ b/src/utils/types.h
@@ -35,12 +35,9 @@
#include <utils/pimpl_ptr.h>
-class QWidget;
+#include <memory>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+class QWidget;
namespace Kleo
{
@@ -75,11 +72,11 @@ class ExecutionContextUser
{
public:
ExecutionContextUser();
- explicit ExecutionContextUser(const boost::shared_ptr<const ExecutionContext> &ec);
+ explicit ExecutionContextUser(const std::shared_ptr<const ExecutionContext> &ec);
virtual ~ExecutionContextUser();
- void setExecutionContext(const boost::shared_ptr<const ExecutionContext> &ec);
- boost::shared_ptr<const ExecutionContext> executionContext() const;
+ void setExecutionContext(const std::shared_ptr<const ExecutionContext> &ec);
+ std::shared_ptr<const ExecutionContext> executionContext() const;
protected:
void bringToForeground(QWidget *wid);
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b4cead2..8488f7d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -63,7 +63,7 @@ ecm_mark_as_test(test_verify)
target_link_libraries(test_verify
KF5::Libkleo
Qt5::Test
- KF5::QGpgme
+ QGpgme
KF5::CoreAddons
KF5::I18n
Qt5::Widgets
@@ -104,13 +104,13 @@ if(USABLE_ASSUAN_FOUND)
if(WIN32)
target_link_libraries(test_uiserver
${ASSUAN_VANILLA_LIBRARIES}
- KF5::QGpgme
+ QGpgme
ws2_32
)
else()
target_link_libraries(test_uiserver
${ASSUAN_PTHREAD_LIBRARIES}
- KF5::QGpgme
+ QGpgme
)
endif()
diff --git a/tests/test_verify.cpp b/tests/test_verify.cpp
index 9ba3244..8546df3 100644
--- a/tests/test_verify.cpp
+++ b/tests/test_verify.cpp
@@ -32,10 +32,11 @@
#include "kleo_test.h"
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/VerifyDetachedJob>
-#include <Libkleo/KeyListJob>
-#include <Libkleo/DecryptVerifyJob>
+#include <QGpgME/Protocol>
+#include <QGpgME/VerifyDetachedJob>
+#include <QGpgME/KeyListJob>
+#include <QGpgME/DecryptVerifyJob>
+
#include <KAboutData>
#include <gpgme++/error.h>
@@ -60,21 +61,21 @@ private:
// Data shared with all tests
QByteArray mSignature;
QByteArray mSignedData;
- const Kleo::CryptoBackend::Protocol *mBackend;
+ const QGpgME::Protocol *mBackend;
QEventLoop mEventLoop;
// Data for testParallelVerifyAndKeyListJobs()
- QList<Kleo::VerifyDetachedJob *> mParallelVerifyJobs;
- QList<Kleo::KeyListJob *> mParallelKeyListJobs;
+ QList<QGpgME::VerifyDetachedJob *> mParallelVerifyJobs;
+ QList<QGpgME::KeyListJob *> mParallelKeyListJobs;
// Data for testMixedParallelJobs()
- QList<Kleo::Job *> mRunningJobs;
+ QList<QGpgME::Job *> mRunningJobs;
int mJobsStarted;
public Q_SLOTS:
void slotParallelKeyListJobFinished()
{
- mParallelKeyListJobs.removeAll(static_cast<Kleo::KeyListJob *>(sender()));
+ mParallelKeyListJobs.removeAll(static_cast<QGpgME::KeyListJob *>(sender()));
// When all jobs are done, quit the event loop
if (mParallelVerifyJobs.isEmpty() && mParallelKeyListJobs.isEmpty()) {
@@ -85,14 +86,14 @@ public Q_SLOTS:
void slotParallelVerifyJobFinished(GpgME::VerificationResult result)
{
// Verify the result of the job is correct
- QVERIFY(mParallelVerifyJobs.contains(static_cast<Kleo::VerifyDetachedJob *>(sender())));
+ QVERIFY(mParallelVerifyJobs.contains(static_cast<QGpgME::VerifyDetachedJob *>(sender())));
QCOMPARE(result.signature(0).validity(), GpgME::Signature::Full);
- mParallelVerifyJobs.removeAll(static_cast<Kleo::VerifyDetachedJob *>(sender()));
+ mParallelVerifyJobs.removeAll(static_cast<QGpgME::VerifyDetachedJob *>(sender()));
// Start a key list job
- Kleo::KeyListJob *job = mBackend->keyListJob();
+ QGpgME::KeyListJob *job = mBackend->keyListJob();
mParallelKeyListJobs.append(job);
- connect(job, &Kleo::Job::done,
+ connect(job, &QGpgME::Job::done,
this, &VerifyTest::slotParallelKeyListJobFinished);
QVERIFY(!job->start(QStringList()));
}
@@ -100,7 +101,7 @@ public Q_SLOTS:
void someJobDone()
{
// Don't bother checking any results here
- mRunningJobs.removeAll(static_cast<Kleo::Job *>(sender()));
+ mRunningJobs.removeAll(static_cast<QGpgME::Job *>(sender()));
}
void startAnotherJob()
@@ -114,18 +115,18 @@ public Q_SLOTS:
}
// Randomly either start a keylist or a verify job
- Kleo::Job *job;
+ QGpgME::Job *job;
if (counter % 2 == 0) {
- Kleo::VerifyDetachedJob *vdj = mBackend->verifyDetachedJob();
+ QGpgME::VerifyDetachedJob *vdj = mBackend->verifyDetachedJob();
QVERIFY(!vdj->start(mSignature, mSignedData));
job = vdj;
} else {
- Kleo::KeyListJob *klj = mBackend->keyListJob();
+ QGpgME::KeyListJob *klj = mBackend->keyListJob();
QVERIFY(!klj->start(QStringList()));
job = klj;
}
mRunningJobs.append(job);
- connect(job, &Kleo::Job::done, this, &VerifyTest::someJobDone);
+ connect(job, &QGpgME::Job::done, this, &VerifyTest::someJobDone);
// Quit after 2500 jobs, that should be enough
mJobsStarted++;
@@ -152,12 +153,12 @@ private Q_SLOTS:
mSignature = sigFile.readAll();
mSignedData = dataFile.readAll();
- mBackend = Kleo::CryptoBackendFactory::instance()->protocol("openpgp");
+ mBackend = QGpgME::openpgp();
}
void testVerify()
{
- Kleo::VerifyDetachedJob *job = mBackend->verifyDetachedJob();
+ QGpgME::VerifyDetachedJob *job = mBackend->verifyDetachedJob();
QSignalSpy spy(job, SIGNAL(result(GpgME::VerificationResult)));
QVERIFY(spy.isValid());
GpgME::Error err = job->start(mSignature, mSignedData);
@@ -186,7 +187,7 @@ private Q_SLOTS:
QVERIFY(sigFile.open(QFile::ReadOnly));
const QByteArray ciphertext = sigFile.readAll();
- Kleo::DecryptVerifyJob *job = mBackend->decryptVerifyJob();
+ QGpgME::DecryptVerifyJob *job = mBackend->decryptVerifyJob();
result = job->exec(ciphertext, plaintext);
QVERIFY(result.first.error().code());
@@ -209,7 +210,7 @@ private Q_SLOTS:
// ^ This should also be reevaluated if the underlying bug in gpgme
// is fixed.
for (int i = 0; i < 10; ++i) {
- Kleo::VerifyDetachedJob *job = mBackend->verifyDetachedJob();
+ QGpgME::VerifyDetachedJob *job = mBackend->verifyDetachedJob();
mParallelVerifyJobs.append(job);
QVERIFY(!job->start(mSignature, mSignedData));
connect(job, SIGNAL(result(GpgME::VerificationResult)),