aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-16 18:05:00 +0000
committersaturneric <[email protected]>2025-04-16 18:05:00 +0000
commit272cf34f21ab1741d24673a7e3b7c95567a74cec (patch)
tree4497435e41a8bbdd7560cee57b2c8c4171099951 /src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp
parentfix: found bugs (diff)
downloadGpgFrontend-272cf34f21ab1741d24673a7e3b7c95567a74cec.tar.gz
GpgFrontend-272cf34f21ab1741d24673a7e3b7c95567a74cec.zip
fix: testing and solve bugs found
Diffstat (limited to 'src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp')
-rw-r--r--src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp40
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