From cb7f92222254ca7ccc3898187dc97e5fd698d17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 13 Sep 2016 13:02:20 +0200 Subject: [PATCH] Set componentName to KWIN_NAME on QActions for KGlobalAccel By setting the componentName we ensure that test don't grab the shortcut. CCBUG: 368675 --- tabbox/tabbox.cpp | 1 + useractions.cpp | 2 ++ virtualdesktops.cpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 14c9bf4053..9686239947 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -518,6 +518,7 @@ template 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() << shortcut); diff --git a/useractions.cpp b/useractions.cpp index f6ca559f3a..5432fd8abd 100755 --- a/useractions.cpp +++ b/useractions.cpp @@ -973,6 +973,7 @@ template 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, diff --git a/virtualdesktops.cpp b/virtualdesktops.cpp index a68ebb9b84..c51958d21e 100644 --- a/virtualdesktops.cpp +++ b/virtualdesktops.cpp @@ -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());