Commit c59bf4b4 authored by Daniel Teske's avatar Daniel Teske
Browse files

Move creating of the default session into the SessionManager ctor



There used to be 3 states for the SessionManager:
1) Uninitialized (after ctor)
2) A default virgin session
3) Using a session (including the default session)

And we used to switch from state 1 to 2 or 3 after ICore::coreOpened().
This changes that we start in state 2 and thus don't emit a few signals
after coreOpened. I don't think that'll break anything.

Change-Id: I4cf7dade132c9d0ebd6d472d79c8b70c07acd20f
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent acf98f13
......@@ -1468,11 +1468,8 @@ void ProjectExplorerPlugin::restoreSession()
arguments.removeOne(d->m_sessionToRestoreAtStartup);
// Restore latest session or what was passed on the command line
if (d->m_sessionToRestoreAtStartup.isEmpty()) {
d->m_session->createAndLoadNewDefaultSession();
} else {
if (!d->m_sessionToRestoreAtStartup.isEmpty())
d->m_session->loadSession(d->m_sessionToRestoreAtStartup);
}
// update welcome page
connect(Core::ModeManager::instance(),
......
......@@ -324,6 +324,7 @@ SessionManager::SessionManager(QObject *parent)
: QObject(parent),
m_file(new SessionFile),
m_sessionNode(new SessionNode(this)),
m_sessionName(QLatin1String("default")),
m_virginSession(true)
{
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
......@@ -340,6 +341,7 @@ SessionManager::SessionManager(QObject *parent)
connect(em, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
this, SLOT(markSessionFileDirty()));
m_file->setFileName(sessionNameToFileName(m_sessionName));
m_autoSaveSessionTimer = new QTimer(this);
m_autoSaveSessionTimer->setSingleShot(true);
......@@ -980,15 +982,6 @@ QString SessionManager::sessionNameFromFileName(const QString &fileName) const
return fileName.mid(slash + 1, fileName.length() - slash - 5); // Exclude .qws
}
/*!
\brief Creates a new default session and switches to it.
*/
void SessionManager::createAndLoadNewDefaultSession()
{
createImpl(sessionNameToFileName(QLatin1String("default")));
}
/*!
\brief Just creates a new session (Does not actually create the file).
*/
......
......@@ -76,7 +76,6 @@ public:
QString lastSession() const;
QStringList sessions() const;
void createAndLoadNewDefaultSession();
bool createSession(const QString &session);
bool deleteSession(const QString &session);
......
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