SessionManager: Don't autosave the session while loading a session

Change-Id: I3ce769f9d9753b2771b349ad19a5b248a7f306d2
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Daniel Teske
2012-05-31 13:02:08 +02:00
parent a97d144a33
commit 69a7b5e824
3 changed files with 25 additions and 9 deletions

View File

@@ -93,6 +93,7 @@ SessionManager::SessionManager(QObject *parent)
m_sessionNode(new SessionNode(this)),
m_sessionName(QLatin1String("default")),
m_virginSession(true),
m_loadingSession(false),
m_startupProject(0)
{
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
@@ -291,6 +292,11 @@ void SessionManager::removeProject(Project *project)
removeProjects(QList<Project*>() << project);
}
bool SessionManager::loadingSession()
{
return m_loadingSession;
}
bool SessionManager::save()
{
if (debug)
@@ -810,17 +816,23 @@ bool SessionManager::loadSession(const QString &session)
}
}
m_loadingSession = true;
// Allow everyone to set something in the session and before saving
emit aboutToUnloadSession(m_sessionName);
if (!isDefaultVirgin()) {
if (!save())
if (!save()) {
m_loadingSession = false;
return false;
}
}
// Clean up
if (!ICore::editorManager()->closeAllEditors())
if (!ICore::editorManager()->closeAllEditors()) {
m_loadingSession = false;
return false;
}
setStartupProject(0);
removeProjects(projects());
@@ -872,6 +884,7 @@ bool SessionManager::loadSession(const QString &session)
// Starts a event loop, better do that at the very end
askUserAboutFailedProjects();
m_loadingSession = false;
return true;
}