Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix preselect of sigencfiles actions

This is only relevant for GpgEX as it offers explicit
sign and encrypt actions. For these actions the wizard
should be preselected accordingly.

GnuPG-Bug-Id: 3543
parent 59ebe7da
......@@ -115,6 +115,16 @@ public:
setMinimumHeight(300);
}
void setEncryptionPreset(bool value)
{
mWidget->setEncryptionChecked(value);
}
void setSigningPreset(bool value)
{
mWidget->setSigningChecked(value);
}
bool isComplete() const override
{
return !mWidget->currentOp().isNull();
......@@ -377,10 +387,8 @@ private:
SignEncryptFilesWizard::SignEncryptFilesWizard(QWidget *parent, Qt::WindowFlags f)
: QWizard(parent, f)
, mSigningPreset(false)
, mSigningUserMutable(false)
, mEncryptionUserMutable(false)
, mEncryptionPreset(false)
, mSigningUserMutable(true)
, mEncryptionUserMutable(true)
{
bool de_vs = Kleo::gpgComplianceP("de-vs");
#ifdef Q_OS_WIN
......@@ -443,10 +451,7 @@ SignEncryptFilesWizard::~SignEncryptFilesWizard()
void SignEncryptFilesWizard::setSigningPreset(bool preset)
{
if (preset == mSigningPreset) {
return;
}
mSigningPreset = preset;
mSigEncPage->setSigningPreset(preset);
}
void SignEncryptFilesWizard::setSigningUserMutable(bool mut)
......@@ -459,10 +464,7 @@ void SignEncryptFilesWizard::setSigningUserMutable(bool mut)
void SignEncryptFilesWizard::setEncryptionPreset(bool preset)
{
if (preset == mEncryptionPreset) {
return;
}
mEncryptionPreset = preset;
mSigEncPage->setEncryptionPreset(preset);
}
void SignEncryptFilesWizard::setEncryptionUserMutable(bool mut)
......
......@@ -114,10 +114,8 @@ private:
SigEncPage *mSigEncPage;
ResultPage *mResultPage;
QAbstractButton *mLabel;
bool mSigningPreset,
mSigningUserMutable,
mEncryptionUserMutable,
mEncryptionPreset;
bool mSigningUserMutable,
mEncryptionUserMutable;
};
}
......
......@@ -107,19 +107,19 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent)
/* The signature selection */
QHBoxLayout *sigLay = new QHBoxLayout;
QGroupBox *sigGrp = new QGroupBox(i18n("Prove authenticity (sign)"));
QCheckBox *sigChk = new QCheckBox(i18n("Sign as:"));
sigChk->setChecked(true);
mSigChk = new QCheckBox(i18n("Sign as:"));
mSigChk->setChecked(true);
mSigSelect = new KeySelectionCombo();
mSigSelect->setKeyFilter(std::shared_ptr<KeyFilter>(new SignCertificateFilter()));
sigLay->addWidget(sigChk);
sigLay->addWidget(mSigChk);
sigLay->addWidget(mSigSelect, 1);
sigGrp->setLayout(sigLay);
lay->addWidget(sigGrp);
connect(sigChk, &QCheckBox::toggled, mSigSelect, &QWidget::setEnabled);
connect(sigChk, &QCheckBox::toggled, this, &SignEncryptWidget::updateOp);
connect(mSigChk, &QCheckBox::toggled, mSigSelect, &QWidget::setEnabled);
connect(mSigChk, &QCheckBox::toggled, this, &SignEncryptWidget::updateOp);
connect(mSigSelect, &KeySelectionCombo::currentKeyChanged,
this, &SignEncryptWidget::updateOp);
......@@ -134,16 +134,16 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent)
// Own key
mSelfSelect = new KeySelectionCombo();
mSelfSelect->setKeyFilter(std::shared_ptr<KeyFilter>(new EncryptSelfCertificateFilter()));
QCheckBox *encSelfChk = new QCheckBox(i18n("Encrypt for me:"));
encSelfChk->setChecked(true);
mRecpLayout->addWidget(encSelfChk, 0, 0);
mEncSelfChk = new QCheckBox(i18n("Encrypt for me:"));
mEncSelfChk->setChecked(true);
mRecpLayout->addWidget(mEncSelfChk, 0, 0);
mRecpLayout->addWidget(mSelfSelect, 0, 1);
// Checkbox for other keys
QCheckBox *encOtherChk = new QCheckBox(i18n("Encrypt for others:"));
mRecpLayout->addWidget(encOtherChk, 1, 0);
encOtherChk->setChecked(true);
connect(encOtherChk, &QCheckBox::toggled, this,
mEncOtherChk = new QCheckBox(i18n("Encrypt for others:"));
mRecpLayout->addWidget(mEncOtherChk, 1, 0);
mEncOtherChk->setChecked(true);
connect(mEncOtherChk, &QCheckBox::toggled, this,
[this](bool toggled) {
Q_FOREACH (CertificateLineEdit *edit, mRecpWidgets) {
edit->setEnabled(toggled);
......@@ -179,14 +179,14 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent)
// Connect it
connect(encBox, &QGroupBox::toggled, recipientWidget, &QWidget::setEnabled);
connect(encBox, &QGroupBox::toggled, this, &SignEncryptWidget::updateOp);
connect(encSelfChk, &QCheckBox::toggled, mSelfSelect, &QWidget::setEnabled);
connect(encSelfChk, &QCheckBox::toggled, this, &SignEncryptWidget::updateOp);
connect(mEncSelfChk, &QCheckBox::toggled, mSelfSelect, &QWidget::setEnabled);
connect(mEncSelfChk, &QCheckBox::toggled, this, &SignEncryptWidget::updateOp);
connect(mSymmetric, &QCheckBox::toggled, this, &SignEncryptWidget::updateOp);
connect(mSelfSelect, &KeySelectionCombo::currentKeyChanged,
this, &SignEncryptWidget::updateOp);
// Ensure that the sigChk is aligned togehter with the encryption check boxes.
sigChk->setMinimumWidth(qMax(encOtherChk->width(), encSelfChk->width()));
// Ensure that the mSigChk is aligned togehter with the encryption check boxes.
mSigChk->setMinimumWidth(qMax(mEncOtherChk->width(), mEncSelfChk->width()));
lay->addWidget(encBox);
......@@ -383,3 +383,14 @@ void SignEncryptWidget::saveOwnKeys() const
keys.writeEntry("EncryptKey", encKey.primaryFingerprint());
}
}
void SignEncryptWidget::setSigningChecked(bool value)
{
mSigChk->setChecked(value);
}
void SignEncryptWidget::setEncryptionChecked(bool value)
{
mEncSelfChk->setChecked(value);
mEncOtherChk->setChecked(value);
}
......@@ -78,6 +78,12 @@ public:
userIDs have Validity >= Full). */
bool isDeVsAndValid() const;
/** Set wether or not signing group should be checked */
void setSigningChecked(bool value);
/** Set wether or not encryption group should be checked */
void setEncryptionChecked(bool value);
protected Q_SLOTS:
void updateOp();
void recipientsChanged();
......@@ -104,7 +110,10 @@ private:
QGridLayout *mRecpLayout;
QString mOp;
AbstractKeyListModel *mModel;
QCheckBox *mSymmetric;
QCheckBox *mSymmetric,
*mSigChk,
*mEncOtherChk,
*mEncSelfChk;
int mRecpRowCount;
};
} // namespace Kleo
......
......@@ -225,11 +225,7 @@ void SignEncryptFilesController::Private::updateWizardMode()
wizard->setSigningPreset(false);
} else {
wizard->setSigningUserMutable(true);
wizard->setSigningPreset(false);
if (signOp == SignSelected) {
wizard->setSigningPreset(true);
}
wizard->setSigningPreset(signOp == SignSelected);
}
if (encrOp == EncryptDisallowed) {
......@@ -238,10 +234,7 @@ void SignEncryptFilesController::Private::updateWizardMode()
} else {
wizard->setEncryptionUserMutable(true);
wizard->setEncryptionPreset(false);
if (encrOp == EncryptSelected) {
wizard->setEncryptionPreset(true);
}
wizard->setEncryptionPreset(encrOp == EncryptSelected);
}
wizard->setArchiveForced(archOp == ArchiveForced);
......
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