Commit cb7f9222 authored by Martin Flöser's avatar Martin Flöser

Set componentName to KWIN_NAME on QActions for KGlobalAccel

By setting the componentName we ensure that test don't grab the shortcut.

CCBUG: 368675
parent 6ae917d7
......@@ -518,6 +518,7 @@ template <typename Slot>
void TabBox::key(const char *actionName, Slot slot, const QKeySequence &shortcut)
{
QAction *a = new QAction(this);
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
a->setObjectName(QString::fromUtf8(actionName));
a->setText(i18n(actionName));
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << shortcut);
......
......@@ -973,6 +973,7 @@ template <typename Slot>
void Workspace::initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, Slot slot, const QVariant &data)
{
QAction *a = new QAction(this);
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
a->setObjectName(actionName);
a->setText(description);
if (data.isValid()) {
......@@ -1042,6 +1043,7 @@ void Workspace::clientShortcutUpdated(Client* c)
if (!c->shortcut().isEmpty()) {
if (action == NULL) { // new shortcut
action = new QAction(this);
action->setProperty("componentName", QStringLiteral(KWIN_NAME));
action->setObjectName(key);
action->setText(i18n("Activate Window (%1)", c->caption()));
connect(action, &QAction::triggered, c,
......
......@@ -455,6 +455,7 @@ void VirtualDesktopManager::initSwitchToShortcuts()
void VirtualDesktopManager::addAction(const QString &name, const KLocalizedString &label, uint value, const QKeySequence &key, void (VirtualDesktopManager::*slot)())
{
QAction *a = new QAction(this);
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
a->setObjectName(name.arg(value));
a->setText(label.subs(value).toString());
a->setData(value);
......@@ -465,6 +466,7 @@ void VirtualDesktopManager::addAction(const QString &name, const KLocalizedStrin
void VirtualDesktopManager::addAction(const QString &name, const QString &label, void (VirtualDesktopManager::*slot)())
{
QAction *a = new QAction(this);
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
a->setObjectName(name);
a->setText(label);
KGlobalAccel::setGlobalShortcut(a, QKeySequence());
......
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