summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/sessiondialog.cpp
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@nokia.com>2011-07-07 14:14:10 +0200
committerJarek Kobus <jaroslaw.kobus@nokia.com>2011-07-08 08:17:33 +0200
commit2b8296e93e1e05979b81cc39b28f7bf876d20b73 (patch)
treefcde891ece75cf92307822cf56cf9ec315255936 /src/plugins/projectexplorer/sessiondialog.cpp
parent1f3896e8af6f4417588b65f0fa68759277ab6dac (diff)
downloadqt-creator-2b8296e93e1e05979b81cc39b28f7bf876d20b73.tar.gz
Add "Switch To" button to new session
Task-number: QTCREATORBUG-5310 Change-Id: I16d61be00c8d49957c286cde0b8ca0c5bae69756 Reviewed-on: http://codereview.qt.nokia.com/1308 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Diffstat (limited to 'src/plugins/projectexplorer/sessiondialog.cpp')
-rw-r--r--src/plugins/projectexplorer/sessiondialog.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp
index c136c13a7b..3046c919b5 100644
--- a/src/plugins/projectexplorer/sessiondialog.cpp
+++ b/src/plugins/projectexplorer/sessiondialog.cpp
@@ -94,13 +94,19 @@ public:
void setValue(const QString &value);
QString value() const;
+ bool isSwitchToRequested() const;
+
+private slots:
+ void clicked(QAbstractButton *button);
private:
QLineEdit *m_newSessionLineEdit;
+ QPushButton *m_switchToButton;
+ bool m_usedSwitchTo;
};
SessionNameInputDialog::SessionNameInputDialog(const QStringList &sessions, QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent), m_usedSwitchTo(false)
{
QVBoxLayout *hlayout = new QVBoxLayout(this);
QLabel *label = new QLabel(tr("Enter the name of the session:"), this);
@@ -109,8 +115,10 @@ SessionNameInputDialog::SessionNameInputDialog(const QStringList &sessions, QWid
m_newSessionLineEdit->setValidator(new SessionValidator(this, sessions));
hlayout->addWidget(m_newSessionLineEdit);
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+ m_switchToButton = buttons->addButton(tr("Switch to"), QDialogButtonBox::AcceptRole);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(clicked(QAbstractButton*)));
hlayout->addWidget(buttons);
setLayout(hlayout);
}
@@ -125,6 +133,17 @@ QString SessionNameInputDialog::value() const
return m_newSessionLineEdit->text();
}
+void SessionNameInputDialog::clicked(QAbstractButton *button)
+{
+ if (button == m_switchToButton)
+ m_usedSwitchTo = true;
+}
+
+bool SessionNameInputDialog::isSwitchToRequested() const
+{
+ return m_usedSwitchTo;
+}
+
SessionDialog::SessionDialog(SessionManager *sessionManager)
: m_sessionManager(sessionManager)
@@ -223,6 +242,9 @@ void SessionDialog::createNew()
m_ui.sessionList->addItems(sessions);
m_ui.sessionList->setCurrentRow(sessions.indexOf(newSession));
markItems();
+ if (newSessionInputDialog.isSwitchToRequested()) {
+ switchToSession();
+ }
}
}
@@ -272,6 +294,7 @@ void SessionDialog::switchToSession()
m_sessionManager->loadSession(session);
markItems();
updateActions();
+ reject();
}
} // namespace Internal