diff options
author | Anton Kreuzkamp <akreuzkamp@web.de> | 2011-08-21 12:01:26 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-08-21 12:01:26 +0200 |
commit | a0315947c024a3be1d35b4700af7fa653272093e (patch) | |
tree | f9a95b5200e144ecb81b50e995fdfc2344dc2482 /src/mainview.cpp | |
parent | Fix saving in adblock management (diff) | |
download | rekonq-a0315947c024a3be1d35b4700af7fa653272093e.tar.xz |
Restore tab's history when restoring a tab/session
We finally have it :D
CCMAIL: akreuzkamp@web.de
REVIEW: 100604
REVIEWED-BY: adjam, elproxy
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index ca5ae654..b5738944 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -100,16 +100,13 @@ MainView::MainView(MainWindow *parent) void MainView::postLaunch() { - QStringList list = rApp->sessionManager()->closedSites(); - Q_FOREACH(const QString & line, list) + QList<TabHistory> list = rApp->sessionManager()->closedSites(); + Q_FOREACH(const TabHistory & tab, list) { - if (line.startsWith(QL1S("about"))) - break; - QString title = line; - QString url = title; - HistoryItem item(url, QDateTime(), title); - m_recentlyClosedTabs.removeAll(item); - m_recentlyClosedTabs.prepend(item); + if (tab.url.startsWith(QL1S("about"))) + continue; + m_recentlyClosedTabs.removeAll(tab); + m_recentlyClosedTabs.prepend(tab); } // Session Manager @@ -486,13 +483,12 @@ void MainView::closeTab(int index, bool del) ) { const int recentlyClosedTabsLimit = 10; - QString title = tabToClose->view()->title(); - QString url = tabToClose->url().prettyUrl(); - HistoryItem item(url, QDateTime(), title); - m_recentlyClosedTabs.removeAll(item); + TabHistory history(tabToClose->view()->history()); + + m_recentlyClosedTabs.removeAll(history); if (m_recentlyClosedTabs.count() == recentlyClosedTabsLimit) m_recentlyClosedTabs.removeLast(); - m_recentlyClosedTabs.prepend(item); + m_recentlyClosedTabs.prepend(history); } removeTab(index); @@ -652,8 +648,10 @@ void MainView::openLastClosedTab() if (m_recentlyClosedTabs.isEmpty()) return; - const HistoryItem item = m_recentlyClosedTabs.takeFirst(); - rApp->loadUrl(KUrl(item.url), Rekonq::NewTab); + TabHistory history = m_recentlyClosedTabs.takeFirst(); + WebView *view = rApp->mainWindow()->mainView()->newWebTab()->view(); + + history.applyHistory(view->history()); } @@ -662,12 +660,19 @@ void MainView::openClosedTab() KAction *action = qobject_cast<KAction *>(sender()); if (action) { - rApp->loadUrl(action->data().toUrl(), Rekonq::NewTab); + WebView *view = rApp->mainWindow()->mainView()->newWebTab()->view(); + TabHistory history; + Q_FOREACH(TabHistory item, m_recentlyClosedTabs) + { + if (item.history == action->data().toByteArray()) + { + history = item; + break; + } + } + history.applyHistory(view->history()); - QString title = action->text(); - title = title.remove('&'); - HistoryItem item(action->data().toString(), QDateTime(), title); - m_recentlyClosedTabs.removeAll(item); + m_recentlyClosedTabs.removeAll(history); } } |