@@ -71,25 +71,55 @@ class DCCDBusInterface;
7171struct ShortcutInfoNew {
7272 QString id;
7373 QString displayName;
74- int category;
74+ QString category; // Logical category key (e.g. "System", app-defined)
7575 QStringList hotkeys;
7676 QString localLanguageName;
77+ QString localLanguageCategory; // Resolved display text for the category
78+ bool isCustom = false ; // True for runtime-added (service API) shortcuts
7779};
7880Q_DECLARE_METATYPE (ShortcutInfoNew)
7981Q_DECLARE_METATYPE (QList<ShortcutInfoNew>)
8082
8183inline QDBusArgument &operator <<(QDBusArgument &argument, const ShortcutInfoNew &info) {
8284 argument.beginStructure ();
8385 argument << info.id << info.displayName << info.category
84- << info.hotkeys << info.localLanguageName ;
86+ << info.hotkeys << info.localLanguageName
87+ << info.localLanguageCategory << info.isCustom ;
8588 argument.endStructure ();
8689 return argument;
8790}
8891
8992inline const QDBusArgument &operator >>(const QDBusArgument &argument, ShortcutInfoNew &info) {
9093 argument.beginStructure ();
9194 argument >> info.id >> info.displayName >> info.category
92- >> info.hotkeys >> info.localLanguageName ;
95+ >> info.hotkeys >> info.localLanguageName
96+ >> info.localLanguageCategory >> info.isCustom ;
97+ argument.endStructure ();
98+ return argument;
99+ }
100+
101+ // New API category metadata (dde-services ListCategories()). The control
102+ // center treats this as the single source of truth for grouping/ordering/
103+ // display/custom-detection — it never hardcodes category strings.
104+ struct CategoryInfoNew {
105+ QString key;
106+ QString displayName;
107+ int order = 0 ;
108+ bool isCustom = false ;
109+ };
110+ Q_DECLARE_METATYPE (CategoryInfoNew)
111+ Q_DECLARE_METATYPE (QList<CategoryInfoNew>)
112+
113+ inline QDBusArgument &operator <<(QDBusArgument &argument, const CategoryInfoNew &info) {
114+ argument.beginStructure ();
115+ argument << info.key << info.displayName << info.order << info.isCustom ;
116+ argument.endStructure ();
117+ return argument;
118+ }
119+
120+ inline const QDBusArgument &operator >>(const QDBusArgument &argument, CategoryInfoNew &info) {
121+ argument.beginStructure ();
122+ argument >> info.key >> info.displayName >> info.order >> info.isCustom ;
93123 argument.endStructure ();
94124 return argument;
95125}
@@ -194,6 +224,9 @@ class KeyboardDBusProxy : public QObject, public DCC_NAMESPACE::IKeyboardDeviceP
194224 // never reuse Deleted, whose X11 auto-wiring → KeyboardWorker::removed is a
195225 // dead-end relay. Carries only the id (the new-API signal has no type).
196226 void shortcutRemovedById (const QString &id);
227+ // Wayland: category metadata from ListCategories() — drives grouping,
228+ // ordering, display names, and custom-group identity in the model.
229+ void categoriesReady (const QList<CategoryInfoNew> &categories);
197230
198231 // wm
199232 void compositingEnabledChanged (bool enabled);
@@ -204,6 +237,8 @@ public slots:
204237 // Keybinding
205238 QDBusPendingReply<> KeybindingReset ();
206239 QDBusPendingReply<QString> ListAllShortcuts ();
240+ // Wayland: fetch category metadata (ordering/display/custom flag).
241+ QDBusPendingReply<> ListCategories ();
207242 QString LookupConflictingShortcut (const QString &in0);
208243 QDBusPendingReply<ShortcutInfoNew> LookupConflictShortcut (const QString &in0);
209244 QDBusPendingReply<> ClearShortcutKeystrokes (const QString &in0, int in1);
@@ -239,6 +274,7 @@ private slots:
239274 void onLangSelectorStartServiceProcessFinished (QDBusPendingCallWatcher *w);
240275 // New API -> Old API adapters (Wayland)
241276 void onListAllShortcutsNewFinished (QDBusPendingCallWatcher *w);
277+ void onListCategoriesFinished (QDBusPendingCallWatcher *w);
242278 void onGetShortcutNewFinished (QDBusPendingCallWatcher *w);
243279 void onSearchShortcutsNewFinished (QDBusPendingCallWatcher *w);
244280 // Bridge: new dde-services D-Bus signals (ShortcutChanged/ShortcutRemoved)
0 commit comments