summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-03-30 18:00:09 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-04-02 09:22:58 +0200
commit2c282bb56aba0fd951a7798ebc2a75f3a4ebe742 (patch)
tree01601db0f7054dda5ee8361fcd2702b3df37305a
parentImplement session saving, inspired from kate session management (diff)
downloadrekonq-2c282bb56aba0fd951a7798ebc2a75f3a4ebe742.tar.xz
Load a clean session and close dialog
-rw-r--r--src/sessionmanager.cpp16
-rw-r--r--src/sessionwidget.cpp3
-rw-r--r--src/sessionwidget.h3
3 files changed, 18 insertions, 4 deletions
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 00a3064e..a4345635 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -456,6 +456,9 @@ bool SessionManager::restoreYourSession(int index)
if (!readSessionDocument(document,sessionPath + sessionName))
return false;
+ // trace the windows to delete
+ RekonqWindowList wList = rApp->rekonqWindowList();
+
for (unsigned int winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)
{
QDomElement window = document.elementsByTagName("window").at(winNo).toElement();
@@ -466,7 +469,13 @@ bool SessionManager::restoreYourSession(int index)
tw->tabWidget()->setCurrentIndex(currentTab);
}
-
+
+ Q_FOREACH(const QWeakPointer<RekonqWindow> &w, wList)
+ {
+ if (!w.isNull())
+ w.data()->close();
+ }
+
return true;
}
@@ -475,14 +484,15 @@ void SessionManager::manageSession()
{
kDebug() << "OK ,manage session..";
- QPointer<KDialog> dialog = new KDialog(rApp->rekonqWindow());
+ QPointer<KDialog> dialog = new KDialog();
dialog->setCaption(i18nc("@title:window", "Manage Session"));
dialog->setButtons(KDialog::Ok);
dialog->button(KDialog::Ok)->setText(i18n("Done"));
SessionWidget widg;
- widg.show();
+ connect(&widg,SIGNAL(closeDialog()),dialog, SLOT(accept()));
+
dialog->setMainWidget(&widg);
dialog->exec();
}
diff --git a/src/sessionwidget.cpp b/src/sessionwidget.cpp
index fa8330a7..e7e118e1 100644
--- a/src/sessionwidget.cpp
+++ b/src/sessionwidget.cpp
@@ -75,7 +75,8 @@ void SessionWidget::loadSession()
{
int cc = listWidget->currentRow();
SessionManager::self()->restoreYourSession(cc);
- // close();
+
+ emit closeDialog();
}
diff --git a/src/sessionwidget.h b/src/sessionwidget.h
index d40dee7f..4fa99acd 100644
--- a/src/sessionwidget.h
+++ b/src/sessionwidget.h
@@ -56,6 +56,9 @@ private Q_SLOTS:
void deleteSession();
void updateButtons(int);
+
+Q_SIGNALS:
+ void closeDialog();
};