diff options
| author | Erik Hahn <[email protected]> | 2013-10-13 10:44:13 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-10-13 10:48:00 +0200 |
| commit | 0c55297ce40847a9af1e00f233c3943f66ab577f (patch) | |
| tree | d1d2d7d277b29a6a15a3773ac76879b5a27ca380 | |
| parent | 5bfb5031a593fbd7e0a60bd8ca869671c712db9d (diff) | |
Files passed as arguments: Ignore unsupported files
With this patch, Dolphin ignores all files passed to it that it can't
Also, archives are now opened inside Dolphin so it can be used as an
archive manager at least for local files. If the user tries to open a
remote archive Dolphin still opens it externally; I have observed that
if it receives one as an argument, it will display a pseudo-folder that
contains only said archive. So having it set as the archive handler is
still broken, but in a less annoying way.
CCBUG: 318683
REVIEW: 113191
FIXED-IN: 4.11.3
| -rw-r--r-- | src/dolphinmainwindow.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 73001bf54..a11fb0c5b 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -31,6 +31,7 @@ #include "panels/information/informationpanel.h" #include "settings/dolphinsettingsdialog.h" #include "statusbar/dolphinstatusbar.h" +#include "views/dolphinview.h" #include "views/dolphinviewactionhandler.h" #include "views/dolphinremoteencoding.h" #include "views/draganddrophelper.h" @@ -243,8 +244,20 @@ void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs) return; } - if (dirs.count() == 1) { - m_activeViewContainer->setUrl(dirs.first()); + // dirs could contain URLs that actually point to archives or other files. + // Replace them by URLs we can open where possible and filter the rest out. + QList<KUrl> urlsToOpen; + foreach (const KUrl& rawUrl, dirs) { + const KFileItem& item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, rawUrl); + item.determineMimeType(); + const KUrl& url = DolphinView::openItemAsFolderUrl(item); + if (!url.isEmpty()) { + urlsToOpen.append(url); + } + } + + if (urlsToOpen.count() == 1) { + m_activeViewContainer->setUrl(urlsToOpen.first()); return; } @@ -254,12 +267,12 @@ void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs) // Open each directory inside a new tab. If the "split view" option has been enabled, // always show two directories within one tab. - QList<KUrl>::const_iterator it = dirs.begin(); - while (it != dirs.end()) { + QList<KUrl>::const_iterator it = urlsToOpen.begin(); + while (it != urlsToOpen.end()) { openNewTab(*it); ++it; - if (hasSplitView && (it != dirs.end())) { + if (hasSplitView && (it != urlsToOpen.end())) { const int tabIndex = m_viewTab.count() - 1; m_viewTab[tabIndex].secondaryView->setUrl(*it); ++it; |
