• Skip to content
  • Skip to link menu
KDE 4.8 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

KCalCore Library

attendee.cpp
Go to the documentation of this file.
00001 /*
00002   This file is part of the kcalcore library.
00003 
00004   Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005   Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
00006   Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
00007 
00008   This library is free software; you can redistribute it and/or
00009   modify it under the terms of the GNU Library General Public
00010   License as published by the Free Software Foundation; either
00011   version 2 of the License, or (at your option) any later version.
00012 
00013   This library is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016   Library General Public License for more details.
00017 
00018   You should have received a copy of the GNU Library General Public License
00019   along with this library; see the file COPYING.LIB.  If not, write to
00020   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021   Boston, MA 02110-1301, USA.
00022 */
00034 #include "attendee.h"
00035 using namespace KCalCore;
00036 
00041 //@cond PRIVATE
00042 class KCalCore::Attendee::Private
00043 {
00044   public:
00045     bool mRSVP;
00046     Role mRole;
00047     PartStat mStatus;
00048     QString mUid;
00049     QString mDelegate;
00050     QString mDelegator;
00051     CustomProperties mCustomProperties;
00052 };
00053 //@endcond
00054 
00055 Attendee::Attendee( const QString &name, const QString &email, bool rsvp,
00056                     Attendee::PartStat status, Attendee::Role role, const QString &uid )
00057   : d( new Attendee::Private )
00058 {
00059   setName( name );
00060   setEmail( email );
00061   d->mRSVP = rsvp;
00062   d->mStatus = status;
00063   d->mRole = role;
00064   d->mUid = uid;
00065 }
00066 
00067 Attendee::Attendee( const Attendee &attendee )
00068   : Person( attendee ),
00069     d( new Attendee::Private( *attendee.d ) )
00070 {
00071 }
00072 
00073 Attendee::~Attendee()
00074 {
00075   delete d;
00076 }
00077 
00078 bool KCalCore::Attendee::operator==( const Attendee &attendee ) const
00079 {
00080   return
00081     ( Person & )*this == ( const Person & )attendee &&
00082     d->mRSVP == attendee.d->mRSVP &&
00083     d->mRole == attendee.d->mRole &&
00084     d->mStatus == attendee.d->mStatus &&
00085     d->mUid == attendee.d->mUid &&
00086     d->mDelegate == attendee.d->mDelegate &&
00087     d->mDelegator == attendee.d->mDelegator;
00088 }
00089 
00090 bool KCalCore::Attendee::operator!=( const Attendee &attendee ) const
00091 {
00092   return !operator==( attendee );
00093 }
00094 
00095 Attendee &KCalCore::Attendee::operator=( const Attendee &attendee )
00096 {
00097   // check for self assignment
00098   if ( &attendee == this ) {
00099     return *this;
00100   }
00101 
00102   *d = *attendee.d;
00103   setName( attendee.name() );
00104   setEmail( attendee.email() );
00105   return *this;
00106 }
00107 
00108 void Attendee::setRSVP( bool r )
00109 {
00110   d->mRSVP = r;
00111 }
00112 
00113 bool Attendee::RSVP() const
00114 {
00115   return d->mRSVP;
00116 }
00117 
00118 void Attendee::setStatus( Attendee::PartStat status )
00119 {
00120   d->mStatus = status;
00121 }
00122 
00123 Attendee::PartStat Attendee::status() const
00124 {
00125   return d->mStatus;
00126 }
00127 
00128 void Attendee::setRole( Attendee::Role role )
00129 {
00130   d->mRole = role;
00131 }
00132 
00133 Attendee::Role Attendee::role() const
00134 {
00135   return d->mRole;
00136 }
00137 
00138 void Attendee::setUid( const QString &uid )
00139 {
00140   d->mUid = uid;
00141 }
00142 
00143 QString Attendee::uid() const
00144 {
00145   return d->mUid;
00146 }
00147 
00148 void Attendee::setDelegate( const QString &delegate )
00149 {
00150   d->mDelegate = delegate;
00151 }
00152 
00153 QString Attendee::delegate() const
00154 {
00155   return d->mDelegate;
00156 }
00157 
00158 void Attendee::setDelegator( const QString &delegator )
00159 {
00160   d->mDelegator = delegator;
00161 }
00162 
00163 QString Attendee::delegator() const
00164 {
00165   return d->mDelegator;
00166 }
00167 
00168 void Attendee::setCustomProperty( const QByteArray &xname, const QString &xvalue )
00169 {
00170   d->mCustomProperties.setNonKDECustomProperty( xname, xvalue );
00171 }
00172 
00173 CustomProperties &Attendee::customProperties()
00174 {
00175   return d->mCustomProperties;
00176 }
00177 
00178 const CustomProperties &Attendee::customProperties() const
00179 {
00180   return d->mCustomProperties;
00181 }
00182 
00183 QDataStream &KCalCore::operator<<( QDataStream &stream, const KCalCore::Attendee::Ptr &attendee )
00184 {
00185   KCalCore::Person::Ptr p( new KCalCore::Person( *( (Person *)attendee.data() ) ) );
00186   stream << p;
00187   return stream << attendee->d->mRSVP
00188                 << int( attendee->d->mRole )
00189                 << int( attendee->d->mStatus )
00190                 << attendee->d->mUid
00191                 << attendee->d->mDelegate
00192                 << attendee->d->mDelegator
00193                 << attendee->d->mCustomProperties;
00194 }
00195 
00196 QDataStream &KCalCore::operator>>( QDataStream &stream, KCalCore::Attendee::Ptr &attendee )
00197 {
00198   bool RSVP;
00199   Attendee::Role role;
00200   Attendee::PartStat status;
00201   QString uid;
00202   QString delegate;
00203   QString delegator;
00204   CustomProperties customProperties;
00205   uint role_int;
00206   uint status_int;
00207 
00208   KCalCore::Person::Ptr person( new Person() );
00209   stream >> person;
00210   stream >> RSVP
00211          >> role_int
00212          >> status_int
00213          >> uid
00214          >> delegate
00215          >> delegator
00216          >> customProperties;
00217 
00218   role = Attendee::Role( role_int );
00219   status = Attendee::PartStat( status_int );
00220 
00221   Attendee::Ptr att_temp( new KCalCore::Attendee( person->name(), person->email(),
00222                                                   RSVP, status, role, uid ) );
00223   att_temp->setDelegate( delegate );
00224   att_temp->setDelegator( delegator );
00225   att_temp->d->mCustomProperties = customProperties;
00226   attendee.swap( att_temp );
00227   return stream;
00228 }

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal