Commit 1d6b5376 authored by Christian Muehlhaeuser's avatar Christian Muehlhaeuser
Browse files

Add global shortcuts for switching to the previous/next activity

Summary:
We currently have a mouse-wheel action to switch to the previous/next activity,
but it wasn't possible to assign a global keyboard shortcut to these actions.

As discussed on Phabricator, this doesn't define a default key-sequence yet,
but at least gives users the possibility to assign there own ones, which wasn't
possible before.

Reviewers: apol, davidedmundson, #vdg, #plasma, ngraham

Reviewed By: davidedmundson, #vdg, #plasma, ngraham

Subscribers: ngraham, romangg, ivan, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D22382
parent c7eeee65
......@@ -203,9 +203,26 @@ ShellCorona::ShellCorona(QObject *parent)
stopActivityAction->setData(Plasma::Types::ControlAction);
stopActivityAction->setVisible(false);
KGlobalAccel::self()->setGlobalShortcut(stopActivityAction, Qt::META + Qt::Key_S);
QAction *previousActivityAction = actions()->addAction(QStringLiteral("switch to previous activity"));
connect(previousActivityAction, &QAction::triggered,
this, &ShellCorona::previousActivity);
previousActivityAction->setText(i18n("Switch to Previous Activity"));
previousActivityAction->setData(Plasma::Types::ConfigureAction);
previousActivityAction->setShortcutContext(Qt::ApplicationShortcut);
KGlobalAccel::self()->setGlobalShortcut(previousActivityAction, QKeySequence());
QAction *nextActivityAction = actions()->addAction(QStringLiteral("switch to next activity"));
connect(nextActivityAction, &QAction::triggered,
this, &ShellCorona::nextActivity);
nextActivityAction->setText(i18n("Switch to Next Activity"));
nextActivityAction->setData(Plasma::Types::ConfigureAction);
nextActivityAction->setShortcutContext(Qt::ApplicationShortcut);
KGlobalAccel::self()->setGlobalShortcut(nextActivityAction, QKeySequence());
connect(m_activityController, &KActivities::Controller::currentActivityChanged, this, &ShellCorona::currentActivityChanged);
connect(m_activityController, &KActivities::Controller::activityAdded, this, &ShellCorona::activityAdded);
connect(m_activityController, &KActivities::Controller::activityRemoved, this, &ShellCorona::activityRemoved);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment