• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.5 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 
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 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Fri Jan 17 2014 22:11:59 by doxygen 1.8.3.1 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.11.5 API Reference

Skip menu "kdepimlibs-4.11.5 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