summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-23 01:34:47 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-23 01:34:47 +0200
commite435ee3eae6285fb9d48cc011a1cefc08429b873 (patch)
tree7b50558119a413e4939a53e7ddf053eb0f90cd43 /src
parentMerge branch 'master' of gitorious.org:rekonq/mainline (diff)
downloadrekonq-e435ee3eae6285fb9d48cc011a1cefc08429b873.tar.xz
Dramatically improved "detach tab" performances..
Need to round some corners, yet.
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp6
-rw-r--r--src/application.h2
-rw-r--r--src/mainview.cpp23
-rw-r--r--src/mainview.h2
4 files changed, 23 insertions, 10 deletions
diff --git a/src/application.cpp b/src/application.cpp
index db6d3c32..45d115ae 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -329,10 +329,12 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
}
-MainWindow *Application::newMainWindow()
+MainWindow *Application::newMainWindow(bool withTab)
{
MainWindow *w = new MainWindow();
- w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
+
+ if(withTab)
+ w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
m_mainWindows.prepend(w);
w->show();
diff --git a/src/application.h b/src/application.h
index c268d586..fe3c50c1 100644
--- a/src/application.h
+++ b/src/application.h
@@ -102,7 +102,7 @@ public:
static Application *instance();
MainWindow *mainWindow();
- MainWindow *newMainWindow();
+ MainWindow *newMainWindow(bool withTab = true);
MainWindowList mainWindowList();
static KIcon icon(const KUrl &url);
diff --git a/src/mainview.cpp b/src/mainview.cpp
index cb2e3b11..3adc0ec9 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,17 @@ void MainView::detachTab(int index)
if (index < 0 || index >= count())
return;
- KUrl url = webTab(index)->view()->url();
- closeTab(index);
+ WebTab *tab = webTab(index);
+ QString label = tab->view()->title();
+ QWidget *bar = _bars->widget(index);
+
+ closeTab(index, false);
- Application::instance()->loadUrl(url, Rekonq::NewWindow);
+ MainWindow *w = Application::instance()->newMainWindow(false);
+ w->mainView()->addTab(tab, Application::icon(tab->url()), label);
+ QStackedWidget *stack = qobject_cast<QStackedWidget *>(w->mainView()->urlBarWidget());
+ stack->insertWidget(0, bar);
+ w->mainView()->updateTabBar();
}
diff --git a/src/mainview.h b/src/mainview.h
index 272cf82e..367fcb13 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -123,7 +123,7 @@ public slots:
void newTab();
void cloneTab(int index = -1);
- void closeTab(int index = -1);
+ void closeTab(int index = -1, bool del = true);
void closeOtherTabs(int index);
void reloadTab(int index = -1);
void reloadAllTabs();