summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-10-12 15:48:32 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-10-12 17:19:15 (GMT)
commitda4c0eb2677cd38bbaaa43dbc904f9328528e81c (patch)
tree49e5255da15863f01ab2542f9d65e643918cadeb
parent920027ccdaad7420c37057cbb244095e898ca7d8 (diff)
Port away from boost where possible
We only use boost algorithm now, but all references to shared_ptr, bind etc. have been replaced with C++11 equivalents.
-rw-r--r--src/commands/checksumcreatefilescommand.cpp3
-rw-r--r--src/commands/checksumverifyfilescommand.cpp3
-rw-r--r--src/commands/decryptverifyclipboardcommand.cpp2
-rw-r--r--src/commands/decryptverifyfilescommand.cpp3
-rw-r--r--src/commands/deletecertificatescommand.cpp20
-rw-r--r--src/commands/encryptclipboardcommand.cpp2
-rw-r--r--src/commands/exportcertificatecommand.cpp8
-rw-r--r--src/commands/importcertificatescommand.cpp34
-rw-r--r--src/commands/lookupcertificatescommand.cpp10
-rw-r--r--src/commands/reloadkeyscommand.cpp3
-rw-r--r--src/commands/selftestcommand.cpp11
-rw-r--r--src/commands/signclipboardcommand.cpp2
-rw-r--r--src/commands/signencryptfilescommand.cpp4
-rw-r--r--src/conf/appearanceconfigwidget.cpp6
-rw-r--r--src/crypto/certificateresolver.cpp29
-rw-r--r--src/crypto/controller.cpp3
-rw-r--r--src/crypto/createchecksumscontroller.cpp65
-rw-r--r--src/crypto/decryptverifytask.cpp24
-rw-r--r--src/crypto/gui/certificatelineedit.cpp2
-rw-r--r--src/crypto/gui/certificatelineedit.h5
-rw-r--r--src/crypto/gui/newresultpage.cpp13
-rw-r--r--src/crypto/gui/resultlistwidget.cpp28
-rw-r--r--src/crypto/gui/resultpage.cpp8
-rw-r--r--src/crypto/gui/signencryptemailconflictdialog.cpp46
-rw-r--r--src/crypto/gui/signencryptemailconflictdialog.h5
-rw-r--r--src/crypto/gui/signencryptwidget.cpp9
-rw-r--r--src/crypto/gui/signingcertificateselectionwidget.cpp14
-rw-r--r--src/crypto/gui/verifychecksumsdialog.cpp5
-rw-r--r--src/crypto/newsignencryptemailcontroller.cpp95
-rw-r--r--src/crypto/recipient.cpp12
-rw-r--r--src/crypto/recipient.h5
-rw-r--r--src/crypto/sender.cpp24
-rw-r--r--src/crypto/sender.h5
-rw-r--r--src/crypto/signemailcontroller.cpp7
-rw-r--r--src/crypto/signemailtask.cpp17
-rw-r--r--src/crypto/signencryptfilescontroller.cpp7
-rw-r--r--src/crypto/task.cpp11
-rw-r--r--src/crypto/task.h12
-rw-r--r--src/crypto/taskcollection.cpp10
-rw-r--r--src/crypto/verifychecksumscontroller.cpp64
-rw-r--r--src/dialogs/adduseriddialog.cpp2
-rw-r--r--src/dialogs/certificatedetailsdialog.cpp5
-rw-r--r--src/dialogs/certificateselectiondialog.cpp16
-rw-r--r--src/dialogs/certificateselectiondialog.h8
-rw-r--r--src/dialogs/certifycertificatedialog.cpp25
-rw-r--r--src/dialogs/deletecertificatesdialog.cpp7
-rw-r--r--src/dialogs/lookupcertificatesdialog.cpp3
-rw-r--r--src/dialogs/selftestdialog.cpp27
-rw-r--r--src/dialogs/selftestdialog.h12
-rw-r--r--src/dialogs/setinitialpindialog.cpp6
-rw-r--r--src/kleopatraapplication.cpp7
-rw-r--r--src/libkleopatraclient/core/command.cpp8
-rw-r--r--src/mainwindow.cpp8
-rw-r--r--src/newcertificatewizard/newcertificatewizard.cpp10
-rw-r--r--src/selftest/enginecheck.cpp15
-rw-r--r--src/selftest/enginecheck.h11
-rw-r--r--src/selftest/gpgagentcheck.cpp7
-rw-r--r--src/selftest/gpgagentcheck.h7
-rw-r--r--src/selftest/gpgconfcheck.cpp7
-rw-r--r--src/selftest/gpgconfcheck.h7
-rw-r--r--src/selftest/libkleopatrarccheck.cpp7
-rw-r--r--src/selftest/libkleopatrarccheck.h7
-rw-r--r--src/selftest/registrycheck.cpp7
-rw-r--r--src/selftest/registrycheck.h7
-rw-r--r--src/selftest/uiservercheck.cpp7
-rw-r--r--src/selftest/uiservercheck.h7
-rw-r--r--src/smartcard/readerstatus.cpp42
-rw-r--r--src/systrayicon.cpp4
-rw-r--r--src/uiserver/assuanserverconnection.cpp63
-rw-r--r--src/uiserver/decryptverifycommandemailbase.cpp1
-rw-r--r--src/uiserver/decryptverifycommandfilesbase.cpp6
-rw-r--r--src/uiserver/selectcertificatecommand.cpp8
-rw-r--r--src/uiserver/sessiondata.cpp5
-rw-r--r--src/uiserver/uiserver.cpp22
-rw-r--r--src/uiserver/uiserver_p.h2
-rw-r--r--src/uiserver/uiserver_unix.cpp1
-rw-r--r--src/uiserver/uiserver_win.cpp1
-rw-r--r--src/utils/cached.h14
-rw-r--r--src/utils/detail_p.h2
-rw-r--r--src/utils/kleo_assert.h22
-rw-r--r--src/utils/multivalidator.cpp24
-rw-r--r--src/utils/path-helper.cpp14
-rw-r--r--src/view/keylistcontroller.cpp44
-rw-r--r--src/view/keytreeview.cpp15
-rw-r--r--src/view/keytreeview.h12
-rw-r--r--src/view/searchbar.cpp9
-rw-r--r--src/view/searchbar.h8
-rw-r--r--src/view/tabwidget.cpp33
-rw-r--r--src/view/tabwidget.h8
89 files changed, 589 insertions, 647 deletions
diff --git a/src/commands/checksumcreatefilescommand.cpp b/src/commands/checksumcreatefilescommand.cpp
index 1d20568..0ebe4f3 100644
--- a/src/commands/checksumcreatefilescommand.cpp
+++ b/src/commands/checksumcreatefilescommand.cpp
@@ -52,7 +52,6 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class ChecksumCreateFilesCommand::Private : public Command::Private
{
@@ -100,7 +99,7 @@ const ChecksumCreateFilesCommand::Private *ChecksumCreateFilesCommand::d_func()
ChecksumCreateFilesCommand::Private::Private(ChecksumCreateFilesCommand *qq, KeyListController *c)
: Command::Private(qq, c),
files(),
- shared_qq(qq, kdtools::nodelete()),
+ shared_qq(qq, [](ChecksumCreateFilesCommand*){}),
controller()
{
controller.setAllowAddition(true);
diff --git a/src/commands/checksumverifyfilescommand.cpp b/src/commands/checksumverifyfilescommand.cpp
index fcfa8ff..f9a81b7 100644
--- a/src/commands/checksumverifyfilescommand.cpp
+++ b/src/commands/checksumverifyfilescommand.cpp
@@ -52,7 +52,6 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class ChecksumVerifyFilesCommand::Private : public Command::Private
{
@@ -100,7 +99,7 @@ const ChecksumVerifyFilesCommand::Private *ChecksumVerifyFilesCommand::d_func()
ChecksumVerifyFilesCommand::Private::Private(ChecksumVerifyFilesCommand *qq, KeyListController *c)
: Command::Private(qq, c),
files(),
- shared_qq(qq, kdtools::nodelete()),
+ shared_qq(qq, [](ChecksumVerifyFilesCommand *){}),
controller()
{
diff --git a/src/commands/decryptverifyclipboardcommand.cpp b/src/commands/decryptverifyclipboardcommand.cpp
index a8bbe0f..cb69de2 100644
--- a/src/commands/decryptverifyclipboardcommand.cpp
+++ b/src/commands/decryptverifyclipboardcommand.cpp
@@ -101,7 +101,7 @@ const DecryptVerifyClipboardCommand::Private *DecryptVerifyClipboardCommand::d_f
DecryptVerifyClipboardCommand::Private::Private(DecryptVerifyClipboardCommand *qq, KeyListController *c)
: Command::Private(qq, c),
- shared_qq(qq, kdtools::nodelete()),
+ shared_qq(qq, [](DecryptVerifyClipboardCommand*){}),
input(),
controller()
{
diff --git a/src/commands/decryptverifyfilescommand.cpp b/src/commands/decryptverifyfilescommand.cpp
index df29453..f307087 100644
--- a/src/commands/decryptverifyfilescommand.cpp
+++ b/src/commands/decryptverifyfilescommand.cpp
@@ -54,7 +54,6 @@
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class DecryptVerifyFilesCommand::Private : public Command::Private
{
@@ -104,7 +103,7 @@ const DecryptVerifyFilesCommand::Private *DecryptVerifyFilesCommand::d_func() co
DecryptVerifyFilesCommand::Private::Private(DecryptVerifyFilesCommand *qq, KeyListController *c, bool forceManualMode)
: Command::Private(qq, c),
files(),
- shared_qq(qq, kdtools::nodelete())
+ shared_qq(qq, [](DecryptVerifyFilesCommand*){})
{
FileOperationsPreferences prefs;
if (!forceManualMode &&
diff --git a/src/commands/deletecertificatescommand.cpp b/src/commands/deletecertificatescommand.cpp
index e9094e1..6c52e63 100644
--- a/src/commands/deletecertificatescommand.cpp
+++ b/src/commands/deletecertificatescommand.cpp
@@ -54,13 +54,10 @@
#include <QPointer>
#include <QAbstractItemView>
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <vector>
#include <cassert>
-using namespace boost;
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Dialogs;
@@ -281,13 +278,13 @@ void DeleteCertificatesCommand::doStart()
return;
}
- kdtools::sort(selected, _detail::ByFingerprint<std::less>());
+ std::sort(selected.begin(), selected.end(), _detail::ByFingerprint<std::less>());
// Calculate the closure of the selected keys (those that need to
// be deleted with them, though not selected themselves):
std::vector<Key> toBeDeleted = KeyCache::instance()->findSubjects(selected);
- kdtools::sort(toBeDeleted, _detail::ByFingerprint<std::less>());
+ std::sort(toBeDeleted.begin(), toBeDeleted.end(), _detail::ByFingerprint<std::less>());
std::vector<Key> unselected;
unselected.reserve(toBeDeleted.size());
@@ -310,12 +307,13 @@ void DeleteCertificatesCommand::Private::slotDialogAccepted()
std::vector<Key> keys = dialog->keys();
assert(!keys.empty());
- std::vector<Key>::iterator
- pgpBegin = keys.begin(),
- pgpEnd = std::stable_partition(pgpBegin, keys.end(),
- boost::bind(&GpgME::Key::protocol, _1) != CMS),
- cmsBegin = pgpEnd,
- cmsEnd = keys.end();
+ auto pgpBegin = keys.begin();
+ auto pgpEnd = std::stable_partition(pgpBegin, keys.end(),
+ [](const GpgME::Key &key) {
+ return key.protocol() != GpgME::CMS;
+ });
+ auto cmsBegin = pgpEnd;
+ auto cmsEnd = keys.end();
std::vector<Key> openpgp(pgpBegin, pgpEnd);
std::vector<Key> cms(cmsBegin, cmsEnd);
diff --git a/src/commands/encryptclipboardcommand.cpp b/src/commands/encryptclipboardcommand.cpp
index 73adb7a..3c857a9 100644
--- a/src/commands/encryptclipboardcommand.cpp
+++ b/src/commands/encryptclipboardcommand.cpp
@@ -102,7 +102,7 @@ const EncryptClipboardCommand::Private *EncryptClipboardCommand::d_func() const
EncryptClipboardCommand::Private::Private(EncryptClipboardCommand *qq, KeyListController *c)
: Command::Private(qq, c),
- shared_qq(qq, kdtools::nodelete()),
+ shared_qq(qq, [](EncryptClipboardCommand*){}),
input(),
controller(EncryptEMailController::ClipboardMode)
{
diff --git a/src/commands/exportcertificatecommand.cpp b/src/commands/exportcertificatecommand.cpp
index d96a4b1..548205b 100644
--- a/src/commands/exportcertificatecommand.cpp
+++ b/src/commands/exportcertificatecommand.cpp
@@ -54,7 +54,6 @@
#include <QMap>
#include <QPointer>
-#include <boost/bind.hpp>
#include <algorithm>
#include <vector>
#include <cassert>
@@ -62,7 +61,6 @@
using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace GpgME;
-using namespace boost;
using namespace QGpgME;
class ExportCertificateCommand::Private : public Command::Private
@@ -163,8 +161,10 @@ void ExportCertificateCommand::doStart()
return;
}
- const std::vector<Key>::iterator firstCms = std::partition(keys.begin(), keys.end(), boost::bind(&GpgME::Key::protocol, _1) != CMS);
-
+ const auto firstCms = std::partition(keys.begin(), keys.end(),
+ [](const GpgME::Key &key) {
+ return key.protocol() != GpgME::CMS;
+ });
std::vector<Key> openpgp, cms;
std::copy(keys.begin(), firstCms, std::back_inserter(openpgp));
std::copy(firstCms, keys.end(), std::back_inserter(cms));
diff --git a/src/commands/importcertificatescommand.cpp b/src/commands/importcertificatescommand.cpp
index 9616bf7..b746eac 100644
--- a/src/commands/importcertificatescommand.cpp
+++ b/src/commands/importcertificatescommand.cpp
@@ -60,9 +60,6 @@
#include <QTreeView>
#include <QTextDocument> // for Qt::escape
-#include <boost/bind.hpp>
-#include <boost/mem_fn.hpp>
-
#include <memory>
#include <algorithm>
#include <cassert>
@@ -71,7 +68,6 @@
using namespace GpgME;
using namespace Kleo;
-using namespace boost;
using namespace QGpgME;
namespace
@@ -118,7 +114,11 @@ protected:
if (it == m_importsByFingerprint.end()) {
return AbstractKeyListSortFilterProxyModel::data(index, role);
} else {
- return Formatting::importMetaData(*it, kdtools::copy<QStringList>(m_idsByFingerprint[it->fingerprint()]));
+ QStringList rv;
+ const auto ids = m_idsByFingerprint[it->fingerprint()];
+ rv.reserve(ids.size());
+ std::copy(ids.cbegin(), ids.cend(), std::back_inserter(rv));
+ return Formatting::importMetaData(*it, rv);
}
}
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE
@@ -231,7 +231,7 @@ static QString make_tooltip(const QStringList &ids)
void ImportCertificatesCommand::Private::setImportResultProxyModel(const std::vector<ImportResult> &results, const QStringList &ids)
{
- if (kdtools::none_of(results, mem_fn(&ImportResult::numConsidered))) {
+ if (std::none_of(results.cbegin(), results.cend(), std::mem_fn(&ImportResult::numConsidered))) {
return;
}
q->addTemporaryView(i18nc("@title:tab", "Imported Certificates"),
@@ -244,7 +244,7 @@ void ImportCertificatesCommand::Private::setImportResultProxyModel(const std::ve
int sum(const std::vector<ImportResult> &res, int (ImportResult::*fun)() const)
{
- return kdtools::accumulate_transform(res.begin(), res.end(), mem_fn(fun), 0);
+ return kdtools::accumulate_transform(res.begin(), res.end(), std::mem_fn(fun), 0);
}
static QString make_report(const std::vector<ImportResult> &res, const QString &id = QString())
@@ -402,15 +402,23 @@ void ImportCertificatesCommand::Private::tryToFinish()
return;
}
- if (kdtools::any(results, boost::bind(&Error::code, boost::bind(&ImportResult::error, _1)))) {
+ if (std::any_of(results.cbegin(), results.cend(),
+ [](const GpgME::ImportResult &result) {
+ return result.error().code();
+ })) {
setImportResultProxyModel(results, ids);
- if (kdtools::all(results, boost::bind(&Error::isCanceled, boost::bind(&ImportResult::error, _1)))) {
+ if (std::all_of(results.cbegin(), results.cend(),
+ [](const GpgME::ImportResult &result) {
+ return result.error().isCanceled();
+ })) {
Q_EMIT q->canceled();
- } else
+ } else {
for (unsigned int i = 0, end = results.size(); i != end; ++i)
if (const Error err = results[i].error()) {
showError(err, ids[i]);
}
+
+ }
} else {
//iterate over all imported certificates
Q_FOREACH (const ImportResult &result, results) {
@@ -486,7 +494,7 @@ void ImportCertificatesCommand::Private::startImport(GpgME::Protocol protocol, c
{
assert(protocol != UnknownProtocol);
- if (kdtools::contains(nonWorkingProtocols, protocol)) {
+ if (std::find(nonWorkingProtocols.cbegin(), nonWorkingProtocols.cend(), protocol) != nonWorkingProtocols.cend()) {
return;
}
@@ -527,7 +535,7 @@ void ImportCertificatesCommand::Private::startImport(GpgME::Protocol protocol, c
{
assert(protocol != UnknownProtocol);
- if (kdtools::contains(nonWorkingProtocols, protocol)) {
+ if (std::find(nonWorkingProtocols.cbegin(), nonWorkingProtocols.cend(), protocol) != nonWorkingProtocols.cend()) {
return;
}
@@ -556,7 +564,7 @@ void ImportCertificatesCommand::Private::startImport(GpgME::Protocol protocol, c
void ImportCertificatesCommand::doCancel()
{
- kdtools::for_each(d->jobs, mem_fn(&Job::slotCancel));
+ std::for_each(d->jobs.begin(), d->jobs.end(), [](Job *job) { job->slotCancel(); });
}
#undef d
diff --git a/src/commands/lookupcertificatescommand.cpp b/src/commands/lookupcertificatescommand.cpp
index 9250fd1..06c1584 100644
--- a/src/commands/lookupcertificatescommand.cpp
+++ b/src/commands/lookupcertificatescommand.cpp
@@ -58,9 +58,6 @@
#include <QRegExp>
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
#include <vector>
#include <map>
#include <algorithm>
@@ -70,7 +67,6 @@ using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Dialogs;
using namespace GpgME;
-using namespace boost;
using namespace QGpgME;
class LookupCertificatesCommand::Private : public ImportCertificatesCommand::Private
@@ -320,7 +316,7 @@ void LookupCertificatesCommand::Private::slotImportRequested(const std::vector<K
dialog = 0;
assert(!keys.empty());
- assert(kdtools::none_of(keys, mem_fn(&Key::isNull)));
+ assert(std::none_of(keys.cbegin(), keys.cend(), [](const Key &key) { return key.isNull(); }));
std::vector<Key> pgp, cms;
pgp.reserve(keys.size());
@@ -328,7 +324,9 @@ void LookupCertificatesCommand::Private::slotImportRequested(const std::vector<K
kdtools::separate_if(keys.begin(), keys.end(),
std::back_inserter(pgp),
std::back_inserter(cms),
- boost::bind(&Key::protocol, _1) == OpenPGP);
+ [](const Key &key) {
+ return key.protocol() == GpgME::OpenPGP;
+ });
setWaitForMoreJobs(true);
if (!pgp.empty())
diff --git a/src/commands/reloadkeyscommand.cpp b/src/commands/reloadkeyscommand.cpp
index 17c606c..c8d75a4 100644
--- a/src/commands/reloadkeyscommand.cpp
+++ b/src/commands/reloadkeyscommand.cpp
@@ -41,10 +41,7 @@
#include <gpgme++/keylistresult.h>
-#include <boost/bind.hpp>
-
using namespace Kleo;
-using namespace boost;
using namespace GpgME;
class ReloadKeysCommand::Private : public Command::Private
diff --git a/src/commands/selftestcommand.cpp b/src/commands/selftestcommand.cpp
index b92d4a3..4314b52 100644
--- a/src/commands/selftestcommand.cpp
+++ b/src/commands/selftestcommand.cpp
@@ -55,15 +55,11 @@
#include <KConfigGroup>
#include <KSharedConfig>
-#include <boost/shared_ptr.hpp>
-#include <boost/mem_fn.hpp>
-
#include <vector>
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Dialogs;
-using namespace boost;
static const char *const components[] = {
0, // gpgconf
@@ -133,7 +129,7 @@ private:
void runTests()
{
- std::vector< shared_ptr<Kleo::SelfTest> > tests;
+ std::vector< std::shared_ptr<Kleo::SelfTest> > tests;
#if defined(Q_OS_WIN)
//Q_EMIT q->info( i18n("Checking Windows Registry...") );
@@ -158,7 +154,10 @@ private:
#endif
tests.push_back(makeLibKleopatraRcSelfTest());
- if (!dialog && kdtools::none_of(tests, mem_fn(&Kleo::SelfTest::failed))) {
+ if (!dialog && std::none_of(tests.cbegin(), tests.cend(),
+ [](const std::shared_ptr<SelfTest> &test) {
+ return test->failed();
+ })) {
finished();
return;
}
diff --git a/src/commands/signclipboardcommand.cpp b/src/commands/signclipboardcommand.cpp
index ddb14cd..16950ab 100644
--- a/src/commands/signclipboardcommand.cpp
+++ b/src/commands/signclipboardcommand.cpp
@@ -102,7 +102,7 @@ const SignClipboardCommand::Private *SignClipboardCommand::d_func() const
SignClipboardCommand::Private::Private(SignClipboardCommand *qq, KeyListController *c)
: Command::Private(qq, c),
- shared_qq(qq, kdtools::nodelete()),
+ shared_qq(qq, [](SignClipboardCommand*){}),
input(),
controller(SignEMailController::ClipboardMode)
{
diff --git a/src/commands/signencryptfilescommand.cpp b/src/commands/signencryptfilescommand.cpp
index 6d63789..de29d58 100644
--- a/src/commands/signencryptfilescommand.cpp
+++ b/src/commands/signencryptfilescommand.cpp
@@ -47,12 +47,12 @@
#include <QStringList>
+#include <cassert>
#include <exception>
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::Crypto;
-using namespace boost;
class SignEncryptFilesCommand::Private : public Command::Private
{
@@ -100,7 +100,7 @@ const SignEncryptFilesCommand::Private *SignEncryptFilesCommand::d_func() const
SignEncryptFilesCommand::Private::Private(SignEncryptFilesCommand *qq, KeyListController *c)
: Command::Private(qq, c),
files(),
- shared_qq(qq, kdtools::nodelete()),
+ shared_qq(qq, [](SignEncryptFilesCommand*){}),
controller()
{
controller.setOperationMode(SignEncryptFilesController::SignSelected |
diff --git a/src/conf/appearanceconfigwidget.cpp b/src/conf/appearanceconfigwidget.cpp
index b51332a..ecc6f68 100644
--- a/src/conf/appearanceconfigwidget.cpp
+++ b/src/conf/appearanceconfigwidget.cpp
@@ -59,15 +59,11 @@
#include <QFontDialog>
#include <QRegularExpression>
-#include <boost/range.hpp>
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <cassert>
using namespace Kleo;
using namespace Kleo::Config;
-using namespace boost;
enum {
HasNameRole = Qt::UserRole + 0x1234, /*!< Records that the user has assigned a name (to avoid comparing with i18n-strings) */
@@ -244,7 +240,7 @@ static void set_default_appearance(QListWidgetItem *item)
MayChangeBoldRole,
MayChangeStrikeOutRole,
};
- erase_if_allowed(item, fontRoles, size(fontRoles), fontAllowRoles, size(fontAllowRoles));
+ erase_if_allowed(item, fontRoles, sizeof(fontRoles) / sizeof(int), fontAllowRoles, sizeof(fontAllowRoles) / sizeof(int));
}
static void writeOrDelete(KConfigGroup &group, const char *key, const QVariant &value)
diff --git a/src/crypto/certificateresolver.cpp b/src/crypto/certificateresolver.cpp
index 54676f2..bb41de3 100644
--- a/src/crypto/certificateresolver.cpp
+++ b/src/crypto/certificateresolver.cpp
@@ -46,14 +46,12 @@
#include <QHash>
#include <QSet>
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <iterator>
+#include <cassert>
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
using namespace GpgME;
using namespace KMime::Types;
using namespace KMime::HeaderParsing;
@@ -62,19 +60,22 @@ std::vector< std::vector<Key> > CertificateResolver::resolveRecipients(const std
{
std::vector< std::vector<Key> > result;
std::transform(recipients.begin(), recipients.end(),
- std::back_inserter(result), boost::bind(&resolveRecipient, _1, proto));
+ std::back_inserter(result),
+ [proto](const Mailbox &recipient) {
+ return resolveRecipient(recipient, proto);
+ });
return result;
}
std::vector<Key> CertificateResolver::resolveRecipient(const Mailbox &recipient, Protocol proto)
{
std::vector<Key> result = KeyCache::instance()->findByEMailAddress(recipient.address());
- std::vector<Key>::iterator end = std::remove_if(result.begin(), result.end(),
- !boost::bind(&Key::canEncrypt, _1));
+ auto end = std::remove_if(result.begin(), result.end(),
+ [](const Key &key) { return key.canEncrypt(); });
if (proto != UnknownProtocol)
end = std::remove_if(result.begin(), end,
- boost::bind(&Key::protocol, _1) != proto);
+ [proto](const Key &key) { return key.protocol() != proto; });
result.erase(end, result.end());
return result;
@@ -84,21 +85,23 @@ std::vector< std::vector<Key> > CertificateResolver::resolveSigners(const std::v
{
std::vector< std::vector<Key> > result;
std::transform(signers.begin(), signers.end(),
- std::back_inserter(result), boost::bind(&resolveSigner, _1, proto));
+ std::back_inserter(result),
+ [proto](const Mailbox &signer) {
+ return resolveSigner(signer, proto);
+ });
return result;
}
std::vector<Key> CertificateResolver::resolveSigner(const Mailbox &signer, Protocol proto)
{
std::vector<Key> result = KeyCache::instance()->findByEMailAddress(signer.address());
- std::vector<Key>::iterator end
- = std::remove_if(result.begin(), result.end(),
- !boost::bind(&Key::hasSecret, _1));
+ auto end = std::remove_if(result.begin(), result.end(),
+ [](const Key &key) { return key.hasSecret(); });
end = std::remove_if(result.begin(), end,
- !boost::bind(&Key::canReallySign, _1));
+ [](const Key &key) { return key.canReallySign(); });
if (proto != UnknownProtocol)
end = std::remove_if(result.begin(), end,
- boost::bind(&Key::protocol, _1) != proto);
+ [proto](const Key &key) { return key.protocol() != proto; });
result.erase(end, result.end());
return result;
}
diff --git a/src/crypto/controller.cpp b/src/crypto/controller.cpp
index c7c9b25..ce00118 100644
--- a/src/crypto/controller.cpp
+++ b/src/crypto/controller.cpp
@@ -87,8 +87,7 @@ void Controller::doTaskDone(const Task *, const std::shared_ptr<const Task::Resu
void Controller::connectTask(const std::shared_ptr<Task> &task)
{
assert(task);
- connect(task.get(), SIGNAL(result(boost::shared_ptr<const Kleo::Crypto::Task::Result>)),
- this, SLOT(taskDone(boost::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(task.get(), &Task::result, this, &Controller::taskDone);
}
void Controller::setLastError(int err, const QString &msg)
diff --git a/src/crypto/createchecksumscontroller.cpp b/src/crypto/createchecksumscontroller.cpp
index 5669ee1..86b98aa 100644
--- a/src/crypto/createchecksumscontroller.cpp
+++ b/src/crypto/createchecksumscontroller.cpp
@@ -62,18 +62,15 @@
#include <QDir>
#include <QProcess>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-
#include <gpg-error.h>
#include <deque>
#include <map>
#include <limits>
+#include <functional>
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
namespace
{
@@ -169,21 +166,23 @@ static const Qt::CaseSensitivity fs_cs = HAVE_UNIX ? Qt::CaseSensitive : Qt::Cas
static QStringList fs_sort(QStringList l)
{
- int (*QString_compare)(const QString &, const QString &, Qt::CaseSensitivity) = &QString::compare;
- kdtools::sort(l, boost::bind(QString_compare, _1, _2, fs_cs) < 0);
+ std::sort(l.begin(), l.end(), [](const QString &lhs, const QString &rhs) {
+ return QString::compare(lhs, rhs, fs_cs) < 0;
+ });
return l;
}
static QStringList fs_intersect(QStringList l1, QStringList l2)
{
- int (*QString_compare)(const QString &, const QString &, Qt::CaseSensitivity) = &QString::compare;
fs_sort(l1);
fs_sort(l2);
QStringList result;
std::set_intersection(l1.begin(), l1.end(),
l2.begin(), l2.end(),
std::back_inserter(result),
- boost::bind(QString_compare, _1, _2, fs_cs) < 0);
+ [](const QString &lhs, const QString &rhs) {
+ return QString::compare(lhs, rhs, fs_cs) < 0;
+ });
return result;
}
@@ -200,12 +199,14 @@ static QList<QRegExp> get_patterns(const std::vector< std::shared_ptr<ChecksumDe
namespace
{
+
struct matches_any : std::unary_function<QString, bool> {
const QList<QRegExp> m_regexps;
explicit matches_any(const QList<QRegExp> &regexps) : m_regexps(regexps) {}
bool operator()(const QString &s) const
{
- return kdtools::any(m_regexps, boost::bind(&QRegExp::exactMatch, _1, s));
+ return std::any_of(m_regexps.cbegin(), m_regexps.cend(),
+ [s](const QRegExp &rx) { return rx.exactMatch(s); });
}
};
}
@@ -317,8 +318,8 @@ void CreateChecksumsController::setFiles(const QStringList &files)
kleo_assert(!d->isRunning());
kleo_assert(!files.empty());
const QList<QRegExp> patterns = get_patterns(d->checksumDefinitions);
- if (!kdtools::all(files, matches_any(patterns)) &&
- !kdtools::none_of(files, matches_any(patterns))) {
+ if (!std::all_of(files.cbegin(), files.cend(), matches_any(patterns)) &&
+ !std::none_of(files.cbegin(), files.cend(), matches_any(patterns))) {
throw Exception(gpg_error(GPG_ERR_INV_ARG), i18n("Create Checksums: input files must be either all checksum files or all files to be checksummed, not a mixture of both."));
}
const QMutexLocker locker(&d->mutex);
@@ -385,9 +386,12 @@ struct Dir {
static QStringList remove_checksum_files(QStringList l, const QList<QRegExp> &rxs)
{
QStringList::iterator end = l.end();
- Q_FOREACH (const QRegExp &rx, rxs)
+ Q_FOREACH (const QRegExp &rx, rxs) {
end = std::remove_if(l.begin(), end,
- boost::bind(&QRegExp::exactMatch, rx, _1));
+ [rx](const QString &str) {
+ return rx.exactMatch(str);
+ });
+ }
l.erase(end, l.end());
return l;
}
@@ -472,7 +476,7 @@ static std::shared_ptr<ChecksumDefinition> filename2definition(const QString &fi
}
static std::vector<Dir> find_dirs_by_sum_files(const QStringList &files, bool allowAddition,
- const function<void(int)> &progress,
+ const std::function<void(int)> &progress,
const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
@@ -494,8 +498,10 @@ static std::vector<Dir> find_dirs_by_sum_files(const QStringList &files, bool al
inputFiles = entries;
} else {
const std::vector<File> parsed = parse_sum_file(fi.absoluteFilePath());
- const QStringList oldInputFiles =
- kdtools::transform<QStringList>(parsed, mem_fn(&File::name));
+ QStringList oldInputFiles;
+ oldInputFiles.reserve(parsed.size());
+ std::transform(parsed.cbegin(), parsed.cend(), std::back_inserter(oldInputFiles),
+ std::mem_fn(&File::name));
inputFiles = fs_intersect(oldInputFiles, entries);
}
@@ -509,7 +515,7 @@ static std::vector<Dir> find_dirs_by_sum_files(const QStringList &files, bool al
dirs.push_back(item);
- if (!progress.empty()) {
+ if (progress) {
progress(++i);
}
@@ -528,7 +534,7 @@ struct less_dir : std::binary_function<QDir, QDir, bool> {
}
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::function<void(int)> &progress,
const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
Q_UNUSED(allowAddition);
@@ -552,13 +558,16 @@ static std::vector<Dir> find_dirs_by_input_files(const QStringList &files, const
if (fi.isDir()) {
QDir dir(file);
dirs2files[ dir ] = remove_checksum_files(dir.entryList(QDir::Files), patterns);
- kdtools::transform(dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot),
- std::inserter(inputs, inputs.begin()),
- boost::bind(&QDir::absoluteFilePath, cref(dir), _1));
+ const auto entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ std::transform(entryList.cbegin(), entryList.cend(),
+ std::inserter(inputs, inputs.begin()),
+ [&dir](const QString &entry) {
+ return dir.absoluteFilePath(entry);
+ });
} else {
dirs2files[fi.dir()].push_back(file);
}
- if (!progress.empty()) {
+ if (progress) {
progress(++i);
}
}
@@ -584,7 +593,7 @@ static std::vector<Dir> find_dirs_by_input_files(const QStringList &files, const
};
dirs.push_back(dir);
- if (!progress.empty()) {
+ if (progress) {
progress(++i);
}
@@ -667,9 +676,8 @@ void CreateChecksumsController::Private::run()
const QString scanning = i18n("Scanning directories...");
Q_EMIT progress(0, 0, scanning);
- const bool haveSumFiles
- = kdtools::all(files, matches_any(get_patterns(checksumDefinitions)));
- const function<void(int)> progressCb = boost::bind(&Private::progress, this, _1, 0, scanning);
+ const bool haveSumFiles = std::all_of(files.cbegin(), files.cend(), matches_any(get_patterns(checksumDefinitions)));
+ const auto progressCb = [this, &scanning](int c) { Q_EMIT progress(c, 0, scanning); };
const std::vector<Dir> dirs = haveSumFiles
? find_dirs_by_sum_files(files, allowAddition, progressCb, checksumDefinitions)
: find_dirs_by_input_files(files, checksumDefinition, allowAddition, progressCb, checksumDefinitions);
@@ -682,8 +690,9 @@ void CreateChecksumsController::Private::run()
Q_EMIT progress(0, 0, i18n("Calculating total size..."));
- const quint64 total
- = kdtools::accumulate_transform(dirs, mem_fn(&Dir::totalSize), Q_UINT64_C(0));
+ const quint64 total = kdtools::accumulate_transform(dirs.cbegin(), dirs.cend(),
+ std::mem_fn(&Dir::totalSize),
+ Q_UINT64_C(0));
if (!canceled) {
diff --git a/src/crypto/decryptverifytask.cpp b/src/crypto/decryptverifytask.cpp
index 813848b..722d733 100644
--- a/src/crypto/decryptverifytask.cpp
+++ b/src/crypto/decryptverifytask.cpp
@@ -72,8 +72,6 @@
#include <QStringList>
#include <QTextDocument> // Qt::escape
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <cassert>
#include <sstream>
@@ -81,7 +79,6 @@
using namespace Kleo::Crypto;
using namespace Kleo;
using namespace GpgME;
-using namespace boost;
using namespace KMime::Types;
namespace
@@ -177,12 +174,18 @@ static std::vector<Mailbox> extractMailboxes(const std::vector<Key> &signers)
static bool keyContainsMailbox(const Key &key, const Mailbox &mbox)
{
const std::vector<Mailbox> mbxs = extractMailboxes(key);
- return std::find_if(mbxs.begin(), mbxs.end(), boost::bind(mailbox_equal, mbox, _1, Qt::CaseInsensitive)) != mbxs.end();
+ return std::find_if(mbxs.cbegin(), mbxs.cend(),
+ [mbox](const Mailbox &m) {
+ return mailbox_equal(mbox, m, Qt::CaseInsensitive);
+ }) != mbxs.cend();
}
static bool keysContainMailbox(const std::vector<Key> &keys, const Mailbox &mbox)
{
- return std::find_if(keys.begin(), keys.end(), boost::bind(keyContainsMailbox, _1, mbox)) != keys.end();
+ return std::find_if(keys.cbegin(), keys.cend(),
+ [mbox](const Key &key) {
+ return keyContainsMailbox(key, mbox);
+ }) != keys.cend();
}
static bool relevantInDecryptVerifyContext(const VerificationResult &r)
@@ -376,7 +379,7 @@ public:
}
bool hasKeys() const
{
- return kdtools::any(signers, !boost::bind(&Key::isNull, _1));
+ return std::any_of(signers.cbegin(), signers.cend(), [](const Key &key) { return !key.isNull(); });
}
std::vector<Mailbox> signerMailboxes() const
{
@@ -430,11 +433,11 @@ static QString formatVerificationResultOverview(const VerificationResult &res, c
return i18n("<b>No signatures found.</b>");
}
- const uint bad = std::count_if(sigs.begin(), sigs.end(), IsBad);
+ const uint bad = std::count_if(sigs.cbegin(), sigs.cend(), IsBad);
if (bad > 0) {
return i18np("<b>Invalid signature.</b>", "<b>%1 invalid signatures.</b>", bad);
}
- const uint warn = std::count_if(sigs.begin(), sigs.end(), !boost::bind(IsGoodOrValid, _1));
+ const uint warn = std::count_if(sigs.cbegin(), sigs.cend(), [](const Signature &sig) { return !IsGoodOrValid(sig); });
if (warn > 0) {
return i18np("<b>Not enough information to check signature validity.</b>", "<b>%1 signatures could not be verified.</b>", warn);
}
@@ -499,7 +502,10 @@ static QString formatSignature(const Signature &sig, const Key &key, const Decry
static QStringList format(const std::vector<Mailbox> &mbxs)
{
QStringList res;
- std::transform(mbxs.begin(), mbxs.end(), std::back_inserter(res), boost::bind(&Mailbox::prettyAddress, _1));
+ std::transform(mbxs.cbegin(), mbxs.cend(), std::back_inserter(res),
+ [](const Mailbox &mbox) {
+ return mbox.prettyAddress();
+ });
return res;
}
diff --git a/src/crypto/gui/certificatelineedit.cpp b/src/crypto/gui/certificatelineedit.cpp
index 83f9eb2..49dd1d4 100644
--- a/src/crypto/gui/certificatelineedit.cpp
+++ b/src/crypto/gui/certificatelineedit.cpp
@@ -68,7 +68,7 @@ CertificateLineEdit::CertificateLineEdit(AbstractKeyListModel *model,
KeyFilter *filter)
: QLineEdit(parent),
mFilterModel(new KeyListSortFilterProxyModel(this)),
- mFilter(boost::shared_ptr<KeyFilter>(filter)),
+ mFilter(std::shared_ptr<KeyFilter>(filter)),
mEditStarted(false),
mEditFinished(false),
mLineAction(new QAction(Q_NULLPTR))
diff --git a/src/crypto/gui/certificatelineedit.h b/src/crypto/gui/certificatelineedit.h
index 9915ac7..3628dce 100644
--- a/src/crypto/gui/certificatelineedit.h
+++ b/src/crypto/gui/certificatelineedit.h
@@ -35,10 +35,11 @@
#include <QString>
#include <gpgme++/key.h>
-#include <boost/shared_ptr.hpp>
#include "dialogs/certificateselectiondialog.h"
+#include <memory>
+
class QLabel;
class QAction;
@@ -104,7 +105,7 @@ private:
QLabel *mStatusLabel,
*mStatusIcon;
GpgME::Key mKey;
- boost::shared_ptr<KeyFilter> mFilter;
+ std::shared_ptr<KeyFilter> mFilter;
bool mEditStarted,
mEditFinished;
QAction *mLineAction;
diff --git a/src/crypto/gui/newresultpage.cpp b/src/crypto/gui/newresultpage.cpp
index a5d0fb8..db8a76f 100644
--- a/src/crypto/gui/newresultpage.cpp
+++ b/src/crypto/gui/newresultpage.cpp
@@ -41,8 +41,6 @@
#include <Libkleo/Stl_Util>
-#include <boost/mem_fn.hpp>
-
#include <KLocalizedString>
#include <QCheckBox>
@@ -59,7 +57,6 @@ static const int ProgressBarHideDelay = 2000; // 2 secs
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
class NewResultPage::Private
{
@@ -167,7 +164,7 @@ void NewResultPage::setTaskCollection(const std::shared_ptr<TaskCollection> &col
void NewResultPage::addTaskCollection(const std::shared_ptr<TaskCollection> &coll)
{
assert(coll);
- if (kdtools::contains(d->m_collections, coll)) {
+ if (std::find(d->m_collections.cbegin(), d->m_collections.cend(), coll) != d->m_collections.cend()) {
return;
}
d->m_hideProgressTimer.stop();
@@ -178,10 +175,10 @@ void NewResultPage::addTaskCollection(const std::shared_ptr<TaskCollection> &col
this, SLOT(progress(QString,int,int)));
connect(coll.get(), SIGNAL(done()),
this, SLOT(allDone()));
- 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(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(coll.get(), SIGNAL(started(std::shared_ptr<Kleo::Crypto::Task>)),
+ this, SLOT(started(std::shared_ptr<Kleo::Crypto::Task>)));
Q_FOREACH (const std::shared_ptr<Task> &i, coll->tasks()) { // create labels for all tags in collection
assert(i);
diff --git a/src/crypto/gui/resultlistwidget.cpp b/src/crypto/gui/resultlistwidget.cpp
index d87942e..6712a24 100644
--- a/src/crypto/gui/resultlistwidget.cpp
+++ b/src/crypto/gui/resultlistwidget.cpp
@@ -50,16 +50,12 @@
#include <QLabel>
#include <QVBoxLayout>
-#include <boost/bind.hpp>
-#include <boost/mem_fn.hpp>
-
#include <cassert>
#include <KGuiItem>
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
class ResultListWidget::Private
{
@@ -155,7 +151,8 @@ void ResultListWidget::Private::setupMulti()
void ResultListWidget::Private::addResultWidget(ResultItemWidget *widget)
{
assert(widget);
- assert(kdtools::any(m_collections, !boost::bind(&TaskCollection::isEmpty, _1)));
+ assert(std::any_of(m_collections.cbegin(), m_collections.cend(),
+ [](const std::shared_ptr<TaskCollection> &t) { return !t->isEmpty(); }));
assert(m_scrollArea);
assert(m_scrollArea->widget());
@@ -180,7 +177,8 @@ void ResultListWidget::Private::allTasksDone()
void ResultListWidget::Private::result(const std::shared_ptr<const Task::Result> &result)
{
assert(result);
- assert(kdtools::any(m_collections, !boost::bind(&TaskCollection::isEmpty, _1)));
+ assert(std::any_of(m_collections.cbegin(), m_collections.cend(),
+ [](const std::shared_ptr<TaskCollection> &t) { return !t->isEmpty(); }));
ResultItemWidget *wid = new ResultItemWidget(result);
q->connect(wid, SIGNAL(detailsToggled(bool)), q, SLOT(detailsToggled(bool)));
q->connect(wid, &ResultItemWidget::linkActivated, q, &ResultListWidget::linkActivated);
@@ -190,17 +188,21 @@ void ResultListWidget::Private::result(const std::shared_ptr<const Task::Result>
bool ResultListWidget::isComplete() const
{
- return kdtools::all(d->m_collections, mem_fn(&TaskCollection::allTasksCompleted));
+ return std::all_of(d->m_collections.cbegin(), d->m_collections.cend(),
+ std::mem_fn(&TaskCollection::allTasksCompleted));
}
unsigned int ResultListWidget::totalNumberOfTasks() const
{
- return kdtools::accumulate_transform(d->m_collections, mem_fn(&TaskCollection::size), 0U);
+ return kdtools::accumulate_transform(d->m_collections.cbegin(),
+ d->m_collections.cend(),
+ std::mem_fn(&TaskCollection::size), 0U);
}
unsigned int ResultListWidget::numberOfCompletedTasks() const
{
- return kdtools::accumulate_transform(d->m_collections, mem_fn(&TaskCollection::numberOfCompletedTasks), 0U);
+ return kdtools::accumulate_transform(d->m_collections.cbegin(), d->m_collections.cend(),
+ std::mem_fn(&TaskCollection::numberOfCompletedTasks), 0U);
}
void ResultListWidget::setTaskCollection(const std::shared_ptr<TaskCollection> &coll)
@@ -213,10 +215,10 @@ void ResultListWidget::addTaskCollection(const std::shared_ptr<TaskCollection> &
{
assert(coll); assert(!coll->isEmpty());
d->m_collections.push_back(coll);
- 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(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(coll.get(), SIGNAL(started(std::shared_ptr<Kleo::Crypto::Task>)),
+ this, SLOT(started(std::shared_ptr<Kleo::Crypto::Task>)));
connect(coll.get(), SIGNAL(done()), this, SLOT(allTasksDone()));
d->setupMulti();
setStandaloneMode(d->m_standaloneMode);
diff --git a/src/crypto/gui/resultpage.cpp b/src/crypto/gui/resultpage.cpp
index a9671ab..2107537 100644
--- a/src/crypto/gui/resultpage.cpp
+++ b/src/crypto/gui/resultpage.cpp
@@ -172,10 +172,10 @@ void ResultPage::setTaskCollection(const std::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::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>)));
+ connect(d->m_tasks.get(), SIGNAL(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(d->m_tasks.get(), SIGNAL(started(std::shared_ptr<Kleo::Crypto::Task>)),
+ this, SLOT(started(std::shared_ptr<Kleo::Crypto::Task>)));
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()));
diff --git a/src/crypto/gui/signencryptemailconflictdialog.cpp b/src/crypto/gui/signencryptemailconflictdialog.cpp
index abd866a..58ea8a8 100644
--- a/src/crypto/gui/signencryptemailconflictdialog.cpp
+++ b/src/crypto/gui/signencryptemailconflictdialog.cpp
@@ -64,9 +64,7 @@
#include <QPointer>
#include <QSignalBlocker>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-
+#include <algorithm>
#include <iterator>
using namespace Kleo;
@@ -74,7 +72,6 @@ using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
using namespace Kleo::Dialogs;
using namespace GpgME;
-using namespace boost;
Q_DECLARE_METATYPE(GpgME::Key)
Q_DECLARE_METATYPE(GpgME::UserID)
@@ -194,16 +191,26 @@ private:
bool needShowAllRecipients(Protocol proto) const
{
- if (sign)
- if (const unsigned int num = kdtools::count_if(ui.signers, boost::bind(&CertificateSelectionLine::wasInitiallyAmbiguous, _1, proto)))
+ if (sign) {
+ if (const unsigned int num = std::count_if(ui.signers.cbegin(), ui.signers.cend(),
+ [proto](const CertificateSelectionLine &l) {
+ return l.wasInitiallyAmbiguous(proto);
+ })) {
if (num != ui.signers.size()) {
return true;
}
- if (encrypt)
- if (const unsigned int num = kdtools::count_if(ui.recipients, boost::bind(&CertificateSelectionLine::wasInitiallyAmbiguous, _1, proto)))
+ }
+ }
+ if (encrypt) {
+ if (const unsigned int num = std::count_if(ui.recipients.cbegin(), ui.signers.cend(),
+ [proto](const CertificateSelectionLine &l) {
+ return l.wasInitiallyAmbiguous(proto);
+ })) {
if (num != ui.recipients.size()) {
return true;
}
+ }
+ }
return false;
}
@@ -404,8 +411,8 @@ private:
std::vector<CertificateSelectionLine> sig, enc;
sig.swap(signers);
enc.swap(recipients);
- kdtools::for_each(sig, mem_fn(&CertificateSelectionLine::kill));
- kdtools::for_each(enc, mem_fn(&CertificateSelectionLine::kill));
+ std::for_each(sig.begin(), sig.end(), std::mem_fn(&CertificateSelectionLine::kill));
+ std::for_each(enc.begin(), enc.end(), std::mem_fn(&CertificateSelectionLine::kill));
glay.removeWidget(&selectSigningCertificatesGB);
glay.removeWidget(&selectEncryptionCertificatesGB);
}
@@ -548,9 +555,14 @@ bool SignEncryptEMailConflictDialog::isComplete() const
bool SignEncryptEMailConflictDialog::Private::isComplete(Protocol proto) const
{
- return (!sign || kdtools::none_of(ui.signers, boost::bind(&CertificateSelectionLine::isStillAmbiguous, _1, proto)))
- && (!encrypt || kdtools::none_of(ui.recipients, boost::bind(&CertificateSelectionLine::isStillAmbiguous, _1, proto)))
- ;
+ return (!sign || std::none_of(ui.signers.cbegin(), ui.signers.cend(),
+ [proto](const CertificateSelectionLine &l) {
+ return l.isStillAmbiguous(proto);
+ }))
+ && (!encrypt || std::none_of(ui.recipients.cbegin(), ui.recipients.cend(),
+ [proto](const CertificateSelectionLine &l) {
+ return l.isStillAmbiguous(proto);
+ }));
}
static std::vector<Key> get_keys(const std::vector<CertificateSelectionLine> &lines, Protocol proto)
@@ -562,9 +574,11 @@ static std::vector<Key> get_keys(const std::vector<CertificateSelectionLine> &li
std::vector<Key> keys;
keys.reserve(lines.size());
- kdtools::transform(lines, std::back_inserter(keys),
- boost::bind(&CertificateSelectionLine::key, _1, proto));
- kleo_assert(kdtools::none_of(keys, mem_fn(&Key::isNull)));
+ std::transform(lines.cbegin(), lines.cend(), std::back_inserter(keys),
+ [proto](const CertificateSelectionLine &l) {
+ return l.key(proto);
+ });
+ kleo_assert(std::none_of(keys.cbegin(), keys.cend(), std::mem_fn(&Key::isNull)));
return keys;
}
diff --git a/src/crypto/gui/signencryptemailconflictdialog.h b/src/crypto/gui/signencryptemailconflictdialog.h
index 2fb9f7f..1743d84 100644
--- a/src/crypto/gui/signencryptemailconflictdialog.h
+++ b/src/crypto/gui/signencryptemailconflictdialog.h
@@ -41,11 +41,6 @@
#include <vector>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace GpgME
{
class Key;
diff --git a/src/crypto/gui/signencryptwidget.cpp b/src/crypto/gui/signencryptwidget.cpp
index 90c5ac2..b9e204d 100644
--- a/src/crypto/gui/signencryptwidget.cpp
+++ b/src/crypto/gui/signencryptwidget.cpp
@@ -107,7 +107,7 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent)
sigChk->setChecked(true);
mSigSelect = new KeySelectionCombo();
- mSigSelect->setKeyFilter(boost::shared_ptr<KeyFilter>(new SignCertificateFilter()));
+ mSigSelect->setKeyFilter(std::shared_ptr<KeyFilter>(new SignCertificateFilter()));
sigLay->addWidget(sigChk);
sigLay->addWidget(mSigSelect, 1);
@@ -129,7 +129,7 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent)
// Own key
mSelfSelect = new KeySelectionCombo();
- mSelfSelect->setKeyFilter(boost::shared_ptr<KeyFilter>(new EncryptSelfCertificateFilter()));
+ mSelfSelect->setKeyFilter(std::shared_ptr<KeyFilter>(new EncryptSelfCertificateFilter()));
QCheckBox *encSelfChk = new QCheckBox(i18n("Encrypt for me:"));
encSelfChk->setChecked(true);
mRecpLayout->addWidget(encSelfChk, 0, 0);
@@ -167,11 +167,6 @@ 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);
connect(encBox, &QGroupBox::toggled, this, &SignEncryptWidget::updateOp);
diff --git a/src/crypto/gui/signingcertificateselectionwidget.cpp b/src/crypto/gui/signingcertificateselectionwidget.cpp
index bb1de91..34a7bfe 100644
--- a/src/crypto/gui/signingcertificateselectionwidget.cpp
+++ b/src/crypto/gui/signingcertificateselectionwidget.cpp
@@ -43,8 +43,6 @@
#include <QByteArray>
#include <QMap>
-#include <boost/bind.hpp>
-
#include <cassert>
using namespace Kleo;
@@ -121,12 +119,12 @@ std::vector<GpgME::Key> SigningCertificateSelectionWidget::Private::candidates(G
std::vector<GpgME::Key> keys = KeyCache::instance()->keys();
std::vector<GpgME::Key>::iterator end = keys.end();
- end = std::remove_if(keys.begin(), end, boost::bind(&GpgME::Key::protocol, _1) != prot);
- end = std::remove_if(keys.begin(), end, !boost::bind(&GpgME::Key::hasSecret, _1));
- assert(kdtools::all(keys.begin(), end, boost::bind(&GpgME::Key::hasSecret, _1)));
- end = std::remove_if(keys.begin(), end, !boost::bind(&GpgME::Key::canReallySign, _1));
- end = std::remove_if(keys.begin(), end, boost::bind(&GpgME::Key::isExpired, _1));
- end = std::remove_if(keys.begin(), end, boost::bind(&GpgME::Key::isRevoked, _1));
+ end = std::remove_if(keys.begin(), end, [prot](const GpgME::Key &key) { return key.protocol() != prot; });
+ end = std::remove_if(keys.begin(), end, [](const GpgME::Key &key) { return !key.hasSecret(); });
+ assert(std::all_of(keys.begin(), end, [](const GpgME::Key &key) { return key.hasSecret(); }));
+ end = std::remove_if(keys.begin(), end, [](const GpgME::Key &key) { return !key.canReallySign(); });
+ end = std::remove_if(keys.begin(), end, [](const GpgME::Key &key) { return key.isExpired(); });
+ end = std::remove_if(keys.begin(), end, [](const GpgME::Key &key) { return key.isRevoked(); });
keys.erase(end, keys.end());
return keys;
}
diff --git a/src/crypto/gui/verifychecksumsdialog.cpp b/src/crypto/gui/verifychecksumsdialog.cpp
index 594d6ff..2929d18 100644
--- a/src/crypto/gui/verifychecksumsdialog.cpp
+++ b/src/crypto/gui/verifychecksumsdialog.cpp
@@ -53,14 +53,11 @@
#include <QHeaderView>
#include "kleopatra_debug.h"
-#include <boost/static_assert.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
namespace
{
@@ -71,7 +68,7 @@ static Qt::GlobalColor statusColor[] = {
Qt::red, // Failed
Qt::darkRed, // Error
};
-BOOST_STATIC_ASSERT((sizeof statusColor / sizeof * statusColor == VerifyChecksumsDialog::NumStatii));
+static_assert(sizeof statusColor / sizeof * statusColor == VerifyChecksumsDialog::NumStatii);
class ColorizedFileSystemModel : public QDirModel
{
diff --git a/src/crypto/newsignencryptemailcontroller.cpp b/src/crypto/newsignencryptemailcontroller.cpp
index 787d2a2..b809100 100644
--- a/src/crypto/newsignencryptemailcontroller.cpp
+++ b/src/crypto/newsignencryptemailcontroller.cpp
@@ -62,12 +62,9 @@
#include <QPointer>
#include <QTimer>
-#include <boost/bind.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
using namespace GpgME;
using namespace KMime::Types;
@@ -114,54 +111,46 @@ using namespace KMime::Types;
namespace
{
-struct count_signing_certificates {
- typedef size_t result_type;
- const Protocol proto;
- explicit count_signing_certificates(Protocol proto) : proto(proto) {}
- size_t operator()(const Sender &sender) const
- {
- const size_t result = sender.signingCertificateCandidates(proto).size();
- qDebug("count_signing_certificates( %9s %20s ) == %2lu",
- proto == OpenPGP ? "OpenPGP," : proto == CMS ? "CMS," : "<unknown>,",
- qPrintable(sender.mailbox().prettyAddress()), result);
- return result;
- }
-};
+static size_t count_signing_certificates(Protocol proto, const Sender &sender)
+{
+ const size_t result = sender.signingCertificateCandidates(proto).size();
+ qDebug("count_signing_certificates( %9s %20s ) == %2lu",
+ proto == OpenPGP ? "OpenPGP," : proto == CMS ? "CMS," : "<unknown>,",
+ qPrintable(sender.mailbox().prettyAddress()), result);
+ return result;
+}
-struct count_encrypt_certificates {
- typedef size_t result_type;
- const Protocol proto;
- explicit count_encrypt_certificates(Protocol proto) : proto(proto) {}
- size_t operator()(const Sender &sender) const
- {
- const size_t result = sender.encryptToSelfCertificateCandidates(proto).size();
- qDebug("count_encrypt_certificates( %9s %20s ) == %2lu",
- proto == OpenPGP ? "OpenPGP," : proto == CMS ? "CMS," : "<unknown>,",
- qPrintable(sender.mailbox().prettyAddress()), result);
- return result;
- }
+static size_t count_encrypt_certificates(Protocol proto, const Sender &sender)
+{
+ const size_t result = sender.encryptToSelfCertificateCandidates(proto).size();
+ qDebug("count_encrypt_certificates( %9s %20s ) == %2lu",
+ proto == OpenPGP ? "OpenPGP," : proto == CMS ? "CMS," : "<unknown>,",
+ qPrintable(sender.mailbox().prettyAddress()), result);
+ return result;
+}
- size_t operator()(const Recipient &recipient) const
- {
- const size_t result = recipient.encryptionCertificateCandidates(proto).size();
- qDebug("count_encrypt_certificates( %9s %20s ) == %2lu",
- proto == OpenPGP ? "OpenPGP," : proto == CMS ? "CMS," : "<unknown>,",
- qPrintable(recipient.mailbox().prettyAddress()), result);
- return result;
- }
-};
+static size_t count_encrypt_certificates(Protocol proto, const Recipient &recipient)
+{ const size_t result = recipient.encryptionCertificateCandidates(proto).size();
+ qDebug("count_encrypt_certificates( %9s %20s ) == %2lu",
+ proto == OpenPGP ? "OpenPGP," : proto == CMS ? "CMS," : "<unknown>,",
+ qPrintable(recipient.mailbox().prettyAddress()), result);
+ return result;
+}
}
static bool has_perfect_match(bool sign, bool encrypt, Protocol proto, const std::vector<Sender> &senders, const std::vector<Recipient> &recipients)
{
if (sign)
- if (!kdtools::all(senders, boost::bind(count_signing_certificates(proto), _1) == 1)) {
+ if (!std::all_of(senders.cbegin(), senders.cend(),
+ [proto](const Sender &sender) { return count_signing_certificates(proto, sender) == 1; })) {
return false;
}
if (encrypt)
- if (!kdtools::all(senders, boost::bind(count_encrypt_certificates(proto), _1) == 1) ||
- !kdtools::all(recipients, boost::bind(count_encrypt_certificates(proto), _1) == 1)) {
+ if (!std::all_of(senders.cbegin(), senders.cend(),
+ [proto](const Sender &sender) { return count_encrypt_certificates(proto, sender) == 1; })
+ || !std::all_of(recipients.cbegin(), recipients.cend(),
+ [proto](const Recipient &rec) { return count_encrypt_certificates(proto, rec) == 1; })) {
return false;
}
return true;
@@ -170,12 +159,15 @@ static bool has_perfect_match(bool sign, bool encrypt, Protocol proto, const std
static bool has_partial_match(bool sign, bool encrypt, Protocol proto, const std::vector<Sender> &senders, const std::vector<Recipient> &recipients)
{
if (sign)
- if (!kdtools::all(senders, boost::bind(count_signing_certificates(proto), _1) >= 1)) {
+ if (std::all_of(senders.cbegin(), senders.cend(),
+ [proto](const Sender &sender) { return count_signing_certificates(proto, sender) >= 1; })) {
return false;
}
if (encrypt)
- if (!kdtools::all(senders, boost::bind(count_encrypt_certificates(proto), _1) >= 1) ||
- !kdtools::all(recipients, boost::bind(count_encrypt_certificates(proto), _1) >= 1)) {
+ if (!std::all_of(senders.cbegin(), senders.cend(),
+ [proto](const Sender &sender) { return count_encrypt_certificates(proto, sender) >= 1; })
+ || !std::all_of(recipients.cbegin(), recipients.cend(),
+ [proto](const Recipient &rec) { return count_encrypt_certificates(proto, rec) >= 1; })) {
return false;
}
return true;
@@ -452,8 +444,9 @@ void NewSignEncryptEMailController::startEncryption(const std::vector< std::shar
void NewSignEncryptEMailController::Private::startEncryption()
{
std::shared_ptr<TaskCollection> coll(new TaskCollection);
- const std::vector<std::shared_ptr<Task> > tmp
- = kdtools::copy< std::vector<std::shared_ptr<Task> > >(runnable);
+ std::vector<std::shared_ptr<Task> > tmp;
+ tmp.reserve(runnable.size());
+ std::copy(runnable.cbegin(), runnable.cend(), std::back_inserter(tmp));
coll->setTasks(tmp);
#if 0
#warning use a new result dialog
@@ -479,7 +472,7 @@ void NewSignEncryptEMailController::startSigning(const std::vector< std::shared_
tasks.reserve(inputs.size());
kleo_assert(!d->signers.empty());
- kleo_assert(kdtools::none_of(d->signers, mem_fn(&Key::isNull)));
+ kleo_assert(std::none_of(d->signers.cbegin(), d->signers.cend(), std::mem_fn(&Key::isNull)));
for (unsigned int i = 0, end = inputs.size(); i < end; ++i) {
@@ -502,8 +495,9 @@ void NewSignEncryptEMailController::startSigning(const std::vector< std::shared_
void NewSignEncryptEMailController::Private::startSigning()
{
std::shared_ptr<TaskCollection> coll(new TaskCollection);
- const std::vector<std::shared_ptr<Task> > tmp
- = kdtools::copy< std::vector<std::shared_ptr<Task> > >(runnable);
+ std::vector<std::shared_ptr<Task> > tmp;
+ tmp.reserve(runnable.size());
+ std::copy(runnable.cbegin(), runnable.cend(), std::back_inserter(tmp));
coll->setTasks(tmp);
#if 0
#warning use a new result dialog
@@ -540,9 +534,8 @@ void NewSignEncryptEMailController::Private::schedule()
std::shared_ptr<Task> NewSignEncryptEMailController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< std::shared_ptr<Task> >::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<Task> &task) { return task->protocol() == proto; });
if (it == runnable.end()) {
return std::shared_ptr<Task>();
}
diff --git a/src/crypto/recipient.cpp b/src/crypto/recipient.cpp
index 22e7fea..60ab977 100644
--- a/src/crypto/recipient.cpp
+++ b/src/crypto/recipient.cpp
@@ -36,6 +36,7 @@
#include <Libkleo/Predicates>
#include <Libkleo/KeyCache>
+#include <Libkleo/Stl_Util>
#include <utils/kleo_assert.h>
#include <utils/cached.h>
@@ -48,7 +49,6 @@ using namespace Kleo;
using namespace Kleo::Crypto;
using namespace KMime::Types;
using namespace GpgME;
-using namespace boost;
namespace KMime
{
@@ -87,9 +87,9 @@ public:
// ### that don't match, for the case where there's a low
// ### total number of keys
const std::vector<Key> encrypt = KeyCache::instance()->findEncryptionKeysByMailbox(mb.addrSpec().asString());
- kdtools::separate_if(encrypt,
+ kdtools::separate_if(encrypt.cbegin(), encrypt.cend(),
std::back_inserter(pgpEncryptionKeys), std::back_inserter(cmsEncryptionKeys),
- boost::bind(&Key::protocol, _1) == OpenPGP);
+ [](const Key &key) { return key.protocol() == OpenPGP; });
}
private:
@@ -120,8 +120,10 @@ bool Recipient::deepEquals(const Recipient &other) const
&& compare(d->cmsEncryptionKey, other.d->cmsEncryptionKey)
&& compare(d->pgpEncryptionUid.parent(), other.d->pgpEncryptionUid.parent())
&& strcmp(d->pgpEncryptionUid.id(), other.d->pgpEncryptionUid.id())
- && kdtools::equal(d->pgpEncryptionKeys, other.d->pgpEncryptionKeys, compare)
- && kdtools::equal(d->cmsEncryptionKeys, other.d->cmsEncryptionKeys, compare)
+ && std::equal(d->pgpEncryptionKeys.cbegin(), d->pgpEncryptionKeys.cend(),
+ other.d->pgpEncryptionKeys.cbegin(), compare)
+ && std::equal(d->cmsEncryptionKeys.cbegin(), d->pgpEncryptionKeys.cend(),
+ other.d->cmsEncryptionKeys.cbegin(), compare)
;
}
diff --git a/src/crypto/recipient.h b/src/crypto/recipient.h
index 94b92a1..12a6ad2 100644
--- a/src/crypto/recipient.h
+++ b/src/crypto/recipient.h
@@ -35,8 +35,7 @@
#include <gpgme++/global.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace KMime
@@ -97,7 +96,7 @@ private:
private:
class Private;
- boost::shared_ptr<Private> d;
+ std::shared_ptr<Private> d;
};
inline bool operator!=(const Recipient &lhs, const Recipient &rhs)
diff --git a/src/crypto/sender.cpp b/src/crypto/sender.cpp
index 5218630..f98c185 100644
--- a/src/crypto/sender.cpp
+++ b/src/crypto/sender.cpp
@@ -36,6 +36,7 @@
#include <Libkleo/Predicates>
#include <Libkleo/KeyCache>
+#include <Libkleo/Stl_Util>
#include <utils/kleo_assert.h>
#include <utils/cached.h>
@@ -44,11 +45,12 @@
#include <gpgme++/key.h>
+#include <algorithm>
+
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace KMime::Types;
using namespace GpgME;
-using namespace boost;
namespace KMime
{
@@ -88,12 +90,12 @@ public:
const QString email = mb.addrSpec().asString();
const std::vector<Key> signers = KeyCache::instance()->findSigningKeysByMailbox(email);
const std::vector<Key> encrypt = KeyCache::instance()->findEncryptionKeysByMailbox(email);
- kdtools::separate_if(signers,
+ kdtools::separate_if(signers.cbegin(), signers.cend(),
std::back_inserter(pgpSigners), std::back_inserter(cmsSigners),
- boost::bind(&Key::protocol, _1) == OpenPGP);
- kdtools::separate_if(encrypt,
+ [](const Key &key) { return key.protocol() == OpenPGP; });
+ kdtools::separate_if(encrypt.cbegin(), encrypt.cend(),
std::back_inserter(pgpEncryptToSelfKeys), std::back_inserter(cmsEncryptToSelfKeys),
- boost::bind(&Key::protocol, _1) == OpenPGP);
+ [](const Key &key) { return key.protocol() == OpenPGP; });
}
private:
@@ -126,10 +128,14 @@ bool Sender::deepEquals(const Sender &other) const
&& compare(d->cmsEncryptionKey, other.d->cmsEncryptionKey)
&& compare(d->pgpEncryptionUid.parent(), other.d->pgpEncryptionUid.parent())
&& strcmp(d->pgpEncryptionUid.id(), other.d->pgpEncryptionUid.id()) == 0
- && kdtools::equal(d->pgpSigners, other.d->pgpSigners, compare)
- && kdtools::equal(d->cmsSigners, other.d->cmsSigners, compare)
- && kdtools::equal(d->pgpEncryptToSelfKeys, other.d->pgpEncryptToSelfKeys, compare)
- && kdtools::equal(d->cmsEncryptToSelfKeys, other.d->cmsEncryptToSelfKeys, compare)
+ && std::equal(d->pgpSigners.cbegin(), d->pgpSigners.cend(),
+ other.d->pgpSigners.cbegin(), compare)
+ && std::equal(d->cmsSigners.cbegin(), d->cmsSigners.cend(),
+ other.d->cmsSigners.cbegin(), compare)
+ && std::equal(d->pgpEncryptToSelfKeys.cbegin(), d->pgpEncryptToSelfKeys.cend(),
+ other.d->pgpEncryptToSelfKeys.cbegin(), compare)
+ && std::equal(d->cmsEncryptToSelfKeys.cbegin(), d->cmsEncryptToSelfKeys.cend(),
+ other.d->cmsEncryptToSelfKeys.cbegin(), compare)
;
}
diff --git a/src/crypto/sender.h b/src/crypto/sender.h
index 8acdf2c..fce8843 100644
--- a/src/crypto/sender.h
+++ b/src/crypto/sender.h
@@ -35,8 +35,7 @@
#include <gpgme++/global.h>
-#include <boost/shared_ptr.hpp>
-
+#include <memory>
#include <vector>
namespace KMime
@@ -102,7 +101,7 @@ private:
private:
class Private;
- boost::shared_ptr<Private> d;
+ std::shared_ptr<Private> d;
};
inline bool operator!=(const Sender &lhs, const Sender &rhs)
diff --git a/src/crypto/signemailcontroller.cpp b/src/crypto/signemailcontroller.cpp
index a29ec82..943648d 100644
--- a/src/crypto/signemailcontroller.cpp
+++ b/src/crypto/signemailcontroller.cpp
@@ -55,8 +55,6 @@
#include <QPointer>
#include <QTimer>
-#include <boost/bind.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
@@ -278,9 +276,8 @@ void SignEMailController::Private::schedule()
// ### extract to base
std::shared_ptr<SignEMailTask> SignEMailController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< std::shared_ptr<SignEMailTask> >::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<Task> &task) { return task->protocol() == proto; });
if (it == runnable.end()) {
return std::shared_ptr<SignEMailTask>();
}
diff --git a/src/crypto/signemailtask.cpp b/src/crypto/signemailtask.cpp
index 18038e8..8831eec 100644
--- a/src/crypto/signemailtask.cpp
+++ b/src/crypto/signemailtask.cpp
@@ -52,12 +52,11 @@
#include <QPointer>
#include <QTextDocument> // for Qt::escape
-#include <boost/bind.hpp>
-#include <boost/mem_fn.hpp>
+#include <algorithm>
+#include <functional>
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
using namespace GpgME;
namespace
@@ -159,7 +158,7 @@ void SignEMailTask::setSigners(const std::vector<Key> &signers)
{
kleo_assert(!d->job);
kleo_assert(!signers.empty());
- kleo_assert(kdtools::none_of(signers, mem_fn(&Key::isNull)));
+ kleo_assert(std::none_of(signers.cbegin(), signers.cend(), std::mem_fn(&Key::isNull)));
d->signers = signers;
}
@@ -240,15 +239,11 @@ static QString collect_micalgs(const GpgME::SigningResult &result, GpgME::Protoc
{
const std::vector<GpgME::CreatedSignature> css = result.createdSignatures();
QStringList micalgs;
-#ifndef DASHBOT_HAS_STABLE_COMPILER
- Q_FOREACH (const GpgME::CreatedSignature &sig, css) {
- micalgs.push_back(QString::fromLatin1(sig.hashAlgorithmAsString()).toLower());
- }
-#else
std::transform(css.begin(), css.end(),
std::back_inserter(micalgs),
- boost::bind(&QString::toLower, boost::bind(&QString::fromLatin1, boost::bind(&GpgME::CreatedSignature::hashAlgorithmAsString, _1), -1)));
-#endif
+ [](const GpgME::CreatedSignature &sig) {
+ return QString::fromLatin1(sig.hashAlgorithmAsString()).toLower();
+ });
if (proto == GpgME::OpenPGP)
for (QStringList::iterator it = micalgs.begin(), end = micalgs.end(); it != end; ++it) {
it->prepend(QStringLiteral("pgp-"));
diff --git a/src/crypto/signencryptfilescontroller.cpp b/src/crypto/signencryptfilescontroller.cpp
index 66edd90..e529c60 100644
--- a/src/crypto/signencryptfilescontroller.cpp
+++ b/src/crypto/signencryptfilescontroller.cpp
@@ -63,8 +63,6 @@
#include <QFileInfo>
#include <QDir>
-#include <boost/bind.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace GpgME;
@@ -612,9 +610,8 @@ void SignEncryptFilesController::Private::schedule()
std::shared_ptr<SignEncryptFilesTask> SignEncryptFilesController::Private::takeRunnable(GpgME::Protocol proto)
{
- const std::vector< std::shared_ptr<SignEncryptFilesTask> >::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<Task> &task) { return task->protocol() == proto; });
if (it == runnable.end()) {
return std::shared_ptr<SignEncryptFilesTask>();
}
diff --git a/src/crypto/task.cpp b/src/crypto/task.cpp
index 5b6f2d1..b29de57 100644
--- a/src/crypto/task.cpp
+++ b/src/crypto/task.cpp
@@ -51,11 +51,8 @@
#include <QString>
-#include <boost/bind.hpp>
-
using namespace Kleo;
using namespace Kleo::Crypto;
-using namespace boost;
using namespace GpgME;
namespace
@@ -178,7 +175,7 @@ void Task::setProgress(const QString &label, int processed, int total)
d->m_progress = processed;
d->m_totalProgress = total;
d->m_progressLabel = label;
- Q_EMIT progress(label, processed, total);
+ Q_EMIT progress(label, processed, total, QPrivateSignal());
}
void Task::start()
@@ -194,7 +191,7 @@ void Task::start()
} catch (...) {
QMetaObject::invokeMethod(this, "emitError", Qt::QueuedConnection, Q_ARG(int, makeGnuPGError(GPG_ERR_UNEXPECTED)), Q_ARG(QString, i18n("Unknown exception in Task::start()")));
}
- Q_EMIT started();
+ Q_EMIT started(QPrivateSignal());
}
void Task::emitError(int errCode, const QString &details)
@@ -205,8 +202,8 @@ void Task::emitError(int errCode, const QString &details)
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);
+ Q_EMIT progress(progressLabel(), currentProgress(), totalProgress(), QPrivateSignal());
+ Q_EMIT result(r, QPrivateSignal());
}
std::shared_ptr<Task::Result> Task::makeErrorResult(int errCode, const QString &details)
diff --git a/src/crypto/task.h b/src/crypto/task.h
index 146f8a7..528535a 100644
--- a/src/crypto/task.h
+++ b/src/crypto/task.h
@@ -84,15 +84,9 @@ public Q_SLOTS:
virtual void cancel() = 0;
Q_SIGNALS:
-
-#ifndef Q_MOC_RUN
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-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 std::shared_ptr<const Kleo::Crypto::Task::Result> &);
- void started();
+ void progress(const QString &what, int processed, int total, QPrivateSignal);
+ void result(const std::shared_ptr<const Kleo::Crypto::Task::Result> &, QPrivateSignal);
+ void started(QPrivateSignal);
protected:
std::shared_ptr<Result> makeErrorResult(int errCode, const QString &details);
diff --git a/src/crypto/taskcollection.cpp b/src/crypto/taskcollection.cpp
index a0aa012..0f435f0 100644
--- a/src/crypto/taskcollection.cpp
+++ b/src/crypto/taskcollection.cpp
@@ -124,11 +124,7 @@ void TaskCollection::Private::calculateAndEmitProgress()
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);
+ static bool haveWorkingProgress = 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.
@@ -215,8 +211,8 @@ void TaskCollection::setTasks(const std::vector<std::shared_ptr<Task> > &tasks)
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::std::shared_ptr<const Kleo::Crypto::Task::Result>)),
- this, SLOT(taskResult(boost::std::shared_ptr<const Kleo::Crypto::Task::Result>)));
+ connect(i.get(), SIGNAL(result(std::shared_ptr<const Kleo::Crypto::Task::Result>)),
+ this, SLOT(taskResult(std::shared_ptr<const Kleo::Crypto::Task::Result>)));
connect(i.get(), SIGNAL(started()),
this, SLOT(taskStarted()));
}
diff --git a/src/crypto/verifychecksumscontroller.cpp b/src/crypto/verifychecksumscontroller.cpp
index ce41c9b..ece8f86 100644
--- a/src/crypto/verifychecksumscontroller.cpp
+++ b/src/crypto/verifychecksumscontroller.cpp
@@ -57,9 +57,6 @@
#include <QDir>
#include <QProcess>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-
#include <gpg-error.h>
#include <deque>
@@ -69,7 +66,6 @@
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Crypto::Gui;
-using namespace boost;
#ifdef Q_OS_UNIX
static const bool HAVE_UNIX = true;
@@ -85,7 +81,10 @@ static const Qt::CaseSensitivity fs_cs = HAVE_UNIX ? Qt::CaseSensitive : Qt::Cas
static QStringList fs_sort(QStringList l)
{
int (*QString_compare)(const QString &, const QString &, Qt::CaseSensitivity) = &QString::compare;
- kdtools::sort(l, boost::bind(QString_compare, _1, _2, fs_cs) < 0);
+ std::sort(l.begin(), l.end(),
+ [](const QString &lhs, const QString &rhs) {
+ return QString::compare(lhs, rhs, fs_cs) < 0;
+ });
return l;
}
@@ -98,7 +97,9 @@ static QStringList fs_intersect(QStringList l1, QStringList l2)
std::set_intersection(l1.begin(), l1.end(),
l2.begin(), l2.end(),
std::back_inserter(result),
- boost::bind(QString_compare, _1, _2, fs_cs) < 0);
+ [](const QString &lhs, const QString &rhs) {
+ return QString::compare(lhs, rhs, fs_cs) < 0;
+ });
return result;
}
#endif
@@ -121,7 +122,8 @@ struct matches_any : std::unary_function<QString, bool> {
explicit matches_any(const QList<QRegExp> &regexps) : m_regexps(regexps) {}
bool operator()(const QString &s) const
{
- return kdtools::any(m_regexps, boost::bind(&QRegExp::exactMatch, _1, s));
+ return std::any_of(m_regexps.cbegin(), m_regexps.cend(),
+ [&s](const QRegExp &rx) { return rx.exactMatch(s); });
}
};
struct matches_none_of : std::unary_function<QString, bool> {
@@ -129,7 +131,8 @@ struct matches_none_of : std::unary_function<QString, bool> {
explicit matches_none_of(const QList<QRegExp> &regexps) : m_regexps(regexps) {}
bool operator()(const QString &s) const
{
- return kdtools::none_of(m_regexps, boost::bind(&QRegExp::exactMatch, _1, s));
+ return std::none_of(m_regexps.cbegin(), m_regexps.cend(),
+ [&s](const QRegExp &rx) { return rx.exactMatch(s); });
}
};
}
@@ -433,11 +436,14 @@ static QStringList find_base_directiories(const QStringList &files)
}
} while (changed);
- return kdtools::transform<QStringList>(dirs, mem_fn(&QDir::absolutePath));
+ QStringList rv;
+ rv.reserve(dirs.size());
+ std::transform(dirs.cbegin(), dirs.cend(), std::back_inserter(rv), std::mem_fn(&QDir::absolutePath));
+ return rv;
}
static std::vector<SumFile> find_sums_by_input_files(const QStringList &files, QStringList &errors,
- const function<void(int)> &progress,
+ const std::function<void(int)> &progress,
const std::vector< std::shared_ptr<ChecksumDefinition> > &checksumDefinitions)
{
const QList<QRegExp> patterns = get_patterns(checksumDefinitions);
@@ -467,9 +473,11 @@ static std::vector<SumFile> find_sums_by_input_files(const QStringList &files, Q
const QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
qCDebug(KLEOPATRA_LOG) << "find_sums_by_input_files: found " << dirs.size()
<< " subdirs, prepending";
- kdtools::transform(dirs,
- std::inserter(inputs, inputs.begin()),
- boost::bind(&QDir::absoluteFilePath, cref(dir), _1));
+ std::transform(dirs.cbegin(), dirs.cend(),
+ std::inserter(inputs, inputs.begin()),
+ [&dir](const QString &path) {
+ return dir.absoluteFilePath(path);
+ });
} else if (is_sum_file(fileName)) {
qCDebug(KLEOPATRA_LOG) << "find_sums_by_input_files: it's a sum file";
dirs2sums[fi.dir()].insert(fileName);
@@ -479,14 +487,15 @@ static std::vector<SumFile> find_sums_by_input_files(const QStringList &files, Q
const QStringList sumfiles = filter_checksum_files(dir.entryList(QDir::Files), patterns);
qCDebug(KLEOPATRA_LOG) << "find_sums_by_input_files: found " << sumfiles.size()
<< " potential sumfiles: " << qPrintable(sumfiles.join(QStringLiteral(", ")));
- const QStringList::const_iterator it = kdtools::find_if(sumfiles, sumfile_contains_file(dir, fileName));
+ const auto it = std::find_if(sumfiles.cbegin(), sumfiles.cend(),
+ sumfile_contains_file(dir, fileName));
if (it == sumfiles.end()) {
errors.push_back(i18n("Cannot find checksums file for file %1", file));
} else {
dirs2sums[dir].insert(*it);
}
}
- if (!progress.empty()) {
+ if (progress) {
progress(++i);
}
}
@@ -507,18 +516,21 @@ static std::vector<SumFile> find_sums_by_input_files(const QStringList &files, Q
Q_FOREACH (const QString &sumFileName, it->second) {
const std::vector<File> summedfiles = parse_sum_file(dir.absoluteFilePath(sumFileName));
-
+ QStringList files;
+ files.reserve(summedfiles.size());
+ std::transform(summedfiles.cbegin(), summedfiles.cend(),
+ std::back_inserter(files), std::mem_fn(&File::name));
const SumFile sumFile = {
it->first,
sumFileName,
- aggregate_size(it->first, kdtools::transform<QStringList>(summedfiles, mem_fn(&File::name))),
+ aggregate_size(it->first, files),
filename2definition(sumFileName, checksumDefinitions),
};
sumfiles.push_back(sumFile);
}
- if (!progress.empty()) {
+ if (progress) {
progress(++i);
}
@@ -530,8 +542,9 @@ static QStringList c_lang_environment()
{
QStringList env = QProcess::systemEnvironment();
env.erase(std::remove_if(env.begin(), env.end(),
- boost::bind(&QRegExp::exactMatch,
- QRegExp(QLatin1String("^LANG=.*"), fs_cs), _1)),
+ [](const QString &str) {
+ return QRegExp(QLatin1String("^LANG=.*"), fs_cs).exactMatch(str);
+ }),
env.end());
env.push_back(QStringLiteral("LANG=C"));
return env;
@@ -556,7 +569,7 @@ static VerifyChecksumsDialog::Status string2status(const QByteArray &str)
}
static QString process(const SumFile &sumFile, bool *fatal, const QStringList &env,
- const function<void(const QString &, VerifyChecksumsDialog::Status)> &status)
+ const std::function<void(const QString &, VerifyChecksumsDialog::Status)> &status)
{
QProcess p;
p.setEnvironment(env);
@@ -634,9 +647,9 @@ void VerifyChecksumsController::Private::run()
const QString scanning = i18n("Scanning directories...");
Q_EMIT progress(0, 0, scanning);
- const function<void(int)> progressCb = boost::bind(&Private::progress, this, _1, 0, scanning);
- const function<void(const QString &, VerifyChecksumsDialog::Status)>
- statusCb = boost::bind(&Private::status, this, _1, _2);
+ const auto progressCb = [this, scanning](int arg) { Q_EMIT progress(arg, 0, scanning); };
+ const auto statusCb = [this](const QString &str, VerifyChecksumsDialog::Status st) { Q_EMIT status(str, st); };
+
const std::vector<SumFile> sumfiles = find_sums_by_input_files(files, errors, progressCb, checksumDefinitions);
Q_FOREACH (const SumFile &sumfile, sumfiles) {
@@ -648,7 +661,8 @@ void VerifyChecksumsController::Private::run()
Q_EMIT progress(0, 0, i18n("Calculating total size..."));
const quint64 total
- = kdtools::accumulate_transform(sumfiles, mem_fn(&SumFile::totalSize), Q_UINT64_C(0));
+ = kdtools::accumulate_transform(sumfiles.cbegin(), sumfiles.cend(),
+ std::mem_fn(&SumFile::totalSize), Q_UINT64_C(0));
if (!canceled) {
diff --git a/src/dialogs/adduseriddialog.cpp b/src/dialogs/adduseriddialog.cpp
index 9432d61..944e898 100644
--- a/src/dialogs/adduseriddialog.cpp
+++ b/src/dialogs/adduseriddialog.cpp
@@ -232,7 +232,7 @@ private:
lines[row] = line;
}
- lineList = kdtools::copy< QVector<Line> >(lines);
+ std::copy(lines.begin(), lines.end(), std::back_inserter(lineList));
}
QPushButton *okPB() const
diff --git a/src/dialogs/certificatedetailsdialog.cpp b/src/dialogs/certificatedetailsdialog.cpp
index c05fa6b..99106d1 100644
--- a/src/dialogs/certificatedetailsdialog.cpp
+++ b/src/dialogs/certificatedetailsdialog.cpp
@@ -66,8 +66,6 @@
#include <QPointer>
#include <QHeaderView>
-#include <boost/mem_fn.hpp>
-
#include <algorithm>
#include <cassert>
#include <KSharedConfig>
@@ -77,11 +75,10 @@ using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace Kleo::Commands;
using namespace GpgME;
-using namespace boost;
static bool own(const QVector<UserID::Signature> &sigs)
{
- const shared_ptr<const KeyCache> kc = KeyCache::instance();
+ const std::shared_ptr<const KeyCache> kc = KeyCache::instance();
Q_FOREACH (const UserID::Signature &sig, sigs) {
const Key signer = kc->findByKeyIDOrFingerprint(sig.signerKeyID());
if (signer.isNull() || !signer.hasSecret()) {
diff --git a/src/dialogs/certificateselectiondialog.cpp b/src/dialogs/certificateselectiondialog.cpp
index 7d44238..a5c1dd2 100644
--- a/src/dialogs/certificateselectiondialog.cpp
+++ b/src/dialogs/certificateselectiondialog.cpp
@@ -58,14 +58,12 @@
#include <QPointer>
#include <QVBoxLayout>
-#include <boost/bind.hpp>
-
#include <algorithm>
+#include <cassert>
using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace Kleo::Commands;
-using namespace boost;
using namespace GpgME;
class CertificateSelectionDialog::Private
@@ -231,7 +229,7 @@ void CertificateSelectionDialog::setStringFilter(const QString &filter)
d->ui.tabWidget.setStringFilter(filter);
}
-void CertificateSelectionDialog::setKeyFilter(const shared_ptr<KeyFilter> &filter)
+void CertificateSelectionDialog::setKeyFilter(const std::shared_ptr<KeyFilter> &filter)
{
d->ui.tabWidget.setKeyFilter(filter);
}
@@ -307,10 +305,10 @@ void CertificateSelectionDialog::filterAllowedKeys(std::vector<Key> &keys, int o
switch (options & AnyFormat) {
case OpenPGPFormat:
- end = std::remove_if(keys.begin(), end, boost::bind(&Key::protocol, _1) != GpgME::OpenPGP);
+ end = std::remove_if(keys.begin(), end, [](const Key &key) { return key.protocol() != OpenPGP; });
break;
case CMSFormat:
- end = std::remove_if(keys.begin(), end, boost::bind(&Key::protocol, _1) != GpgME::CMS);
+ end = std::remove_if(keys.begin(), end, [](const Key &key) { return key.protocol() != CMS; });
break;
default:
case AnyFormat:
@@ -319,10 +317,10 @@ void CertificateSelectionDialog::filterAllowedKeys(std::vector<Key> &keys, int o
switch (options & AnyCertificate) {
case SignOnly:
- end = std::remove_if(keys.begin(), end, !boost::bind(&Key::canReallySign, _1));
+ end = std::remove_if(keys.begin(), end, [](const Key &key) { return !key.canReallySign(); });
break;
case EncryptOnly:
- end = std::remove_if(keys.begin(), end, !boost::bind(&Key::canEncrypt, _1));
+ end = std::remove_if(keys.begin(), end, [](const Key &key) { return !key.canEncrypt(); });
break;
default:
case AnyCertificate:
@@ -330,7 +328,7 @@ void CertificateSelectionDialog::filterAllowedKeys(std::vector<Key> &keys, int o
}
if (options & SecretKeys) {
- end = std::remove_if(keys.begin(), end, !boost::bind(&Key::hasSecret, _1));
+ end = std::remove_if(keys.begin(), end, [](const Key &key) { return !key.hasSecret(); });
}
keys.erase(end, keys.end());
diff --git a/src/dialogs/certificateselectiondialog.h b/src/dialogs/certificateselectiondialog.h
index 057a604..89b4f4f 100644
--- a/src/dialogs/certificateselectiondialog.h
+++ b/src/dialogs/certificateselectiondialog.h
@@ -37,6 +37,7 @@
#include <utils/pimpl_ptr.h>
+#include <memory>
#include <vector>
namespace GpgME
@@ -44,11 +45,6 @@ namespace GpgME
class Key;
}
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
@@ -100,7 +96,7 @@ public:
public Q_SLOTS:
void setStringFilter(const QString &text);
- void setKeyFilter(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ void setKeyFilter(const std::shared_ptr<Kleo::KeyFilter> &filter);
void accept() Q_DECL_OVERRIDE;
protected:
diff --git a/src/dialogs/certifycertificatedialog.cpp b/src/dialogs/certifycertificatedialog.cpp
index c2f3405..1deb166 100644
--- a/src/dialogs/certifycertificatedialog.cpp
+++ b/src/dialogs/certifycertificatedialog.cpp
@@ -53,13 +53,10 @@
#include <QTextDocument> // Qt::escape
-#include <boost/bind.hpp>
-
#include <gpg-error.h>
#include <cassert>
-using namespace boost;
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Dialogs;
@@ -82,9 +79,10 @@ void UserIDModel::setCertificateToCertify(const Key &key)
void UserIDModel::setCheckedUserIDs(const std::vector<unsigned int> &uids)
{
- const std::vector<unsigned int> sorted = kdtools::sorted(uids);
+ std::vector<unsigned int> sorted = uids;
+ std::sort(sorted.begin(), sorted.end());
for (unsigned int i = 0, end = rowCount(); i != end; ++i) {
- item(i)->setCheckState(kdtools::binary_search(sorted, i) ? Qt::Checked : Qt::Unchecked);
+ item(i)->setCheckState(std::binary_search(sorted.begin(), sorted.end(), i) ? Qt::Checked : Qt::Unchecked);
}
}
@@ -468,14 +466,12 @@ void CertifyCertificateDialog::Private::certificationResult(const Error &err)
namespace
{
-struct UidEqual : std::binary_function<UserID, UserID, bool> {
- bool operator()(const UserID &lhs, const UserID &rhs) const
- {
- return qstrcmp(lhs.parent().primaryFingerprint(),
- rhs.parent().primaryFingerprint()) == 0
- && qstrcmp(lhs.id(), rhs.id()) == 0;
- }
-};
+static bool uidEqual(const UserID &lhs, const UserID &rhs)
+{
+ return qstrcmp(lhs.parent().primaryFingerprint(),
+ rhs.parent().primaryFingerprint()) == 0
+ && qstrcmp(lhs.id(), rhs.id()) == 0;
+}
}
void CertifyCertificateDialog::setSelectedUserIDs(const std::vector<UserID> &uids)
@@ -491,7 +487,8 @@ void CertifyCertificateDialog::setSelectedUserIDs(const std::vector<UserID> &uid
Q_FOREACH (const UserID &uid, uids) {
kleo_assert(qstrcmp(uid.parent().primaryFingerprint(), fpr) == 0);
const unsigned int idx =
- std::distance(all.begin(), kdtools::find_if(all, boost::bind(UidEqual(), _1, uid)));
+ std::distance(all.cbegin(), std::find_if(all.cbegin(), all.cend(),
+ [uid](const UserID &other) { return uidEqual(uid, other); }));
if (idx < all.size()) {
indexes.push_back(idx);
}
diff --git a/src/dialogs/deletecertificatesdialog.cpp b/src/dialogs/deletecertificatesdialog.cpp
index c9735e2..9b17f19 100644
--- a/src/dialogs/deletecertificatesdialog.cpp
+++ b/src/dialogs/deletecertificatesdialog.cpp
@@ -56,14 +56,11 @@
#include <gpgme++/key.h>
-#include <boost/mem_fn.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace GpgME;
-using namespace boost;
class DeleteCertificatesDialog::Private
{
@@ -205,8 +202,8 @@ void DeleteCertificatesDialog::accept()
const std::vector<Key> sel = d->ui.selectedKTV.keys();
const std::vector<Key> uns = d->ui.unselectedKTV.keys();
- const uint secret = kdtools::count_if(sel, mem_fn(&Key::hasSecret))
- + kdtools::count_if(uns, mem_fn(&Key::hasSecret));
+ const uint secret = std::count_if(sel.cbegin(), sel.cend(), std::mem_fn(&Key::hasSecret))
+ + std::count_if(uns.cbegin(), uns.cend(), std::mem_fn(&Key::hasSecret));
const uint total = sel.size() + uns.size();
int ret = KMessageBox::Continue;
diff --git a/src/dialogs/lookupcertificatesdialog.cpp b/src/dialogs/lookupcertificatesdialog.cpp
index f3748a1..a332861 100644
--- a/src/dialogs/lookupcertificatesdialog.cpp
+++ b/src/dialogs/lookupcertificatesdialog.cpp
@@ -49,15 +49,12 @@
#include <QPushButton>
#include <QHeaderView>
-#include <boost/bind.hpp>
-
#include <cassert>
#include <KSharedConfig>
using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace GpgME;
-using namespace boost;
static const int minimalSearchTextLength = 2; // ### TODO: make that KIOSK-able
diff --git a/src/dialogs/selftestdialog.cpp b/src/dialogs/selftestdialog.cpp
index c117df4..973d792 100644
--- a/src/dialogs/selftestdialog.cpp
+++ b/src/dialogs/selftestdialog.cpp
@@ -47,14 +47,11 @@
#include <QApplication>
#include "kleopatra_debug.h"
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
#include <vector>
using namespace Kleo;
using namespace Kleo::Dialogs;
-using namespace boost;
namespace
{
@@ -77,13 +74,13 @@ public:
NumColumns
};
- const shared_ptr<SelfTest> &fromModelIndex(const QModelIndex &idx) const
+ const std::shared_ptr<SelfTest> &fromModelIndex(const QModelIndex &idx) const
{
const unsigned int row = idx.row();
if (row < m_tests.size()) {
return m_tests[row];
}
- static const shared_ptr<SelfTest> null;
+ static const std::shared_ptr<SelfTest> null;
return null;
}
@@ -144,7 +141,7 @@ public:
endRemoveRows();
}
- void append(const std::vector< shared_ptr<SelfTest> > &tests)
+ void append(const std::vector<std::shared_ptr<SelfTest>> &tests)
{
if (tests.empty()) {
return;
@@ -161,13 +158,13 @@ public:
}
}
- const shared_ptr<SelfTest> &at(unsigned int idx) const
+ const std::shared_ptr<SelfTest> &at(unsigned int idx) const
{
return m_tests.at(idx);
}
private:
- std::vector< shared_ptr<SelfTest> > m_tests;
+ std::vector<std::shared_ptr<SelfTest>> m_tests;
};
class Proxy : public QSortFilterProxyModel
@@ -208,7 +205,7 @@ private:
if (const Model *const model = qobject_cast<Model *>(sourceModel())) {
if (!src_parent.isValid() && src_row >= 0 &&
src_row < model->rowCount(src_parent)) {
- if (const shared_ptr<SelfTest> &t = model->at(src_row)) {
+ if (const std::shared_ptr<SelfTest> &t = model->at(src_row)) {
return !t->passed();
} else {
qCWarning(KLEOPATRA_LOG) << "NULL test??";
@@ -273,7 +270,7 @@ private:
ui.detailsGB->hide();
ui.proposedCorrectiveActionGB->hide();
} else {
- const shared_ptr<SelfTest> &t = model.at(row);
+ const std::shared_ptr<SelfTest> &t = model.at(row);
ui.detailsLB->setText(t->longError());
ui.detailsGB->setVisible(!t->passed());
const QString action = t->proposedFix();
@@ -284,7 +281,7 @@ private:
}
void slotDoItClicked()
{
- if (const shared_ptr<SelfTest> st = model.fromModelIndex(selectedRow()))
+ if (const std::shared_ptr<SelfTest> st = model.fromModelIndex(selectedRow()))
if (st->fix()) {
model.reloadData();
}
@@ -340,7 +337,7 @@ SelfTestDialog::SelfTestDialog(QWidget *p, Qt::WindowFlags f)
setAutomaticMode(false);
}
-SelfTestDialog::SelfTestDialog(const std::vector< shared_ptr<SelfTest> > &tests, QWidget *p, Qt::WindowFlags f)
+SelfTestDialog::SelfTestDialog(const std::vector<std::shared_ptr<SelfTest>> &tests, QWidget *p, Qt::WindowFlags f)
: QDialog(p, f), d(new Private(this))
{
addSelfTests(tests);
@@ -354,13 +351,13 @@ void SelfTestDialog::clear()
d->model.clear();
}
-void SelfTestDialog::addSelfTest(const shared_ptr<SelfTest> &test)
+void SelfTestDialog::addSelfTest(const std::shared_ptr<SelfTest> &test)
{
- d->model.append(std::vector< shared_ptr<SelfTest> >(1, test));
+ d->model.append(std::vector<std::shared_ptr<SelfTest>>(1, test));
d->updateColumnSizes();
}
-void SelfTestDialog::addSelfTests(const std::vector< shared_ptr<SelfTest> > &tests)
+void SelfTestDialog::addSelfTests(const std::vector<std::shared_ptr<SelfTest>> &tests)
{
d->model.append(tests);
d->updateColumnSizes();
diff --git a/src/dialogs/selftestdialog.h b/src/dialogs/selftestdialog.h
index 2126b35..5c9f66b 100644
--- a/src/dialogs/selftestdialog.h
+++ b/src/dialogs/selftestdialog.h
@@ -37,13 +37,9 @@
#include <utils/pimpl_ptr.h>
+#include <memory>
#include <vector>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
-
namespace Kleo
{
@@ -58,13 +54,13 @@ class SelfTestDialog : public QDialog
Q_PROPERTY(bool runAtStartUp READ runAtStartUp WRITE setRunAtStartUp)
public:
explicit SelfTestDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = 0);
- explicit SelfTestDialog(const std::vector< boost::shared_ptr<SelfTest> > &tests, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = 0);
+ explicit SelfTestDialog(const std::vector<std::shared_ptr<SelfTest>> &tests, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = 0);
~SelfTestDialog();
void setAutomaticMode(bool automatic);
- void addSelfTest(const boost::shared_ptr<SelfTest> &test);
- void addSelfTests(const std::vector< boost::shared_ptr<SelfTest> > &tests);
+ void addSelfTest(const std::shared_ptr<SelfTest> &test);
+ void addSelfTests(const std::vector<std::shared_ptr<SelfTest>> &tests);
void setRunAtStartUp(bool run);
bool runAtStartUp() const;
diff --git a/src/dialogs/setinitialpindialog.cpp b/src/dialogs/setinitialpindialog.cpp
index 908ec4c..e23225a 100644
--- a/src/dialogs/setinitialpindialog.cpp
+++ b/src/dialogs/setinitialpindialog.cpp
@@ -44,8 +44,6 @@
#include <gpgme++/error.h>
-#include <boost/static_assert.hpp>
-
#include <cassert>
using namespace Kleo;
@@ -72,8 +70,8 @@ const char *icons[] = {
"security-low", // Failed
};
-BOOST_STATIC_ASSERT((sizeof icons / sizeof(*icons) == NumStates));
-BOOST_STATIC_ASSERT((sizeof("movie-") == 7));
+static_assert(sizeof icons / sizeof(*icons) == NumStates, "");
+static_assert(sizeof("movie-") == 7, "");
static void update_widget(State state, bool delay, QLabel *resultLB, QLabel *lb, QPushButton *pb, QLabel *statusLB)
{
diff --git a/src/kleopatraapplication.cpp b/src/kleopatraapplication.cpp
index 4be1109..eb4348d 100644
--- a/src/kleopatraapplication.cpp
+++ b/src/kleopatraapplication.cpp
@@ -75,14 +75,11 @@
#include <QPointer>
#include <QCommandLineOption>
-#include <boost/shared_ptr.hpp>
-
#include <memory>
#include <KSharedConfig>
using namespace Kleo;
using namespace Kleo::Commands;
-using namespace boost;
static void add_resources()
{
@@ -147,9 +144,9 @@ public:
#ifndef QT_NO_SYSTEMTRAYICON
SysTrayIcon *sysTray;
#endif
- shared_ptr<KeyCache> keyCache;
+ std::shared_ptr<KeyCache> keyCache;
std::shared_ptr<Log> log;
- shared_ptr<FileSystemWatcher> watcher;
+ std::shared_ptr<FileSystemWatcher> watcher;
public:
void setupKeyCache()
diff --git a/src/libkleopatraclient/core/command.cpp b/src/libkleopatraclient/core/command.cpp
index fe3b387..4f8b016 100644
--- a/src/libkleopatraclient/core/command.cpp
+++ b/src/libkleopatraclient/core/command.cpp
@@ -45,15 +45,13 @@
#include <assuan.h>
#include <gpg-error.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/type_traits/remove_pointer.hpp>
-
#include <algorithm>
#include <string>
#include <sstream>
+#include <memory>
+#include <type_traits>
using namespace KleopatraClientCopy;
-using namespace boost;
// copied from kleopatra/utils/hex.cpp
static std::string hexencode(const std::string &in)
@@ -389,7 +387,7 @@ static void my_assuan_release(assuan_context_t ctx)
}
#endif
-typedef shared_ptr< remove_pointer<assuan_context_t>::type > AssuanContextBase;
+typedef std::shared_ptr<std::remove_pointer<assuan_context_t>::type > AssuanContextBase;
namespace
{
struct AssuanClientContext : AssuanContextBase {
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 223c106..c17278d 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -86,15 +86,11 @@
#include <QGpgME/CryptoConfig>
#include <QGpgME/Protocol>
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
#include <vector>
#include <KSharedConfig>
using namespace Kleo;
using namespace Kleo::Commands;
-using namespace boost;
using namespace GpgME;
static KGuiItem KStandardGuiItem_quit()
@@ -475,9 +471,9 @@ static QStringList extract_local_files(const QMimeData *data)
QStringList result;
std::transform(urls.begin(), end,
std::back_inserter(result),
- boost::bind(&QUrl::toLocalFile, _1));
+ std::mem_fn(&QUrl::toLocalFile));
result.erase(std::remove_if(result.begin(), result.end(),
- boost::bind(&QString::isEmpty, _1)), result.end());
+ std::mem_fn(&QString::isEmpty)), result.end());
return result;
}
diff --git a/src/newcertificatewizard/newcertificatewizard.cpp b/src/newcertificatewizard/newcertificatewizard.cpp
index 43f7cba..4d725be 100644
--- a/src/newcertificatewizard/newcertificatewizard.cpp
+++ b/src/newcertificatewizard/newcertificatewizard.cpp
@@ -79,9 +79,9 @@
#include <QDesktopServices>
#include <QUrlQuery>
-#include <boost/range.hpp>
-
#include <algorithm>
+#include <cassert>
+
#include <KSharedConfig>
#include <QLocale>
@@ -89,7 +89,6 @@ using namespace Kleo;
using namespace Kleo::NewCertificateUi;
using namespace Kleo::Commands;
using namespace GpgME;
-using namespace boost;
static const char RSA_KEYSIZES_ENTRY[] = "RSAKeySizes";
static const char DSA_KEYSIZES_ENTRY[] = "DSAKeySizes";
@@ -118,7 +117,7 @@ static const QStringList curveNames {
static void set_tab_order(const QList<QWidget *> &wl)
{
- kdtools::for_each_adjacent_pair(wl, &QWidget::setTabOrder);
+ kdtools::for_each_adjacent_pair(wl.begin(), wl.end(), &QWidget::setTabOrder);
}
enum KeyAlgo { RSA, DSA, ELG, ECDSA, ECDH };
@@ -1430,7 +1429,8 @@ void EnterDetailsPage::updateForm()
// create lineList in visual order, so requirementsAreMet()
// complains from top to bottom:
- lineList = kdtools::copy< QVector<Line> >(lines);
+ lineList.reserve(lines.count());
+ std::copy(lines.cbegin(), lines.cend(), std::back_inserter(lineList));
widgets.push_back(ui.resultLE);
widgets.push_back(ui.addEmailToDnCB);
diff --git a/src/selftest/enginecheck.cpp b/src/selftest/enginecheck.cpp
index 0a20291..34fc2bb 100644
--- a/src/selftest/enginecheck.cpp
+++ b/src/selftest/enginecheck.cpp
@@ -49,15 +49,12 @@
#include <QFile>
#include <QRegExp>
-#include <boost/shared_ptr.hpp>
-
#include <algorithm>
#include <cassert>
using namespace Kleo;
using namespace Kleo::_detail;
using namespace GpgME;
-using namespace boost;
static QString engine_name(GpgME::Engine eng)
{
@@ -144,19 +141,19 @@ public:
};
}
-shared_ptr<SelfTest> Kleo::makeGpgEngineCheckSelfTest()
+std::shared_ptr<SelfTest> Kleo::makeGpgEngineCheckSelfTest()
{
- return shared_ptr<SelfTest>(new EngineCheck(GpgME::GpgEngine));
+ return std::shared_ptr<SelfTest>(new EngineCheck(GpgME::GpgEngine));
}
-shared_ptr<SelfTest> Kleo::makeGpgSmEngineCheckSelfTest()
+std::shared_ptr<SelfTest> Kleo::makeGpgSmEngineCheckSelfTest()
{
- return shared_ptr<SelfTest>(new EngineCheck(GpgME::GpgSMEngine));
+ return std::shared_ptr<SelfTest>(new EngineCheck(GpgME::GpgSMEngine));
}
-shared_ptr<SelfTest> Kleo::makeGpgConfEngineCheckSelfTest()
+std::shared_ptr<SelfTest> Kleo::makeGpgConfEngineCheckSelfTest()
{
- return shared_ptr<SelfTest>(new EngineCheck(GpgME::GpgConfEngine));
+ return std::shared_ptr<SelfTest>(new EngineCheck(GpgME::GpgConfEngine));
}
//
diff --git a/src/selftest/enginecheck.h b/src/selftest/enginecheck.h
index 5611d69..ce56494 100644
--- a/src/selftest/enginecheck.h
+++ b/src/selftest/enginecheck.h
@@ -35,19 +35,16 @@
#include <selftest/selftest.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
class SelfTest;
-boost::shared_ptr<SelfTest> makeGpgEngineCheckSelfTest();
-boost::shared_ptr<SelfTest> makeGpgSmEngineCheckSelfTest();
-boost::shared_ptr<SelfTest> makeGpgConfEngineCheckSelfTest();
+std::shared_ptr<SelfTest> makeGpgEngineCheckSelfTest();
+std::shared_ptr<SelfTest> makeGpgSmEngineCheckSelfTest();
+std::shared_ptr<SelfTest> makeGpgConfEngineCheckSelfTest();
}
diff --git a/src/selftest/gpgagentcheck.cpp b/src/selftest/gpgagentcheck.cpp
index abdbbf8..e461211 100644
--- a/src/selftest/gpgagentcheck.cpp
+++ b/src/selftest/gpgagentcheck.cpp
@@ -45,13 +45,10 @@
#include <KLocalizedString>
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::_detail;
-using namespace boost;
using namespace GpgME;
namespace
@@ -123,7 +120,7 @@ public:
};
}
-shared_ptr<SelfTest> Kleo::makeGpgAgentConnectivitySelfTest()
+std::shared_ptr<SelfTest> Kleo::makeGpgAgentConnectivitySelfTest()
{
- return shared_ptr<SelfTest>(new GpgAgentCheck);
+ return std::shared_ptr<SelfTest>(new GpgAgentCheck);
}
diff --git a/src/selftest/gpgagentcheck.h b/src/selftest/gpgagentcheck.h
index 5a21cf8..d460c49 100644
--- a/src/selftest/gpgagentcheck.h
+++ b/src/selftest/gpgagentcheck.h
@@ -35,17 +35,14 @@
#include <selftest/selftest.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
class SelfTest;
-boost::shared_ptr<SelfTest> makeGpgAgentConnectivitySelfTest();
+std::shared_ptr<SelfTest> makeGpgAgentConnectivitySelfTest();
}
diff --git a/src/selftest/gpgconfcheck.cpp b/src/selftest/gpgconfcheck.cpp
index e035376..0283063 100644
--- a/src/selftest/gpgconfcheck.cpp
+++ b/src/selftest/gpgconfcheck.cpp
@@ -45,13 +45,10 @@
#include <QProcess>
#include <QDir>
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::_detail;
-using namespace boost;
namespace
{
@@ -161,7 +158,7 @@ public:
};
}
-shared_ptr<SelfTest> Kleo::makeGpgConfCheckConfigurationSelfTest(const char *component)
+std::shared_ptr<SelfTest> Kleo::makeGpgConfCheckConfigurationSelfTest(const char *component)
{
- return shared_ptr<SelfTest>(new GpgConfCheck(component));
+ return std::shared_ptr<SelfTest>(new GpgConfCheck(component));
}
diff --git a/src/selftest/gpgconfcheck.h b/src/selftest/gpgconfcheck.h
index e335c0e..19bc8aa 100644
--- a/src/selftest/gpgconfcheck.h
+++ b/src/selftest/gpgconfcheck.h
@@ -35,17 +35,14 @@
#include <selftest/selftest.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
class SelfTest;
-boost::shared_ptr<SelfTest> makeGpgConfCheckConfigurationSelfTest(const char *component = 0);
+std::shared_ptr<SelfTest> makeGpgConfCheckConfigurationSelfTest(const char *component = 0);
}
diff --git a/src/selftest/libkleopatrarccheck.cpp b/src/selftest/libkleopatrarccheck.cpp
index 3ec5e4d..1f7e8eb 100644
--- a/src/selftest/libkleopatrarccheck.cpp
+++ b/src/selftest/libkleopatrarccheck.cpp
@@ -42,13 +42,10 @@
#include <KLocalizedString>
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::_detail;
-using namespace boost;
namespace
{
@@ -90,7 +87,7 @@ public:
};
}
-shared_ptr<SelfTest> Kleo::makeLibKleopatraRcSelfTest()
+std::shared_ptr<SelfTest> Kleo::makeLibKleopatraRcSelfTest()
{
- return shared_ptr<SelfTest>(new LibKleopatraRcCheck);
+ return std::shared_ptr<SelfTest>(new LibKleopatraRcCheck);
}
diff --git a/src/selftest/libkleopatrarccheck.h b/src/selftest/libkleopatrarccheck.h
index cc8e915..460c56c 100644
--- a/src/selftest/libkleopatrarccheck.h
+++ b/src/selftest/libkleopatrarccheck.h
@@ -35,17 +35,14 @@
#include <selftest/selftest.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
class SelfTest;
-boost::shared_ptr<SelfTest> makeLibKleopatraRcSelfTest();
+std::shared_ptr<SelfTest> makeLibKleopatraRcSelfTest();
}
diff --git a/src/selftest/registrycheck.cpp b/src/selftest/registrycheck.cpp
index 00940ae..6a43596 100644
--- a/src/selftest/registrycheck.cpp
+++ b/src/selftest/registrycheck.cpp
@@ -41,13 +41,10 @@
#include <QSettings>
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::_detail;
-using namespace boost;
static QString gnupg_path = QStringLiteral("HKEY_LOCAL_MACHINE\\Software\\GNU\\GnuPG");
static QString gnupg_key = QStringLiteral("gpgProgram");
@@ -124,7 +121,7 @@ public:
};
}
-shared_ptr<SelfTest> Kleo::makeGpgProgramRegistryCheckSelfTest()
+std::shared_ptr<SelfTest> Kleo::makeGpgProgramRegistryCheckSelfTest()
{
- return shared_ptr<SelfTest>(new RegistryCheck);
+ return std::shared_ptr<SelfTest>(new RegistryCheck);
}
diff --git a/src/selftest/registrycheck.h b/src/selftest/registrycheck.h
index 21c637c..5ccf800 100644
--- a/src/selftest/registrycheck.h
+++ b/src/selftest/registrycheck.h
@@ -35,17 +35,14 @@
#include <selftest/selftest.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
class SelfTest;
-boost::shared_ptr<SelfTest> makeGpgProgramRegistryCheckSelfTest();
+std::shared_ptr<SelfTest> makeGpgProgramRegistryCheckSelfTest();
}
diff --git a/src/selftest/uiservercheck.cpp b/src/selftest/uiservercheck.cpp
index 637a2c2..bd0f208 100644
--- a/src/selftest/uiservercheck.cpp
+++ b/src/selftest/uiservercheck.cpp
@@ -45,13 +45,10 @@
#include <KLocalizedString>
-#include <boost/shared_ptr.hpp>
-
#include <cassert>
using namespace Kleo;
using namespace Kleo::_detail;
-using namespace boost;
namespace
{
@@ -103,7 +100,7 @@ public:
};
}
-shared_ptr<SelfTest> Kleo::makeUiServerConnectivitySelfTest()
+std::shared_ptr<SelfTest> Kleo::makeUiServerConnectivitySelfTest()
{
- return shared_ptr<SelfTest>(new UiServerCheck);
+ return std::shared_ptr<SelfTest>(new UiServerCheck);
}
diff --git a/src/selftest/uiservercheck.h b/src/selftest/uiservercheck.h
index f7af354..30e317a 100644
--- a/src/selftest/uiservercheck.h
+++ b/src/selftest/uiservercheck.h
@@ -35,17 +35,14 @@
#include <selftest/selftest.h>
-namespace boost
-{
-template <typename T> class shared_ptr;
-}
+#include <memory>
namespace Kleo
{
class SelfTest;
-boost::shared_ptr<SelfTest> makeUiServerConnectivitySelfTest();
+std::shared_ptr<SelfTest> makeUiServerConnectivitySelfTest();
}
diff --git a/src/smartcard/readerstatus.cpp b/src/smartcard/readerstatus.cpp
index eeefc41..3d3cdcd 100644
--- a/src/smartcard/readerstatus.cpp
+++ b/src/smartcard/readerstatus.cpp
@@ -59,9 +59,6 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/case_conv.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/range.hpp>
-#include <boost/bind.hpp>
#include <memory>
#include <vector>
@@ -75,7 +72,6 @@
using namespace Kleo;
using namespace Kleo::SmartCard;
using namespace GpgME;
-using namespace boost;
static const unsigned int CHECK_INTERVAL = 2000; // msecs
@@ -113,7 +109,7 @@ static const char *flags[] = {
"ACTIVE",
"USABLE",
};
-BOOST_STATIC_ASSERT((sizeof flags / sizeof * flags == ReaderStatus::_NumScdStates));
+static_assert(sizeof flags / sizeof * flags == ReaderStatus::_NumScdStates, "");
static const char *prettyFlags[] = {
"NoCard",
@@ -124,7 +120,7 @@ static const char *prettyFlags[] = {
"CardHasNullPin",
"CardError",
};
-BOOST_STATIC_ASSERT((sizeof prettyFlags / sizeof * prettyFlags == ReaderStatus::NumStates));
+static_assert(sizeof prettyFlags / sizeof * prettyFlags == ReaderStatus::NumStates, "");
static QByteArray read_file(const QString &fileName)
{
@@ -181,16 +177,19 @@ static const char *app_types[] = {
"dinsig",
"geldkarte",
};
-BOOST_STATIC_ASSERT((sizeof app_types / sizeof * app_types == ReaderStatus::NumAppTypes));
+static_assert(sizeof app_types / sizeof * app_types == ReaderStatus::NumAppTypes, "");
static ReaderStatus::AppType parse_app_type(const std::string &s)
{
qCDebug(KLEOPATRA_LOG) << "parse_app_type(" << s.c_str() << ")";
- const char **it = std::find(begin(app_types), end(app_types), to_lower_copy(s));
- if (it == end(app_types)) {
+ const char **it = std::find_if(std::begin(app_types), std::end(app_types),
+ [&s](const char *type) {
+ return ::strcasecmp(s.c_str(), type) == 0;
+ });
+ if (it == std::end(app_types)) {
return TRACE(ReaderStatus::UnknownApplication);
}
- return TRACE(static_cast<ReaderStatus::AppType>(it - begin(app_types)));
+ return TRACE(static_cast<ReaderStatus::AppType>(it - std::begin(app_types)));
}
@@ -351,7 +350,7 @@ static CardInfo get_card_status(const QString &fileName, unsigned int idx, std::
// the following only works for NKS v3...
std::vector<std::string> chvStatus;
chvStatus.reserve(4); // expected number of fields
- split(chvStatus, scd_getattr_status(gpg_agent, "CHV-STATUS", err), is_any_of(" \t"), token_compress_on);
+ boost::split(chvStatus, scd_getattr_status(gpg_agent, "CHV-STATUS", err), boost::is_any_of(" \t"), boost::token_compress_on);
if (err.code()) {
return ci;
}
@@ -359,7 +358,7 @@ static CardInfo get_card_status(const QString &fileName, unsigned int idx, std::
std::back_inserter(ci.pinStates),
parse_pin_state);
- if (kdtools::contains(ci.pinStates, ReaderStatus::NullPin)) {
+ if (std::find(ci.pinStates.cbegin(), ci.pinStates.cend(), ReaderStatus::NullPin) != ci.pinStates.cend()) {
ci.status = ReaderStatus::CardHasNullPin;
return ci;
}
@@ -381,7 +380,10 @@ static CardInfo get_card_status(const QString &fileName, unsigned int idx, std::
}
klc->setKeyListMode(Ephemeral);
- if (kdtools::any(keyPairInfos, !boost::bind(&parse_keypairinfo_and_lookup_key, klc.get(), _1))) {
+ if (std::any_of(keyPairInfos.cbegin(), keyPairInfos.cend(),
+ [&klc](const std::string &str) {
+ return !parse_keypairinfo_and_lookup_key(klc.get(), str);
+ })) {
ci.status = ReaderStatus::CardCanLearnKeys;
}
@@ -504,8 +506,10 @@ public Q_SLOTS:
}
QStringList files = gnupgHome.entryList(QStringList(QStringLiteral("reader_*.status")), QDir::Files, QDir::Name);
- bool *dummy = 0;
- kdtools::sort(files, boost::bind(parseFileName, _1, dummy) < boost::bind(parseFileName, _2, dummy));
+ std::sort(files.begin(), files.end(),
+ [](const QString &lhs, const QString &rhs) {
+ return parseFileName(lhs, Q_NULLPTR) < parseFileName(rhs, Q_NULLPTR);
+ });
std::vector<QByteArray> contents;
@@ -736,12 +740,16 @@ public:
private:
bool anyCardHasNullPinImpl() const
{
- return kdtools::any(cardInfos(), boost::bind(&CardInfo::status, _1) == CardHasNullPin);
+ const auto cis = cardInfos();
+ return std::any_of(cis.cbegin(), cis.cend(),
+ [](const CardInfo &ci) { return ci.status == CardHasNullPin; });
}
bool anyCardCanLearnKeysImpl() const
{
- return kdtools::any(cardInfos(), boost::bind(&CardInfo::status, _1) == CardCanLearnKeys);
+ const auto cis = cardInfos();
+ return std::any_of(cis.cbegin(), cis.cend(),
+ [](const CardInfo &ci) { return ci.status == CardCanLearnKeys; });
}
private:
diff --git a/src/systrayicon.cpp b/src/systrayicon.cpp
index debce7a..69ba19d 100644
--- a/src/systrayicon.cpp
+++ b/src/systrayicon.cpp
@@ -64,12 +64,8 @@
#include <QPointer>
#include <QSignalBlocker>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-
#include <cassert>
-using namespace boost;
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::SmartCard;
diff --git a/src/uiserver/assuanserverconnection.cpp b/src/uiserver/assuanserverconnection.cpp
index 02c69c4..a177cb5 100644
--- a/src/uiserver/assuanserverconnection.cpp
+++ b/src/uiserver/assuanserverconnection.cpp
@@ -76,19 +76,13 @@
#include <kleo-assuan.h>
-#ifndef Q_MOC_RUN // QTBUG-22829
-#include <boost/type_traits/remove_pointer.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/bind.hpp>
-#include <boost/mem_fn.hpp>
-#include <boost/mpl/if.hpp>
-#endif
-
#include <vector>
#include <map>
#include <string>
#include <memory>
#include <algorithm>
+#include <functional>
+#include <type_traits>
#include <errno.h>
@@ -104,7 +98,6 @@
# include <unistd.h>
#endif
using namespace Kleo;
-using namespace boost;
static const unsigned int INIT_SOCKET_FLAGS = 3; // says info assuan...
//static int(*USE_DEFAULT_HANDLER)(assuan_context_t,char*) = 0;
@@ -121,7 +114,7 @@ static void my_assuan_release(assuan_context_t ctx)
#endif
// 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;
+typedef std::shared_ptr<std::remove_pointer<assuan_context_t>::type> AssuanContextBase;
struct AssuanContext : AssuanContextBase {
AssuanContext() : AssuanContextBase() {}
#ifndef HAVE_ASSUAN2
@@ -291,9 +284,10 @@ public Q_SLOTS:
private:
void nohupDone(AssuanCommand *cmd)
{
- const std::vector< std::shared_ptr<AssuanCommand> >::iterator it
- = std::find_if(nohupedCommands.begin(), nohupedCommands.end(),
- boost::bind(&std::shared_ptr<AssuanCommand>::get, _1) == cmd);
+ const auto it = std::find_if(nohupedCommands.begin(), nohupedCommands.end(),
+ [cmd](const std::shared_ptr<AssuanCommand> &other) {
+ return other.get() == cmd;
+ });
assert(it != nohupedCommands.end());
nohupedCommands.erase(it);
if (nohupedCommands.empty() && closed) {
@@ -506,7 +500,8 @@ private:
return assuan_process_done(ctx_, 0);
}
- template <bool in> struct Input_or_Output : mpl::if_c<in, Input, Output> {};
+ template <bool in>
+ struct Input_or_Output : std::conditional<in, Input, Output> {};
// format: TAG (FD|FD=\d+|FILE=...)
template <bool in, typename T_memptr>
@@ -554,9 +549,9 @@ private:
}
} else {
#if defined(Q_OS_WIN32)
- fd = (assuan_fd_t)lexical_cast<intptr_t>(fdstr);
+ fd = (assuan_fd_t)std::stoi(fdstr);
#else
- fd = lexical_cast<assuan_fd_t>(fdstr);
+ fd = std::stoi(fdstr);
#endif
}
@@ -812,7 +807,9 @@ private:
QStringList sl;
std::transform(c.begin(), c.end(),
std::back_inserter(sl),
- boost::bind(&KMime::Types::Mailbox::prettyAddress, _1));
+ [](typename T_container::const_reference val) {
+ return val.prettyAddress();
+ });
return dumpStringList(sl);
}
@@ -840,7 +837,10 @@ private:
QByteArray dumpFiles() const
{
- return dumpStringList(kdtools::copy<QStringList>(files));
+ QStringList rv;
+ rv.reserve(files.size());
+ std::copy(files.cbegin(), files.cend(), std::back_inserter(rv));
+ return dumpStringList(rv);
}
void cleanup();
@@ -855,14 +855,11 @@ private:
sessionId = 0;
mementos.clear();
files.clear();
- std::for_each(inputs.begin(), inputs.end(),
- boost::bind(&Input::finalize, _1));
+ std::for_each(inputs.begin(), inputs.end(), std::mem_fn(&Input::finalize));
inputs.clear();
- std::for_each(outputs.begin(), outputs.end(),
- boost::bind(&Output::finalize, _1));
+ std::for_each(outputs.begin(), outputs.end(), std::mem_fn(&Output::finalize));
outputs.clear();
- std::for_each(messages.begin(), messages.end(),
- boost::bind(&Input::finalize, _1));
+ std::for_each(messages.begin(), messages.end(), std::mem_fn(&Input::finalize));
messages.clear();
bias = GpgME::UnknownProtocol;
}
@@ -955,14 +952,14 @@ AssuanServerConnection::Private::Private(assuan_fd_t fd_, const std::vector< std
assert(numFDs != -1); // == 1
if (!numFDs || fds[0] != fd) {
- const std::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), std::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 std::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), std::mem_fn(&QObject::deleteLater));
connect(sn.get(), &QSocketNotifier::activated, this, &Private::slotReadActivity);
notifiers.push_back(sn);
}
@@ -1355,7 +1352,10 @@ const std::vector< std::shared_ptr<Output> > &AssuanCommand::outputs() const
QStringList AssuanCommand::fileNames() const
{
- return kdtools::copy<QStringList>(d->files);
+ QStringList rv;
+ rv.reserve(d->files.size());
+ std::copy(d->files.cbegin(), d->files.cend(), std::back_inserter(rv));
+ return rv;
}
unsigned int AssuanCommand::numFiles() const
@@ -1444,12 +1444,9 @@ void AssuanCommand::done(const GpgME::Error &err)
d->done = true;
- std::for_each(d->messages.begin(), d->messages.end(),
- boost::bind(&Input::finalize, _1));
- std::for_each(d->inputs.begin(), d->inputs.end(),
- boost::bind(&Input::finalize, _1));
- std::for_each(d->outputs.begin(), d->outputs.end(),
- boost::bind(&Output::finalize, _1));
+ std::for_each(d->messages.begin(), d->messages.end(), std::mem_fn(&Input::finalize));
+ std::for_each(d->inputs.begin(), d->inputs.end(), std::mem_fn(&Input::finalize));
+ std::for_each(d->outputs.begin(), d->outputs.end(), std::mem_fn(&Output::finalize));
d->messages.clear();
d->inputs.clear();
d->outputs.clear();
diff --git a/src/uiserver/decryptverifycommandemailbase.cpp b/src/uiserver/decryptverifycommandemailbase.cpp
index 3f71911..5e4544c 100644
--- a/src/uiserver/decryptverifycommandemailbase.cpp
+++ b/src/uiserver/decryptverifycommandemailbase.cpp
@@ -62,7 +62,6 @@ using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Formatting;
using namespace GpgME;
-using namespace boost;
class DecryptVerifyCommandEMailBase::Private : public QObject
{
diff --git a/src/uiserver/decryptverifycommandfilesbase.cpp b/src/uiserver/decryptverifycommandfilesbase.cpp
index a864bae..9cb98b8 100644
--- a/src/uiserver/decryptverifycommandfilesbase.cpp
+++ b/src/uiserver/decryptverifycommandfilesbase.cpp
@@ -59,13 +59,13 @@
#include <gpg-error.h>
+#include <memory>
#include <cassert>
using namespace Kleo;
using namespace Kleo::Crypto;
using namespace Kleo::Formatting;
using namespace GpgME;
-using namespace boost;
class DecryptVerifyCommandFilesBase::Private : public QObject
{
@@ -101,7 +101,7 @@ public Q_SLOTS:
public:
private:
- shared_ptr<DecryptVerifyFilesController> controller;
+ std::shared_ptr<DecryptVerifyFilesController> controller;
};
DecryptVerifyCommandFilesBase::DecryptVerifyCommandFilesBase()
@@ -173,7 +173,7 @@ void DecryptVerifyCommandFilesBase::Private::checkForErrors() const
if (fileNames.empty())
throw Exception(makeError(GPG_ERR_ASS_NO_INPUT),
i18n("At least one FILE must be present"));
- if (!kdtools::all(fileNames, is_file()))
+ if (!std::all_of(fileNames.cbegin(), fileNames.cend(), is_file()))
throw Exception(makeError(GPG_ERR_INV_ARG),
i18n("DECRYPT/VERIFY_FILES cannot use directories as input"));
diff --git a/src/uiserver/selectcertificatecommand.cpp b/src/uiserver/selectcertificatecommand.cpp
index 692a46d..3b7e495 100644
--- a/src/uiserver/selectcertificatecommand.cpp
+++ b/src/uiserver/selectcertificatecommand.cpp
@@ -36,8 +36,6 @@
#include <dialogs/certificateselectiondialog.h>
-#include <boost/mem_fn.hpp>
-
#include <Libkleo/Stl_Util>
#include <Libkleo/Exception>
#include <Libkleo/KeyCache>
@@ -58,7 +56,6 @@
using namespace Kleo;
using namespace Kleo::Dialogs;
using namespace GpgME;
-using namespace boost;
class SelectCertificateCommand::Private
{
@@ -150,7 +147,10 @@ void SelectCertificateCommand::Private::slotSelectedCertificates(int err, const
if (err) {
return;
}
- const std::vector<std::string> fprs = kdtools::transform< std::vector<std::string> >(data.split('\n'), mem_fn(&QByteArray::constData));
+ const auto split = data.split('\n');
+ std::vector<std::string> fprs;
+ fprs.reserve(split.size());
+ std::transform(split.cbegin(), split.cend(), std::back_inserter(fprs), std::mem_fn(&QByteArray::constData));
const std::vector<Key> keys = KeyCache::instance()->findByKeyIDOrFingerprint(fprs);
Q_FOREACH (const Key &key, keys) {
qCDebug(KLEOPATRA_LOG) << "found key " << key.userID(0).id();
diff --git a/src/uiserver/sessiondata.cpp b/src/uiserver/sessiondata.cpp
index ebdcd26..7534259 100644
--- a/src/uiserver/sessiondata.cpp
+++ b/src/uiserver/sessiondata.cpp
@@ -38,12 +38,9 @@
#include <QMutex>
-#include <boost/bind.hpp>
-
#include <cassert>
using namespace Kleo;
-using namespace boost;
static const int GARBAGE_COLLECTION_INTERVAL = 60000; // 1min
@@ -62,7 +59,7 @@ std::shared_ptr<SessionDataHandler> SessionDataHandler::instance()
{
mutex.lock();
static SessionDataHandler handler;
- return std::shared_ptr<SessionDataHandler>(&handler, boost::bind(&QMutex::unlock, &mutex));
+ return std::shared_ptr<SessionDataHandler>(&handler, [](SessionDataHandler*) { mutex.unlock(); });
}
SessionDataHandler::SessionDataHandler()
diff --git a/src/uiserver/uiserver.cpp b/src/uiserver/uiserver.cpp
index 7c2af82..316bb54 100644
--- a/src/uiserver/uiserver.cpp
+++ b/src/uiserver/uiserver.cpp
@@ -52,15 +52,11 @@
#include <QTimer>
#include <QFile>
-#include <boost/range/empty.hpp>
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <cassert>
#include <cerrno>
using namespace Kleo;
-using namespace boost;
// static
void UiServer::setLogStream(FILE *stream)
@@ -116,6 +112,14 @@ UiServer::~UiServer()
}
}
+namespace {
+using Iterator = std::vector<std::shared_ptr<AssuanCommandFactory>>::iterator;
+static bool empty(const std::pair<Iterator, Iterator> &iters)
+{
+ return iters.first == iters.second;
+}
+}
+
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>()))) {
@@ -160,8 +164,10 @@ void UiServer::enableCryptoCommands(bool on)
return;
}
d->cryptoCommandsEnabled = on;
- kdtools::for_each(d->connections,
- boost::bind(&AssuanServerConnection::enableCryptoCommands, _1, on));
+ std::for_each(d->connections.cbegin(), d->connections.cend(),
+ [on](std::shared_ptr<AssuanServerConnection> conn) {
+ conn->enableCryptoCommands(on);
+ });
}
QString UiServer::socketName() const
@@ -198,7 +204,9 @@ 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(&std::shared_ptr<AssuanServerConnection>::get, _1) == conn),
+ [conn](const std::shared_ptr<AssuanServerConnection> &other) {
+ return conn == other.get();
+ }),
connections.end());
if (q->isStopped()) {
SessionDataHandler::instance()->clear();
diff --git a/src/uiserver/uiserver_p.h b/src/uiserver/uiserver_p.h
index dbb5df7..f92c1db 100644
--- a/src/uiserver/uiserver_p.h
+++ b/src/uiserver/uiserver_p.h
@@ -44,8 +44,6 @@
#include <kleo-assuan.h>
-#include <boost/bind.hpp>
-
#include <memory>
#include <algorithm>
#include <vector>
diff --git a/src/uiserver/uiserver_unix.cpp b/src/uiserver/uiserver_unix.cpp
index 3d2bc25..2b07b85 100644
--- a/src/uiserver/uiserver_unix.cpp
+++ b/src/uiserver/uiserver_unix.cpp
@@ -49,7 +49,6 @@
#include <cstring>
using namespace Kleo;
-using namespace boost;
QString UiServer::Private::systemErrorString()
{
diff --git a/src/uiserver/uiserver_win.cpp b/src/uiserver/uiserver_win.cpp
index 8bb1b37..fe4d418 100644
--- a/src/uiserver/uiserver_win.cpp
+++ b/src/uiserver/uiserver_win.cpp
@@ -51,7 +51,6 @@
#include <cstdlib>
using namespace Kleo;
-using namespace boost;
QString UiServer::Private::systemErrorString()
{
diff --git a/src/utils/cached.h b/src/utils/cached.h
index 647ae4d..d7bfd25 100644
--- a/src/utils/cached.h
+++ b/src/utils/cached.h
@@ -33,7 +33,7 @@
#ifndef __KLEOPATRA_UTILS_CACHED_H__
#define __KLEOPATRA_UTILS_CACHED_H__
-#include <boost/call_traits.hpp>
+#include <type_traits>
namespace Kleo
{
@@ -43,16 +43,19 @@ class cached
{
T m_value;
bool m_dirty;
+
+ using CallType = const typename std::conditional<std::is_pod<T>::value, T, T&>::type;
+
public:
cached() : m_value(), m_dirty(true) {}
- /* implicit */ cached(typename boost::call_traits<T>::param_type value) : m_value(value), m_dirty(false) {}
+ /* implicit */ cached(const CallType value) : m_value(value), m_dirty(false) {}
- operator typename boost::call_traits<T>::param_type() const
+ operator T() const
{
return m_value;
}
- cached &operator=(typename boost::call_traits<T>::param_type value)
+ cached &operator=(T value)
{
m_value = value;
m_dirty = false;
@@ -63,7 +66,8 @@ public:
{
return m_dirty;
}
- typename boost::call_traits<T>::param_type value() const
+
+ T value() const
{
return m_value;
}
diff --git a/src/utils/detail_p.h b/src/utils/detail_p.h
index 8fe69e1..f48239f 100644
--- a/src/utils/detail_p.h
+++ b/src/utils/detail_p.h
@@ -35,8 +35,6 @@
#include <kleo-assuan.h>
-#include <boost/shared_ptr.hpp>
-
#include <QByteArray>
#ifdef _WIN32
diff --git a/src/utils/kleo_assert.h b/src/utils/kleo_assert.h
index 570b88d..ea436c5 100644
--- a/src/utils/kleo_assert.h
+++ b/src/utils/kleo_assert.h
@@ -35,16 +35,18 @@
#include <libkleo/exception.h>
-#include <boost/preprocessor/stringize.hpp>
-
#include <assert.h>
+#define S(x) #x
+#define S_(x) S(x)
+#define S_LINE S_(__LINE__)
+
#define kleo_assert_fail_impl( cond, file, line ) \
throw Kleo::Exception( gpg_error( GPG_ERR_INTERNAL ), \
- "assertion \"" #cond "\" failed at " file ":" BOOST_PP_STRINGIZE( line ) )
+ "assertion \"" #cond "\" failed at " file ":" line )
#define kleo_assert_fail_impl_func( cond, file, line, func ) \
throw Kleo::Exception( gpg_error( GPG_ERR_INTERNAL ), \
- std::string( "assertion \"" #cond "\" failed in " ) + func + " (" file ":" BOOST_PP_STRINGIZE( line ) ")" )
+ std::string( "assertion \"" #cond "\" failed in " ) + func + " (" file ":" line ")" )
#define kleo_assert_impl( cond, file, line ) \
if ( cond ) {} \
@@ -69,23 +71,23 @@
#endif
#if KLEO_GNUC_PREREQ(2, 6)
-# define kleo_assert( cond ) kleo_assert_impl_func( cond, __FILE__, __LINE__, __PRETTY_FUNCTION__ )
-# define kleo_assert_fail( cond ) kleo_assert_fail_impl_func( cond, __FILE__, __LINE__, __PRETTY_FUNCTION__ )
+# define kleo_assert( cond ) kleo_assert_impl_func( cond, __FILE__, S_LINE, __PRETTY_FUNCTION__ )
+# define kleo_assert_fail( cond ) kleo_assert_fail_impl_func( cond, __FILE__, S_LINE, __PRETTY_FUNCTION__ )
# define notImplemented() throw Exception( gpg_error( GPG_ERR_NOT_IMPLEMENTED ), __PRETTY_FUNCTION__ )
#elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
-# define kleo_assert( cond ) kleo_assert_impl_func( cond, __FILE__, __LINE__, __func__ )
-# define kleo_assert_fail( cond ) kleo_assert_fail_impl_func( cond, __FILE__, __LINE__, __func__ )
+# define kleo_assert( cond ) kleo_assert_impl_func( cond, __FILE__, S_LINE, __func__ )
+# define kleo_assert_fail( cond ) kleo_assert_fail_impl_func( cond, __FILE__, S_LINE, __func__ )
# define notImplemented() throw Exception( gpg_error( GPG_ERR_NOT_IMPLEMENTED ), __func__ )
#endif
#undef KLEO_GNUC_PREREQ
#ifndef kleo_assert
-# define kleo_assert( cond ) kleo_assert_impl( cond, __FILE__, __LINE__ )
+# define kleo_assert( cond ) kleo_assert_impl( cond, __FILE__, S_LINE )
#endif
#ifndef kleo_assert_fail
-# define kleo_assert_fail( cond ) kleo_assert_fail_impl( cond, __FILE__, __LINE__ )
+# define kleo_assert_fail( cond ) kleo_assert_fail_impl( cond, __FILE__, S_LINE )
#endif
#ifndef notImplemented
diff --git a/src/utils/multivalidator.cpp b/src/utils/multivalidator.cpp
index 54d84ec..3615531 100644
--- a/src/utils/multivalidator.cpp
+++ b/src/utils/multivalidator.cpp
@@ -36,15 +36,10 @@
#include <Libkleo/Stl_Util>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-
#include <vector>
#include <iterator>
using namespace Kleo;
-using namespace boost;
-using namespace boost::lambda;
MultiValidator::~MultiValidator() {}
@@ -62,7 +57,8 @@ void MultiValidator::addValidator(QValidator *vali)
void MultiValidator::addValidators(const QList<QValidator *> &valis)
{
- kdtools::for_each(valis, bind(&MultiValidator::addValidator, this, _1));
+ std::for_each(valis.cbegin(), valis.cend(),
+ [this](QValidator *val) { addValidator(val); });
}
void MultiValidator::removeValidator(QValidator *vali)
@@ -80,12 +76,14 @@ void MultiValidator::removeValidator(QValidator *vali)
void MultiValidator::removeValidators(const QList<QValidator *> &valis)
{
- kdtools::for_each(valis, bind(&MultiValidator::removeValidator, this, _1));
+ std::for_each(valis.cbegin(), valis.cend(),
+ [this](QValidator *val) { removeValidator(val); });
}
void MultiValidator::fixup(QString &str) const
{
- kdtools::for_each(m_validators, bind(&QValidator::fixup, _1, ref(str)));
+ std::for_each(m_validators.begin(), m_validators.end(),
+ [&str](QValidator *val) { val->fixup(str); });
}
QValidator::State MultiValidator::validate(QString &str, int &pos) const
@@ -94,11 +92,15 @@ QValidator::State MultiValidator::validate(QString &str, int &pos) const
states.reserve(m_validators.size());
std::transform(m_validators.begin(), m_validators.end(),
std::back_inserter(states),
- bind(&QValidator::validate, _1, ref(str), ref(pos)));
- if (kdtools::any(states, _1 == Invalid)) {
+ [&str, &pos](QValidator *val) {
+ return val->validate(str, pos);
+ });
+ if (std::any_of(states.cbegin(), states.cend(),
+ [](State state) { return state == Invalid; })) {
return Invalid;
}
- if (kdtools::all(states, _1 == Acceptable)) {
+ if (std::all_of(states.cbegin(), states.cend(),
+ [](State state) { return state == Acceptable; })) {
return Acceptable;
}
return Intermediate;
diff --git a/src/utils/path-helper.cpp b/src/utils/path-helper.cpp
index e84b454..08a539b 100644
--- a/src/utils/path-helper.cpp
+++ b/src/utils/path-helper.cpp
@@ -46,12 +46,9 @@
#include <QFileInfo>
#include <QDir>
-#include <boost/bind.hpp>
-
#include <algorithm>
using namespace Kleo;
-using namespace boost;
static QString commonPrefix(const QString &s1, const QString &s2)
{
@@ -95,9 +92,14 @@ QStringList Kleo::makeRelativeTo(const QString &base, const QStringList &fileNam
QStringList Kleo::makeRelativeTo(const QDir &baseDir, const QStringList &fileNames)
{
- return kdtools::transform<QStringList>
- (fileNames,
- boost::bind(&QDir::relativeFilePath, &baseDir, _1));
+ QStringList rv;
+ rv.reserve(fileNames.size());
+ std::transform(fileNames.cbegin(), fileNames.cend(),
+ std::back_inserter(rv),
+ [&baseDir](const QString &file) {
+ return baseDir.relativeFilePath(file);
+ });
+ return rv;
}
void Kleo::recursivelyRemovePath(const QString &path)
diff --git a/src/view/keylistcontroller.cpp b/src/view/keylistcontroller.cpp
index ebd3aab..b13e053 100644
--- a/src/view/keylistcontroller.cpp
+++ b/src/view/keylistcontroller.cpp
@@ -69,7 +69,6 @@
#include "commands/checksumcreatefilescommand.h"
#include "commands/exportpaperkeycommand.h"
-#include <Libkleo/Stl_Util>
#include <Libkleo/KeyCache>
#include <Libkleo/KeyListModel>
#include <Libkleo/Formatting>
@@ -85,15 +84,12 @@
#include <QItemSelectionModel>
#include <QAction>
-#include <boost/bind.hpp>
-
#include <algorithm>
#include <cassert>
using namespace Kleo;
using namespace Kleo::Commands;
using namespace Kleo::SmartCard;
-using namespace boost;
using namespace GpgME;
class KeyListController::Private
@@ -151,7 +147,7 @@ public:
void slotActionTriggered();
void slotCurrentViewChanged(QAbstractItemView *view)
{
- if (view && !kdtools::binary_search(views, view)) {
+ if (view && !std::binary_search(views.cbegin(), views.cend(), view)) {
qCDebug(KLEOPATRA_LOG) << "you need to register view" << view << "before trying to set it as the current view!";
addView(view);
}
@@ -230,7 +226,7 @@ void KeyListController::Private::slotAboutToRemoveKey(const Key &key)
void KeyListController::addView(QAbstractItemView *view)
{
- if (!view || kdtools::binary_search(d->views, view)) {
+ if (!view || std::binary_search(d->views.cbegin(), d->views.cend(), view)) {
return;
}
d->addView(view);
@@ -238,7 +234,7 @@ void KeyListController::addView(QAbstractItemView *view)
void KeyListController::removeView(QAbstractItemView *view)
{
- if (!view || !kdtools::binary_search(d->views, view)) {
+ if (!view || !std::binary_search(d->views.cbegin(), d->views.cend(), view)) {
return;
}
d->removeView(view);
@@ -328,7 +324,9 @@ void KeyListController::Private::connectTabWidget()
if (!tabWidget) {
return;
}
- kdtools::for_each(tabWidget->views(), boost::bind(&Private::addView, this, _1));
+ const auto views = tabWidget->views();
+ std::for_each(views.cbegin(), views.cend(),
+ [this](QAbstractItemView *view) { addView(view); });
for (unsigned int i = 0; i < numTabs2Controller; ++i) {
connect(tabWidget, tabs2controller[i].signal, q, tabs2controller[i].slot);
}
@@ -342,7 +340,9 @@ void KeyListController::Private::disconnectTabWidget()
for (unsigned int i = 0; i < numTabs2Controller; ++i) {
disconnect(tabWidget, tabs2controller[i].signal, q, tabs2controller[i].slot);
}
- kdtools::for_each(tabWidget->views(), boost::bind(&Private::removeView, this, _1));
+ const auto views = tabWidget->views();
+ std::for_each(views.cbegin(), views.cend(),
+ [this](QAbstractItemView *view) { removeView(view); });
}
AbstractKeyListModel *KeyListController::flatModel() const
@@ -563,7 +563,7 @@ void KeyListController::registerAction(QAction *action, Command::Restrictions re
void KeyListController::registerCommand(Command *cmd)
{
- if (!cmd || kdtools::binary_search(d->commands, cmd)) {
+ if (!cmd || std::binary_search(d->commands.cbegin(), d->commands.cend(), cmd)) {
return;
}
d->addCommand(cmd);
@@ -580,13 +580,13 @@ bool KeyListController::hasRunningCommands() const
bool KeyListController::shutdownWarningRequired() const
{
- return kdtools::any(d->commands, mem_fn(&Command::warnWhenRunningAtShutdown));
+ return std::any_of(d->commands.cbegin(), d->commands.cend(), std::mem_fn(&Command::warnWhenRunningAtShutdown));
}
// slot
void KeyListController::cancelCommands()
{
- kdtools::for_each(d->commands, mem_fn(&Command::cancel));
+ std::for_each(d->commands.begin(), d->commands.end(), std::mem_fn(&Command::cancel));
}
void KeyListController::Private::connectView(QAbstractItemView *view)
@@ -621,7 +621,7 @@ void KeyListController::Private::connectCommand(Command *cmd)
void KeyListController::Private::slotDoubleClicked(const QModelIndex &idx)
{
QAbstractItemView *const view = qobject_cast<QAbstractItemView *>(q->sender());
- if (!view || !kdtools::binary_search(views, view)) {
+ if (!view || !std::binary_search(views.cbegin(), views.cend(), view)) {
return;
}
@@ -638,7 +638,7 @@ void KeyListController::Private::slotActivated(const QModelIndex &idx)
{
Q_UNUSED(idx);
QAbstractItemView *const view = qobject_cast<QAbstractItemView *>(q->sender());
- if (!view || !kdtools::binary_search(views, view)) {
+ if (!view || !std::binary_search(views.cbegin(), views.cend(), view)) {
return;
}
@@ -659,7 +659,7 @@ void KeyListController::Private::slotSelectionChanged(const QItemSelection &old,
void KeyListController::Private::slotContextMenu(const QPoint &p)
{
QAbstractItemView *const view = qobject_cast<QAbstractItemView *>(q->sender());
- if (view && kdtools::binary_search(views, view)) {
+ if (view && std::binary_search(views.cbegin(), views.cend(), view)) {
Q_EMIT q->contextMenuRequested(view, view->viewport()->mapToGlobal(p));
} else {
qCDebug(KLEOPATRA_LOG) << "sender is not a QAbstractItemView*!";
@@ -669,7 +669,7 @@ void KeyListController::Private::slotContextMenu(const QPoint &p)
void KeyListController::Private::slotCommandFinished()
{
Command *const cmd = qobject_cast<Command *>(q->sender());
- if (!cmd || !kdtools::binary_search(commands, cmd)) {
+ if (!cmd || !std::binary_search(commands.cbegin(), commands.cend(), cmd)) {
return;
}
qCDebug(KLEOPATRA_LOG) << (void *)cmd;
@@ -744,15 +744,15 @@ Command::Restrictions KeyListController::Private::calculateRestrictionsMask(cons
result |= Command::OnlyOneKey;
}
- if (kdtools::all(keys.begin(), keys.end(), boost::bind(&Key::hasSecret, _1))) {
+ if (std::all_of(keys.cbegin(), keys.cend(), std::mem_fn(&Key::hasSecret))) {
result |= Command::NeedSecretKey;
- } else if (!kdtools::any(keys.begin(), keys.end(), boost::bind(&Key::hasSecret, _1))) {
+ } else if (!std::any_of(keys.cbegin(), keys.cend(), std::mem_fn(&Key::hasSecret))) {
result |= Command::MustNotBeSecretKey;
}
- if (kdtools::all(keys.begin(), keys.end(), boost::bind(&Key::protocol, _1) == OpenPGP)) {
+ if (std::all_of(keys.cbegin(), keys.cend(), [](const Key &key) { return key.protocol() == OpenPGP; })) {
result |= Command::MustBeOpenPGP;
- } else if (kdtools::all(keys.begin(), keys.end(), boost::bind(&Key::protocol, _1) == CMS)) {
+ } else if (std::all_of(keys.cbegin(), keys.cend(), [](const Key &key) { return key.protocol() == CMS; })) {
result |= Command::MustBeCMS;
}
@@ -777,8 +777,8 @@ Command::Restrictions KeyListController::Private::calculateRestrictionsMask(cons
void KeyListController::Private::slotActionTriggered()
{
if (const QObject *const s = q->sender()) {
- const std::vector<action_item>::const_iterator it
- = kdtools::find_if(actions, boost::bind(&action_item::action, _1) == q->sender());
+ const auto it = std::find_if(actions.cbegin(), actions.cend(),
+ [this](const action_item &item) { return item.action == q->sender(); });
if (it != actions.end())
if (Command *const c = it->createCommand(this->currentView, q)) {
if (parentWidget) {
diff --git a/src/view/keytreeview.cpp b/src/view/keytreeview.cpp
index 5a1df51..de239e3 100644
--- a/src/view/keytreeview.cpp
+++ b/src/view/keytreeview.cpp
@@ -54,7 +54,6 @@
#include <cassert>
using namespace Kleo;
-using namespace boost;
using namespace GpgME;
namespace
@@ -104,7 +103,7 @@ KeyTreeView::KeyTreeView(const KeyTreeView &other)
setSortColumn(other.sortColumn(), other.sortOrder());
}
-KeyTreeView::KeyTreeView(const QString &text, const shared_ptr<KeyFilter> &kf, AbstractKeyListSortFilterProxyModel *proxy, QWidget *parent)
+KeyTreeView::KeyTreeView(const QString &text, const std::shared_ptr<KeyFilter> &kf, AbstractKeyListSortFilterProxyModel *proxy, QWidget *parent)
: QWidget(parent),
m_proxy(new KeyListSortFilterProxyModel(this)),
m_additionalProxy(proxy),
@@ -264,7 +263,7 @@ void KeyTreeView::setStringFilter(const QString &filter)
Q_EMIT stringFilterChanged(filter);
}
-void KeyTreeView::setKeyFilter(const shared_ptr<KeyFilter> &filter)
+void KeyTreeView::setKeyFilter(const std::shared_ptr<KeyFilter> &filter)
{
if (filter == m_keyFilter || (filter && m_keyFilter && filter->id() == m_keyFilter->id())) {
return;
@@ -402,10 +401,12 @@ void KeyTreeView::removeKeys(const std::vector<Key> &keys)
m_keys.swap(newKeys);
if (m_flatModel) {
- kdtools::for_each(sorted, boost::bind(&AbstractKeyListModel::removeKey, m_flatModel, _1));
+ std::for_each(sorted.cbegin(), sorted.cend(),
+ [this](const Key &key) { m_flatModel->removeKey(key); });
}
if (m_hierarchicalModel) {
- kdtools::for_each(sorted, boost::bind(&AbstractKeyListModel::removeKey, m_hierarchicalModel, _1));
+ std::for_each(sorted.cbegin(), sorted.cend(),
+ [this](const Key &key) { m_hierarchicalModel->removeKey(key); });
}
}
@@ -419,8 +420,8 @@ static const struct {
SLOT(setStringFilter(QString))
},
{
- SIGNAL(keyFilterChanged(boost::shared_ptr<Kleo::KeyFilter>)),
- SLOT(setKeyFilter(boost::shared_ptr<Kleo::KeyFilter>))
+ SIGNAL(keyFilterChanged(std::shared_ptr<Kleo::KeyFilter>)),
+ SLOT(setKeyFilter(std::shared_ptr<Kleo::KeyFilter>))
},
};
static const unsigned int numConnections = sizeof connections / sizeof * connections;
diff --git a/src/view/keytreeview.h b/src/view/keytreeview.h
index 474110a..1ee9d0c 100644
--- a/src/view/keytreeview.h
+++ b/src/view/keytreeview.h
@@ -39,7 +39,7 @@
#include <gpgme++/key.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <vector>
class QTreeView;
@@ -57,7 +57,7 @@ class KeyTreeView : public QWidget
Q_OBJECT
public:
explicit KeyTreeView(QWidget *parent = Q_NULLPTR);
- KeyTreeView(const QString &stringFilter, const boost::shared_ptr<KeyFilter> &keyFilter,
+ KeyTreeView(const QString &stringFilter, const std::shared_ptr<KeyFilter> &keyFilter,
AbstractKeyListSortFilterProxyModel *additionalProxy, QWidget *parent);
~KeyTreeView();
@@ -105,7 +105,7 @@ public:
{
return m_stringFilter;
}
- const boost::shared_ptr<KeyFilter> &keyFilter() const
+ const std::shared_ptr<KeyFilter> &keyFilter() const
{
return m_keyFilter;
}
@@ -131,12 +131,12 @@ public:
public Q_SLOTS:
virtual void setStringFilter(const QString &text);
- virtual void setKeyFilter(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ virtual void setKeyFilter(const std::shared_ptr<Kleo::KeyFilter> &filter);
virtual void setHierarchicalView(bool on);
Q_SIGNALS:
void stringFilterChanged(const QString &filter);
- void keyFilterChanged(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ void keyFilterChanged(const std::shared_ptr<Kleo::KeyFilter> &filter);
void hierarchicalChanged(bool on);
protected:
@@ -158,7 +158,7 @@ private:
AbstractKeyListModel *m_hierarchicalModel;
QString m_stringFilter;
- boost::shared_ptr<KeyFilter> m_keyFilter;
+ std::shared_ptr<KeyFilter> m_keyFilter;
bool m_isHierarchical : 1;
};
diff --git a/src/view/searchbar.cpp b/src/view/searchbar.cpp
index d91c66e..5996535 100644
--- a/src/view/searchbar.cpp
+++ b/src/view/searchbar.cpp
@@ -46,7 +46,6 @@
#include <cassert>
using namespace Kleo;
-using namespace boost;
class SearchBar::Private
{
@@ -62,20 +61,20 @@ private:
Q_EMIT q->keyFilterChanged(keyFilter(idx));
}
- shared_ptr<KeyFilter> keyFilter(int idx) const
+ std::shared_ptr<KeyFilter> keyFilter(int idx) const
{
const QModelIndex mi = KeyFilterManager::instance()->model()->index(idx, 0);
return KeyFilterManager::instance()->fromModelIndex(mi);
}
- shared_ptr<KeyFilter> currentKeyFilter() const
+ std::shared_ptr<KeyFilter> currentKeyFilter() const
{
return keyFilter(combo->currentIndex());
}
QString currentKeyFilterID() const
{
- if (const shared_ptr<KeyFilter> f = currentKeyFilter()) {
+ if (const std::shared_ptr<KeyFilter> f = currentKeyFilter()) {
return f->id();
} else {
return QString();
@@ -131,7 +130,7 @@ void SearchBar::setStringFilter(const QString &filter)
}
// slot
-void SearchBar::setKeyFilter(const shared_ptr<KeyFilter> &kf)
+void SearchBar::setKeyFilter(const std::shared_ptr<KeyFilter> &kf)
{
const QModelIndex idx = KeyFilterManager::instance()->toModelIndex(kf);
if (idx.isValid()) {
diff --git a/src/view/searchbar.h b/src/view/searchbar.h
index 3f99f41..5cea1b6 100644
--- a/src/view/searchbar.h
+++ b/src/view/searchbar.h
@@ -37,7 +37,7 @@
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class QLineEdit;
@@ -54,7 +54,7 @@ public:
~SearchBar();
QString stringFilter() const;
- const boost::shared_ptr<KeyFilter> &keyFilter() const;
+ const std::shared_ptr<KeyFilter> &keyFilter() const;
QLineEdit *lineEdit() const;
@@ -62,14 +62,14 @@ public:
public Q_SLOTS:
void setStringFilter(const QString &text);
- void setKeyFilter(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ void setKeyFilter(const std::shared_ptr<Kleo::KeyFilter> &filter);
void setChangeStringFilterEnabled(bool enable);
void setChangeKeyFilterEnabled(bool enable);
Q_SIGNALS:
void stringFilterChanged(const QString &text);
- void keyFilterChanged(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ void keyFilterChanged(const std::shared_ptr<Kleo::KeyFilter> &filter);
private:
class Private;
diff --git a/src/view/tabwidget.cpp b/src/view/tabwidget.cpp
index 0ce4c8f..eee4cb5 100644
--- a/src/view/tabwidget.cpp
+++ b/src/view/tabwidget.cpp
@@ -66,7 +66,6 @@
#include <cassert>
using namespace Kleo;
-using namespace boost;
using namespace GpgME;
namespace
@@ -89,7 +88,7 @@ public:
void setHierarchicalView(bool hierarchical) Q_DECL_OVERRIDE;
void setStringFilter(const QString &filter) Q_DECL_OVERRIDE;
- void setKeyFilter(const shared_ptr<KeyFilter> &filter) Q_DECL_OVERRIDE;
+ void setKeyFilter(const std::shared_ptr<KeyFilter> &filter) Q_DECL_OVERRIDE;
QString title() const
{
@@ -205,7 +204,11 @@ Page::Page(const KConfigGroup &group, QWidget *parent)
{
init();
setHierarchicalView(group.readEntry(HIERARCHICAL_VIEW_ENTRY, true));
- setColumnSizes(kdtools::copy< std::vector<int> >(group.readEntry(COLUMN_SIZES, QList<int>())));
+ const QList<int> settings = group.readEntry(COLUMN_SIZES, QList<int>());
+ std::vector<int> sizes;
+ sizes.reserve(settings.size());
+ std::copy(settings.cbegin(), settings.cend(), std::back_inserter(sizes));
+ setColumnSizes(sizes);
setSortColumn(group.readEntry(SORT_COLUMN, 0),
group.readEntry(SORT_DESCENDING, true) ? Qt::DescendingOrder : Qt::AscendingOrder);
}
@@ -224,7 +227,11 @@ void Page::saveTo(KConfigGroup &group) const
group.writeEntry(STRING_FILTER_ENTRY, stringFilter());
group.writeEntry(KEY_FILTER_ENTRY, keyFilter() ? keyFilter()->id() : QString());
group.writeEntry(HIERARCHICAL_VIEW_ENTRY, isHierarchicalView());
- group.writeEntry(COLUMN_SIZES, kdtools::copy< QList<int> >(columnSizes()));
+ QList<int> settings;
+ const auto sizes = columnSizes();
+ settings.reserve(sizes.size());
+ std::copy(sizes.cbegin(), sizes.cend(), std::back_inserter(settings));
+ group.writeEntry(COLUMN_SIZES, settings);
group.writeEntry(SORT_COLUMN, sortColumn());
group.writeEntry(SORT_DESCENDING, sortOrder() == Qt::DescendingOrder);
}
@@ -237,7 +244,7 @@ void Page::setStringFilter(const QString &filter)
KeyTreeView::setStringFilter(filter);
}
-void Page::setKeyFilter(const shared_ptr<KeyFilter> &filter)
+void Page::setKeyFilter(const std::shared_ptr<KeyFilter> &filter)
{
if (!canChangeKeyFilter()) {
return;
@@ -297,7 +304,7 @@ void Page::setTemporary(bool on)
}
m_isTemporary = on;
if (on) {
- setKeyFilter(shared_ptr<KeyFilter>());
+ setKeyFilter(std::shared_ptr<KeyFilter>());
}
}
@@ -319,7 +326,7 @@ private:
void slotContextMenu(const QPoint &p);
void currentIndexChanged(int index);
void slotPageTitleChanged(const QString &title);
- void slotPageKeyFilterChanged(const shared_ptr<KeyFilter> &filter);
+ void slotPageKeyFilterChanged(const std::shared_ptr<KeyFilter> &filter);
void slotPageStringFilterChanged(const QString &filter);
void slotPageHierarchyChanged(bool on);
@@ -497,7 +504,7 @@ void TabWidget::Private::currentIndexChanged(int index)
{
const Page *const page = this->page(index);
Q_EMIT q->currentViewChanged(page ? page->view() : 0);
- Q_EMIT q->keyFilterChanged(page ? page->keyFilter() : shared_ptr<KeyFilter>());
+ Q_EMIT q->keyFilterChanged(page ? page->keyFilter() : std::shared_ptr<KeyFilter>());
Q_EMIT q->stringFilterChanged(page ? page->stringFilter() : QString());
enableDisableCurrentPageActions();
}
@@ -540,7 +547,7 @@ void TabWidget::Private::slotPageTitleChanged(const QString &)
}
}
-void TabWidget::Private::slotPageKeyFilterChanged(const shared_ptr<KeyFilter> &kf)
+void TabWidget::Private::slotPageKeyFilterChanged(const std::shared_ptr<KeyFilter> &kf)
{
if (isSenderCurrentPage()) {
Q_EMIT q->keyFilterChanged(kf);
@@ -709,7 +716,7 @@ void TabWidget::setStringFilter(const QString &filter)
}
}
-void TabWidget::setKeyFilter(const shared_ptr<KeyFilter> &filter)
+void TabWidget::setKeyFilter(const std::shared_ptr<KeyFilter> &filter)
{
if (Page *const page = d->currentPage()) {
page->setKeyFilter(filter);
@@ -864,7 +871,7 @@ QTreeView *TabWidget::Private::addView(Page *page, Page *columnReference)
page->setHierarchicalModel(hierarchicalModel);
connect(page, SIGNAL(titleChanged(QString)), q, SLOT(slotPageTitleChanged(QString)));
- connect(page, SIGNAL(keyFilterChanged(boost::shared_ptr<Kleo::KeyFilter>)), q, SLOT(slotPageKeyFilterChanged(boost::shared_ptr<Kleo::KeyFilter>)));
+ connect(page, SIGNAL(keyFilterChanged(std::shared_ptr<Kleo::KeyFilter>)), q, SLOT(slotPageKeyFilterChanged(std::shared_ptr<Kleo::KeyFilter>)));
connect(page, SIGNAL(stringFilterChanged(QString)), q, SLOT(slotPageStringFilterChanged(QString)));
connect(page, SIGNAL(hierarchicalChanged(bool)), q, SLOT(slotPageHierarchyChanged(bool)));
@@ -948,8 +955,8 @@ void TabWidget::connectSearchBar(QObject *sb)
{
xconnect(sb, SIGNAL(stringFilterChanged(QString)),
this, SLOT(setStringFilter(QString)));
- xconnect(sb, SIGNAL(keyFilterChanged(boost::shared_ptr<Kleo::KeyFilter>)),
- this, SLOT(setKeyFilter(boost::shared_ptr<Kleo::KeyFilter>)));
+ xconnect(sb, SIGNAL(keyFilterChanged(std::shared_ptr<Kleo::KeyFilter>)),
+ this, SLOT(setKeyFilter(std::shared_ptr<Kleo::KeyFilter>)));
connect(this, SIGNAL(enableChangeStringFilter(bool)),
sb, SLOT(setChangeStringFilterEnabled(bool)));
connect(this, SIGNAL(enableChangeKeyFilter(bool)),
diff --git a/src/view/tabwidget.h b/src/view/tabwidget.h
index cb96412..8a3ab52 100644
--- a/src/view/tabwidget.h
+++ b/src/view/tabwidget.h
@@ -35,11 +35,11 @@
#include <QWidget>
+#include <memory>
#include <vector>
#include <utils/pimpl_ptr.h>
-#include <boost/shared_ptr.hpp>
class QAbstractItemView;
@@ -86,7 +86,7 @@ public:
void setMultiSelection(bool on);
public Q_SLOTS:
- void setKeyFilter(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ void setKeyFilter(const std::shared_ptr<Kleo::KeyFilter> &filter);
void setStringFilter(const QString &filter);
Q_SIGNALS:
@@ -95,7 +95,7 @@ Q_SIGNALS:
void currentViewChanged(QAbstractItemView *view);
void stringFilterChanged(const QString &filter);
- void keyFilterChanged(const boost::shared_ptr<Kleo::KeyFilter> &filter);
+ void keyFilterChanged(const std::shared_ptr<Kleo::KeyFilter> &filter);
void enableChangeStringFilter(bool enable);
void enableChangeKeyFilter(bool enable);
@@ -106,7 +106,7 @@ private:
Q_PRIVATE_SLOT(d, void currentIndexChanged(int))
Q_PRIVATE_SLOT(d, void slotPageTitleChanged(const QString &))
- Q_PRIVATE_SLOT(d, void slotPageKeyFilterChanged(const boost::shared_ptr<Kleo::KeyFilter> &))
+ Q_PRIVATE_SLOT(d, void slotPageKeyFilterChanged(const std::shared_ptr<Kleo::KeyFilter> &))
Q_PRIVATE_SLOT(d, void slotPageStringFilterChanged(const QString &))
Q_PRIVATE_SLOT(d, void slotPageHierarchyChanged(bool))
Q_PRIVATE_SLOT(d, void slotRenameCurrentTab())