summaryrefslogtreecommitdiff
path: root/src/sessionmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-02-17 18:11:19 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-02-17 18:11:19 +0100
commit8e5c5ae29692e5e8179b17f574d454fab0c90dda (patch)
tree9379436bce60ce7c272ea6984b11ee6c442f0757 /src/sessionmanager.cpp
parentClosed Tabs page return, first bits (diff)
downloadrekonq-8e5c5ae29692e5e8179b17f574d454fab0c90dda.tar.xz
Closed tabs page, last bits (?)
Restore closed tabs on restart
Diffstat (limited to 'src/sessionmanager.cpp')
-rw-r--r--src/sessionmanager.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 850a709e..e9ea5bf5 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -343,7 +343,7 @@ bool SessionManager::restoreTabWindow(TabWindow* window)
}
-QList<TabHistory> SessionManager::closedSites()
+QList<TabHistory> SessionManager::closedSitesForWindow(const QString &windowName)
{
QList<TabHistory> list;
QDomDocument document("session");
@@ -351,19 +351,29 @@ QList<TabHistory> SessionManager::closedSites()
if (!readSessionDocument(document, m_sessionFilePath))
return list;
- for (unsigned int tabNo = 0; tabNo < document.elementsByTagName("tab").length(); tabNo++)
+ for (unsigned int winNo = 0; winNo < document.elementsByTagName("tab").length(); winNo++)
{
- QDomElement tab = document.elementsByTagName("tab").at(tabNo).toElement();
+ QDomElement windowElement = document.elementsByTagName("window").at(winNo).toElement();
- TabHistory tabHistory;
+ if (windowName != windowElement.attribute("name", ""))
+ continue;
+
+ for (unsigned int tabNo = 0; tabNo < windowElement.elementsByTagName("tab").length(); tabNo++)
+ {
+ QDomElement tab = windowElement.elementsByTagName("tab").at(tabNo).toElement();
- tabHistory.title = tab.attribute("title");
- tabHistory.url = tab.attribute("url");
+ TabHistory tabHistory;
+
+ tabHistory.title = tab.attribute("title");
+ tabHistory.url = tab.attribute("url");
- QDomCDATASection historySection = tab.firstChild().toCDATASection();
- tabHistory.history = QByteArray::fromBase64(historySection.data().toAscii());
+ QDomCDATASection historySection = tab.firstChild().toCDATASection();
+ tabHistory.history = QByteArray::fromBase64(historySection.data().toAscii());
- list << tabHistory;
+ list << tabHistory;
+ }
+
+ return list;
}
return list;