diff options
| author | Jin Liu <[email protected]> | 2024-08-19 11:15:23 +0000 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2024-08-19 11:15:23 +0000 |
| commit | 2b1906eeeabaf91b856d46e72390ae811747ec39 (patch) | |
| tree | 3858c977ff9517a1cd3f81f26e09d08a76afd60d /src/dolphincontextmenu.cpp | |
| parent | eac3abac9c9c5d243e905fcff13de7e127cadb0e (diff) | |
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.
Diffstat (limited to 'src/dolphincontextmenu.cpp')
| -rw-r--r-- | src/dolphincontextmenu.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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<QAction *>(QStringLiteral("openWith_submenu"))) { Q_ASSERT(openWithSubMenu->menu()); Q_ASSERT(!openWithSubMenu->menu()->isEmpty()); |
