diff options
| author | Peter Penz <[email protected]> | 2010-10-06 15:04:37 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2010-10-06 15:04:37 +0000 |
| commit | a83876c44fe26cafd942b1231c46e19a404b9082 (patch) | |
| tree | e38db585d43637f7ee5d1e411627bd94d53e8610 /src | |
| parent | d928089fd23b48dcb9ad8511c87b3b695b149487 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
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(); } } |
