┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Kot <[email protected]>2025-11-04 09:48:43 +0000
committerMéven Car <[email protected]>2025-11-04 09:48:43 +0000
commit4e89d3b88aabd371ef0b0b10c6a5fc95c8765250 (patch)
tree792ae0c11807e47a29d20b512f19d83dfdefc896
parentd211906cc93ee5a28842b83b6f7a575cca5c7743 (diff)
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
-rw-r--r--src/dolphinviewcontainer.cpp7
-rw-r--r--src/dolphinviewcontainer.h4
2 files changed, 8 insertions, 3 deletions
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) {
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h
index d2d322b08..09413ba55 100644
--- a/src/dolphinviewcontainer.h
+++ b/src/dolphinviewcontainer.h
@@ -351,7 +351,9 @@ private Q_SLOTS:
void slotItemsActivated(const KFileItemList &items);
/**
- * Handles middle click of file. It opens the file passed using the second application associated with the file's mimetype.
+ * Handles middle click of file. It opens the file passed using
+ * the second application associated with the file's mimetype, or
+ * the third if shift modifier is pressed.
*/
void slotfileMiddleClickActivated(const KFileItem &item);