summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-24 16:22:02 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-24 16:22:02 +0200
commitddd86a17a26b88fe39df17459bef587aa22a16d3 (patch)
treef2327733717a5a149f68e17daee540f529f32d64 /src/mainview.cpp
parentNew dns prefetch webkit property and updated local storage one (diff)
parentDetach tab. last fixes. (diff)
downloadrekonq-ddd86a17a26b88fe39df17459bef587aa22a16d3.tar.xz
Merge branch 'DETACH_TAB'
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index cb2e3b11..63c10683 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -456,7 +456,7 @@ void MainView::cloneTab(int index)
// When index is -1 index chooses the current tab
-void MainView::closeTab(int index)
+void MainView::closeTab(int index, bool del)
{
// open default homePage if just one tab is opened
if (count() == 1)
@@ -510,11 +510,15 @@ void MainView::closeTab(int index)
removeTab(index);
updateTabBar(); // UI operation: do it ASAP!!
- tab->deleteLater(); // tab is scheduled for deletion.
QWidget *urlbar = _bars->widget(index);
_bars->removeWidget(urlbar);
- urlbar->deleteLater();
+
+ if(del)
+ {
+ tab->deleteLater(); // tab is scheduled for deletion.
+ urlbar->deleteLater();
+ }
emit tabsChanged();
}
@@ -682,10 +686,26 @@ void MainView::detachTab(int index)
if (index < 0 || index >= count())
return;
- KUrl url = webTab(index)->view()->url();
- closeTab(index);
-
- Application::instance()->loadUrl(url, Rekonq::NewWindow);
+ WebTab *tab = webTab(index);
+ KUrl u = tab->url();
+ kDebug() << u;
+ if( u.scheme() == QL1S("about") )
+ {
+ closeTab(index);
+ Application::instance()->loadUrl(u, Rekonq::NewWindow);
+ }
+ else
+ {
+ QString label = tab->view()->title();
+ QWidget *bar = _bars->widget(index);
+ closeTab(index, false);
+
+ MainWindow *w = Application::instance()->newMainWindow(false);
+ w->mainView()->addTab(tab, Application::icon( u ), label);
+ QStackedWidget *stack = qobject_cast<QStackedWidget *>(w->mainView()->urlBarWidget());
+ stack->insertWidget(0, bar);
+ w->mainView()->updateTabBar();
+ }
}