From 7f9aa706542a3f0c60a2409ed2b95199d8f433d7 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Mon, 20 Jul 2020 15:12:27 +0200 Subject: [PATCH] Fix compliance display in newkeyapprovaldlg The encryptionkeys list is only filled correctly in the accepted check. It is better to check the combos directly here to ensure that the correct state is shown. --- src/ui/newkeyapprovaldialog.cpp | 36 +++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/ui/newkeyapprovaldialog.cpp b/src/ui/newkeyapprovaldialog.cpp index cf41cfe..b6e5141 100644 --- a/src/ui/newkeyapprovaldialog.cpp +++ b/src/ui/newkeyapprovaldialog.cpp @@ -640,21 +640,41 @@ public: // Handle compliance bool de_vs = true; - for (const auto &key: q->signingKeys()) { + + bool isPGP = mFormatBtns->checkedId() == 1; + bool isSMIME = mFormatBtns->checkedId() == 2; + + for (const auto combo: qAsConst(mEncCombos)) { + const auto &key = combo->currentKey(); + if (!combo->isVisible()) { + continue; + } + if (isSMIME && key.protocol() != GpgME::CMS) { + continue; + } + if (isPGP && key.protocol() != GpgME::OpenPGP) { + continue; + } + qCDebug(LIBKLEO_LOG) << "Checking" << key.primaryFingerprint() << Formatting::isKeyDeVs(key); if (!Formatting::isKeyDeVs(key) || keyValidity(key) < GpgME::UserID::Validity::Full) { de_vs = false; break; } } if (de_vs) { - for (const auto &keys: q->encryptionKeys().values()) { - for (const auto &key: keys) { - if (!Formatting::isKeyDeVs(key) || keyValidity(key) < GpgME::UserID::Validity::Full) { - de_vs = false; - break; - } + for (const auto combo: qAsConst(mSigningCombos)) { + const auto key = combo->currentKey(); + if (!combo->isVisible()) { + continue; + } + if (isSMIME && key.protocol() != GpgME::CMS) { + continue; + } + if (isPGP && key.protocol() != GpgME::OpenPGP) { + continue; } - if (!de_vs) { + if (!Formatting::isKeyDeVs(key) || keyValidity(key) < GpgME::UserID::Validity::Full) { + de_vs = false; break; } } -- GitLab