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
This commit is contained in:
Denis Dzyubenko
2009-07-31 15:18:46 +02:00
parent b54517ad0f
commit 8f869c301c
3 changed files with 16 additions and 16 deletions

View File

@@ -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