diff options
author | Saturneric <[email protected]> | 2023-07-13 10:19:04 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-07-13 10:19:04 +0000 |
commit | 0ec05be303b3d6b64c041f7c1640eabeb55c899c (patch) | |
tree | c9b25afa3fd84f3b24c1d9114e3b25df76b702d6 /src/ui/dialog/settings/SettingsGeneral.cpp | |
parent | feat: support resotring unsaved pages after a crash (diff) | |
download | GpgFrontend-0ec05be303b3d6b64c041f7c1640eabeb55c899c.tar.gz GpgFrontend-0ec05be303b3d6b64c041f7c1640eabeb55c899c.zip |
feat: support all clear log and data files
Diffstat (limited to 'src/ui/dialog/settings/SettingsGeneral.cpp')
-rw-r--r-- | src/ui/dialog/settings/SettingsGeneral.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp index 719e5de8..be5190dd 100644 --- a/src/ui/dialog/settings/SettingsGeneral.cpp +++ b/src/ui/dialog/settings/SettingsGeneral.cpp @@ -63,6 +63,16 @@ GeneralTab::GeneralTab(QWidget* parent) "<b>" + QString(_("NOTE")) + _(": ") + "</b>" + _("GpgFrontend will restart automatically if you change the language!")); + ui_->dataBox->setTitle(_("Data")); + ui_->clearAllLogFilesButton->setText(QString::fromStdString( + (boost::format(_("Clear All Log (Total Size: %s)")) % + GlobalSettingStation::GetInstance().GetLogFilesSize()) + .str())); + ui_->clearAllDataObjectsButton->setText(QString::fromStdString( + (boost::format(_("Clear All Data Objects (Total Size: %s)")) % + GlobalSettingStation::GetInstance().GetDataObjectsFilesSize()) + .str())); + #ifdef MULTI_LANG_SUPPORT lang_ = SettingsDialog::ListLanguages(); for (const auto& l : lang_) { @@ -72,6 +82,31 @@ GeneralTab::GeneralTab(QWidget* parent) this, &GeneralTab::slot_language_changed); #endif + connect(ui_->clearAllLogFilesButton, &QPushButton::clicked, this, [=]() { + GlobalSettingStation::GetInstance().ClearAllLogFiles(); + ui_->clearAllLogFilesButton->setText(QString::fromStdString( + (boost::format(_("Clear All Log (Total Size: %s)")) % + GlobalSettingStation::GetInstance().GetLogFilesSize()) + .str())); + }); + + connect(ui_->clearAllDataObjectsButton, &QPushButton::clicked, this, [=]() { + QMessageBox::StandardButton reply; + reply = QMessageBox::question( + this, _("Confirm"), + _("Are you sure you want to clear all data objects?\nThis will result " + "in " + "loss of all cached form positions, statuses, key servers, etc."), + QMessageBox::Yes | QMessageBox::No); + if (reply == QMessageBox::Yes) { + GlobalSettingStation::GetInstance().ClearAllDataObjects(); + ui_->clearAllDataObjectsButton->setText(QString::fromStdString( + (boost::format(_("Clear All Data Objects (Total Size: %s)")) % + GlobalSettingStation::GetInstance().GetDataObjectsFilesSize()) + .str())); + } + }); + SetSettings(); } |