1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56: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())); connect(m_autoSaver, SIGNAL(save()), m_sessionManager, SLOT(autoSaveLastSession()));
Settings settings; Settings settings;
m_isStartingAfterCrash = settings.value("SessionRestore/isRunning", false).toBool(); settings.beginGroup(QSL("SessionRestore"));
settings.setValue("SessionRestore/isRunning", true); 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 // we have to ask about startup session before creating main window
if (!m_isStartingAfterCrash && afterLaunch() == SelectSession) if (!m_isStartingAfterCrash && afterLaunch() == SelectSession)
@ -749,6 +761,7 @@ void MainApplication::saveSettings()
Settings settings; Settings settings;
settings.beginGroup("SessionRestore"); settings.beginGroup("SessionRestore");
settings.setValue("isRunning", false); settings.setValue("isRunning", false);
settings.setValue("isRestoring", false);
settings.endGroup(); settings.endGroup();
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup("Web-Browser-Settings");