Set component display name for touchpad and keyboard shortcuts

Otherwise they appear as "KWin" in the settings when we want them
to be "Touchpad" and "Keyboard Layout Switcher".
BUG:440259
FIXED-IN:5.23
This commit is contained in:
David Redondo 2021-07-26 10:37:48 +02:00
parent d4c7486fe1
commit d84198f3b8
2 changed files with 7 additions and 0 deletions

View file

@ -39,6 +39,7 @@
#include "cursor.h"
#include <KDecoration2/Decoration>
#include <KGlobalAccel>
#include <KLocalizedString>
#include <KWaylandServer/display.h>
#include <KWaylandServer/fakeinput_interface.h>
#include <KWaylandServer/relativepointer_v1_interface.h>
@ -2480,12 +2481,17 @@ void InputRedirection::setupTouchpadShortcuts()
QAction *touchpadOnAction = new QAction(this);
QAction *touchpadOffAction = new QAction(this);
const QString touchpadDisplayName = i18n("Touchpad");
touchpadToggleAction->setObjectName(QStringLiteral("Toggle Touchpad"));
touchpadToggleAction->setProperty("componentName", s_touchpadComponent);
touchpadToggleAction->setProperty("componentDisplayName", touchpadDisplayName);
touchpadOnAction->setObjectName(QStringLiteral("Enable Touchpad"));
touchpadOnAction->setProperty("componentName", s_touchpadComponent);
touchpadOnAction->setProperty("componentDisplayName", touchpadDisplayName);
touchpadOffAction->setObjectName(QStringLiteral("Disable Touchpad"));
touchpadOffAction->setProperty("componentName", s_touchpadComponent);
touchpadOffAction->setProperty("componentDisplayName", touchpadDisplayName);
KGlobalAccel::self()->setDefaultShortcut(touchpadToggleAction, QList<QKeySequence>{Qt::Key_TouchpadToggle});
KGlobalAccel::self()->setShortcut(touchpadToggleAction, QList<QKeySequence>{Qt::Key_TouchpadToggle});
KGlobalAccel::self()->setDefaultShortcut(touchpadOnAction, QList<QKeySequence>{Qt::Key_TouchpadOn});

View file

@ -43,6 +43,7 @@ void KeyboardLayout::init()
QAction *switchKeyboardAction = new QAction(this);
switchKeyboardAction->setObjectName(QStringLiteral("Switch to Next Keyboard Layout"));
switchKeyboardAction->setProperty("componentName", QStringLiteral("KDE Keyboard Layout Switcher"));
switchKeyboardAction->setProperty("componentDisplayName", i18n("Keyboard Layout Switcher"));
const QKeySequence sequence = QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_K);
KGlobalAccel::self()->setDefaultShortcut(switchKeyboardAction, QList<QKeySequence>({sequence}));
KGlobalAccel::self()->setShortcut(switchKeyboardAction, QList<QKeySequence>({sequence}));