• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

  • kcalcore
attendee.cpp
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
6 Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
34#include "attendee.h"
35
36#include <QDataStream>
37
38using namespace KCalCore;
39
44//@cond PRIVATE
45class KCalCore::Attendee::Private
46{
47public:
48 void setCuType(CuType cuType);
49 void setCuType(const QString &cuType);
50 CuType cuType() const;
51 QString cuTypeStr() const;
52
53 bool mRSVP;
54 Role mRole;
55 PartStat mStatus;
56 QString mUid;
57 QString mDelegate;
58 QString mDelegator;
59 CustomProperties mCustomProperties;
60private:
61 QString sCuType;
62 CuType mCuType;
63};
64//@endcond
65
66void KCalCore::Attendee::Private::setCuType(Attendee::CuType cuType)
67{
68 mCuType = cuType;
69 sCuType.clear();
70}
71
72void KCalCore::Attendee::Private::setCuType(const QString &cuType)
73{
74 const QString upper = cuType.toUpper();
75 if (upper == QLatin1String("INDIVIDUAL")) {
76 setCuType(Attendee::Individual);
77 } else if (upper == QLatin1String("GROUP")) {
78 setCuType(Attendee::Group);
79 } else if (upper == QLatin1String("RESOURCE")) {
80 setCuType(Attendee::Resource);
81 } else if (upper == QLatin1String("ROOM")) {
82 setCuType(Attendee::Room);
83 } else {
84 setCuType(Attendee::Unknown);
85 if (upper.startsWith(QLatin1String("X-")) || upper.startsWith(QLatin1String("IANA-"))) {
86 sCuType = upper;
87 }
88 }
89}
90
91Attendee::CuType KCalCore::Attendee::Private::cuType() const
92{
93 return mCuType;
94}
95
96QString KCalCore::Attendee::Private::cuTypeStr() const
97{
98 switch (mCuType) {
99 case Attendee::Individual:
100 return QLatin1String("INDIVIDUAL");
101 case Attendee::Group:
102 return QLatin1String("GROUP");
103 case Attendee::Resource:
104 return QLatin1String("RESOURCE");
105 case Attendee::Room:
106 return QLatin1String("ROOM");
107 case Attendee::Unknown:
108 if (sCuType.isEmpty()) {
109 return QLatin1String("UNKNOWN");
110 } else {
111 return sCuType;
112 }
113 }
114 return QLatin1String("UNKNOWN");
115}
116
117
118
119Attendee::Attendee(const QString &name, const QString &email, bool rsvp,
120 Attendee::PartStat status, Attendee::Role role, const QString &uid)
121 : d(new Attendee::Private)
122{
123 setName(name);
124 setEmail(email);
125 d->mRSVP = rsvp;
126 d->mStatus = status;
127 d->mRole = role;
128 d->mUid = uid;
129 d->setCuType(Attendee::Individual);
130}
131
132Attendee::Attendee(const Attendee &attendee)
133 : Person(attendee),
134 d(new Attendee::Private(*attendee.d))
135{
136}
137
138Attendee::~Attendee()
139{
140 delete d;
141}
142
143bool KCalCore::Attendee::operator==(const Attendee &attendee) const
144{
145 return
146 d->mUid == attendee.d->mUid &&
147 d->mRSVP == attendee.d->mRSVP &&
148 d->mRole == attendee.d->mRole &&
149 d->mStatus == attendee.d->mStatus &&
150 d->mDelegate == attendee.d->mDelegate &&
151 d->mDelegator == attendee.d->mDelegator &&
152 d->cuTypeStr() == attendee.d->cuTypeStr() &&
153 (const Person &)*this == (const Person &)attendee;
154}
155
156bool KCalCore::Attendee::operator!=(const Attendee &attendee) const
157{
158 return !operator==(attendee);
159}
160
161Attendee &KCalCore::Attendee::operator=(const Attendee &attendee)
162{
163 // check for self assignment
164 if (&attendee == this) {
165 return *this;
166 }
167
168 *d = *attendee.d;
169 setName(attendee.name());
170 setEmail(attendee.email());
171 return *this;
172}
173
174void Attendee::setRSVP(bool r)
175{
176 d->mRSVP = r;
177}
178
179bool Attendee::RSVP() const
180{
181 return d->mRSVP;
182}
183
184void Attendee::setStatus(Attendee::PartStat status)
185{
186 d->mStatus = status;
187}
188
189Attendee::PartStat Attendee::status() const
190{
191 return d->mStatus;
192}
193
194void Attendee::setCuType(Attendee::CuType cuType)
195{
196 d->setCuType(cuType);
197}
198
199void Attendee::setCuType(const QString &cuType)
200{
201 d->setCuType(cuType);
202}
203
204Attendee::CuType Attendee::cuType() const
205{
206 return d->cuType();
207}
208
209QString Attendee::cuTypeStr() const
210{
211 return d->cuTypeStr();
212}
213
214void Attendee::setRole(Attendee::Role role)
215{
216 d->mRole = role;
217}
218
219Attendee::Role Attendee::role() const
220{
221 return d->mRole;
222}
223
224void Attendee::setUid(const QString &uid)
225{
226 d->mUid = uid;
227}
228
229QString Attendee::uid() const
230{
231 return d->mUid;
232}
233
234void Attendee::setDelegate(const QString &delegate)
235{
236 d->mDelegate = delegate;
237}
238
239QString Attendee::delegate() const
240{
241 return d->mDelegate;
242}
243
244void Attendee::setDelegator(const QString &delegator)
245{
246 d->mDelegator = delegator;
247}
248
249QString Attendee::delegator() const
250{
251 return d->mDelegator;
252}
253
254void Attendee::setCustomProperty(const QByteArray &xname, const QString &xvalue)
255{
256 d->mCustomProperties.setNonKDECustomProperty(xname, xvalue);
257}
258
259CustomProperties &Attendee::customProperties()
260{
261 return d->mCustomProperties;
262}
263
264const CustomProperties &Attendee::customProperties() const
265{
266 return d->mCustomProperties;
267}
268
269QDataStream &KCalCore::operator<<(QDataStream &stream, const KCalCore::Attendee::Ptr &attendee)
270{
271 KCalCore::Person::Ptr p(new KCalCore::Person(*((Person *)attendee.data())));
272 stream << p;
273 return stream << attendee->d->mRSVP
274 << int(attendee->d->mRole)
275 << int(attendee->d->mStatus)
276 << attendee->d->mUid
277 << attendee->d->mDelegate
278 << attendee->d->mDelegator
279 << attendee->d->cuTypeStr()
280 << attendee->d->mCustomProperties;
281}
282
283QDataStream &KCalCore::operator>>(QDataStream &stream, KCalCore::Attendee::Ptr &attendee)
284{
285 bool RSVP;
286 Attendee::Role role;
287 Attendee::PartStat status;
288 QString uid;
289 QString delegate;
290 QString delegator;
291 QString cuType;
292 CustomProperties customProperties;
293 uint role_int;
294 uint status_int;
295
296 KCalCore::Person::Ptr person(new Person());
297 stream >> person;
298 stream >> RSVP
299 >> role_int
300 >> status_int
301 >> uid
302 >> delegate
303 >> delegator
304 >> cuType
305 >> customProperties;
306
307 role = Attendee::Role(role_int);
308 status = Attendee::PartStat(status_int);
309
310 Attendee::Ptr att_temp(new KCalCore::Attendee(person->name(), person->email(),
311 RSVP, status, role, uid));
312 att_temp->setDelegate(delegate);
313 att_temp->setDelegator(delegator);
314 att_temp->setCuType(cuType);
315 att_temp->d->mCustomProperties = customProperties;
316 attendee.swap(att_temp);
317 return stream;
318}
attendee.h
This file is part of the API for handling calendar data and defines the Attendee class.
KCalCore::Attendee
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
Definition attendee.h:58
KCalCore::Attendee::customProperties
CustomProperties & customProperties()
Returns a reference to the CustomProperties object.
Definition attendee.cpp:259
KCalCore::Attendee::email
QString email() const
Returns the email address for this person.
Definition person.cpp:131
KCalCore::Attendee::setStatus
void setStatus(PartStat status)
Sets the PartStat of the attendee to status.
Definition attendee.cpp:184
KCalCore::Attendee::setDelegator
void setDelegator(const QString &delegator)
Sets the delegator.
Definition attendee.cpp:244
KCalCore::Attendee::setUid
void setUid(const QString &uid)
Sets the UID of the attendee to uid.
Definition attendee.cpp:224
KCalCore::Attendee::operator=
Attendee & operator=(const Attendee &attendee)
Sets this attendee equal to attendee.
Definition attendee.cpp:161
KCalCore::Attendee::RSVP
bool RSVP() const
Returns the attendee RSVP flag.
Definition attendee.cpp:179
KCalCore::Attendee::setRole
void setRole(Role role)
Sets the Role of the attendee to role.
Definition attendee.cpp:214
KCalCore::Attendee::setCuType
void setCuType(CuType cuType)
Sets the CuType of the attendee to cuType.
Definition attendee.cpp:194
KCalCore::Attendee::operator==
bool operator==(const Attendee &attendee) const
Compares this with attendee for equality.
Definition attendee.cpp:143
KCalCore::Attendee::cuTypeStr
QString cuTypeStr() const
Returns the CuType of the attendee.
Definition attendee.cpp:209
KCalCore::Attendee::name
QString name() const
Returns the person name string.
Definition person.cpp:126
KCalCore::Attendee::Role
Role
The different types of participation roles.
Definition attendee.h:84
KCalCore::Attendee::setEmail
void setEmail(const QString &email)
Sets the email address for this person to email.
Definition person.cpp:146
KCalCore::Attendee::setDelegate
void setDelegate(const QString &delegate)
Sets the delegate.
Definition attendee.cpp:234
KCalCore::Attendee::delegate
QString delegate() const
Returns the delegate.
Definition attendee.cpp:239
KCalCore::Attendee::setName
void setName(const QString &name)
Sets the name of the person to name.
Definition person.cpp:141
KCalCore::Attendee::role
Role role() const
Returns the Role of the attendee.
Definition attendee.cpp:219
KCalCore::Attendee::setRSVP
void setRSVP(bool rsvp)
Sets the RSVP flag of the attendee to rsvp.
Definition attendee.cpp:174
KCalCore::Attendee::~Attendee
~Attendee()
Destroys the attendee.
Definition attendee.cpp:138
KCalCore::Attendee::delegator
QString delegator() const
Returns the delegator.
Definition attendee.cpp:249
KCalCore::Attendee::uid
QString uid() const
Returns the UID of the attendee.
Definition attendee.cpp:229
KCalCore::Attendee::operator!=
bool operator!=(const Attendee &attendee) const
Compares this with attendee for inequality.
Definition attendee.cpp:156
KCalCore::Attendee::setCustomProperty
void setCustomProperty(const QByteArray &xname, const QString &xvalue)
Adds a custom property.
Definition attendee.cpp:254
KCalCore::Attendee::PartStat
PartStat
The different types of participant status.
Definition attendee.h:70
KCalCore::Attendee::Attendee
Attendee(const QString &name, const QString &email, bool rsvp=false, PartStat status=None, Role role=ReqParticipant, const QString &uid=QString())
Constructs an attendee consisting of a Person name (name) and email address (email); invitation statu...
Definition attendee.cpp:119
KCalCore::Attendee::status
PartStat status() const
Returns the PartStat of the attendee.
Definition attendee.cpp:189
KCalCore::Attendee::CuType
CuType
The different types of a participant.
Definition attendee.h:97
KCalCore::Attendee::Unknown
@ Unknown
Otherwise not known.
Definition attendee.h:102
KCalCore::Attendee::Room
@ Room
A room resource.
Definition attendee.h:101
KCalCore::Attendee::Individual
@ Individual
An individual (default)
Definition attendee.h:98
KCalCore::Attendee::Resource
@ Resource
A physical resource.
Definition attendee.h:100
KCalCore::Attendee::Group
@ Group
A group of individuals.
Definition attendee.h:99
KCalCore::Attendee::Ptr
QSharedPointer< Attendee > Ptr
A shared pointer to an Attendee object.
Definition attendee.h:113
KCalCore::Attendee::cuType
CuType cuType() const
Returns the CuType of the attendee.
Definition attendee.cpp:204
KCalCore::CustomProperties
A class to manage custom calendar properties.
Definition customproperties.h:52
KCalCore::Person
Represents a person, by name and email address.
Definition person.h:51
KCalCore::Person::Ptr
QSharedPointer< Person > Ptr
A shared pointer to a Person object.
Definition person.h:56
KCalCore
TODO: KDE5:
Definition alarm.h:47
KCalCore::operator>>
KCALCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
Definition alarm.cpp:863
KCalCore::operator<<
KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &)
Alarm serializer.
Definition alarm.cpp:853
qHash
static uint qHash(const KDateTime &dt)
Private class that helps to provide binary compatibility between releases.
Definition occurrenceiterator.cpp:157
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal