diff options
Diffstat (limited to 'src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp')
-rw-r--r-- | src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp index 09b7da7e..66a607b8 100644 --- a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp @@ -28,8 +28,7 @@ #include "GpgVerifyResultAnalyse.h" -#include "core/GpgModel.h" -#include "core/function/gpg/GpgKeyGetter.h" +#include "core/function/gpg/GpgAbstractKeyGetter.h" #include "core/utils/CommonUtils.h" #include "core/utils/LocalizedUtils.h" @@ -200,29 +199,19 @@ auto GpgFrontend::GpgVerifyResultAnalyse::print_signer( QTextStream &stream, GpgSignature sign) -> bool { auto fingerprint = sign.GetFingerprint(); auto key = - GpgFrontend::GpgKeyGetter::GetInstance(GetChannel()).GetKey(fingerprint); - if (key.IsGood()) { - stream << "- " << tr("Signed By") << ": " << key.UIDs().front().GetUID() - << Qt::endl; - - auto s_keys = key.SubKeys(); - auto it = std::find_if(s_keys.begin(), s_keys.end(), - [fingerprint](const GpgSubKey &k) { - return k.Fingerprint() == fingerprint; - }); - - if (it != s_keys.end()) { - auto &s_key = *it; - if (s_key.Fingerprint() != key.Fingerprint()) { - stream << "- " << tr("Key ID") << ": " << key.ID() << " (" - << tr("Subkey") << ")" << Qt::endl; - } else { - stream << "- " << tr("Key ID") << ": " << key.ID() << " (" - << tr("Primary Key") << ")" << Qt::endl; - } - stream << "- " << tr("Key Create Date") << ": " - << QLocale().toString(s_key.CreationTime()) << Qt::endl; + GpgAbstractKeyGetter::GetInstance(GetChannel()).GetKey(fingerprint); + if (key != nullptr) { + stream << "- " << tr("Signed By") << ": " << key->UID() << Qt::endl; + + if (key->KeyType() == GpgAbstractKeyType::kGPG_SUBKEY) { + stream << "- " << tr("Key ID") << ": " << key->ID() << " (" + << tr("Subkey") << ")" << Qt::endl; + } else { + stream << "- " << tr("Key ID") << ": " << key->ID() << " (" + << tr("Primary Key") << ")" << Qt::endl; } + stream << "- " << tr("Key Create Date") << ": " + << QLocale().toString(key->CreationTime()) << Qt::endl; } else { stream_ << "- " << tr("Signed By") << "(" << tr("Fingerprint") << ")" @@ -239,7 +228,8 @@ auto GpgFrontend::GpgVerifyResultAnalyse::print_signer( stream << "- " << tr("Sign Date") << "(" << tr("Localized") << ")" << ": " << QLocale().toString(sign.GetCreateTime()) << Qt::endl; stream << Qt::endl; - return key.IsGood(); + + return key != nullptr; } auto GpgFrontend::GpgVerifyResultAnalyse::GetSignatures() const |