• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.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 using namespace KCalCore;
36 
41 //@cond PRIVATE
42 class KCalCore::Attendee::Private
43 {
44  public:
45  bool mRSVP;
46  Role mRole;
47  PartStat mStatus;
48  QString mUid;
49  QString mDelegate;
50  QString mDelegator;
51  CustomProperties mCustomProperties;
52 };
53 //@endcond
54 
55 Attendee::Attendee( const QString &name, const QString &email, bool rsvp,
56  Attendee::PartStat status, Attendee::Role role, const QString &uid )
57  : d( new Attendee::Private )
58 {
59  setName( name );
60  setEmail( email );
61  d->mRSVP = rsvp;
62  d->mStatus = status;
63  d->mRole = role;
64  d->mUid = uid;
65 }
66 
67 Attendee::Attendee( const Attendee &attendee )
68  : Person( attendee ),
69  d( new Attendee::Private( *attendee.d ) )
70 {
71 }
72 
73 Attendee::~Attendee()
74 {
75  delete d;
76 }
77 
78 bool KCalCore::Attendee::operator==( const Attendee &attendee ) const
79 {
80  return
81  ( Person & )*this == ( const Person & )attendee &&
82  d->mRSVP == attendee.d->mRSVP &&
83  d->mRole == attendee.d->mRole &&
84  d->mStatus == attendee.d->mStatus &&
85  d->mUid == attendee.d->mUid &&
86  d->mDelegate == attendee.d->mDelegate &&
87  d->mDelegator == attendee.d->mDelegator;
88 }
89 
90 bool KCalCore::Attendee::operator!=( const Attendee &attendee ) const
91 {
92  return !operator==( attendee );
93 }
94 
95 Attendee &KCalCore::Attendee::operator=( const Attendee &attendee )
96 {
97  // check for self assignment
98  if ( &attendee == this ) {
99  return *this;
100  }
101 
102  *d = *attendee.d;
103  setName( attendee.name() );
104  setEmail( attendee.email() );
105  return *this;
106 }
107 
108 void Attendee::setRSVP( bool r )
109 {
110  d->mRSVP = r;
111 }
112 
113 bool Attendee::RSVP() const
114 {
115  return d->mRSVP;
116 }
117 
118 void Attendee::setStatus( Attendee::PartStat status )
119 {
120  d->mStatus = status;
121 }
122 
123 Attendee::PartStat Attendee::status() const
124 {
125  return d->mStatus;
126 }
127 
128 void Attendee::setRole( Attendee::Role role )
129 {
130  d->mRole = role;
131 }
132 
133 Attendee::Role Attendee::role() const
134 {
135  return d->mRole;
136 }
137 
138 void Attendee::setUid( const QString &uid )
139 {
140  d->mUid = uid;
141 }
142 
143 QString Attendee::uid() const
144 {
145  return d->mUid;
146 }
147 
148 void Attendee::setDelegate( const QString &delegate )
149 {
150  d->mDelegate = delegate;
151 }
152 
153 QString Attendee::delegate() const
154 {
155  return d->mDelegate;
156 }
157 
158 void Attendee::setDelegator( const QString &delegator )
159 {
160  d->mDelegator = delegator;
161 }
162 
163 QString Attendee::delegator() const
164 {
165  return d->mDelegator;
166 }
167 
168 void Attendee::setCustomProperty( const QByteArray &xname, const QString &xvalue )
169 {
170  d->mCustomProperties.setNonKDECustomProperty( xname, xvalue );
171 }
172 
173 CustomProperties &Attendee::customProperties()
174 {
175  return d->mCustomProperties;
176 }
177 
178 const CustomProperties &Attendee::customProperties() const
179 {
180  return d->mCustomProperties;
181 }
182 
183 QDataStream &KCalCore::operator<<( QDataStream &stream, const KCalCore::Attendee::Ptr &attendee )
184 {
185  KCalCore::Person::Ptr p( new KCalCore::Person( *( (Person *)attendee.data() ) ) );
186  stream << p;
187  return stream << attendee->d->mRSVP
188  << int( attendee->d->mRole )
189  << int( attendee->d->mStatus )
190  << attendee->d->mUid
191  << attendee->d->mDelegate
192  << attendee->d->mDelegator
193  << attendee->d->mCustomProperties;
194 }
195 
196 QDataStream &KCalCore::operator>>( QDataStream &stream, KCalCore::Attendee::Ptr &attendee )
197 {
198  bool RSVP;
199  Attendee::Role role;
200  Attendee::PartStat status;
201  QString uid;
202  QString delegate;
203  QString delegator;
204  CustomProperties customProperties;
205  uint role_int;
206  uint status_int;
207 
208  KCalCore::Person::Ptr person( new Person() );
209  stream >> person;
210  stream >> RSVP
211  >> role_int
212  >> status_int
213  >> uid
214  >> delegate
215  >> delegator
216  >> customProperties;
217 
218  role = Attendee::Role( role_int );
219  status = Attendee::PartStat( status_int );
220 
221  Attendee::Ptr att_temp( new KCalCore::Attendee( person->name(), person->email(),
222  RSVP, status, role, uid ) );
223  att_temp->setDelegate( delegate );
224  att_temp->setDelegator( delegator );
225  att_temp->d->mCustomProperties = customProperties;
226  attendee.swap( att_temp );
227  return stream;
228 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:24:50 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.10.5 API Reference

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