aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window/MainWindowSlotUI.cpp
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2024-05-11 17:18:36 +0000
committerGitHub <[email protected]>2024-05-11 17:18:36 +0000
commitf909f2c4c35b187eb165ec5545e35d54c6d92bf3 (patch)
tree428fe9e63ecae6bb93be6f20cd2b1ee9b29ffd8d /src/ui/main_window/MainWindowSlotUI.cpp
parentMerge pull request #145 from jermanuts/jermanuts-wizard-links-update (diff)
parentfix: remove qt5compat and redirect dll output path of modules (diff)
downloadGpgFrontend-f909f2c4c35b187eb165ec5545e35d54c6d92bf3.tar.gz
GpgFrontend-f909f2c4c35b187eb165ec5545e35d54c6d92bf3.zip
Merge pull request #148 from saturneric/develop
Develop 2.1.3.1
Diffstat (limited to 'src/ui/main_window/MainWindowSlotUI.cpp')
-rw-r--r--src/ui/main_window/MainWindowSlotUI.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp
index 99a26626..39ceedc6 100644
--- a/src/ui/main_window/MainWindowSlotUI.cpp
+++ b/src/ui/main_window/MainWindowSlotUI.cpp
@@ -28,13 +28,14 @@
#include "MainWindow.h"
#include "core/GpgConstants.h"
+#include "core/function/CacheManager.h"
#include "core/model/GpgPassphraseContext.h"
+#include "core/model/SettingsObject.h"
#include "ui/UserInterfaceUtils.h"
#include "ui/dialog/Wizard.h"
#include "ui/function/RaisePinentry.h"
#include "ui/main_window/KeyMgmt.h"
-#include "ui/struct/SettingsObject.h"
-#include "ui/struct/settings/AppearanceSO.h"
+#include "ui/struct/settings_object/AppearanceSO.h"
#include "ui/widgets/TextEdit.h"
namespace GpgFrontend::UI {
@@ -121,10 +122,13 @@ void MainWindow::slot_open_settings_dialog() {
import_button_->setIconSize(
QSize(appearance.tool_bar_icon_width, appearance.tool_bar_icon_height));
- // restart mainwindow if necessary
- if (get_restart_needed() != 0) {
+ // restart main window if necessary
+ if (restart_mode_ != kNonRestartCode) {
if (edit_->MaybeSaveAnyTab()) {
- emit SignalRestartApplication(get_restart_needed());
+ // clear cache of unsaved page
+ CacheManager::GetInstance().SaveDurableCache(
+ "editor_unsaved_pages", QJsonDocument(QJsonArray()), true);
+ emit SignalRestartApplication(restart_mode_);
}
}
});
@@ -180,11 +184,9 @@ void MainWindow::slot_cut_pgp_header() {
void MainWindow::SlotSetRestartNeeded(int mode) {
GF_UI_LOG_DEBUG("restart mode: {}", mode);
- this->restart_needed_ = mode;
+ this->restart_mode_ = mode;
}
-int MainWindow::get_restart_needed() const { return this->restart_needed_; }
-
void MainWindow::SlotUpdateCryptoMenuStatus(unsigned int type) {
MainWindow::CryptoMenu::OperationType opera_type = type;
GF_UI_LOG_DEBUG("update crypto menu status, type: {}", opera_type);