1
/***************************************************************************
3
* Copyright (C) 2009 Marco Martin <notmart@gmail.com> *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
19
***************************************************************************/
21
#include "systemtraytypes.h"
24
// Marshall the ImageStruct data into a D-BUS argument
25
const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusImageStruct &icon)
27
argument.beginStructure();
28
argument << icon.width;
29
argument << icon.height;
30
argument << icon.data;
31
argument.endStructure();
36
// Retrieve the ImageStruct data from the D-BUS argument
37
const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusImageStruct &icon)
43
if (argument.currentType() == QDBusArgument::StructureType) {
44
argument.beginStructure();
45
//kDebug() << "begun structure";
51
//kDebug() << data.size();
52
argument.endStructure();
62
// Marshall the ImageVector data into a D-BUS argument
63
const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusImageVector &iconVector)
65
argument.beginArray(qMetaTypeId<KDbusImageStruct>());
66
for (int i=0; i<iconVector.size(); ++i) {
67
argument << iconVector[i];
73
// Retrieve the ImageVector data from the D-BUS argument
74
const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusImageVector &iconVector)
78
if (argument.currentType() == QDBusArgument::ArrayType) {
79
argument.beginArray();
81
while (!argument.atEnd()) {
82
KDbusImageStruct element;
84
iconVector.append(element);
93
// Marshall the ToolTipStruct data into a D-BUS argument
94
const QDBusArgument &operator<<(QDBusArgument &argument, const KDbusToolTipStruct &toolTip)
96
argument.beginStructure();
97
argument << toolTip.icon;
98
argument << toolTip.image;
99
argument << toolTip.title;
100
argument << toolTip.subTitle;
101
argument.endStructure();
106
// Retrieve the ToolTipStruct data from the D-BUS argument
107
const QDBusArgument &operator>>(const QDBusArgument &argument, KDbusToolTipStruct &toolTip)
110
KDbusImageVector image;
114
if (argument.currentType() == QDBusArgument::StructureType) {
115
argument.beginStructure();
119
argument >> subTitle;
120
argument.endStructure();
124
toolTip.image = image;
125
toolTip.title = title;
126
toolTip.subTitle = subTitle;