From: Peter Penz Date: Wed, 6 Oct 2010 15:04:37 +0000 (+0000) Subject: Implement the actions "Open in New Window" and "Open in New Tab" for the case if... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a83876c44fe26cafd942b1231c46e19a404b9082 Implement the actions "Open in New Window" and "Open in New Tab" for the case if no item is selected. svn path=/trunk/KDE/kdebase/apps/; revision=1183222 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 1c1343976..21b181746 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -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(); } }