Commit 15724dab authored by Ingo Klöcker's avatar Ingo Klöcker

Add support for groups of keys to SignEncryptWidget

There are not yet any groups in the model, but once there are
groups all keys in the selected groups are added to the list of
recipients.

GnuPG-bug-id: 5175, 5241
parent 4563ccd7
Pipeline #47658 failed with stage
in 4 minutes
......@@ -23,6 +23,7 @@
#include <Libkleo/DefaultKeyFilter>
#include <Libkleo/KeyCache>
#include <Libkleo/KeyGroup>
#include <Libkleo/KeyListModel>
#include <Libkleo/KeySelectionCombo>
#include <Libkleo/KeyListSortFilterProxyModel>
......@@ -302,7 +303,7 @@ void SignEncryptWidget::recipientsChanged()
{
bool oneEmpty = false;
Q_FOREACH (const CertificateLineEdit *w, mRecpWidgets) {
if (w->key().isNull()) {
if (w->isEmpty()) {
oneEmpty = true;
break;
}
......@@ -338,8 +339,12 @@ QVector <Key> SignEncryptWidget::recipients() const
break;
}
const Key k = w->key();
const KeyGroup g = w->group();
if (!k.isNull()) {
ret << k;
} else if (!g.isNull()) {
const auto keys = g.keys();
std::copy(keys.begin(), keys.end(), std::back_inserter(ret));
}
}
const Key k = selfKey();
......@@ -510,7 +515,7 @@ void SignEncryptWidget::setProtocol(GpgME::Protocol proto)
bool SignEncryptWidget::validate()
{
for (const auto edit: qAsConst(mRecpWidgets)) {
if (!edit->isEmpty() && edit->key().isNull()) {
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);
......
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