Skip to content

Commit

Permalink
Make it possible to select default session from menu
Browse files Browse the repository at this point in the history
when we are in the limbo state where no session has been loaded, and the
default session has not been explicitly created or loaded yet.

Fixes: QTCREATORBUG-28393
Change-Id: I66d69561e18b5073a477d90c1926074e3cd97cee
Reviewed-by: <[email protected]>
Reviewed-by: Christian Kandeler <[email protected]>
  • Loading branch information
e4z9 committed Nov 25, 2022
1 parent 3cd3bba commit cb8742c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/plugins/projectexplorer/projectexplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4173,6 +4173,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()
auto *ag = new QActionGroup(m_sessionMenu);
connect(ag, &QActionGroup::triggered, this, &ProjectExplorerPluginPrivate::setSession);
const QString activeSession = SessionManager::activeSession();
const bool isDefaultVirgin = SessionManager::isDefaultVirgin();

const QStringList sessions = SessionManager::sessions();
for (int i = 0; i < sessions.size(); ++i) {
Expand All @@ -4184,7 +4185,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()
QAction *act = ag->addAction(actionText);
act->setData(session);
act->setCheckable(true);
if (session == activeSession)
if (session == activeSession && !isDefaultVirgin)
act->setChecked(true);
}
m_sessionMenu->addActions(ag->actions());
Expand All @@ -4193,9 +4194,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()

void ProjectExplorerPluginPrivate::setSession(QAction *action)
{
QString session = action->data().toString();
if (session != SessionManager::activeSession())
SessionManager::loadSession(session);
SessionManager::loadSession(action->data().toString());
}

void ProjectExplorerPlugin::setProjectExplorerSettings(const ProjectExplorerSettings &pes)
Expand Down

0 comments on commit cb8742c

Please sign in to comment.