- fileItemActions.addOpenWithActionsTo(this, QStringLiteral("DesktopEntryName != '%1'").arg(qApp->desktopFileName()));
-}
-
-void DolphinContextMenu::addCustomActions()
-{
- addActions(m_customActions);
+ 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).)
+ 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());
+
+ auto *secondaryApp = openWithSubMenu->menu()->actions().first();
+ // Add it like a keyboard shortcut, Qt uses \t as a separator.
+ if (!secondaryApp->text().contains(QLatin1Char('\t'))) {
+ secondaryApp->setText(secondaryApp->text() + QLatin1Char('\t')
+ + i18nc("@action:inmenu Shortcut, middle click to trigger menu item, keep short", "Middle Click"));
+ }
+ }
+ }