From a0315947c024a3be1d35b4700af7fa653272093e Mon Sep 17 00:00:00 2001 From: Anton Kreuzkamp Date: Sun, 21 Aug 2011 12:01:26 +0200 Subject: Restore tab's history when restoring a tab/session We finally have it :D CCMAIL: akreuzkamp@web.de REVIEW: 100604 REVIEWED-BY: adjam, elproxy --- src/history/historymanager.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/history') diff --git a/src/history/historymanager.h b/src/history/historymanager.h index 101bc09d..bdce16d7 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -97,6 +98,41 @@ public: }; +// --------------------------------------------------------------------------------------------------------------- + +class TabHistory +{ +public: + explicit TabHistory(QWebHistory *h = 0) + { + if (h) + { + title = h->currentItem().title(); + url = h->currentItem().url().toString(); + QDataStream stream(&history, QIODevice::ReadWrite); + stream << *h; + } + } + + inline bool operator ==(const TabHistory &other) const + { + return history == other.history; + } + + void applyHistory(QWebHistory *h) + { + if (h) + { + QDataStream stream(&history, QIODevice::ReadOnly); + stream >> *h; + } + } + + QString title; + QString url; + QByteArray history; +}; + // --------------------------------------------------------------------------------------------------------------- -- cgit v1.2.1