summaryrefslogtreecommitdiff
path: root/src/tabwindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabwindow')
-rw-r--r--src/tabwindow/tabwindow.cpp43
-rw-r--r--src/tabwindow/tabwindow.h5
2 files changed, 37 insertions, 11 deletions
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index acf84948..6865ca97 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -252,6 +252,12 @@ WebWindow *TabWindow::webWindow(int index) const
}
+QList<TabHistory> TabWindow::recentlyClosedTabs()
+{
+ return m_recentlyClosedTabs;
+}
+
+
WebWindow *TabWindow::prepareNewTab(WebPage *page)
{
WebWindow *tab = new WebWindow(this, _isPrivateBrowsing, page);
@@ -707,28 +713,45 @@ void TabWindow::bookmarkAllTabs()
void TabWindow::restoreLastClosedTab()
{
+ restoreClosedTab(0);
+}
+
+
+void TabWindow::restoreClosedTab(int index, bool inNewTab)
+{
if (m_recentlyClosedTabs.isEmpty())
return;
-
- TabHistory history = m_recentlyClosedTabs.takeAt(0);
+
+ if (index >= m_recentlyClosedTabs.count())
+ return;
+
+ TabHistory history = m_recentlyClosedTabs.takeAt(index);
QUrl u = QUrl(history.url);
int restorePosition = history.position;
- WebWindow *tab = prepareNewTab();
-
- if (restorePosition < count())
- insertTab(restorePosition, tab, i18n("restored tab"));
- else
- addTab(tab, i18n("restored tab"));
+ WebWindow *tab;
- setCurrentWidget(tab);
+ if (inNewTab)
+ {
+ tab = prepareNewTab();
+ if (restorePosition < count())
+ insertTab(restorePosition, tab, i18n("restored tab"));
+ else
+ addTab(tab, i18n("restored tab"));
+ setCurrentWidget(tab);
+ }
+ else
+ {
+ tab = currentWebWindow();
+ }
+
tab->load(u);
// just to get sure...
- m_recentlyClosedTabs.removeAll(history);
+ m_recentlyClosedTabs.removeAll(history);
}
diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h
index a273d3b1..a1e369d9 100644
--- a/src/tabwindow/tabwindow.h
+++ b/src/tabwindow/tabwindow.h
@@ -73,6 +73,9 @@ public:
virtual KActionCollection *actionCollection() const;
QAction *actionByName(const QString &name);
+ QList<TabHistory> recentlyClosedTabs();
+ void restoreClosedTab(int index, bool inNewTab = true);
+
public Q_SLOTS:
void loadUrl(const KUrl &, Rekonq::OpenType type = Rekonq::CurrentTab, TabHistory *history = 0);
void newTab(WebPage *page = 0);
@@ -115,7 +118,7 @@ private Q_SLOTS:
void previousTab();
void restoreLastClosedTab();
-
+
void setFullScreen(bool);
void loadFavorite(const int);