Add API to check if keycache is PGP only

parent 55960049
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.7.40")
set(PIM_VERSION "5.7.41")
project(libkleo VERSION ${PIM_VERSION})
......
......@@ -87,7 +87,7 @@ class KeyCache::Private
friend class ::Kleo::KeyCache;
KeyCache *const q;
public:
explicit Private(KeyCache *qq) : q(qq), m_refreshInterval(1), m_initalized(false)
explicit Private(KeyCache *qq) : q(qq), m_refreshInterval(1), m_initalized(false), m_pgpOnly(true)
{
connect(&m_autoKeyListingTimer, &QTimer::timeout, q, [this]() { q->startKeyListing(); });
updateAutoKeyListingTimer();
......@@ -207,6 +207,7 @@ private:
std::vector<Subkey> subkeyid;
} by;
bool m_initalized;
bool m_pgpOnly;
};
std::shared_ptr<const KeyCache> KeyCache::instance()
......@@ -928,6 +929,7 @@ void KeyCache::insert(const std::vector<Key> &keys)
by_chainid.swap(d->by.chainid);
for (const Key &key : qAsConst(sorted)) {
d->m_pgpOnly &= key.protocol() == GpgME::OpenPGP;
Q_EMIT added(key);
}
......@@ -1132,6 +1134,11 @@ void KeyCache::Private::ensureCachePopulated() const
}
}
bool KeyCache::pgpOnly() const
{
return d->m_pgpOnly;
}
#include "moc_keycache_p.cpp"
#include "moc_keycache.cpp"
......@@ -134,6 +134,9 @@ public:
/** Check if at least one keylisting was finished. */
bool initialized() const;
/** Check if all keys have OpenPGP Protocol. */
bool pgpOnly() const;
public Q_SLOTS:
void clear();
void startKeyListing(GpgME::Protocol proto = GpgME::UnknownProtocol)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment