Commit 58497e46 authored by dt's avatar dt
Browse files

Fix restoring of default sessions

They appeared to be always empty.

Task-Nr: QTCREATORBUG-977
parent e813f280
...@@ -381,7 +381,7 @@ SessionManager::SessionManager(QObject *parent) ...@@ -381,7 +381,7 @@ SessionManager::SessionManager(QObject *parent)
m_file(new SessionFile), m_file(new SessionFile),
m_sessionNode(new Internal::SessionNodeImpl(this)), m_sessionNode(new Internal::SessionNodeImpl(this)),
m_currentEditor(0), m_currentEditor(0),
m_defaultVirginSession(true) m_virginSession(true)
{ {
// Create qtcreator dir if it doesn't yet exist // Create qtcreator dir if it doesn't yet exist
QString configDir = QFileInfo(m_core->settings()->fileName()).path(); QString configDir = QFileInfo(m_core->settings()->fileName()).path();
...@@ -435,7 +435,8 @@ SessionManager::~SessionManager() ...@@ -435,7 +435,8 @@ SessionManager::~SessionManager()
bool SessionManager::isDefaultVirgin() const bool SessionManager::isDefaultVirgin() const
{ {
return m_defaultVirginSession; return isDefaultSession(m_sessionName)
&& m_virginSession;
} }
bool SessionManager::isDefaultSession(const QString &session) const bool SessionManager::isDefaultSession(const QString &session) const
...@@ -573,7 +574,7 @@ void SessionManager::addProject(Project *project) ...@@ -573,7 +574,7 @@ void SessionManager::addProject(Project *project)
void SessionManager::addProjects(const QList<Project*> &projects) void SessionManager::addProjects(const QList<Project*> &projects)
{ {
m_defaultVirginSession = false; m_virginSession = false;
QList<Project*> clearedList; QList<Project*> clearedList;
foreach (Project *pro, projects) { foreach (Project *pro, projects) {
if (!m_file->m_projects.contains(pro)) { if (!m_file->m_projects.contains(pro)) {
...@@ -604,7 +605,7 @@ void SessionManager::addProjects(const QList<Project*> &projects) ...@@ -604,7 +605,7 @@ void SessionManager::addProjects(const QList<Project*> &projects)
void SessionManager::removeProject(Project *project) void SessionManager::removeProject(Project *project)
{ {
m_defaultVirginSession = false; m_virginSession = false;
if (project == 0) { if (project == 0) {
qDebug() << "SessionManager::removeProject(0) ... THIS SHOULD NOT HAPPEN"; qDebug() << "SessionManager::removeProject(0) ... THIS SHOULD NOT HAPPEN";
return; return;
...@@ -634,7 +635,7 @@ bool SessionManager::createImpl(const QString &fileName) ...@@ -634,7 +635,7 @@ bool SessionManager::createImpl(const QString &fileName)
setStartupProject(0); setStartupProject(0);
} }
m_defaultVirginSession = false; m_virginSession = true;
if (debug) if (debug)
qDebug() << "SessionManager - creating new session returns " << success; qDebug() << "SessionManager - creating new session returns " << success;
...@@ -662,7 +663,7 @@ bool SessionManager::loadImpl(const QString &fileName) ...@@ -662,7 +663,7 @@ bool SessionManager::loadImpl(const QString &fileName)
} }
} }
m_defaultVirginSession = false; m_virginSession = false;
if (success) { if (success) {
emit aboutToUnloadSession(); emit aboutToUnloadSession();
...@@ -1144,7 +1145,7 @@ void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty) ...@@ -1144,7 +1145,7 @@ void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty)
if (m_file && !m_file->fileName().isEmpty()) if (m_file && !m_file->fileName().isEmpty())
m_autoSaveSessionTimer->start(); m_autoSaveSessionTimer->start();
if (makeDefaultVirginDirty) if (makeDefaultVirginDirty)
m_defaultVirginSession = false; m_virginSession = false;
} }
#include "session.moc" #include "session.moc"
...@@ -194,7 +194,7 @@ private: ...@@ -194,7 +194,7 @@ private:
QPointer<Core::IEditor> m_currentEditor; QPointer<Core::IEditor> m_currentEditor;
QString m_displayName; QString m_displayName;
QString m_sessionName; QString m_sessionName;
bool m_defaultVirginSession; bool m_virginSession;
mutable QStringList m_sessions; mutable QStringList m_sessions;
......
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