Only show restore page when crashing during session restore

If app crashes during one minute after restoring crashed session,
show the restore page with options to the user next time instead
of showing restore page after every crash.
remotes/origin/Falkon/3.0
David Rosca 8 years ago
parent c85d33e92a
commit 0b6c555c62
  1. 17
      src/lib/app/mainapplication.cpp

@ -285,8 +285,20 @@ MainApplication::MainApplication(int &argc, char** argv)
connect(m_autoSaver, SIGNAL(save()), m_sessionManager, SLOT(autoSaveLastSession()));
Settings settings;
m_isStartingAfterCrash = settings.value("SessionRestore/isRunning", false).toBool();
settings.setValue("SessionRestore/isRunning", true);
settings.beginGroup(QSL("SessionRestore"));
const bool wasRunning = settings.value(QSL("isRunning"), false).toBool();
const bool wasRestoring = settings.value(QSL("isRestoring"), false).toBool();
settings.setValue(QSL("isRunning"), true);
settings.setValue(QSL("isRestoring"), wasRunning);
settings.endGroup();
m_isStartingAfterCrash = wasRunning && wasRestoring;
if (wasRunning) {
QTimer::singleShot(60 * 1000, this, [this]() {
Settings().setValue(QSL("SessionRestore/isRestoring"), false);
});
}
// we have to ask about startup session before creating main window
if (!m_isStartingAfterCrash && afterLaunch() == SelectSession)
@ -749,6 +761,7 @@ void MainApplication::saveSettings()
Settings settings;
settings.beginGroup("SessionRestore");
settings.setValue("isRunning", false);
settings.setValue("isRestoring", false);
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");

Loading…
Cancel
Save