From 583d507b381f3116f278f284cf3927c3477fb03f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 2 Apr 2013 09:17:56 +0200 Subject: Fix session dialog to have open/load as default button --- src/session.ui | 7 ------- src/sessionmanager.cpp | 9 +++++---- src/sessionwidget.cpp | 12 +++++------- src/sessionwidget.h | 3 --- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/session.ui b/src/session.ui index 2f32edaf..eecea5ad 100644 --- a/src/session.ui +++ b/src/session.ui @@ -30,13 +30,6 @@ - - - - Load - - - diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 36082b57..9890967f 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -486,13 +486,14 @@ void SessionManager::manageSessions() QPointer dialog = new KDialog(); dialog->setCaption(i18nc("@title:window", "Manage Session")); - dialog->setButtons(KDialog::Ok); + dialog->setButtons(KDialog::Ok | KDialog::Close); - dialog->button(KDialog::Ok)->setText(i18n("Done")); + dialog->button(KDialog::Ok)->setIcon(KIcon("system-run")); + dialog->button(KDialog::Ok)->setText(i18n("Load")); SessionWidget widg; - connect(&widg,SIGNAL(closeDialog()),dialog, SLOT(accept())); - dialog->setMainWidget(&widg); + + connect(dialog, SIGNAL(okClicked()), &widg, SLOT(loadSession())); dialog->exec(); } diff --git a/src/sessionwidget.cpp b/src/sessionwidget.cpp index e7e118e1..f1b5f4c0 100644 --- a/src/sessionwidget.cpp +++ b/src/sessionwidget.cpp @@ -33,6 +33,8 @@ // Local Includes #include "sessionmanager.h" +#include "application.h" +#include "rekonqwindow.h" // KDE Includes #include @@ -55,9 +57,6 @@ SessionWidget::SessionWidget(QWidget *parent) listWidget->addItem(item); } - loadButton->setIcon(KIcon("system-run")); - connect(loadButton, SIGNAL(clicked()), this, SLOT(loadSession())); - saveButton->setIcon(KIcon("document-save")); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveSession())); @@ -68,6 +67,9 @@ SessionWidget::SessionWidget(QWidget *parent) connect(listWidget, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(save())); updateButtons(-1); + + if (rApp->rekonqWindowList().isEmpty()) + saveButton->setEnabled(false); } @@ -75,8 +77,6 @@ void SessionWidget::loadSession() { int cc = listWidget->currentRow(); SessionManager::self()->restoreYourSession(cc); - - emit closeDialog(); } @@ -103,12 +103,10 @@ void SessionWidget::updateButtons(int index) kDebug() << "UPDATE INDEX: " << index; if (index < 0) { - loadButton->setEnabled(false); deleteButton->setEnabled(false); return; } - loadButton->setEnabled(true); deleteButton->setEnabled(true); } diff --git a/src/sessionwidget.h b/src/sessionwidget.h index 4fa99acd..d40dee7f 100644 --- a/src/sessionwidget.h +++ b/src/sessionwidget.h @@ -56,9 +56,6 @@ private Q_SLOTS: void deleteSession(); void updateButtons(int); - -Q_SIGNALS: - void closeDialog(); }; -- cgit v1.2.1