1 /* 2 * SPDX-FileCopyrightText: 2018-2019 Red Hat Inc 3 * 4 * SPDX-License-Identifier: LGPL-2.0-or-later 5 * 6 * SPDX-FileCopyrightText: 2018-2019 Jan Grulich <jgrulich@redhat.com> 7 */ 8 9 #ifndef XDG_DESKTOP_PORTAL_KDE_SETTINGS_H 10 #define XDG_DESKTOP_PORTAL_KDE_SETTINGS_H 11 12 #include <QDBusAbstractAdaptor> 13 #include <QDBusObjectPath> 14 15 #include <KConfigCore/KSharedConfig> 16 17 class SettingsPortal : public QDBusAbstractAdaptor 18 { 19 Q_OBJECT 20 Q_CLASSINFO("D-Bus Interface", "org.freedesktop.impl.portal.Settings") 21 Q_PROPERTY(uint version READ version CONSTANT) 22 public: 23 /** 24 * An identifier for change signals. 25 * @note Copied from KGlobalSettings 26 */ 27 enum ChangeType { 28 PaletteChanged = 0, 29 FontChanged, 30 StyleChanged, 31 SettingsChanged, 32 IconChanged, 33 CursorChanged, 34 ToolbarStyleChanged, 35 ClipboardConfigChanged, 36 BlockShortcuts, 37 NaturalSortingChanged, 38 }; 39 40 /** 41 * Valid values for the settingsChanged signal 42 * @note Copied from KGlobalSettings 43 */ 44 enum SettingsCategory { 45 SETTINGS_MOUSE, 46 SETTINGS_COMPLETION, 47 SETTINGS_PATHS, 48 SETTINGS_POPUPMENU, 49 SETTINGS_QT, 50 SETTINGS_SHORTCUTS, 51 SETTINGS_LOCALE, 52 SETTINGS_STYLE, 53 }; 54 55 explicit SettingsPortal(QObject *parent); 56 ~SettingsPortal(); 57 58 typedef QMap<QString, QMap<QString, QVariant>> VariantMapMap; 59 version()60 uint version() const 61 { 62 return 1; 63 } 64 65 public Q_SLOTS: 66 void ReadAll(const QStringList &groups); 67 void Read(const QString &group, const QString &key); 68 69 Q_SIGNALS: 70 void SettingChanged(const QString &group, const QString &key, const QDBusVariant &value); 71 72 private Q_SLOTS: 73 void fontChanged(); 74 void globalSettingChanged(int type, int arg); 75 void toolbarStyleChanged(); 76 77 private: 78 QDBusVariant readProperty(const QString &group, const QString &key); 79 80 KSharedConfigPtr m_kdeglobals; 81 }; 82 83 #endif // XDG_DESKTOP_PORTAL_KDE_SETTINGS_H 84