forked from qt-creator/qt-creator
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: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user