┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincontextmenu.cpp
diff options
context:
space:
mode:
authorTomasz Kot <[email protected]>2025-11-16 18:59:53 +0000
committerMéven Car <[email protected]>2025-11-16 18:59:53 +0000
commitd444d1033a16e3f1a540a82af266203ca48aa239 (patch)
treee00df8688021b48deeed3a6e49ea41307cfe2e29 /src/dolphincontextmenu.cpp
parent4916403d46216237205394dc86a86b8ea5a4cedc (diff)
dolphincontextmenu: Add hint that shift+middle-click opens the third app
Checks if the second action in the submenu is actually an app and not a separator, and add hint "Shift + Middle Click".
Diffstat (limited to 'src/dolphincontextmenu.cpp')
-rw-r--r--src/dolphincontextmenu.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 1ca885817..53f155af4 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -492,8 +492,9 @@ void DolphinContextMenu::addOpenWithActions()
// insert 'Open With...' action or sub menu
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.
- // (Unless middle-clicking would open it as a folder in a new tab (e.g. archives).)
+ // For a single file, hint in "Open with" menu that middle-clicking would open it in the secondary app,
+ // and shift + middle-clicking would open it in the third associated app.
+ // (Unless those actions 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"))) {
@@ -506,6 +507,18 @@ void DolphinContextMenu::addOpenWithActions()
secondaryApp->setText(secondaryApp->text() + QLatin1Char('\t')
+ i18nc("@action:inmenu Shortcut, middle click to trigger menu item, keep short", "Middle Click"));
}
+
+ // To add a hint for the third app, check if it is defined.
+ // Note: Apart from apps, the submenu contains an empty action (separator) and "Other application" action (in this order).
+ // Thus, add the hint only when there are four actions - two apps + two of the above.
+ if (openWithSubMenu->menu()->actions().size() >= 4) {
+ auto *thirdApp = *(openWithSubMenu->menu()->actions().begin() + 1);
+ Q_ASSERT(!thirdApp->isSeparator());
+ if (!thirdApp->text().contains(QLatin1Char('\t'))) {
+ thirdApp->setText(thirdApp->text() + QLatin1Char('\t')
+ + i18nc("@action:inmenu Shortcut, shift + middle click to trigger menu item, keep short", "Shift+Middle Click"));
+ }
+ }
}
}
}