]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Implement the actions "Open in New Window" and "Open in New Tab" for the case if...
authorPeter Penz <peter.penz19@gmail.com>
Wed, 6 Oct 2010 15:04:37 +0000 (15:04 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 6 Oct 2010 15:04:37 +0000 (15:04 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1183222

src/dolphinmainwindow.cpp

index 1c1343976750a4af1983c05df9d96a0aff4d5389..21b1817468c3251edb08b52ade656ae0f2f580cf 100644 (file)
@@ -462,17 +462,27 @@ void DolphinMainWindow::activatePrevTab()
 void DolphinMainWindow::openInNewTab()
 {
     const KFileItemList list = m_activeViewContainer->view()->selectedItems();
-    if ((list.count() == 1) && list[0].isDir()) {
+    if (list.isEmpty()) {
+        openNewTab(m_activeViewContainer->url());
+    } else if ((list.count() == 1) && list[0].isDir()) {
         openNewTab(m_activeViewContainer->view()->selectedUrls()[0]);
     }
 }
 
 void DolphinMainWindow::openInNewWindow()
 {
+    KUrl newWindowUrl;
+
     const KFileItemList list = m_activeViewContainer->view()->selectedItems();
-    if ((list.count() == 1) && list[0].isDir()) {
+    if (list.isEmpty()) {
+        newWindowUrl = m_activeViewContainer->url();
+    } else if ((list.count() == 1) && list[0].isDir()) {
+        newWindowUrl = m_activeViewContainer->view()->selectedUrls()[0];
+    }
+
+    if (!newWindowUrl.isEmpty()) {
         DolphinMainWindow* window = DolphinApplication::app()->createMainWindow();
-        window->changeUrl(m_activeViewContainer->view()->selectedUrls()[0]);
+        window->changeUrl(newWindowUrl);
         window->show();
     }
 }