diff options
author | saturneric <[email protected]> | 2024-05-03 18:17:25 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-05-03 18:17:25 +0000 |
commit | 1d9cffa54afdca117a43465fb350ee548ec2e41f (patch) | |
tree | 4facf6641e312b39d19c1388c87eb702ea720ace /src/ui/main_window/MainWindowSlotUI.cpp | |
parent | Merge remote-tracking branch 'origin/main' into develop (diff) | |
download | GpgFrontend-1d9cffa54afdca117a43465fb350ee548ec2e41f.tar.gz GpgFrontend-1d9cffa54afdca117a43465fb350ee548ec2e41f.zip |
fix: discard changes but text still remains
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); |