Backport patch from kde-workspace to add Konsole into shell context menu

epel9
Dan Vrátil 10 years ago
parent b4d8fd1d2c
commit 15354d0e4c

@ -0,0 +1,81 @@
diff --git a/containmentactions/contextmenu/menu.cpp b/containmentactions/contextmenu/menu.cpp
index fee6c7a..bea941c 100644
--- a/containmentactions/contextmenu/menu.cpp
+++ b/containmentactions/contextmenu/menu.cpp
@@ -30,6 +30,7 @@
#include <QDebug>
#include <QIcon>
#include <KLocalizedString>
+#include <KToolInvocation>
#include <Plasma/Containment>
#include <Plasma/Corona>
@@ -45,6 +46,7 @@
ContextMenu::ContextMenu(QObject *parent, const QVariantList &args)
: Plasma::ContainmentActions(parent, args),
+ m_runKonsoleAction(0),
m_runCommandAction(0),
m_lockScreenAction(0),
m_logoutAction(0),
@@ -74,7 +76,7 @@ void ContextMenu::restore(const KConfigGroup &config)
m_actionOrder << "add widgets" << "_add panel" << "lock widgets" << "_context" << "configure" << "remove";
} else {
actions.insert("configure shortcuts", false);
- m_actionOrder << "_context" << "_run_command" << "add widgets" << "_add panel"
+ m_actionOrder << "_context" << "_run_konsole" << "_run_command" << "add widgets" << "_add panel"
<< "manage activities" << "remove" << "lock widgets" << "_sep1"
<<"_lock_screen" << "_logout" << "_sep2" << "run associated application" << "configure"
<< "configure shortcuts" << "_sep3" << "_wallpaper";
@@ -93,6 +95,10 @@ void ContextMenu::restore(const KConfigGroup &config)
// everything below should only happen once, so check for it
if (!m_runCommandAction) {
+ m_runKonsoleAction = new QAction(i18n("Konsole"), this);
+ m_runKonsoleAction->setIcon(QIcon::fromTheme("utilities-terminal"));
+ connect(m_runKonsoleAction, &QAction::triggered, this, &ContextMenu::runKonsole);
+
m_runCommandAction = new QAction(i18nc("plasma_containmentactions_contextmenu", "Run Command..."), this);
m_runCommandAction->setIcon(QIcon::fromTheme("system-run"));
setGlobalActionShortcut(m_runCommandAction, "krunner", "run command");
@@ -158,6 +164,8 @@ QAction *ContextMenu::action(const QString &name)
if (c->corona() && c->corona()->immutability() == Plasma::Types::Mutable) {
return c->corona()->actions()->action("add panel");
}
+ } else if (name == "_run_konsole") {
+ return m_runKonsoleAction;
} else if (name == "_run_command") {
if (KAuthorized::authorizeKAction("run_command")) {
return m_runCommandAction;
@@ -185,6 +193,11 @@ QAction *ContextMenu::action(const QString &name)
return 0;
}
+void ContextMenu::runKonsole()
+{
+ KToolInvocation::invokeTerminal(QString(), QDir::homePath());
+}
+
void ContextMenu::runCommand()
{
if (!KAuthorized::authorizeKAction("run_command")) {
diff --git a/containmentactions/contextmenu/menu.h b/containmentactions/contextmenu/menu.h
index 36013dc..02b71e1 100644
--- a/containmentactions/contextmenu/menu.h
+++ b/containmentactions/contextmenu/menu.h
@@ -40,6 +40,7 @@ public:
void save(KConfigGroup &config);
public Q_SLOTS:
+ void runKonsole();
void runCommand();
void lockScreen();
void startLogout();
@@ -47,6 +48,7 @@ public Q_SLOTS:
private:
void setGlobalActionShortcut(QAction * action, const QString & component, const QString & actionId);
+ QAction *m_runKonsoleAction;
QAction *m_runCommandAction;
QAction *m_lockScreenAction;
QAction *m_logoutAction;

@ -4,7 +4,7 @@
Name: plasma-workspace Name: plasma-workspace
Version: 5.3.0 Version: 5.3.0
Release: 3%{?dist} Release: 4%{?dist}
Summary: Plasma workspace, applications and applets Summary: Plasma workspace, applications and applets
License: GPLv2+ License: GPLv2+
URL: https://projects.kde.org/projects/kde/workspace/plasma-workspace URL: https://projects.kde.org/projects/kde/workspace/plasma-workspace
@ -24,6 +24,7 @@ Source11: startkde.cmake
## downstream Patches ## downstream Patches
Patch10: fix-update-scripts.patch Patch10: fix-update-scripts.patch
Patch11: plasma-workspace-5.3.0-konsole-in-contextmenu.patch
## upstreamable Patches ## upstreamable Patches
@ -298,6 +299,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/{plasma-windowed,org
%changelog %changelog
* Tue May 05 2015 Daniel Vrátil <dvratil@redhat.com> - 5.3.0-4
- backport patch form kde-workspace to add Konsole into shell context menu
- re-enable fix-update-scripts.patch
* Wed Apr 29 2015 Daniel Vrátil <dvratil@redhat.com> - 5.3.0-3 * Wed Apr 29 2015 Daniel Vrátil <dvratil@redhat.com> - 5.3.0-3
- Disable bootstrap - Disable bootstrap

Loading…
Cancel
Save