diff options
author | Ingo Klöcker <[email protected]> | 2022-05-02 13:04:37 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-05-02 13:04:37 +0000 |
commit | 0c304beeaab54dc25a8572270704fd5fa90cf836 (patch) | |
tree | b412dff4ff651dfc68626c30bbae166ad92292c6 /lang/qt/src/util.cpp | |
parent | qt,doc: Fix some API documentation (diff) | |
download | gpgme-0c304beeaab54dc25a8572270704fd5fa90cf836.tar.gz gpgme-0c304beeaab54dc25a8572270704fd5fa90cf836.zip |
qt: Factor out helper for getting the fingerprints of some keys
* lang/qt/src/util.h, lang/qt/src/util.cpp (toFingerprints): New.
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: Use the helper.
--
GnuPG-bug-id: 5951
Diffstat (limited to 'lang/qt/src/util.cpp')
-rw-r--r-- | lang/qt/src/util.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lang/qt/src/util.cpp b/lang/qt/src/util.cpp index 81cdf077..66c7eedd 100644 --- a/lang/qt/src/util.cpp +++ b/lang/qt/src/util.cpp @@ -38,6 +38,10 @@ #include "util.h" #include <QStringList> + +#include <key.h> + +#include <algorithm> #include <functional> std::vector<std::string> toStrings(const QStringList &l) @@ -49,3 +53,13 @@ std::vector<std::string> toStrings(const QStringList &l) std::mem_fn(&QString::toStdString)); return v; } + +QStringList toFingerprints(const std::vector<GpgME::Key> &keys) +{ + QStringList fprs; + fprs.reserve(keys.size()); + std::transform(std::begin(keys), std::end(keys), std::back_inserter(fprs), [](const auto &k) { + return QString::fromLatin1(k.primaryFingerprint()); + }); + return fprs; +} |