You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.8 KiB
79 lines
3.8 KiB
diff --git a/containmentactions/contextmenu/menu.cpp b/containmentactions/contextmenu/menu.cpp
|
|
index 3271140..28409ff 100644
|
|
--- a/containmentactions/contextmenu/menu.cpp
|
|
+++ b/containmentactions/contextmenu/menu.cpp
|
|
@@ -28,6 +28,7 @@
|
|
#include <KAuthorized>
|
|
#include <KGlobalAccel>
|
|
#include <KLocalizedString>
|
|
+#include <KToolInvocation>
|
|
#include <QDebug>
|
|
#include <QIcon>
|
|
|
|
@@ -41,6 +42,7 @@
|
|
ContextMenu::ContextMenu(QObject *parent, const QVariantList &args)
|
|
: Plasma::ContainmentActions(parent, args)
|
|
, m_runCommandAction(nullptr)
|
|
+ , m_runKonsoleAction(nullptr)
|
|
, m_lockScreenAction(nullptr)
|
|
, m_logoutAction(nullptr)
|
|
, m_separator1(nullptr)
|
|
@@ -71,7 +73,7 @@ void ContextMenu::restore(const KConfigGroup &config)
|
|
} else {
|
|
actions.insert(QStringLiteral("configure shortcuts"), false);
|
|
m_actionOrder << QStringLiteral("configure") << QStringLiteral("run associated application") << QStringLiteral("configure shortcuts")
|
|
- << QStringLiteral("_sep1") << QStringLiteral("_context") << QStringLiteral("_run_command") << QStringLiteral("add widgets")
|
|
+ << QStringLiteral("_sep1") << QStringLiteral("_context") << QStringLiteral("_run_konsole") << QStringLiteral("_run_command") << QStringLiteral("add widgets")
|
|
<< QStringLiteral("_add panel") << QStringLiteral("manage activities") << QStringLiteral("remove") << QStringLiteral("edit mode")
|
|
<< QStringLiteral("_sep2") << QStringLiteral("_lock_screen") << QStringLiteral("_logout") << QStringLiteral("_sep3")
|
|
<< QStringLiteral("_wallpaper");
|
|
@@ -95,6 +97,10 @@ void ContextMenu::restore(const KConfigGroup &config)
|
|
m_runCommandAction->setShortcut(KGlobalAccel::self()->globalShortcut(QStringLiteral("krunner.desktop"), QStringLiteral("_launch")).value(0));
|
|
connect(m_runCommandAction, &QAction::triggered, this, &ContextMenu::runCommand);
|
|
|
|
+ m_runKonsoleAction = new QAction(i18n("Konsole"), this);
|
|
+ m_runKonsoleAction->setIcon(QIcon::fromTheme("utilities-terminal"));
|
|
+ connect(m_runKonsoleAction, &QAction::triggered, this, &ContextMenu::runKonsole);
|
|
+
|
|
m_lockScreenAction = new QAction(i18nc("plasma_containmentactions_contextmenu", "Lock Screen"), this);
|
|
m_lockScreenAction->setIcon(QIcon::fromTheme(QStringLiteral("system-lock-screen")));
|
|
m_lockScreenAction->setShortcut(KGlobalAccel::self()->globalShortcut(QStringLiteral("ksmserver"), QStringLiteral("Lock Session")).value(0));
|
|
@@ -173,6 +179,8 @@ QAction *ContextMenu::action(const QString &name)
|
|
if (KAuthorized::authorizeAction(QStringLiteral("run_command")) && KAuthorized::authorize(QStringLiteral("run_command"))) {
|
|
return m_runCommandAction;
|
|
}
|
|
+ } else if (name == QLatin1String("_run_konsole")) {
|
|
+ return m_runKonsoleAction;
|
|
} else if (name == QLatin1String("_lock_screen")) {
|
|
if (KAuthorized::authorizeAction(QStringLiteral("lock_screen"))) {
|
|
return m_lockScreenAction;
|
|
@@ -196,6 +204,11 @@ QAction *ContextMenu::action(const QString &name)
|
|
return nullptr;
|
|
}
|
|
|
|
+void ContextMenu::runKonsole()
|
|
+{
|
|
+ KToolInvocation::invokeTerminal(QString(), QDir::homePath());
|
|
+}
|
|
+
|
|
void ContextMenu::runCommand()
|
|
{
|
|
if (!KAuthorized::authorizeAction(QStringLiteral("run_command"))) {
|
|
diff --git a/containmentactions/contextmenu/menu.h b/containmentactions/contextmenu/menu.h
|
|
index 3cc3d32..6c5aa21 100644
|
|
--- a/containmentactions/contextmenu/menu.h
|
|
+++ b/containmentactions/contextmenu/menu.h
|
|
@@ -43,10 +43,12 @@ public:
|
|
|
|
public Q_SLOTS:
|
|
void runCommand();
|
|
+ void runKonsole();
|
|
void startLogout();
|
|
|
|
private:
|
|
QAction *m_runCommandAction;
|
|
+ QAction *m_runKonsoleAction;
|
|
QAction *m_lockScreenAction;
|
|
QAction *m_logoutAction;
|
|
QAction *m_separator1;
|