Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -110,6 +110,11 @@ SessionDialog::SessionDialog(SessionManager *sessionManager, const QString &last ...@@ -110,6 +110,11 @@ SessionDialog::SessionDialog(SessionManager *sessionManager, const QString &last
{ {
m_ui.setupUi(this); 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()), connect(m_ui.btCreateNew, SIGNAL(clicked()),
this, SLOT(createNew())); this, SLOT(createNew()));
...@@ -143,18 +148,6 @@ void SessionDialog::updateActions() ...@@ -143,18 +148,6 @@ void SessionDialog::updateActions()
m_ui.btDelete->setEnabled(enableDelete); m_ui.btDelete->setEnabled(enableDelete);
} }
void SessionDialog::accept()
{
// do nothing
QDialog::accept();
}
void SessionDialog::reject()
{
// clear list
QDialog::reject();
}
void SessionDialog::createNew() void SessionDialog::createNew()
{ {
NewSessionInputDialog newSessionInputDialog(m_sessionManager->sessions()); NewSessionInputDialog newSessionInputDialog(m_sessionManager->sessions());
...@@ -192,6 +185,15 @@ void SessionDialog::remove() ...@@ -192,6 +185,15 @@ void SessionDialog::remove()
m_ui.sessionList->addItems(m_sessionManager->sessions()); 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 Internal
} // namespace ProjectExplorer } // namespace ProjectExplorer
......
...@@ -47,13 +47,11 @@ class SessionDialog : public QDialog ...@@ -47,13 +47,11 @@ class SessionDialog : public QDialog
public: public:
SessionDialog(SessionManager *sessionManager, const QString &lastSession, bool startup); SessionDialog(SessionManager *sessionManager, const QString &lastSession, bool startup);
void accept();
void reject();
private slots: private slots:
void createNew(); void createNew();
void clone(); void clone();
void remove(); void remove();
void switchToSession();
void updateActions(); void updateActions();
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<item row="1" column="1" colspan="2"> <item row="1" column="1" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Close</set>
</property> </property>
</widget> </widget>
</item> </item>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment