┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAngus McLean <[email protected]>2025-03-17 08:14:55 +0000
committerMéven Car <[email protected]>2025-03-17 08:14:55 +0000
commiteaaeb1b7629cc3c59933101d24dd0c2c67ef1276 (patch)
tree00694e5ec296bc4c6e37d059573c3dfc63d6157f /src
parent78d377a56cac17276109207e0a991eb9206d7785 (diff)
contextmenu: Use default terminal's icons for "Open Terminal" and "Open Terminal Here" actions
The "Open Terminal" and "Open Terminal Here" actions now use the icon of the user default terminal emulator application, instead of always using the "utilities-terminal" icon. BUG: 501435
Diffstat (limited to 'src')
-rw-r--r--src/dolphinmainwindow.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 8a6c99ce5..573582bdd 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -41,6 +41,7 @@
#include <KColorSchemeManager>
#include <KConfig>
#include <KConfigGui>
+#include <KDesktopFile>
#include <KDialogJobUiDelegate>
#include <KDualAction>
#include <KFileItemListProperties>
@@ -2085,12 +2086,18 @@ void DolphinMainWindow::setupActions()
connect(openPreferredSearchTool, &QAction::triggered, this, &DolphinMainWindow::openPreferredSearchTool);
if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
+ // Get icon of user default terminal emulator application
+ const KConfigGroup group(KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::SimpleConfig), QStringLiteral("General"));
+ const QString terminalDesktopFilename = group.readEntry("TerminalService");
+ // Use utilities-terminal icon from theme if readEntry() has failed
+ const QString terminalIcon = terminalDesktopFilename.isEmpty() ? "utilities-terminal" : KDesktopFile(terminalDesktopFilename).readIcon();
+
QAction *openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal"));
openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
openTerminal->setWhatsThis(xi18nc("@info:whatsthis",
"<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>"
"<para>To learn more about terminals use the help features in the terminal application.</para>"));
- openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
+ openTerminal->setIcon(QIcon::fromTheme(terminalIcon));
actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT | Qt::Key_F4);
connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
@@ -2100,7 +2107,7 @@ void DolphinMainWindow::setupActions()
openTerminalHere->setWhatsThis(xi18nc("@info:whatsthis",
"<para>This opens <emphasis>terminal</emphasis> applications for the selected items' locations.</para>"
"<para>To learn more about terminals use the help features in the terminal application.</para>"));
- openTerminalHere->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
+ openTerminalHere->setIcon(QIcon::fromTheme(terminalIcon));
actionCollection()->setDefaultShortcut(openTerminalHere, Qt::SHIFT | Qt::ALT | Qt::Key_F4);
connect(openTerminalHere, &QAction::triggered, this, &DolphinMainWindow::openTerminalHere);
}