File indexing completed on 2024-12-08 03:39:24

0001 /*
0002     SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KGLOBALSHORTCUTINFO_H
0008 #define KGLOBALSHORTCUTINFO_H
0009 
0010 #include <kglobalaccel_export.h>
0011 
0012 #include <QDBusArgument>
0013 #include <QKeySequence>
0014 #include <QList>
0015 #include <QObject>
0016 
0017 class KGlobalShortcutInfoPrivate;
0018 
0019 /**
0020  * @author Michael Jansen <kde@michael-jansen.biz>
0021  */
0022 class KGLOBALACCEL_EXPORT KGlobalShortcutInfo : public QObject
0023 {
0024     Q_OBJECT
0025 
0026     Q_CLASSINFO("D-Bus Interface", "org.kde.kglobalaccel.KShortcutInfo")
0027 
0028     /* clang-format off */
0029     Q_SCRIPTABLE Q_PROPERTY(QString uniqueName READ uniqueName)
0030     Q_SCRIPTABLE Q_PROPERTY(QString friendlyName READ friendlyName)
0031 
0032     Q_SCRIPTABLE Q_PROPERTY(QString componentUniqueName READ componentUniqueName)
0033     Q_SCRIPTABLE Q_PROPERTY(QString componentFriendlyName READ componentFriendlyName)
0034 
0035     Q_SCRIPTABLE Q_PROPERTY(QString contextUniqueName READ contextUniqueName)
0036     Q_SCRIPTABLE Q_PROPERTY(QString contextFriendlyName READ contextFriendlyName)
0037 
0038     Q_SCRIPTABLE Q_PROPERTY(QList<QKeySequence> keys READ keys)
0039     Q_SCRIPTABLE Q_PROPERTY(QList<QKeySequence> defaultKeys READ keys)
0040 
0041 public:
0042     KGlobalShortcutInfo();
0043     /* clang-format on */
0044 
0045     KGlobalShortcutInfo(const KGlobalShortcutInfo &rhs);
0046 
0047     ~KGlobalShortcutInfo() override;
0048 
0049     KGlobalShortcutInfo &operator=(const KGlobalShortcutInfo &rhs);
0050 
0051     QString contextFriendlyName() const;
0052 
0053     QString contextUniqueName() const;
0054 
0055     QString componentFriendlyName() const;
0056 
0057     QString componentUniqueName() const;
0058 
0059     QList<QKeySequence> defaultKeys() const;
0060 
0061     QString friendlyName() const;
0062 
0063     QList<QKeySequence> keys() const;
0064 
0065     QString uniqueName() const;
0066 
0067 private:
0068     friend class GlobalShortcut;
0069 
0070     friend KGLOBALACCEL_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, KGlobalShortcutInfo &shortcut);
0071     friend KGLOBALACCEL_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, QKeySequence &sequence);
0072 
0073     //! Implementation details
0074     KGlobalShortcutInfoPrivate *d;
0075 };
0076 
0077 KGLOBALACCEL_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const KGlobalShortcutInfo &shortcut);
0078 KGLOBALACCEL_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const QKeySequence &sequence);
0079 
0080 KGLOBALACCEL_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, KGlobalShortcutInfo &shortcut);
0081 KGLOBALACCEL_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, QKeySequence &sequence);
0082 
0083 Q_DECLARE_METATYPE(KGlobalShortcutInfo)
0084 
0085 #endif /* #ifndef KGLOBALSHORTCUTINFO_H */