Verified Commit 3095cf5c authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Warn if a recipient could not be found

If the user enters a string in the recipient selection
line and no key can be found for that, better show an
error / warning to indicate that instead of just
ignoring that line edit.
parent 222150af
......@@ -161,6 +161,9 @@ public:
bool sign = !mWidget->signKey().isNull();
bool encrypt = !mWidget->selfKey().isNull() || !mWidget->recipients().empty();
if (!mWidget->validate()) {
return false;
if (mUseOutputDirChk->isVisible()) {
KConfigGroup archCfg(KSharedConfig::openConfig(), "SignEncryptFilesWizard");
......@@ -55,6 +55,7 @@
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
#include <KMessageBox>
using namespace Kleo;
using namespace Kleo::Dialogs;
......@@ -528,3 +529,16 @@ void SignEncryptWidget::setProtocol(GpgME::Protocol proto)
bool SignEncryptWidget::validate()
for (const auto edit: mRecpWidgets) {
if (!edit->isEmpty() && edit->key().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;
return true;
......@@ -103,6 +103,9 @@ public:
/** Remove a Recipient key */
void removeRecipient(const GpgME::Key &key);
/** Validate that each line edit with content has a key. */
bool validate();
protected Q_SLOTS:
void updateOp();
void recipientsChanged();
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