|
Rex Dieter |
d5912e1 |
diff -up plasma-workspace-5.7.95/containmentactions/contextmenu/menu.cpp.konsole-in-contextmenu plasma-workspace-5.7.95/containmentactions/contextmenu/menu.cpp
|
|
Rex Dieter |
d5912e1 |
--- plasma-workspace-5.7.95/containmentactions/contextmenu/menu.cpp.konsole-in-contextmenu 2016-09-15 06:25:28.000000000 -0500
|
|
Rex Dieter |
d5912e1 |
+++ plasma-workspace-5.7.95/containmentactions/contextmenu/menu.cpp 2016-09-22 18:08:59.562282083 -0500
|
|
Rex Dieter |
d5912e1 |
@@ -31,6 +31,7 @@
|
|
Dan Vrátil |
15354d0 |
#include <QIcon>
|
|
Rex Dieter |
d5912e1 |
#include <KGlobalAccel>
|
|
Dan Vrátil |
15354d0 |
#include <KLocalizedString>
|
|
Dan Vrátil |
15354d0 |
+#include <KToolInvocation>
|
|
Dan Vrátil |
15354d0 |
|
|
Dan Vrátil |
15354d0 |
#include <Plasma/Containment>
|
|
Dan Vrátil |
15354d0 |
#include <Plasma/Corona>
|
|
Rex Dieter |
d5912e1 |
@@ -46,6 +47,7 @@
|
|
Dan Vrátil |
15354d0 |
|
|
Dan Vrátil |
15354d0 |
ContextMenu::ContextMenu(QObject *parent, const QVariantList &args)
|
|
Dan Vrátil |
15354d0 |
: Plasma::ContainmentActions(parent, args),
|
|
Dan Vrátil |
15354d0 |
+ m_runKonsoleAction(0),
|
|
Dan Vrátil |
15354d0 |
m_runCommandAction(0),
|
|
Dan Vrátil |
15354d0 |
m_lockScreenAction(0),
|
|
Dan Vrátil |
15354d0 |
m_logoutAction(0),
|
|
Rex Dieter |
d5912e1 |
@@ -75,7 +77,7 @@ void ContextMenu::restore(const KConfigG
|
|
Dan Vrátil |
3b8e436 |
m_actionOrder << QStringLiteral("add widgets") << QStringLiteral("_add panel") << QStringLiteral("lock widgets") << QStringLiteral("_context") << QStringLiteral("configure") << QStringLiteral("remove");
|
|
Dan Vrátil |
15354d0 |
} else {
|
|
Dan Vrátil |
3b8e436 |
actions.insert(QStringLiteral("configure shortcuts"), false);
|
|
Dan Vrátil |
3b8e436 |
- m_actionOrder << QStringLiteral("_context") << QStringLiteral("_run_command") << QStringLiteral("add widgets") << QStringLiteral("_add panel")
|
|
Dan Vrátil |
3b8e436 |
+ m_actionOrder << QStringLiteral("_context") << QStringLiteral("_run_konsole") << QStringLiteral("_run_command") << QStringLiteral("add widgets") << QStringLiteral("_add panel")
|
|
Dan Vrátil |
3b8e436 |
<< QStringLiteral("manage activities") << QStringLiteral("remove") << QStringLiteral("lock widgets") << QStringLiteral("_sep1")
|
|
Dan Vrátil |
3b8e436 |
<
|
|
Dan Vrátil |
3b8e436 |
<< QStringLiteral("configure shortcuts") << QStringLiteral("_sep3") << QStringLiteral("_wallpaper");
|
|
Rex Dieter |
d5912e1 |
@@ -94,6 +96,10 @@ void ContextMenu::restore(const KConfigG
|
|
Dan Vrátil |
15354d0 |
|
|
Dan Vrátil |
15354d0 |
// everything below should only happen once, so check for it
|
|
Dan Vrátil |
15354d0 |
if (!m_runCommandAction) {
|
|
Dan Vrátil |
15354d0 |
+ m_runKonsoleAction = new QAction(i18n("Konsole"), this);
|
|
Dan Vrátil |
15354d0 |
+ m_runKonsoleAction->setIcon(QIcon::fromTheme("utilities-terminal"));
|
|
Dan Vrátil |
15354d0 |
+ connect(m_runKonsoleAction, &QAction::triggered, this, &ContextMenu::runKonsole);
|
|
Dan Vrátil |
15354d0 |
+
|
|
Dan Vrátil |
15354d0 |
m_runCommandAction = new QAction(i18nc("plasma_containmentactions_contextmenu", "Run Command..."), this);
|
|
Dan Vrátil |
3b8e436 |
m_runCommandAction->setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
|
|
Rex Dieter |
d5912e1 |
m_runCommandAction->setShortcut(KGlobalAccel::self()->globalShortcut(QStringLiteral("krunner"), QStringLiteral("run command")).value(0));
|
|
Rex Dieter |
d5912e1 |
@@ -165,6 +171,8 @@ QAction *ContextMenu::action(const QStri
|
|
Dan Vrátil |
15354d0 |
if (c->corona() && c->corona()->immutability() == Plasma::Types::Mutable) {
|
|
Dan Vrátil |
3b8e436 |
return c->corona()->actions()->action(QStringLiteral("add panel"));
|
|
Dan Vrátil |
15354d0 |
}
|
|
Dan Vrátil |
3b8e436 |
+ } else if (name == QLatin1String("_run_konsole")) {
|
|
Dan Vrátil |
15354d0 |
+ return m_runKonsoleAction;
|
|
Dan Vrátil |
3b8e436 |
} else if (name == QLatin1String("_run_command")) {
|
|
Rex Dieter |
d5912e1 |
if (KAuthorized::authorizeAction(QStringLiteral("run_command"))) {
|
|
Dan Vrátil |
15354d0 |
return m_runCommandAction;
|
|
Rex Dieter |
d5912e1 |
@@ -192,6 +200,11 @@ QAction *ContextMenu::action(const QStri
|
|
Dan Vrátil |
15354d0 |
return 0;
|
|
Dan Vrátil |
15354d0 |
}
|
|
Dan Vrátil |
15354d0 |
|
|
Dan Vrátil |
15354d0 |
+void ContextMenu::runKonsole()
|
|
Dan Vrátil |
15354d0 |
+{
|
|
Dan Vrátil |
15354d0 |
+ KToolInvocation::invokeTerminal(QString(), QDir::homePath());
|
|
Dan Vrátil |
15354d0 |
+}
|
|
Dan Vrátil |
15354d0 |
+
|
|
Dan Vrátil |
15354d0 |
void ContextMenu::runCommand()
|
|
Dan Vrátil |
15354d0 |
{
|
|
Rex Dieter |
d5912e1 |
if (!KAuthorized::authorizeAction(QStringLiteral("run_command"))) {
|
|
Rex Dieter |
d5912e1 |
diff -up plasma-workspace-5.7.95/containmentactions/contextmenu/menu.h.konsole-in-contextmenu plasma-workspace-5.7.95/containmentactions/contextmenu/menu.h
|
|
Rex Dieter |
d5912e1 |
--- plasma-workspace-5.7.95/containmentactions/contextmenu/menu.h.konsole-in-contextmenu 2016-09-15 06:25:28.000000000 -0500
|
|
Rex Dieter |
d5912e1 |
+++ plasma-workspace-5.7.95/containmentactions/contextmenu/menu.h 2016-09-22 18:04:41.564858642 -0500
|
|
Rex Dieter |
d5912e1 |
@@ -40,12 +40,14 @@ public:
|
|
Rex Dieter |
41355c0 |
void save(KConfigGroup &config) override;
|
|
Dan Vrátil |
15354d0 |
|
|
Dan Vrátil |
15354d0 |
public Q_SLOTS:
|
|
Dan Vrátil |
15354d0 |
+ void runKonsole();
|
|
Dan Vrátil |
15354d0 |
void runCommand();
|
|
Dan Vrátil |
15354d0 |
void lockScreen();
|
|
Dan Vrátil |
15354d0 |
void startLogout();
|
|
Rex Dieter |
d5912e1 |
void logout();
|
|
Dan Vrátil |
15354d0 |
|
|
Dan Vrátil |
15354d0 |
private:
|
|
Dan Vrátil |
15354d0 |
+ QAction *m_runKonsoleAction;
|
|
Dan Vrátil |
15354d0 |
QAction *m_runCommandAction;
|
|
Dan Vrátil |
15354d0 |
QAction *m_lockScreenAction;
|
|
Dan Vrátil |
15354d0 |
QAction *m_logoutAction;
|