diff options
author | Tobias Hunger <tobias.hunger@digia.com> | 2013-11-11 16:52:22 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@digia.com> | 2013-11-12 10:28:54 +0100 |
commit | 68142cd11a28af1724cdf20327f9a68f88befed8 (patch) | |
tree | 5275627d2ff372cf722f3f6559402011a30ba685 /src/plugins/projectexplorer/sessiondialog.cpp | |
parent | 566be0995d184cd2c3f99d006ffb7249aeff2e57 (diff) | |
download | qt-creator-68142cd11a28af1724cdf20327f9a68f88befed8.tar.gz |
Session: Make Switch to button work when cloning sessions
Make Switch to button work in dialog shown when cloning sessions
in the session manager.
Task-number: QTCREATORBUG-10701
Change-Id: I6901a6cb842eabbfa38b25f3cc4925bec43c61a4
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Diffstat (limited to 'src/plugins/projectexplorer/sessiondialog.cpp')
-rw-r--r-- | src/plugins/projectexplorer/sessiondialog.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp index 0aa6b5be98..e83b05656b 100644 --- a/src/plugins/projectexplorer/sessiondialog.cpp +++ b/src/plugins/projectexplorer/sessiondialog.cpp @@ -186,6 +186,17 @@ void SessionDialog::markItems() } } +void SessionDialog::addSessionToUi(const QString &name, bool switchTo) +{ + m_ui.sessionList->clear(); + QStringList sessions = SessionManager::sessions(); + m_ui.sessionList->addItems(sessions); + m_ui.sessionList->setCurrentRow(sessions.indexOf(name)); + markItems(); + if (switchTo) + switchToSession(); +} + void SessionDialog::updateActions() { if (m_ui.sessionList->currentItem()) { @@ -209,18 +220,12 @@ void SessionDialog::createNew() newSessionInputDialog.setWindowTitle(tr("New session name")); if (newSessionInputDialog.exec() == QDialog::Accepted) { - QString newSession = newSessionInputDialog.value(); - if (newSession.isEmpty() || SessionManager::sessions().contains(newSession)) + QString sessionName = newSessionInputDialog.value(); + if (sessionName.isEmpty() || SessionManager::sessions().contains(sessionName)) return; - SessionManager::createSession(newSession); - m_ui.sessionList->clear(); - QStringList sessions = SessionManager::sessions(); - m_ui.sessionList->addItems(sessions); - m_ui.sessionList->setCurrentRow(sessions.indexOf(newSession)); - markItems(); - if (newSessionInputDialog.isSwitchToRequested()) - switchToSession(); + SessionManager::createSession(sessionName); + addSessionToUi(sessionName, newSessionInputDialog.isSwitchToRequested()); } } @@ -232,13 +237,8 @@ void SessionDialog::clone() if (newSessionInputDialog.exec() == QDialog::Accepted) { QString newSession = newSessionInputDialog.value(); - if (SessionManager::cloneSession(m_ui.sessionList->currentItem()->text(), newSession)) { - m_ui.sessionList->clear(); - QStringList sessions = SessionManager::sessions(); - m_ui.sessionList->addItems(sessions); - m_ui.sessionList->setCurrentRow(sessions.indexOf(newSession)); - markItems(); - } + if (SessionManager::cloneSession(m_ui.sessionList->currentItem()->text(), newSession)) + addSessionToUi(newSession, newSessionInputDialog.isSwitchToRequested()); } } |