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

Filter certificate list with name/email of current key/group

If there is already a key or group selected as recipient, then filter the
certificate list with name or email of the key resp. name of the group
because simply filtering with the text from the input field (which is
the pretty summary text for the key or group) most likely won't yield any
matching certificates or groups.

GnuPG-bug-id: 5845
parent 52f4d78f
Pipeline #147827 passed with stage
in 2 minutes and 38 seconds
......@@ -308,7 +308,17 @@ void SignEncryptWidget::certificateSelectionRequested(CertificateLineEdit *certi
CertificateSelectionDialog::EncryptOnly |
CertificateSelectionDialog::optionsFromProtocol(mCurrentProto) |
CertificateSelectionDialog::IncludeGroups));
dlg.setStringFilter(certificateLineEdit->text());
if (!certificateLineEdit->key().isNull()) {
const auto key = certificateLineEdit->key();
const auto name = QString::fromUtf8(key.userID(0).name());
const auto email = QString::fromUtf8(key.userID(0).email());
dlg.setStringFilter(!name.isEmpty() ? name : email);
} else if (!certificateLineEdit->group().isNull()) {
dlg.setStringFilter(certificateLineEdit->group().name());
} else {
dlg.setStringFilter(certificateLineEdit->text());
}
if (dlg.exec()) {
const std::vector<Key> keys = dlg.selectedCertificates();
......
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