From 4e89d3b88aabd371ef0b0b10c6a5fc95c8765250 Mon Sep 17 00:00:00 2001 From: Tomasz Kot Date: Tue, 4 Nov 2025 09:48:43 +0000 Subject: dolphinview: On shift+middle-click, open file with third app for the open with list Added the feature to open the selected file with the third application from the associated applications list on shift and middle-click. Generalized the middle-click slot to open the file with the app on a specified index, since the behavior should be almost the same for those two actions. Similar to: d27ee07de7558470ef7b497fbe3d3504ce7cad07 BUG: 510237 --- src/dolphinviewcontainer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/dolphinviewcontainer.cpp') diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index b3a8a664a..0605cb0c8 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -777,8 +777,12 @@ void DolphinViewContainer::slotItemActivated(const KFileItem &item) void DolphinViewContainer::slotfileMiddleClickActivated(const KFileItem &item) { KService::List services = KApplicationTrader::queryByMimeType(item.mimetype()); + const auto modifiers = QGuiApplication::keyboardModifiers(); int indexOfAppToOpenFileWith = 1; + if (modifiers & Qt::ShiftModifier) { + indexOfAppToOpenFileWith = 2; + } // executable scripts auto mimeType = item.currentMimeType(); @@ -803,9 +807,8 @@ void DolphinViewContainer::slotfileMiddleClickActivated(const KFileItem &item) connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished); job->start(); } else { - // If no 2nd service available, try to open archives in new tabs, regardless of the "Browse compressed files as folders" setting. + // If no 2nd or 3rd service available, try to open archives in new tabs, regardless of the "Browse compressed files as folders" setting. const QUrl &url = DolphinView::openItemAsFolderUrl(item); - const auto modifiers = QGuiApplication::keyboardModifiers(); if (!url.isEmpty()) { // keep in sync with KUrlNavigator::slotNavigatorButtonClicked if (modifiers & Qt::ShiftModifier) { -- cgit v1.3