1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

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.
This commit is contained in:
David Rosca 2018-01-04 13:59:16 +01:00
parent c85d33e92a
commit 0b6c555c62

View File

@ -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");