Commit 8f869c30 authored by Denis Dzyubenko's avatar Denis Dzyubenko
Browse files

Changed the 'session manager' dialog

There is not much sense to have Ok and Cancel button that just close
the dialog, so instead there should be a Close button and a button to
switch to the currently selected session.

Reviewed-by: dt
parent b54517ad
......@@ -110,6 +110,11 @@ SessionDialog::SessionDialog(SessionManager *sessionManager, const QString &last
{
m_ui.setupUi(this);
QPushButton *switchButton = m_ui.buttonBox->addButton(tr("Switch to session"),
QDialogButtonBox::AcceptRole);
connect(switchButton, SIGNAL(clicked()),
this, SLOT(switchToSession()));
connect(m_ui.btCreateNew, SIGNAL(clicked()),
this, SLOT(createNew()));
......@@ -143,18 +148,6 @@ void SessionDialog::updateActions()
m_ui.btDelete->setEnabled(enableDelete);
}
void SessionDialog::accept()
{
// do nothing
QDialog::accept();
}
void SessionDialog::reject()
{
// clear list
QDialog::reject();
}
void SessionDialog::createNew()
{
NewSessionInputDialog newSessionInputDialog(m_sessionManager->sessions());
......@@ -192,6 +185,15 @@ void SessionDialog::remove()
m_ui.sessionList->addItems(m_sessionManager->sessions());
}
void SessionDialog::switchToSession()
{
if (m_ui.sessionList->currentItem()) {
QString session = m_ui.sessionList->currentItem()->text();
m_sessionManager->loadSession(session);
}
accept();
}
} // namespace Internal
} // namespace ProjectExplorer
......
......@@ -47,13 +47,11 @@ class SessionDialog : public QDialog
public:
SessionDialog(SessionManager *sessionManager, const QString &lastSession, bool startup);
void accept();
void reject();
private slots:
void createNew();
void clone();
void remove();
void switchToSession();
void updateActions();
......
......@@ -65,7 +65,7 @@
<item row="1" column="1" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
......
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