From 2b1906eeeabaf91b856d46e72390ae811747ec39 Mon Sep 17 00:00:00 2001 From: Jin Liu Date: Mon, 19 Aug 2024 11:15:23 +0000 Subject: Fix middle-click not following the "Open archives as folder" setting Previous to this commit middle-clicking an archive would always open it in a new tab. This contradicts the recent change d27ee07de7558470ef7b497fbe3d3504ce7cad07 which made it so middle-click would open an item in the second application that is available to open a file. With this commit, middle-clicking will treat the archive like a folder only when GeneralSettings::browseThroughArchives is enabled or when there is no second application available. Otherwise middle-click will open the archive in the second available application. --- src/dolphincontextmenu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/dolphincontextmenu.cpp') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index b4aade6b9..68f6dbd21 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" @@ -441,7 +442,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()); -- cgit v1.3