summaryrefslogtreecommitdiff
path: root/src/tabwindow
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-12-02 11:44:32 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:06 +0100
commit8ebc401712fd157030a485f38d4500543a013cd0 (patch)
treea772dd422efe3bd9d513e6c595dde9bf12dc91b3 /src/tabwindow
parentFix downloads notifications (diff)
downloadrekonq-8ebc401712fd157030a485f38d4500543a013cd0.tar.xz
Restore tab position on reopening
BUG: 249457
Diffstat (limited to 'src/tabwindow')
-rw-r--r--src/tabwindow/tabwindow.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index a37cc249..beb087c5 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -449,9 +449,9 @@ void TabWindow::cloneTab(int index)
QUrl u = webWindow(index)->url();
QWebHistory* history = webWindow(index)->page()->history();
- TabHistory tHistory(history);
+ TabHistory clonedHistory(history);
- loadUrl(u, Rekonq::NewTab, &tHistory);
+ loadUrl(u, Rekonq::NewTab, &clonedHistory);
}
@@ -483,7 +483,8 @@ void TabWindow::closeTab(int index, bool del)
TabHistory history(tabToClose->page()->history());
history.title = tabToClose->title();
history.url = tabToClose->url().url();
-
+ history.position = index;
+
m_recentlyClosedTabs.removeAll(history);
if (m_recentlyClosedTabs.count() == recentlyClosedTabsLimit)
m_recentlyClosedTabs.removeLast();
@@ -610,7 +611,18 @@ void TabWindow::restoreLastClosedTab()
QUrl u = QUrl(history.url);
- loadUrl(u, Rekonq::NewFocusedTab, &history);
+ int restorePosition = history.position;
+
+ WebWindow *tab = prepareNewTab();
+
+ if (restorePosition < count())
+ insertTab(restorePosition, tab, i18n("restored tab"));
+ else
+ addTab(tab, i18n("restored tab"));
+
+ setCurrentWidget(tab);
+
+ tab->load(u);
// just to get sure...
m_recentlyClosedTabs.removeAll(history);