diff options
author | Saturneric <[email protected]> | 2022-01-12 04:43:30 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-01-12 04:43:30 +0000 |
commit | a1b49d54338724ca8b6bf1c7e8b0a0e1e7287184 (patch) | |
tree | 9433389e530a75acfbc6deb30bf5dfc85e8bab30 | |
parent | <feat>(ui): Added ability to encrypt data object storage (diff) | |
download | GpgFrontend-a1b49d54338724ca8b6bf1c7e8b0a0e1e7287184.tar.gz GpgFrontend-a1b49d54338724ca8b6bf1c7e8b0a0e1e7287184.zip |
<refactor>(ui): Change Sync() to Sync Settings()
Diffstat (limited to '')
-rw-r--r-- | src/init.cpp | 2 | ||||
-rwxr-xr-x | src/ui/KeyMgmt.cpp | 3 | ||||
-rw-r--r-- | src/ui/KeyServerImportDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/MainWindow.cpp | 4 | ||||
-rw-r--r-- | src/ui/Wizard.cpp | 2 | ||||
-rw-r--r-- | src/ui/keypair_details/KeyPairOperaTab.cpp | 2 | ||||
-rw-r--r-- | src/ui/settings/GlobalSettingStation.cpp | 2 | ||||
-rw-r--r-- | src/ui/settings/GlobalSettingStation.h | 6 | ||||
-rw-r--r-- | src/ui/settings/SettingsDialog.cpp | 3 | ||||
-rw-r--r-- | src/ui/widgets/KeyList.cpp | 4 |
10 files changed, 16 insertions, 14 deletions
diff --git a/src/init.cpp b/src/init.cpp index fffaaa1b..30f0b683 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -94,7 +94,7 @@ void init_locale() { if (!general.exists("lang")) general.add("lang", libconfig::Setting::TypeString) = ""; - GpgFrontend::UI::GlobalSettingStation::GetInstance().Sync(); + GpgFrontend::UI::GlobalSettingStation::GetInstance().SyncSettings(); LOG(INFO) << "current system locale" << setlocale(LC_ALL, nullptr); diff --git a/src/ui/KeyMgmt.cpp b/src/ui/KeyMgmt.cpp index 3715b01a..a0209d10 100755 --- a/src/ui/KeyMgmt.cpp +++ b/src/ui/KeyMgmt.cpp @@ -371,7 +371,6 @@ void KeyMgmt::slotExportKeyToKeyPackage() { } void KeyMgmt::slotExportKeyToClipboard() { - auto keys_checked = key_list_->getChecked(); if (keys_checked->empty()) { QMessageBox::critical( @@ -465,7 +464,7 @@ void KeyMgmt::slotSaveWindowState() { key_management.add("window_state", libconfig::Setting::TypeString) = saveState().toBase64().toStdString(); - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); } void KeyMgmt::slotExportAsOpenSSHFormat() { diff --git a/src/ui/KeyServerImportDialog.cpp b/src/ui/KeyServerImportDialog.cpp index 9a118b93..7c59de6f 100644 --- a/src/ui/KeyServerImportDialog.cpp +++ b/src/ui/KeyServerImportDialog.cpp @@ -594,7 +594,7 @@ void KeyServerImportDialog::slotSaveWindowState() { import_from_keyserver["size"]["height"] = QWidget::height(); } - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); } } // namespace GpgFrontend::UI diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 692dfd04..a5416fe9 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -318,7 +318,7 @@ void MainWindow::restoreSettings() { LOG(ERROR) << "cannot resolve settings"; } - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); } void MainWindow::saveSettings() { @@ -354,7 +354,7 @@ void MainWindow::saveSettings() { LOG(ERROR) << "cannot save settings"; }; - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); } void MainWindow::closeAttachmentDock() { diff --git a/src/ui/Wizard.cpp b/src/ui/Wizard.cpp index a8576627..78cea649 100644 --- a/src/ui/Wizard.cpp +++ b/src/ui/Wizard.cpp @@ -69,7 +69,7 @@ void Wizard::slotWizardAccepted() { } else { wizard["show_wizard"] = false; } - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); } catch (...) { LOG(ERROR) << _("Setting Operation Error"); } diff --git a/src/ui/keypair_details/KeyPairOperaTab.cpp b/src/ui/keypair_details/KeyPairOperaTab.cpp index 57eb8164..0ee61593 100644 --- a/src/ui/keypair_details/KeyPairOperaTab.cpp +++ b/src/ui/keypair_details/KeyPairOperaTab.cpp @@ -64,7 +64,7 @@ KeyPairOperaTab::KeyPairOperaTab(const std::string& key_id, QWidget* parent) auto* edit_password_button = new QPushButton(_("Modify Password")); connect(edit_password_button, SIGNAL(clicked()), this, SLOT(slotModifyPassword())); - + vbox_p_k->addWidget(edit_expires_button); vbox_p_k->addWidget(edit_password_button); } diff --git a/src/ui/settings/GlobalSettingStation.cpp b/src/ui/settings/GlobalSettingStation.cpp index 259fe96f..42383bee 100644 --- a/src/ui/settings/GlobalSettingStation.cpp +++ b/src/ui/settings/GlobalSettingStation.cpp @@ -43,7 +43,7 @@ GpgFrontend::UI::GlobalSettingStation::GetInstance() { return *_instance; } -void GpgFrontend::UI::GlobalSettingStation::Sync() noexcept { +void GpgFrontend::UI::GlobalSettingStation::SyncSettings() noexcept { using namespace libconfig; try { ui_cfg.writeFile(ui_config_path.string().c_str()); diff --git a/src/ui/settings/GlobalSettingStation.h b/src/ui/settings/GlobalSettingStation.h index 3080726d..26c42f78 100644 --- a/src/ui/settings/GlobalSettingStation.h +++ b/src/ui/settings/GlobalSettingStation.h @@ -92,7 +92,11 @@ class GlobalSettingStation : public QObject { void ResetRootCerts() { root_certs_.clear(); } - void Sync() noexcept; + void SyncSettings() noexcept; + + void SaveDataObj(const std::string& _key, const nlohmann::json& value); + + std::optional<nlohmann::json> GetDataObject(const std::string& _key); private: // Program Location diff --git a/src/ui/settings/SettingsDialog.cpp b/src/ui/settings/SettingsDialog.cpp index 01e4094f..dc84e8ac 100644 --- a/src/ui/settings/SettingsDialog.cpp +++ b/src/ui/settings/SettingsDialog.cpp @@ -38,7 +38,6 @@ namespace GpgFrontend::UI { SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { - tabWidget = new QTabWidget(); generalTab = new GeneralTab(); appearanceTab = new AppearanceTab(); @@ -126,7 +125,7 @@ void SettingsDialog::slotAccept() { LOG(INFO) << "apply done"; // write settings to filesystem - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); LOG(INFO) << "restart needed" << getRestartNeeded(); if (getRestartNeeded()) { diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index 89634f95..8b93a088 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -355,7 +355,7 @@ void KeyList::dropEvent(QDropEvent* event) { else { general["confirm_import_keys"] = checkBox->isChecked(); } - GlobalSettingStation::GetInstance().Sync(); + GlobalSettingStation::GetInstance().SyncSettings(); } if (event->mimeData()->hasUrls()) { @@ -584,7 +584,7 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) { type_steam << "#"; } - if(it->HasCardKey()) { + if (it->HasCardKey()) { type_steam << "^"; } |