diff options
author | Saturneric <[email protected]> | 2022-01-04 15:49:00 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-01-04 15:49:00 +0000 |
commit | 952d0424ab1a130d4365bd9995b03a9fc1ddd81b (patch) | |
tree | 4c5e5d3b7b41a3e3ac1da007c47a0189e0e1df0f /src/ui/settings/SettingsSendMail.cpp | |
parent | <feature, fix, refactor>(core, ui): fixed known bugs for v2.0.4-beta.1 and ad... (diff) | |
download | GpgFrontend-952d0424ab1a130d4365bd9995b03a9fc1ddd81b.tar.gz GpgFrontend-952d0424ab1a130d4365bd9995b03a9fc1ddd81b.zip |
<fix, refactor>(core, ui): fixed known bugs for v2.0.4-beta.1.
1. fixed proxy settings ui.
2. fixed send mail settings ui.
3. fixed uncaught exception handling.
Diffstat (limited to 'src/ui/settings/SettingsSendMail.cpp')
-rw-r--r-- | src/ui/settings/SettingsSendMail.cpp | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/src/ui/settings/SettingsSendMail.cpp b/src/ui/settings/SettingsSendMail.cpp index e4ab9b0b..f0acb10d 100644 --- a/src/ui/settings/SettingsSendMail.cpp +++ b/src/ui/settings/SettingsSendMail.cpp @@ -39,19 +39,8 @@ SendMailTab::SendMailTab(QWidget* parent) : QWidget(parent), ui(std::make_shared<Ui_SendMailSettings>()) { ui->setupUi(this); - connect(ui->enableCheckBox, &QCheckBox::stateChanged, this, [=](int state) { - ui->smtpServerAddressEdit->setDisabled(state != Qt::Checked); - ui->portSpin->setDisabled(state != Qt::Checked); - ui->connextionSecurityComboBox->setDisabled(state != Qt::Checked); - - ui->identityCheckBox->setDisabled(state != Qt::Checked); - ui->usernameEdit->setDisabled(state != Qt::Checked); - ui->passwordEdit->setDisabled(state != Qt::Checked); - - ui->defaultSenderEmailEdit->setDisabled(state != Qt::Checked); - ui->gpgKeyIDEdit->setDisabled(state != Qt::Checked); - ui->checkConnectionButton->setDisabled(state != Qt::Checked); - }); + connect(ui->enableCheckBox, &QCheckBox::stateChanged, this, + [=](int state) { switch_ui_enabled(state == Qt::Checked); }); #ifdef SMTP_SUPPORT connect(ui->checkConnectionButton, &QPushButton::clicked, this, @@ -60,10 +49,8 @@ SendMailTab::SendMailTab(QWidget* parent) &SendMailTab::slotSendTestMail); #endif - connect(ui->identityCheckBox, &QCheckBox::stateChanged, this, [=](int state) { - ui->usernameEdit->setDisabled(state != Qt::Checked); - ui->passwordEdit->setDisabled(state != Qt::Checked); - }); + connect(ui->identityCheckBox, &QCheckBox::stateChanged, this, + [=](int state) { switch_ui_identity_enabled(state == Qt::Checked); }); connect(ui->connextionSecurityComboBox, &QComboBox::currentTextChanged, this, [=](const QString& current_text) { @@ -174,6 +161,11 @@ void SendMailTab::setSettings() { } catch (...) { LOG(ERROR) << _("Setting Operation Error") << _("identity_enable"); } + + { + auto state = ui->identityCheckBox->checkState(); + switch_ui_identity_enabled(state == Qt::Checked); + } ui->enableCheckBox->setCheckState(Qt::Unchecked); try { @@ -185,6 +177,11 @@ void SendMailTab::setSettings() { } catch (...) { LOG(ERROR) << _("Setting Operation Error") << _("save_key_checked"); } + + { + auto state = ui->enableCheckBox->checkState(); + switch_ui_enabled(state == Qt::Checked); + } } void SendMailTab::applySettings() { @@ -383,6 +380,25 @@ void SendMailTab::slotTestSMTPConnectionResult(const QString& result) { ui->senTestMailButton->setDisabled(true); } } + +void SendMailTab::switch_ui_enabled(bool enabled) { + ui->smtpServerAddressEdit->setDisabled(!enabled); + ui->portSpin->setDisabled(!enabled); + ui->connextionSecurityComboBox->setDisabled(!enabled); + + ui->identityCheckBox->setDisabled(!enabled); + ui->usernameEdit->setDisabled(!enabled); + ui->passwordEdit->setDisabled(!enabled); + + ui->defaultSenderEmailEdit->setDisabled(!enabled); + ui->gpgKeyIDEdit->setDisabled(!enabled); + ui->checkConnectionButton->setDisabled(!enabled); +} + +void SendMailTab::switch_ui_identity_enabled(bool enabled) { + ui->usernameEdit->setDisabled(!enabled); + ui->passwordEdit->setDisabled(!enabled); +} #endif } // namespace GpgFrontend::UI |