Warning, file /frameworks/kglobalaccel/src/kglobalshortcutinfo_dbus.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "kglobalshortcutinfo.h" 0008 #include "kglobalshortcutinfo_p.h" 0009 0010 QDBusArgument &operator<<(QDBusArgument &argument, const QKeySequence &sequence) 0011 { 0012 argument.beginStructure(); 0013 argument.beginArray(qMetaTypeId<int>()); 0014 for (int i = 0; i < maxSequenceLength; i++) { 0015 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 0016 argument << (i < sequence.count() ? sequence[i].toCombined() : 0); 0017 #else 0018 argument << (i < sequence.count() ? sequence[i] : 0); 0019 #endif 0020 } 0021 argument.endArray(); 0022 argument.endStructure(); 0023 return argument; 0024 } 0025 0026 const QDBusArgument &operator>>(const QDBusArgument &argument, QKeySequence &sequence) 0027 { 0028 int s1; 0029 int s2; 0030 int s3; 0031 int s4; 0032 argument.beginStructure(); 0033 argument.beginArray(); 0034 argument >> s1 >> s2 >> s3 >> s4; 0035 sequence = QKeySequence(s1, s2, s3, s4); 0036 argument.endArray(); 0037 argument.endStructure(); 0038 return argument; 0039 } 0040 0041 QDBusArgument &operator<<(QDBusArgument &argument, const KGlobalShortcutInfo &shortcut) 0042 { 0043 argument.beginStructure(); 0044 /* clang-format off */ 0045 argument << shortcut.uniqueName() 0046 << shortcut.friendlyName() 0047 << shortcut.componentUniqueName() 0048 << shortcut.componentFriendlyName() 0049 << shortcut.contextUniqueName() 0050 << shortcut.contextFriendlyName(); 0051 /* clang-format on */ 0052 argument.beginArray(qMetaTypeId<int>()); 0053 0054 const QList<QKeySequence> keys = shortcut.keys(); 0055 for (const QKeySequence &key : keys) { 0056 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 0057 argument << key[0].toCombined(); 0058 #else 0059 argument << key[0]; 0060 #endif 0061 } 0062 argument.endArray(); 0063 argument.beginArray(qMetaTypeId<int>()); 0064 0065 const QList<QKeySequence> defaultKeys = shortcut.defaultKeys(); 0066 for (const QKeySequence &key : defaultKeys) { 0067 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 0068 argument << key[0].toCombined(); 0069 #else 0070 argument << key[0]; 0071 #endif 0072 } 0073 argument.endArray(); 0074 argument.endStructure(); 0075 return argument; 0076 } 0077 0078 const QDBusArgument &operator>>(const QDBusArgument &argument, KGlobalShortcutInfo &shortcut) 0079 { 0080 argument.beginStructure(); 0081 /* clang-format off */ 0082 argument >> shortcut.d->uniqueName 0083 >> shortcut.d->friendlyName 0084 >> shortcut.d->componentUniqueName 0085 >> shortcut.d->componentFriendlyName 0086 >> shortcut.d->contextUniqueName 0087 >> shortcut.d->contextFriendlyName; 0088 /* clang-format on */ 0089 0090 argument.beginArray(); 0091 while (!argument.atEnd()) { 0092 int key; 0093 argument >> key; 0094 shortcut.d->keys.append(QKeySequence(key)); 0095 } 0096 argument.endArray(); 0097 argument.beginArray(); 0098 while (!argument.atEnd()) { 0099 int key; 0100 argument >> key; 0101 shortcut.d->defaultKeys.append(QKeySequence(key)); 0102 } 0103 argument.endArray(); 0104 argument.endStructure(); 0105 return argument; 0106 }