summaryrefslogtreecommitdiff
path: root/src
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
parentFix downloads notifications (diff)
downloadrekonq-8ebc401712fd157030a485f38d4500543a013cd0.tar.xz
Restore tab position on reopening
BUG: 249457
Diffstat (limited to 'src')
-rw-r--r--src/tabhistory.h1
-rw-r--r--src/tabwindow/tabwindow.cpp20
2 files changed, 17 insertions, 4 deletions
diff --git a/src/tabhistory.h b/src/tabhistory.h
index aac359a3..d542fd7c 100644
--- a/src/tabhistory.h
+++ b/src/tabhistory.h
@@ -65,6 +65,7 @@ public:
QString title;
QString url;
QByteArray history;
+ int position;
};
#endif // TAB_HISTORY
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);