Commit 9d6f5fc7 authored by dt's avatar dt
Browse files

Implement a -lastsession switch which restores the last session

parent cfb79828
......@@ -21,5 +21,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
</dependencyList>
<argumentList>
<argument name="-customwizard-verbose">Verbose loading of custom wizards</argument>
<argument name="-lastsession">Restore the last session</argument>
</argumentList>
</plugin>
......@@ -260,6 +260,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_session = new SessionManager(this);
if (arguments.contains("-lastsession"))
d->m_sessionToRestoreAtStartup = d->m_session->lastSession();
connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)),
this, SIGNAL(fileListChanged()));
connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
......@@ -1195,7 +1198,6 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
// We have command line arguments, try to find a session in them
QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments();
// Default to no session loading
d->m_sessionToRestoreAtStartup.clear();
foreach (const QString &arg, arguments) {
if (sessions.contains(arg)) {
// Session argument
......@@ -1203,6 +1205,7 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
break;
}
}
if (!d->m_sessionToRestoreAtStartup.isNull())
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
}
......
Supports Markdown
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