diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sessionmanager.cpp | 16 | ||||
-rw-r--r-- | src/sessionwidget.cpp | 3 | ||||
-rw-r--r-- | src/sessionwidget.h | 3 |
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(); }; |