Commit be84387f authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Improve restoration of last session

* Prefer command line arguments on session management to
  settings.

Reviewed-by: thorbjorn
parent b44d71b3
...@@ -1252,10 +1252,10 @@ void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode, Core::IMode *o ...@@ -1252,10 +1252,10 @@ void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode, Core::IMode *o
void ProjectExplorerPlugin::determineSessionToRestoreAtStartup() void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
{ {
QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments(); QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments();
if (arguments.contains("-lastsession") // Process command line arguments first:
|| d->m_projectExplorerSettings.autorestoreLastSession) { if (arguments.contains("-lastsession"))
d->m_sessionToRestoreAtStartup = d->m_session->lastSession(); d->m_sessionToRestoreAtStartup = d->m_session->lastSession();
} else { if (d->m_sessionToRestoreAtStartup.isNull()) {
QStringList sessions = d->m_session->sessions(); QStringList sessions = d->m_session->sessions();
// We have command line arguments, try to find a session in them // We have command line arguments, try to find a session in them
// Default to no session loading // Default to no session loading
...@@ -1267,6 +1267,10 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup() ...@@ -1267,6 +1267,10 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
} }
} }
} }
// Handle settings only after command line arguments:
if (d->m_sessionToRestoreAtStartup.isNull()
&& d->m_projectExplorerSettings.autorestoreLastSession)
d->m_sessionToRestoreAtStartup = d->m_session->lastSession();
if (!d->m_sessionToRestoreAtStartup.isNull()) if (!d->m_sessionToRestoreAtStartup.isNull())
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT); Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment