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

Update the encryption checkboxes if symmetric only is en-/disabled

GnuPG-bug-id: 5661
parent bfadfb38
Pipeline #89589 passed with stage
in 14 minutes and 33 seconds
......@@ -13,6 +13,7 @@
#include "certificatelineedit.h"
#include "fileoperationspreferences.h"
#include "kleopatraapplication.h"
#include "settings.h"
#include "unknownrecipientwidget.h"
......@@ -227,14 +228,9 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent, bool sigEncExclusive)
lay->addWidget(encBox);
connect(KeyCache::instance().get(), &Kleo::KeyCache::keysMayHaveChanged,
this, [this]() {
const bool haveSecretKeys = !KeyCache::instance()->secretKeys().empty();
const bool havePublicKeys = !KeyCache::instance()->keys().empty();
const bool symmetricOnly = FileOperationsPreferences().symmetricEncryptionOnly();
mSigChk->setEnabled(haveSecretKeys);
mEncSelfChk->setEnabled(haveSecretKeys && !symmetricOnly);
mEncOtherChk->setEnabled(havePublicKeys && !symmetricOnly);
});
this, &SignEncryptWidget::updateCheckBoxes);
connect(KleopatraApplication::instance(), &KleopatraApplication::configurationChanged,
this, &SignEncryptWidget::updateCheckBoxes);
loadKeys();
onProtocolChanged();
......@@ -651,3 +647,18 @@ bool SignEncryptWidget::validate()
}
return unresolvedRecipients.isEmpty();
}
void SignEncryptWidget::updateCheckBoxes()
{
const bool haveSecretKeys = !KeyCache::instance()->secretKeys().empty();
const bool havePublicKeys = !KeyCache::instance()->keys().empty();
const bool symmetricOnly = FileOperationsPreferences().symmetricEncryptionOnly();
mSigChk->setEnabled(haveSecretKeys);
mEncSelfChk->setEnabled(haveSecretKeys && !symmetricOnly);
mEncOtherChk->setEnabled(havePublicKeys && !symmetricOnly);
if (symmetricOnly) {
mEncSelfChk->setChecked(false);
mEncOtherChk->setChecked(false);
mSymmetric->setChecked(true);
}
}
......@@ -117,6 +117,7 @@ Q_SIGNALS:
private:
CertificateLineEdit* addRecipientWidget();
void onProtocolChanged();
void updateCheckBoxes();
private:
KeySelectionCombo *mSigSelect = nullptr;
......
......@@ -115,14 +115,24 @@ public:
private:
void connectConfigureDialog()
{
if (configureDialog && q->mainWindow()) {
connect(configureDialog, SIGNAL(configCommitted()), q->mainWindow(), SLOT(slotConfigCommitted()));
if (configureDialog) {
if (q->mainWindow()) {
connect(configureDialog, SIGNAL(configCommitted()),
q->mainWindow(), SLOT(slotConfigCommitted()));
}
connect(configureDialog, &ConfigureDialog::configCommitted,
q, &KleopatraApplication::configurationChanged);
}
}
void disconnectConfigureDialog()
{
if (configureDialog && q->mainWindow()) {
disconnect(configureDialog, SIGNAL(configCommitted()), q->mainWindow(), SLOT(slotConfigCommitted()));
if (configureDialog) {
if (q->mainWindow()) {
disconnect(configureDialog, SIGNAL(configCommitted()),
q->mainWindow(), SLOT(slotConfigCommitted()));
}
disconnect(configureDialog, &ConfigureDialog::configCommitted,
q, &KleopatraApplication::configurationChanged);
}
}
......
......@@ -95,6 +95,8 @@ Q_SIGNALS:
* correct exitValue */
void setExitValue(int value);
void configurationChanged();
private:
class Private;
kdtools::pimpl_ptr<Private> d;
......
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