diff --git a/globalshortcuts.h b/globalshortcuts.h --- a/globalshortcuts.h +++ b/globalshortcuts.h @@ -21,8 +21,6 @@ #define KWIN_GLOBALSHORTCUTS_H // KWin #include -// KDE -#include // Qt #include @@ -53,13 +51,6 @@ void init(); /** - * @brief Registers an internal global shortcut - * - * @param action The action to trigger if the shortcut is pressed - * @param shortcut The key sequence which triggers this shortcut - */ - void registerShortcut(QAction *action, const QKeySequence &shortcut); - /** * @brief Registers an internal global pointer shortcut * * @param action The action to trigger if the shortcut is pressed @@ -109,11 +100,8 @@ private: void objectDeleted(QObject *object); - QKeySequence getShortcutForAction(const QString &componentName, const QString &actionName, const QKeySequence &defaultShortcut); - QHash > m_shortcuts; QHash > m_pointerShortcuts; QHash > m_axisShortcuts; - KSharedConfigPtr m_config; KGlobalAccelD *m_kglobalAccel = nullptr; KGlobalAccelInterface *m_kglobalAccelInterface = nullptr; }; diff --git a/globalshortcuts.cpp b/globalshortcuts.cpp --- a/globalshortcuts.cpp +++ b/globalshortcuts.cpp @@ -24,8 +24,6 @@ #include "main.h" #include "utils.h" // KDE -#include -#include #include #include // Qt @@ -93,7 +91,6 @@ GlobalShortcutsManager::GlobalShortcutsManager(QObject *parent) : QObject(parent) - , m_config(KSharedConfig::openConfig(QStringLiteral("kglobalshortcutsrc"), KConfig::SimpleConfig)) { } @@ -107,7 +104,6 @@ GlobalShortcutsManager::~GlobalShortcutsManager() { - clearShortcuts(m_shortcuts); clearShortcuts(m_pointerShortcuts); clearShortcuts(m_axisShortcuts); } @@ -148,7 +144,6 @@ void GlobalShortcutsManager::objectDeleted(QObject *object) { - handleDestroyedAction(object, m_shortcuts); handleDestroyedAction(object, m_pointerShortcuts); handleDestroyedAction(object, m_axisShortcuts); } @@ -168,35 +163,6 @@ } } -void GlobalShortcutsManager::registerShortcut(QAction *action, const QKeySequence &shortcut) -{ - QKeySequence s = getShortcutForAction(KWIN_NAME, action->objectName(), shortcut); - if (s.isEmpty()) { - // TODO: insert into a list of empty shortcuts to react on changes - return; - } - int keys = s[0]; - Qt::KeyboardModifiers mods = Qt::NoModifier; - if (keys & Qt::ShiftModifier) { - mods |= Qt::ShiftModifier; - } - if (keys & Qt::ControlModifier) { - mods |= Qt::ControlModifier; - } - if (keys & Qt::AltModifier) { - mods |= Qt::AltModifier; - } - if (keys & Qt::MetaModifier) { - mods |= Qt::MetaModifier; - } - int keysym = 0; - if (!KKeyServer::keyQtToSymX(keys, &keysym)) { - return; - } - addShortcut(m_shortcuts, action, mods, static_cast(keysym)); - connect(action, &QAction::destroyed, this, &GlobalShortcutsManager::objectDeleted); -} - void GlobalShortcutsManager::registerPointerShortcut(QAction *action, Qt::KeyboardModifiers modifiers, Qt::MouseButtons pointerButtons) { addShortcut(m_pointerShortcuts, action, modifiers, pointerButtons); @@ -209,26 +175,6 @@ connect(action, &QAction::destroyed, this, &GlobalShortcutsManager::objectDeleted); } -QKeySequence GlobalShortcutsManager::getShortcutForAction(const QString &componentName, const QString &actionName, const QKeySequence &defaultShortcut) -{ - if (!m_config->hasGroup(componentName)) { - return defaultShortcut; - } - KConfigGroup group = m_config->group(componentName); - if (!group.hasKey(actionName)) { - return defaultShortcut; - } - QStringList parts = group.readEntry(actionName, QStringList()); - // must consist of three parts - if (parts.size() != 3) { - return defaultShortcut; - } - if (parts.first() == "none") { - return defaultShortcut; - } - return QKeySequence(parts.first()); -} - template bool processShortcut(Qt::KeyboardModifiers mods, T key, U &shortcuts) { @@ -274,9 +220,6 @@ } } } - if (processShortcut(mods, key, m_shortcuts)) { - return true; - } return false; } diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -1806,7 +1806,6 @@ void InputRedirection::registerShortcut(const QKeySequence &shortcut, QAction *action) { - m_shortcuts->registerShortcut(action, shortcut); kwinApp()->platform()->setupActionForGlobalAccel(action); }