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