X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c57b0c422bff5e19a9e786f9f4a56ca9fbd8ce75..77a0df6a46cc5fcf600ed852834e0004abc2fa40:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index b4aade6b9..3ce1d1d51 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -7,6 +7,7 @@ #include "dolphincontextmenu.h" #include "dolphin_contextmenusettings.h" +#include "dolphin_generalsettings.h" #include "dolphinmainwindow.h" #include "dolphinnewfilemenu.h" #include "dolphinplacesmodelsingleton.h" @@ -380,9 +381,8 @@ bool DolphinContextMenu::placeExists(const QUrl &url) const { const KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); - const auto &matchedPlaces = placesModel->match(placesModel->index(0, 0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly); - - return !matchedPlaces.isEmpty(); + QModelIndex url_index = placesModel->closestItem(url); + return url_index.isValid() && placesModel->url(url_index).matches(url, QUrl::StripTrailingSlash); } QAction *DolphinContextMenu::createPasteAction() @@ -441,7 +441,9 @@ void DolphinContextMenu::addOpenWithActions() m_fileItemActions->insertOpenWithActionsTo(nullptr, this, QStringList{qApp->desktopFileName()}); // For a single file, hint in "Open with" menu that middle-clicking would open it in the secondary app. - if (m_selectedItems.count() == 1 && !m_fileInfo.isDir()) { + // (Unless middle-clicking would open it as a folder in a new tab (e.g. archives).) + const QUrl &url = DolphinView::openItemAsFolderUrl(m_fileInfo, GeneralSettings::browseThroughArchives()); + if (m_selectedItems.count() == 1 && url.isEmpty()) { if (QAction *openWithSubMenu = findChild(QStringLiteral("openWith_submenu"))) { Q_ASSERT(openWithSubMenu->menu()); Q_ASSERT(!openWithSubMenu->menu()->isEmpty());