summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-12-16 15:24:53 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-12-16 15:24:53 +0100
commit6b3531099f72a7f460c15312707b65ca0415cfe4 (patch)
tree5f1c9719c6d948bddee6260aeda6b6596d4ff1d9 /src
parentCleaner file management (diff)
downloadrekonq-6b3531099f72a7f460c15312707b65ca0415cfe4.tar.xz
detach tab action
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp17
-rw-r--r--src/mainview.h3
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/tabbar.cpp7
-rw-r--r--src/tabbar.h4
5 files changed, 32 insertions, 3 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 0eb292ef..413d1b45 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -87,7 +87,8 @@ MainView::MainView(MainWindow *parent)
connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
-
+ connect(m_tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
+
connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
// current page index changing
@@ -648,3 +649,17 @@ void MainView::resizeEvent(QResizeEvent *event)
updateTabBar();
KTabWidget::resizeEvent(event);
}
+
+
+void MainView::detachTab(int index)
+{
+ if (index < 0)
+ index = currentIndex();
+ if (index < 0 || index >= count())
+ return;
+
+ KUrl url = webTab(index)->view()->url();
+ closeTab(index);
+
+ Application::instance()->loadUrl(url, Rekonq::NewWindow);
+}
diff --git a/src/mainview.h b/src/mainview.h
index 23db69c0..f57c30b5 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -127,7 +127,8 @@ public slots:
void reloadAllTabs();
void nextTab();
void previousTab();
-
+ void detachTab(int index = -1);
+
// WEB slot actions
void webReload();
void webStop();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index a9d014ef..d413e217 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -393,6 +393,10 @@ void MainWindow::setupActions()
actionCollection()->addAction( QLatin1String("reload_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab()) );
+ a = new KAction(KIcon("tab-detach"), i18n("Detach Tab"), this);
+ actionCollection()->addAction( QLatin1String("detach_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab()) );
+
// ----------------------- Bookmarks ToolBar Action --------------------------------------
QAction *qa = m_bmBar->toggleViewAction();
qa->setText( i18n("Bookmarks Toolbar") );
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index ada879a3..12745772 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -140,6 +140,12 @@ void TabBar::reloadTab()
}
+void TabBar::detachTab()
+{
+ emit detachTab(m_actualIndex);
+}
+
+
void TabBar::showTabPreview(int tab)
{
MainView *mv = qobject_cast<MainView *>(parent());
@@ -249,6 +255,7 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
menu.addAction( mainWindow->actionByName("clone_tab") );
+ menu.addAction( mainWindow->actionByName("detach_tab") );
menu.addSeparator();
menu.addAction( mainWindow->actionByName("close_tab") );
menu.addAction( mainWindow->actionByName("close_other_tabs") );
diff --git a/src/tabbar.h b/src/tabbar.h
index 76d70197..f0476cbd 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -69,6 +69,7 @@ signals:
void closeOtherTabs(int index);
void reloadTab(int index);
void reloadAllTabs();
+ void detachTab(int index);
protected:
/**
@@ -85,7 +86,8 @@ private slots:
void closeTab();
void closeOtherTabs();
void reloadTab();
-
+ void detachTab();
+
void contextMenu(int, const QPoint &);
void emptyAreaContextMenu(const QPoint &);