diff options
Diffstat (limited to 'src/ui/main_window/MainWindowSlotUI.cpp')
-rw-r--r-- | src/ui/main_window/MainWindowSlotUI.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 897c1950..39ceedc6 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -28,6 +28,7 @@ #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" @@ -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); |