X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a2f9e005a5e281b5c4938e86b4a5a85ede63c4b9..96eff55e75bfd0f1e3f866b4af14f3778e9002b3:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 8d580432f..3d6f8489d 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -307,16 +307,21 @@ void DolphinMainWindow::openNewTab(const QUrl& url) void DolphinMainWindow::openInNewTab() { const KFileItemList& list = m_activeViewContainer->view()->selectedItems(); - if (list.isEmpty()) { - openNewTab(m_activeViewContainer->url()); - } else { - foreach (const KFileItem& item, list) { - const QUrl& url = DolphinView::openItemAsFolderUrl(item); - if (!url.isEmpty()) { - openNewTab(url); - } + bool tabCreated = false; + + foreach (const KFileItem& item, list) { + const QUrl& url = DolphinView::openItemAsFolderUrl(item); + if (!url.isEmpty()) { + openNewTab(url); + tabCreated = true; } } + + // if no new tab has been created from the selection + // open the current directory in a new tab + if (!tabCreated) { + openNewTab(m_activeViewContainer->url()); + } } void DolphinMainWindow::openInNewWindow()