Commit 727523ff authored by Tobias Hunger's avatar Tobias Hunger

SessionManager: Improve handling of unconfigured projects in sessions

Force Project Mode if the startup project is in need to be configured after
a session is loaded.

Task-number: QTCREATORBUG-15228
Change-Id: I625a9485c5233ff717be20fd2c14c85a3b9275e3
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 073542bb
......@@ -1062,6 +1062,8 @@ bool SessionManager::loadSession(const QString &session)
// retrieve all values before the following code could change them again
Id modeId = Id::fromSetting(value(QLatin1String("ActiveMode")));
if (!modeId.isValid())
modeId = Id(Core::Constants::MODE_EDIT);
QColor c = QColor(reader.restoreValue(QLatin1String("Color")).toString());
if (c.isValid())
......@@ -1083,9 +1085,10 @@ bool SessionManager::loadSession(const QString &session)
d->m_future.reportFinished();
d->m_future = QFutureInterface<void>();
// restore the active mode
if (!modeId.isValid())
modeId = Id(Core::Constants::MODE_EDIT);
// Fall back to Project mode if the startup project is unconfigured and
// use the mode saved in the session otherwise
if (d->m_startupProject && d->m_startupProject->needsConfiguration())
modeId = Id(Constants::MODE_SESSION);
ModeManager::activateMode(modeId);
ModeManager::setFocusToCurrentMode();
......
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