diff --git a/src/kleo/keygroup.cpp b/src/kleo/keygroup.cpp index 352f419d6..3f698f553 100644 --- a/src/kleo/keygroup.cpp +++ b/src/kleo/keygroup.cpp @@ -1,90 +1,90 @@ /* kleo/keygroup.cpp This file is part of libkleopatra, the KDE keymanagement library SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ #include "keygroup.h" #include #include using namespace Kleo; using namespace GpgME; class KeyGroup::Private { public: explicit Private(const QString &id, const QString &name, const std::vector &keys, Source source); QString id; QString name; - std::vector keys; + Keys keys; Source source; }; -KeyGroup::Private::Private(const QString &id_, const QString &name_, const std::vector &keys_, Source source_) - : id(id_) - , name(name_) - , keys(keys_) - , source(source_) +KeyGroup::Private::Private(const QString &id, const QString &name, const std::vector &keys, Source source) + : id(id) + , name(name) + , keys(keys.cbegin(), keys.cend()) + , source(source) { } KeyGroup::KeyGroup() : KeyGroup(QString(), QString(), {}, UnknownSource) { } KeyGroup::~KeyGroup() = default; KeyGroup::KeyGroup(const QString &id, const QString &name, const std::vector &keys, Source source) : d(new Private(id, name, keys, source)) { } KeyGroup::KeyGroup(const KeyGroup &other) : d(new Private(*other.d)) { } KeyGroup &KeyGroup::operator=(const KeyGroup &other) { *d = *other.d; return *this; } KeyGroup::KeyGroup(KeyGroup &&other) = default; KeyGroup &KeyGroup::operator=(KeyGroup &&other) = default; bool KeyGroup::isNull() const { return !d || d->id.isEmpty(); } QString KeyGroup::id() const { return d ? d->id : QString(); } QString KeyGroup::name() const { return d ? d->name : QString(); } -const std::vector &KeyGroup::keys() const +const KeyGroup::Keys &KeyGroup::keys() const { - static const std::vector empty; + static const Keys empty; return d ? d->keys : empty; } KeyGroup::Source KeyGroup::source() const { return d ? d->source : UnknownSource; } diff --git a/src/kleo/keygroup.h b/src/kleo/keygroup.h index 578482aeb..aa1c36fb5 100644 --- a/src/kleo/keygroup.h +++ b/src/kleo/keygroup.h @@ -1,64 +1,69 @@ /* kleo/keygroup.h This file is part of libkleopatra, the KDE keymanagement library SPDX-FileCopyrightText: 2021 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef LIBKLEO_KEYGROUP_H #define LIBKLEO_KEYGROUP_H #include "kleo_export.h" +#include + #include +#include #include class QString; namespace GpgME { class Key; } namespace Kleo { class KLEO_EXPORT KeyGroup { public: + typedef std::set> Keys; + enum Source { UnknownSource, ApplicationConfig, GnuPGConfig, Tags }; KeyGroup(); ~KeyGroup(); explicit KeyGroup(const QString &id, const QString &name, const std::vector &keys, Source source); KeyGroup(const KeyGroup &other); KeyGroup &operator=(const KeyGroup &other); KeyGroup(KeyGroup &&other); KeyGroup &operator=(KeyGroup &&other); bool isNull() const; QString id() const; QString name() const; - const std::vector &keys() const; + const Keys &keys() const; Source source() const; private: class Private; std::unique_ptr d; }; } #endif // LIBKLEO_KEYGROUP_H diff --git a/src/models/keycache.cpp b/src/models/keycache.cpp index 308449d6b..94eaffb4c 100644 --- a/src/models/keycache.cpp +++ b/src/models/keycache.cpp @@ -1,1447 +1,1447 @@ /* -*- mode: c++; c-basic-offset:4 -*- models/keycache.cpp This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2007, 2008 Klarälvdalens Datakonsult AB SPDX-FileCopyrightText: 2018 Intevation GmbH SPDX-FileCopyrightText: 2020 g10 Code GmbH SPDX-FileContributor: Ingo Klöcker SPDX-License-Identifier: GPL-2.0-or-later */ #include "keycache.h" #include "keycache_p.h" #include "libkleo_debug.h" #include "kleo/keygroup.h" #include "kleo/predicates.h" #include "kleo/stl_util.h" #include "kleo/dn.h" #include "utils/filesystemwatcher.h" #include #include #include #include #include #include #include #include #include #include #include #include //#include #include #include #include #include #include #include #include using namespace Kleo; using namespace GpgME; using namespace KMime::Types; static const unsigned int hours2ms = 1000 * 60 * 60; // // // KeyCache // // namespace { make_comparator_str(ByEMail, .first.c_str()); } class KeyCache::Private { friend class ::Kleo::KeyCache; KeyCache *const q; public: explicit Private(KeyCache *qq) : q(qq), m_refreshInterval(1), m_initalized(false), m_pgpOnly(true), m_remarks_enabled(false) { connect(&m_autoKeyListingTimer, &QTimer::timeout, q, [this]() { q->startKeyListing(); }); updateAutoKeyListingTimer(); } ~Private() { if (m_refreshJob) { m_refreshJob->cancel(); } } template < template