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

Use locateKeysJob instead of keyForMailboxJob for locating key

KeyForMailboxJob internally does a KeyListJob with the same options
as the KeyListJob created by locateKeysJob() and then tries to find
the best key matching the given text. But here we are only interested
in triggering the look up and import of keys. The result of the job is
ignored. Therefore, we can use the more simple locateKeysJob().

Additionally, we remove leading and trailing whitespace and do not
perform a look up if the entered text is empty.

GnuPG-bug-id: 5845
parent 5d097045
......@@ -33,7 +33,7 @@
#include <gpgme++/key.h>
#include <QGpgME/KeyForMailboxJob>
#include <QGpgME/KeyListJob>
#include <QGpgME/Protocol>
#include <QHBoxLayout>
......@@ -326,14 +326,14 @@ void CertificateLineEdit::Private::checkLocate()
// Only check once per mailbox
const auto mailText = ui.lineEdit.text();
if (s_lookedUpKeys.contains(mailText)) {
const auto mailText = ui.lineEdit.text().trimmed();
if (mailText.isEmpty() || s_lookedUpKeys.contains(mailText)) {
s_lookedUpKeys << mailText;
qCDebug(KLEOPATRA_LOG) << "Lookup job for" << mailText;
QGpgME::KeyForMailboxJob *job = QGpgME::openpgp()->keyForMailboxJob();
auto job = QGpgME::openpgp()->locateKeysJob();
job->start({mailText}, /*secretOnly=*/false);
void CertificateLineEdit::Private::updateKey()
Supports Markdown
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