From db49ac4e1916f87143574b064b36ec86f8407145 Mon Sep 17 00:00:00 2001 From: Albert Mkhitaryan Date: Fri, 20 Feb 2026 08:48:54 +0000 Subject: Add keyboard shortcut support for service menu actions Introduce ServiceMenuShortcutManager, which registers all service menu actions with KActionCollection at startup allowing users to assign keyboard shortcuts in Configure Keyboard Shorcuts. Save/Load of configs happens via KXMLGUI in dolphinui.rc. Notes: - Manager initializes before setupGUI() for shortcut restoration - Execution and validation handled entirely by KFileItemAction in KIO. BUG: 260266 --- src/servicemenushortcutmanager.h | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/servicemenushortcutmanager.h (limited to 'src/servicemenushortcutmanager.h') diff --git a/src/servicemenushortcutmanager.h b/src/servicemenushortcutmanager.h new file mode 100644 index 000000000..10502c341 --- /dev/null +++ b/src/servicemenushortcutmanager.h @@ -0,0 +1,42 @@ +/* + * SPDX-FileCopyrightText: 2026 Albert Mkhitaryan + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef SERVICEMENUSHORTCUTMANAGER_H +#define SERVICEMENUSHORTCUTMANAGER_H + +#include +#include + +class KActionCategory; +class KActionCollection; +class KFileItemActions; +class KXMLGUIClient; + +/** + * @brief Registers service menu actions with KActionCollection for keyboard shortcuts. + * + * This lightweight manager bridges KIO's service menu actions with Dolphin's + * shortcut system. Actions are obtained from KFileItemActions and registered + * with the action collection. Execution is handled entirely by KFileItemActions. + * + */ +class ServiceMenuShortcutManager : public QObject +{ + Q_OBJECT + +public: + explicit ServiceMenuShortcutManager(KActionCollection *actionCollection, QObject *parent = nullptr); + + void refresh(KFileItemActions *fileItemaActions); + void cleanupStaleShortcuts(KXMLGUIClient *client); + +private: + KActionCollection *m_actionCollection; + KActionCategory *m_category; + QStringList m_actionNames; +}; + +#endif // SERVICEMENUSHORTCUTMANAGER_H -- cgit v1.3