aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/settings/SettingsGeneral.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/settings/SettingsGeneral.cpp')
-rw-r--r--src/ui/dialog/settings/SettingsGeneral.cpp35
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();
}