Implement a -lastsession switch which restores the last session

This commit is contained in:
dt
2010-09-07 18:33:56 +02:00
parent cfb79828cf
commit 9d6f5fc738
2 changed files with 5 additions and 1 deletions

View File

@@ -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>

View File

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