KGlobalAccel

kglobalshortcutinfo_dbus.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Michael Jansen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "kglobalshortcutinfo.h"
8 #include "kglobalshortcutinfo_p.h"
9 
10 QDBusArgument &operator<<(QDBusArgument &argument, const KGlobalShortcutInfo &shortcut)
11 {
12  argument.beginStructure();
13  /* clang-format off */
14  argument << shortcut.uniqueName()
15  << shortcut.friendlyName()
16  << shortcut.componentUniqueName()
17  << shortcut.componentFriendlyName()
18  << shortcut.contextUniqueName()
19  << shortcut.contextFriendlyName();
20  /* clang-format on */
21  argument.beginArray(qMetaTypeId<int>());
22  for (const QKeySequence &key : shortcut.keys()) {
23  argument << key[0];
24  }
25  argument.endArray();
26  argument.beginArray(qMetaTypeId<int>());
27  for (const QKeySequence &key : shortcut.defaultKeys()) {
28  argument << key[0];
29  }
30  argument.endArray();
31  argument.endStructure();
32  return argument;
33 }
34 
35 const QDBusArgument &operator>>(const QDBusArgument &argument, KGlobalShortcutInfo &shortcut)
36 {
37  argument.beginStructure();
38  /* clang-format off */
39  argument >> shortcut.d->uniqueName
40  >> shortcut.d->friendlyName
41  >> shortcut.d->componentUniqueName
42  >> shortcut.d->componentFriendlyName
43  >> shortcut.d->contextUniqueName
44  >> shortcut.d->contextFriendlyName;
45  /* clang-format on */
46 
47  argument.beginArray();
48  while (!argument.atEnd()) {
49  int key;
50  argument >> key;
51  shortcut.d->keys.append(QKeySequence(key));
52  }
53  argument.endArray();
54  argument.beginArray();
55  while (!argument.atEnd()) {
56  int key;
57  argument >> key;
58  shortcut.d->defaultKeys.append(QKeySequence(key));
59  }
60  argument.endArray();
61  argument.endStructure();
62  return argument;
63 }
void beginArray(int id)
bool atEnd() const const
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
void beginStructure()
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
void endStructure()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun May 16 2021 22:53:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.