X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/30a807e44afb334dd153c8bcbdbde4f36942bee0..8cea3f233687493640db9c10251ff1accd3d793c:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 34d2102ef..b4aade6b9 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -357,7 +357,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties addSeparator(); // Insert 'Move to Trash' and/or 'Delete' - const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) || !properties.isLocal()); + const bool showDeleteAction = (KSharedConfig::openConfig()->group(QStringLiteral("KDE")).readEntry("ShowDeleteCommand", false) || !properties.isLocal()); const bool showMoveToTrashAction = (properties.isLocal() && properties.supportsMoving()); if (showDeleteAction && showMoveToTrashAction) { @@ -439,6 +439,21 @@ 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. + if (m_selectedItems.count() == 1 && !m_fileInfo.isDir()) { + if (QAction *openWithSubMenu = findChild(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")); + } + } + } } void DolphinContextMenu::addAdditionalActions(const KFileItemListProperties &props) @@ -454,6 +469,7 @@ void DolphinContextMenu::addAdditionalActions(const KFileItemListProperties &pro const DolphinView *view = m_mainWindow->activeViewContainer()->view(); const QList versionControlActions = view->versionControlActions(m_selectedItems); if (!versionControlActions.isEmpty()) { + addSeparator(); addActions(versionControlActions); addSeparator(); }