diff options
Diffstat (limited to 'src/ui/dialog/settings/SettingsGeneral.cpp')
-rw-r--r-- | src/ui/dialog/settings/SettingsGeneral.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp index 680ed014..7c7f254d 100644 --- a/src/ui/dialog/settings/SettingsGeneral.cpp +++ b/src/ui/dialog/settings/SettingsGeneral.cpp @@ -43,9 +43,12 @@ GeneralTab::GeneralTab(QWidget* parent) : QWidget(parent), ui_(std::make_shared<Ui_GeneralSettings>()) { ui_->setupUi(this); - ui_->saveCheckedKeysBox->setTitle(_("Save Checked Keys")); + ui_->cacheBox->setTitle(_("Cache")); ui_->saveCheckedKeysCheckBox->setText( _("Save checked private keys on exit and restore them on next start.")); + ui_->clearGpgPasswordCacheCheckBox->setText( + "Clear gpg password cache when closing GpgFrontend."); + ui_->longerKeyExpirationDateBox->setTitle(_("Longer Key Expiration Date")); ui_->longerKeyExpirationDateCheckBox->setText( _("Unlock key expiration date setting up to 30 years.")); @@ -63,6 +66,10 @@ GeneralTab::GeneralTab(QWidget* parent) "<b>" + QString(_("NOTE")) + _(": ") + "</b>" + _("GpgFrontend will restart automatically if you change the language!")); + ui_->gnupgDatabaseBox->setTitle(_("GnuPG Key Database Path")); + ui_->keyDatabseUseCustomCheckBox->setText(_("Use Custom Path")); + ui_->customKeyDatabasePathSelectButton->setText(_("Select Custom Path")); + #ifdef MULTI_LANG_SUPPORT lang_ = SettingsDialog::ListLanguages(); for (const auto& l : lang_) { @@ -136,6 +143,15 @@ void GeneralTab::SetSettings() { } try { + bool clear_gpg_password_cache = + settings.lookup("general.clear_gpg_password_cache"); + if (clear_gpg_password_cache) + ui_->clearGpgPasswordCacheCheckBox->setCheckState(Qt::Checked); + } catch (...) { + LOG(ERROR) << _("Setting Operation Error") << _("clear_gpg_password_cache"); + } + + try { bool longer_expiration_date = settings.lookup("general.longer_expiration_date"); LOG(INFO) << "longer_expiration_date" << longer_expiration_date; @@ -223,6 +239,14 @@ void GeneralTab::ApplySettings() { general["save_key_checked"] = ui_->saveCheckedKeysCheckBox->isChecked(); } + if (!general.exists("clear_gpg_password_cache")) + general.add("clear_gpg_password_cache", libconfig::Setting::TypeBoolean) = + ui_->clearGpgPasswordCacheCheckBox->isChecked(); + else { + general["clear_gpg_password_cache"] = + ui_->saveCheckedKeysCheckBox->isChecked(); + } + if (!general.exists("non_ascii_when_export")) general.add("non_ascii_when_export", libconfig::Setting::TypeBoolean) = ui_->asciiModeCheckBox->isChecked(); @@ -265,7 +289,7 @@ void GeneralTab::slot_language_changed() { emit SignalRestartNeeded(true); } void GeneralTab::slot_update_custom_key_database_path_label(int state) { if (state != Qt::CheckState::Checked) { ui_->currentKeyDatabasePathLabel->setText(QString::fromStdString( - GpgContext::GetInstance().GetInfo().DatabasePath)); + GpgContext::GetInstance().GetInfo(false).DatabasePath)); // hide label (not necessary to show the default path) this->ui_->currentKeyDatabasePathLabel->setHidden(true); |