summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-10-25 04:25:36 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-25 04:25:36 +0200
commit8561c1b43a506ac4ead17734c20cc55ce7cec666 (patch)
tree3cdc943514fe72b2af0fd7d3dca69ad2d0d0f0f9 /src/mainview.cpp
parentfix typo in the default bookmarks (diff)
downloadrekonq-8561c1b43a506ac4ead17734c20cc55ce7cec666.tar.xz
Fastest last tab recover :)
In fact, the tab is not really deleted, but just saved somewhere to fastly restore it, having again history and so on..
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index beaf4e21..325afb4c 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -63,6 +63,7 @@ MainView::MainView(MainWindow *parent)
, m_addTabButton(0)
, m_currentTabIndex(0)
, m_parentWindow(parent)
+ , _lastClosedTab(0)
{
// setting tabbar
TabBar *tabBar = new TabBar(this);
@@ -100,6 +101,7 @@ MainView::~MainView()
{
delete _widgetBar;
delete m_addTabButton;
+ delete _lastClosedTab;
}
@@ -500,7 +502,10 @@ void MainView::closeTab(int index, bool del)
if (del)
{
- tabToClose->deleteLater();
+ if(_lastClosedTab)
+ _lastClosedTab->deleteLater();
+ _lastClosedTab = tabToClose;
+// tabToClose->deleteLater();
}
emit tabsChanged();
@@ -634,6 +639,19 @@ void MainView::openLastClosedTab()
return;
const HistoryItem item = m_recentlyClosedTabs.takeFirst();
+
+ // if there is a tab yet loaded, use it
+ if(_lastClosedTab)
+ {
+ addTab(_lastClosedTab, _lastClosedTab->view()->title() );
+ _widgetBar->addWidget(_lastClosedTab->urlBar());
+ updateTabBar();
+ emit tabsChanged();
+
+ _lastClosedTab = 0;
+ return;
+ }
+
Application::instance()->loadUrl(KUrl(item.url), Rekonq::NewTab);
}