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

KCalCore Library

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 
38 using namespace KCalCore;
39 
44 //@cond PRIVATE
45 class KCalCore::Attendee::Private
46 {
47 public:
48  bool mRSVP;
49  Role mRole;
50  PartStat mStatus;
51  QString mUid;
52  QString mDelegate;
53  QString mDelegator;
54  CustomProperties mCustomProperties;
55 };
56 //@endcond
57 
58 Attendee::Attendee(const QString &name, const QString &email, bool rsvp,
59  Attendee::PartStat status, Attendee::Role role, const QString &uid)
60  : d(new Attendee::Private)
61 {
62  setName(name);
63  setEmail(email);
64  d->mRSVP = rsvp;
65  d->mStatus = status;
66  d->mRole = role;
67  d->mUid = uid;
68 }
69 
70 Attendee::Attendee(const Attendee &attendee)
71  : Person(attendee),
72  d(new Attendee::Private(*attendee.d))
73 {
74 }
75 
76 Attendee::~Attendee()
77 {
78  delete d;
79 }
80 
81 bool KCalCore::Attendee::operator==(const Attendee &attendee) const
82 {
83  return
84  d->mUid == attendee.d->mUid &&
85  d->mRSVP == attendee.d->mRSVP &&
86  d->mRole == attendee.d->mRole &&
87  d->mStatus == attendee.d->mStatus &&
88  d->mDelegate == attendee.d->mDelegate &&
89  d->mDelegator == attendee.d->mDelegator &&
90  (const Person &)*this == (const Person &)attendee;
91 }
92 
93 bool KCalCore::Attendee::operator!=(const Attendee &attendee) const
94 {
95  return !operator==(attendee);
96 }
97 
98 Attendee &KCalCore::Attendee::operator=(const Attendee &attendee)
99 {
100  // check for self assignment
101  if (&attendee == this) {
102  return *this;
103  }
104 
105  *d = *attendee.d;
106  setName(attendee.name());
107  setEmail(attendee.email());
108  return *this;
109 }
110 
111 void Attendee::setRSVP(bool r)
112 {
113  d->mRSVP = r;
114 }
115 
116 bool Attendee::RSVP() const
117 {
118  return d->mRSVP;
119 }
120 
121 void Attendee::setStatus(Attendee::PartStat status)
122 {
123  d->mStatus = status;
124 }
125 
126 Attendee::PartStat Attendee::status() const
127 {
128  return d->mStatus;
129 }
130 
131 void Attendee::setRole(Attendee::Role role)
132 {
133  d->mRole = role;
134 }
135 
136 Attendee::Role Attendee::role() const
137 {
138  return d->mRole;
139 }
140 
141 void Attendee::setUid(const QString &uid)
142 {
143  d->mUid = uid;
144 }
145 
146 QString Attendee::uid() const
147 {
148  return d->mUid;
149 }
150 
151 void Attendee::setDelegate(const QString &delegate)
152 {
153  d->mDelegate = delegate;
154 }
155 
156 QString Attendee::delegate() const
157 {
158  return d->mDelegate;
159 }
160 
161 void Attendee::setDelegator(const QString &delegator)
162 {
163  d->mDelegator = delegator;
164 }
165 
166 QString Attendee::delegator() const
167 {
168  return d->mDelegator;
169 }
170 
171 void Attendee::setCustomProperty(const QByteArray &xname, const QString &xvalue)
172 {
173  d->mCustomProperties.setNonKDECustomProperty(xname, xvalue);
174 }
175 
176 CustomProperties &Attendee::customProperties()
177 {
178  return d->mCustomProperties;
179 }
180 
181 const CustomProperties &Attendee::customProperties() const
182 {
183  return d->mCustomProperties;
184 }
185 
186 QDataStream &KCalCore::operator<<(QDataStream &stream, const KCalCore::Attendee::Ptr &attendee)
187 {
188  KCalCore::Person::Ptr p(new KCalCore::Person(*((Person *)attendee.data())));
189  stream << p;
190  return stream << attendee->d->mRSVP
191  << int(attendee->d->mRole)
192  << int(attendee->d->mStatus)
193  << attendee->d->mUid
194  << attendee->d->mDelegate
195  << attendee->d->mDelegator
196  << attendee->d->mCustomProperties;
197 }
198 
199 QDataStream &KCalCore::operator>>(QDataStream &stream, KCalCore::Attendee::Ptr &attendee)
200 {
201  bool RSVP;
202  Attendee::Role role;
203  Attendee::PartStat status;
204  QString uid;
205  QString delegate;
206  QString delegator;
207  CustomProperties customProperties;
208  uint role_int;
209  uint status_int;
210 
211  KCalCore::Person::Ptr person(new Person());
212  stream >> person;
213  stream >> RSVP
214  >> role_int
215  >> status_int
216  >> uid
217  >> delegate
218  >> delegator
219  >> customProperties;
220 
221  role = Attendee::Role(role_int);
222  status = Attendee::PartStat(status_int);
223 
224  Attendee::Ptr att_temp(new KCalCore::Attendee(person->name(), person->email(),
225  RSVP, status, role, uid));
226  att_temp->setDelegate(delegate);
227  att_temp->setDelegator(delegator);
228  att_temp->d->mCustomProperties = customProperties;
229  attendee.swap(att_temp);
230  return stream;
231 }
KCalCore::Attendee::setDelegator
void setDelegator(const QString &delegator)
Sets the delegator.
Definition: attendee.cpp:161
KCalCore::Attendee::~Attendee
~Attendee()
Destroys the attendee.
Definition: attendee.cpp:76
KCalCore::Attendee::setStatus
void setStatus(PartStat status)
Sets the PartStat of the attendee to status.
Definition: attendee.cpp:121
attendee.h
This file is part of the API for handling calendar data and defines the Attendee class.
KCalCore::Person
Represents a person, by name and email address.
Definition: person.h:50
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:58
KCalCore::Person::setEmail
void setEmail(const QString &email)
Sets the email address for this person to email.
Definition: person.cpp:146
KCalCore::Attendee::delegate
QString delegate() const
Returns the delegate.
Definition: attendee.cpp:156
KCalCore::Person::name
QString name() const
Returns the person name string.
Definition: person.cpp:126
KCalCore::Attendee::setCustomProperty
void setCustomProperty(const QByteArray &xname, const QString &xvalue)
Adds a custom property.
Definition: attendee.cpp:171
KCalCore::Attendee::Role
Role
The different types of participation roles.
Definition: attendee.h:84
KCalCore::Attendee::setUid
void setUid(const QString &uid)
Sets the UID of the attendee to uid.
Definition: attendee.cpp:141
KCalCore::Attendee::RSVP
bool RSVP() const
Returns the attendee RSVP flag.
Definition: attendee.cpp:116
KCalCore::Attendee::operator=
Attendee & operator=(const Attendee &attendee)
Sets this attendee equal to attendee.
Definition: attendee.cpp:98
KCalCore::Person::setName
void setName(const QString &name)
Sets the name of the person to name.
Definition: person.cpp:141
KCalCore::Attendee::setDelegate
void setDelegate(const QString &delegate)
Sets the delegate.
Definition: attendee.cpp:151
KCalCore::Attendee::status
PartStat status() const
Returns the PartStat of the attendee.
Definition: attendee.cpp:126
KCalCore::Attendee::PartStat
PartStat
The different types of participant status.
Definition: attendee.h:70
KCalCore::Attendee::setRSVP
void setRSVP(bool rsvp)
Sets the RSVP flag of the attendee to rsvp.
Definition: attendee.cpp:111
KCalCore::Attendee::uid
QString uid() const
Returns the UID of the attendee.
Definition: attendee.cpp:146
KCalCore::Person::email
QString email() const
Returns the email address for this person.
Definition: person.cpp:131
KCalCore::operator>>
KCALCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:863
KCalCore::Person::Ptr
QSharedPointer< Person > Ptr
A shared pointer to a Person object.
Definition: person.h:56
KCalCore::Attendee::Ptr
QSharedPointer< Attendee > Ptr
A shared pointer to an Attendee object.
Definition: attendee.h:94
KCalCore::CustomProperties
A class to manage custom calendar properties.
Definition: customproperties.h:51
KCalCore::Attendee::operator!=
bool operator!=(const Attendee &attendee) const
Compares this with attendee for inequality.
Definition: attendee.cpp:93
KCalCore::Attendee::role
Role role() const
Returns the Role of the attendee.
Definition: attendee.cpp:136
KCalCore::Attendee::operator==
bool operator==(const Attendee &attendee) const
Compares this with attendee for equality.
Definition: attendee.cpp:81
KCalCore::Attendee::customProperties
CustomProperties & customProperties()
Returns a reference to the CustomProperties object.
Definition: attendee.cpp:176
KCalCore::Attendee::delegator
QString delegator() const
Returns the delegator.
Definition: attendee.cpp:166
KCalCore::Attendee
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
Definition: attendee.h:57
KCalCore::operator<<
KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:853
KCalCore::Attendee::setRole
void setRole(Role role)
Sets the Role of the attendee to role.
Definition: attendee.cpp:131
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:57 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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