summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-04-02 09:17:56 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-04-02 09:22:58 +0200
commit583d507b381f3116f278f284cf3927c3477fb03f (patch)
treef432bfc5493d602b0100c9ce3cc6d5d7b05a8524
parentAdd a "session" startup option (diff)
downloadrekonq-583d507b381f3116f278f284cf3927c3477fb03f.tar.xz
Fix session dialog to have open/load as default button
-rw-r--r--src/session.ui7
-rw-r--r--src/sessionmanager.cpp9
-rw-r--r--src/sessionwidget.cpp12
-rw-r--r--src/sessionwidget.h3
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
@@ -31,13 +31,6 @@
</widget>
</item>
<item>
- <widget class="QPushButton" name="loadButton">
- <property name="text">
- <string>Load</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QPushButton" name="deleteButton">
<property name="text">
<string>Delete</string>
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<KDialog> 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 <KIcon>
@@ -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();
};