Verified Commit 05129d5d authored by Ingo Klöcker's avatar Ingo Klöcker Committed by Ingo Klöcker
Browse files

Add helper for checking whether a key is a remote key

The helper can be used to disable or hide certain actions that do not
make sense for remote keys.

GnuPG-bug-id: 6201
parent 619ecb1f
......@@ -60,3 +60,9 @@ std::set<QString> Kleo::getMissingSignerKeyIds(const std::vector<GpgME::Key> &ke
return keyIds;
});
}
bool Kleo::isRemoteKey(const GpgME::Key &key)
{
// a remote key looked up via WKD has key list mode Local; therefore we also look for the key in the local key ring
return (key.keyListMode() == GpgME::Extern) || KeyCache::instance()->findByFingerprint(key.primaryFingerprint()).isNull();
}
......@@ -44,4 +44,10 @@ KLEO_EXPORT std::set<QString> getMissingSignerKeyIds(const std::vector<GpgME::Us
KLEO_EXPORT std::set<QString> getMissingSignerKeyIds(const std::vector<GpgME::Key> &keys);
/**
* Returns true, if the key \p key is the result of a lookup which is not present
* in the local key ring.
*/
KLEO_EXPORT bool isRemoteKey(const GpgME::Key &key);
}
Supports Markdown
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