┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/servicemenushortcutmanager.h
diff options
context:
space:
mode:
authorAlbert Mkhitaryan <[email protected]>2026-02-20 08:48:54 +0000
committerMéven Car <[email protected]>2026-02-20 08:48:54 +0000
commitdb49ac4e1916f87143574b064b36ec86f8407145 (patch)
tree9620cb68a243caf018473f93833da8e52c57973e /src/servicemenushortcutmanager.h
parent2438a457bf7499c91e3b035ed10ade41ac632660 (diff)
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
Diffstat (limited to 'src/servicemenushortcutmanager.h')
-rw-r--r--src/servicemenushortcutmanager.h42
1 files changed, 42 insertions, 0 deletions
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 <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef SERVICEMENUSHORTCUTMANAGER_H
+#define SERVICEMENUSHORTCUTMANAGER_H
+
+#include <QObject>
+#include <QStringList>
+
+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