┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-10-25 10:32:55 +0000
committerPeter Penz <[email protected]>2008-10-25 10:32:55 +0000
commitb1aadb8cce40ac4bc2f33729cd80ef270de72163 (patch)
tree516732a286ff079a1e8f35e183d0d8677478f307 /src/dolphinmainwindow.cpp
parent0ff69a11b8695a451256c6bd1662242aa3711879 (diff)
If the context menu is opened above a directory, add the actions "Open in New Window" and "Open in New Tab" to the context menu.
Thanks to Mathias Soeken for the patch! CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=875711
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 3a46cd6df..0dc2ecb57 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -341,6 +341,25 @@ void DolphinMainWindow::activatePrevTab()
m_tabBar->setCurrentIndex(tabIndex);
}
+void DolphinMainWindow::openInNewTab()
+{
+ const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+ if ((list.count() == 1) && list[0].isDir()) {
+ openNewTab(m_activeViewContainer->view()->selectedUrls()[0]);
+ m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
+ }
+}
+
+void DolphinMainWindow::openInNewWindow()
+{
+ const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+ if ((list.count() == 1) && list[0].isDir()) {
+ DolphinMainWindow* window = DolphinApplication::app()->createMainWindow();
+ window->changeUrl(m_activeViewContainer->view()->selectedUrls()[0]);
+ window->show();
+ }
+}
+
void DolphinMainWindow::toggleActiveView()
{
if (m_viewTab[m_tabIndex].secondaryView == 0) {
@@ -1050,6 +1069,17 @@ void DolphinMainWindow::setupActions()
connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab()));
activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() :
KStandardShortcut::tabPrev());
+
+ // for context menu
+ KAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
+ openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
+ openInNewTab->setIcon(KIcon("tab-new"));
+ connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+
+ KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
+ openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
+ openInNewWindow->setIcon(KIcon("window-new"));
+ connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
}
void DolphinMainWindow::setupDockWidgets()