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

Do not add recipient field unconditionally when editing another started

... because this may result in multiple empty recipient fields. Instead
trigger recipientsChanged() and make this check for completely empty
recipient fields instead of for fields with no key or group. There may
be non-empty recipient fields where the text doesn't match any key or
group.

GnuPG-bug-id: 5535
parent a8bedd58
......@@ -257,7 +257,7 @@ CertificateLineEdit *SignEncryptWidget::addRecipientWidget()
connect(certSel, &CertificateLineEdit::wantsRemoval,
this, &SignEncryptWidget::recpRemovalRequested);
connect(certSel, &CertificateLineEdit::editingStarted,
this, [this] () { addRecipientWidget(); });
this, &SignEncryptWidget::recipientsChanged);
connect(certSel, &CertificateLineEdit::dialogRequested,
this, [this, certSel] () { dialogRequested(certSel); });
......@@ -387,14 +387,10 @@ void SignEncryptWidget::addUnknownRecipient(const char *keyID)
void SignEncryptWidget::recipientsChanged()
{
bool oneEmpty = false;
for (const CertificateLineEdit *w : std::as_const(mRecpWidgets)) {
if (w->key().isNull() && w->group().isNull()) {
oneEmpty = true;
break;
}
}
if (!oneEmpty) {
const bool hasEmptyRecpWidget =
std::any_of(std::cbegin(mRecpWidgets), std::cend(mRecpWidgets),
[](auto w) { return w->isEmpty(); });
if (!hasEmptyRecpWidget) {
addRecipientWidget();
}
updateOp();
......
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