Commit daeb83cd authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

use radio buttons instead of checkboxes to mark entries in sessions menu

just put the actions into an action group
parent e8419795
......@@ -1783,22 +1783,25 @@ void ProjectExplorerPlugin::openWithMenuTriggered(QAction *action)
void ProjectExplorerPlugin::updateSessionMenu()
{
m_sessionMenu->clear();
QActionGroup *ag = new QActionGroup(m_sessionMenu);
connect(ag, SIGNAL(triggered(QAction *)), this, SLOT(setSession(QAction *)));
const QString &activeSession = m_session->activeSession();
foreach (const QString &session, m_session->sessions()) {
QAction *act = m_sessionMenu->addAction(session, this, SLOT(setSession()));
QAction *act = ag->addAction(session);
act->setCheckable(true);
if (session == activeSession)
act->setChecked(true);
}
m_sessionMenu->addActions(ag->actions());
m_sessionMenu->addSeparator();
m_sessionMenu->addAction(m_sessionManagerAction);
m_sessionMenu->setEnabled(true);
}
void ProjectExplorerPlugin::setSession()
void ProjectExplorerPlugin::setSession(QAction *action)
{
QString session = static_cast<QAction *>(sender())->text();
QString session = action->text();
if (session != m_session->activeSession())
m_session->loadSession(session);
}
......
......@@ -151,7 +151,7 @@ private slots:
void populateOpenWithMenu();
void openWithMenuTriggered(QAction *action);
void updateSessionMenu();
void setSession();
void setSession(QAction *action);
void restoreSession();
void loadSession(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