KDEUI
kglobalshortcutinfo_dbus.cpp
Go to the documentation of this file.00001 /* Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz> 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Library General Public 00005 License as published by the Free Software Foundation; either 00006 version 2 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "kglobalshortcutinfo.h" 00020 #include "kglobalshortcutinfo_p.h" 00021 00022 00023 00024 QDBusArgument &operator<< (QDBusArgument &argument, const KGlobalShortcutInfo &shortcut) 00025 { 00026 argument.beginStructure(); 00027 argument << shortcut.uniqueName() 00028 << shortcut.friendlyName() 00029 << shortcut.componentUniqueName() 00030 << shortcut.componentFriendlyName() 00031 << shortcut.contextUniqueName() 00032 << shortcut.contextFriendlyName(); 00033 argument.beginArray(qMetaTypeId<int>()); 00034 Q_FOREACH(const QKeySequence &key, shortcut.keys()) 00035 { 00036 argument << key.operator int(); 00037 } 00038 argument.endArray(); 00039 argument.beginArray(qMetaTypeId<int>()); 00040 Q_FOREACH(const QKeySequence &key, shortcut.defaultKeys()) 00041 { 00042 argument << key.operator int(); 00043 } 00044 argument.endArray(); 00045 argument.endStructure(); 00046 return argument; 00047 } 00048 00049 00050 const QDBusArgument &operator>> (const QDBusArgument &argument, KGlobalShortcutInfo &shortcut) 00051 { 00052 argument.beginStructure(); 00053 argument >> shortcut.d->uniqueName 00054 >> shortcut.d->friendlyName 00055 >> shortcut.d->componentUniqueName 00056 >> shortcut.d->componentFriendlyName 00057 >> shortcut.d->contextUniqueName 00058 >> shortcut.d->contextFriendlyName; 00059 argument.beginArray(); 00060 while (!argument.atEnd()) 00061 { 00062 int key; 00063 argument >> key; 00064 shortcut.d->keys.append(QKeySequence(key)); 00065 } 00066 argument.endArray(); 00067 argument.beginArray(); 00068 while (!argument.atEnd()) 00069 { 00070 int key; 00071 argument >> key; 00072 shortcut.d->defaultKeys.append(QKeySequence(key)); 00073 } 00074 argument.endArray(); 00075 argument.endStructure(); 00076 return argument; 00077 } 00078