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

Fix validation of recipient keys

Check only enabled recipient widgets for valid key/group. List all
unresolved recipients in the error message.

GnuPG-bug-id: 5582
parent 2552ed53
Pipeline #77679 passed with stage
in 15 minutes and 2 seconds
......@@ -632,13 +632,17 @@ void Kleo::SignEncryptWidget::onProtocolChanged()
bool SignEncryptWidget::validate()
{
QStringList unresolvedRecipients;
for (const auto edit: std::as_const(mRecpWidgets)) {
if (!edit->isEmpty() && edit->key().isNull() && edit->group().isNull()) {
KMessageBox::error(this, i18nc("%1 is user input that could not be found",
"Could not find a key for '%1'", edit->text().toHtmlEscaped()),
i18n("Failed to find recipient"), KMessageBox::Notify);
return false;
if (edit->isEnabled() && !edit->isEmpty() && edit->key().isNull() && edit->group().isNull()) {
unresolvedRecipients.push_back(edit->text().toHtmlEscaped());
}
}
return true;
if (!unresolvedRecipients.isEmpty()) {
KMessageBox::errorList(this,
i18n("Could not find a key for the following recipients:"),
unresolvedRecipients,
i18n("Failed to find some keys"));
}
return unresolvedRecipients.isEmpty();
}
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