Commit 021cd34f authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Fix display of tags in key details for secret keys

The problem is that the option secretOnly is incompatible with the
option includeSigs (aka key list mode Signatures) because gpgme does
"gpg --list-secret-keys" if secretOnly is true,
"gpg --check-sigs" if secretOnly is false, but signatures are requested,
"gpg --list-keys" if secretOnly is false and no signatures are requested.
See T3580.

This problem caused the tags to vanish from the key list for the users'
own keys as soon as they viewed the key details.

Using key list mode WithSecret instead of secretOnly fixes the problem.

Note: Adding key list mode Signatures is superfluous because the job
is already created with includeSigs.

GnuPG-bug-id: 5174
parent 2fe6ffd2
Pipeline #46487 canceled with stage
......@@ -32,6 +32,7 @@
#include <gpgme++/keylistresult.h>
#include <gpgme++/tofuinfo.h>
#include <QGpgME/Debug>
#include <QGpgME/Protocol>
#include <QGpgME/KeyListJob>
......@@ -204,8 +205,12 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
QStringList tagList;
#ifdef GPGME_HAS_REMARKS
for (const auto &tag: uid.remarks(Tags::tagKeys(), err)) {
if (err) {
qCWarning(KLEOPATRA_LOG) << "Getting remarks for user id" << uid.id() << "failed:" << err;
}
tagList << QString::fromStdString(tag);
}
qCDebug(KLEOPATRA_LOG) << "tagList:" << tagList;
#endif
const auto tags = tagList.join(QStringLiteral("; "));
item->setData(3, Qt::DisplayRole, tags);
......@@ -595,14 +600,16 @@ void CertificateDetailsWidget::setKey(const GpgME::Key &key)
auto ctx = QGpgME::Job::context(job);
ctx->addKeyListMode(GpgME::WithTofu);
ctx->addKeyListMode(GpgME::Signatures);
ctx->addKeyListMode(GpgME::SignatureNotations);
if (key.hasSecret()) {
ctx->addKeyListMode(GpgME::WithSecret);
}
// Windows QGpgME new style connect problem makes this necessary.
connect(job, SIGNAL(result(GpgME::KeyListResult,std::vector<GpgME::Key>,QString,GpgME::Error)),
this, SLOT(keyListDone(GpgME::KeyListResult,std::vector<GpgME::Key>,QString,GpgME::Error)));
job->start(QStringList() << QLatin1String(key.primaryFingerprint()), key.hasSecret());
job->start(QStringList() << QLatin1String(key.primaryFingerprint()));
}
GpgME::Key CertificateDetailsWidget::key() const
......
Markdown is supported
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