From f60dac9d7ebb5b989aad67d67d5ab3ccef7d278c Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Mon, 15 Mar 2021 12:57:36 +0100 Subject: Adds option to have old or new session behaviour. Closes #187 --- src/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index cd8e5ef..c881ee8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -682,13 +682,12 @@ int main(int argc, char *argv[]) // Stores the first window from the restored session (if any) MainWindow * root_window = nullptr; - if(session_store != nullptr) + if((session_store != nullptr) and (kristall::globals().options.session_restore_behaviour == GenericSettings::RestoreLastSession)) { auto & settings = *session_store; int window_count = settings.beginReadArray("windows"); - for(int index = 0; index < window_count; index += 1) { settings.setArrayIndex(index); @@ -822,6 +821,8 @@ void GenericSettings::load(QSettings &settings) cache_threshold = settings.value("cache_threshold", 125).toInt(); cache_life = settings.value("cache_life", 15).toInt(); cache_unlimited_life = settings.value("cache_unlimited_life", true).toBool(); + + session_restore_behaviour = SessionRestoreBehaviour(settings.value("session_restore_behaviour", int(session_restore_behaviour)).toInt()); } void GenericSettings::save(QSettings &settings) const @@ -886,6 +887,8 @@ void GenericSettings::save(QSettings &settings) const // with emoji support, they get it out of the box. settings.setValue("emojis_enabled", emojis_enabled); } + + settings.setValue("session_restore_behaviour", int(session_restore_behaviour)); } void kristall::applySettings() -- cgit v1.2.3