diff options
Diffstat (limited to 'src/ui/settings/SettingsGeneral.cpp')
-rw-r--r-- | src/ui/settings/SettingsGeneral.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/ui/settings/SettingsGeneral.cpp b/src/ui/settings/SettingsGeneral.cpp index 978a7b5f..6b6568a4 100644 --- a/src/ui/settings/SettingsGeneral.cpp +++ b/src/ui/settings/SettingsGeneral.cpp @@ -65,6 +65,17 @@ GeneralTab::GeneralTab(QWidget* parent) : QWidget(parent) { saveCheckedKeysBox->setLayout(saveCheckedKeysBoxLayout); /***************************************** + * Longer-Expire-Date-Box + *****************************************/ + auto* longerKeyExpirationDateBox = + new QGroupBox(_("Longer Key Expiration Date")); + auto* longerKeyExpirationDateBoxLayout = new QHBoxLayout(); + longerKeyExpirationDateCheckBox = new QCheckBox( + _("Unlock key expiration date setting up to 30 years."), this); + longerKeyExpirationDateBoxLayout->addWidget(longerKeyExpirationDateCheckBox); + longerKeyExpirationDateBox->setLayout(longerKeyExpirationDateBoxLayout); + + /***************************************** * Key-Impport-Confirmation Box *****************************************/ auto* importConfirmationBox = @@ -89,7 +100,7 @@ GeneralTab::GeneralTab(QWidget* parent) : QWidget(parent) { for (const auto& l : lang) { langSelectBox->addItem(l); } - langSelectBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + langSelectBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); langBoxLayout->addWidget(langSelectBox); langBoxLayout->addWidget(new QLabel( @@ -151,6 +162,7 @@ GeneralTab::GeneralTab(QWidget* parent) : QWidget(parent) { #ifdef SERVER_SUPPORT mainLayout->addWidget(serverBox); #endif + mainLayout->addWidget(longerKeyExpirationDateBox); mainLayout->addWidget(saveCheckedKeysBox); mainLayout->addWidget(importConfirmationBox); #ifdef MULTI_LANG_SUPPORT @@ -179,6 +191,16 @@ void GeneralTab::setSettings() { LOG(ERROR) << _("Setting Operation Error") << _("save_key_checked"); } + try { + bool longer_expiration_date = + settings.lookup("general.longer_expiration_date"); + LOG(INFO) << "longer_expiration_date" << longer_expiration_date; + if (longer_expiration_date) + longerKeyExpirationDateCheckBox->setCheckState(Qt::Checked); + } catch (...) { + LOG(ERROR) << _("Setting Operation Error") << _("longer_expiration_date"); + } + #ifdef SERVER_SUPPORT auto serverList = settings.value("general/gpgfrontendServerList").toStringList(); @@ -257,6 +279,14 @@ void GeneralTab::applySettings() { auto& general = settings["general"]; + if (!general.exists("longer_expiration_date")) + general.add("longer_expiration_date", libconfig::Setting::TypeBoolean) = + longerKeyExpirationDateCheckBox->isChecked(); + else { + general["longer_expiration_date"] = + longerKeyExpirationDateCheckBox->isChecked(); + } + if (!general.exists("save_key_checked")) general.add("save_key_checked", libconfig::Setting::TypeBoolean) = saveCheckedKeysCheckBox->isChecked(); |