• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KCal Library

attendee.cpp

Go to the documentation of this file.
00001 /*
00002   This file is part of the kcal library.
00003 
00004   Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015 
00016   You should have received a copy of the GNU Library General Public License
00017   along with this library; see the file COPYING.LIB.  If not, write to
00018   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019   Boston, MA 02110-1301, USA.
00020 */
00032 #include "attendee.h"
00033 
00034 #include <kdebug.h>
00035 #include <klocale.h>
00036 
00037 #include <QtCore/QStringList>
00038 
00039 using namespace KCal;
00040 
00045 //@cond PRIVATE
00046 class KCal::Attendee::Private
00047 {
00048   public:
00049     bool mRSVP;
00050     Role mRole;
00051     PartStat mStatus;
00052     QString mUid;
00053     QString mDelegate;
00054     QString mDelegator;
00055 };
00056 //@endcond
00057 
00058 Attendee::Attendee( const QString &name, const QString &email, bool rsvp,
00059                     Attendee::PartStat status, Attendee::Role role, const QString &uid )
00060   : d( new Attendee::Private )
00061 {
00062   setName( name );
00063   setEmail( email );
00064   d->mRSVP = rsvp;
00065   d->mStatus = status;
00066   d->mRole = role;
00067   d->mUid = uid;
00068 }
00069 
00070 Attendee::Attendee( const Attendee &attendee )
00071   : Person( attendee ),
00072     d( new Attendee::Private( *attendee.d ) )
00073 {
00074 }
00075 
00076 Attendee::~Attendee()
00077 {
00078   delete d;
00079 }
00080 
00081 bool KCal::Attendee::operator==( const Attendee &attendee )
00082 {
00083   return
00084     ( Person & )*this == ( const Person & )attendee &&
00085     d->mRSVP == attendee.d->mRSVP &&
00086     d->mRole == attendee.d->mRole &&
00087     d->mStatus == attendee.d->mStatus &&
00088     d->mUid == attendee.d->mUid &&
00089     d->mDelegate == attendee.d->mDelegate &&
00090     d->mDelegator == attendee.d->mDelegator;
00091 }
00092 
00093 Attendee &KCal::Attendee::operator=( const Attendee &attendee )
00094 {
00095   // check for self assignment
00096   if ( &attendee == this ) {
00097     return *this;
00098   }
00099 
00100   *d = *attendee.d;
00101   setName( attendee.name() );
00102   setEmail( attendee.email() );
00103   return *this;
00104 }
00105 
00106 void Attendee::setRSVP( bool r )
00107 {
00108   d->mRSVP = r;
00109 }
00110 
00111 bool Attendee::RSVP() const
00112 {
00113   return d->mRSVP;
00114 }
00115 
00116 void Attendee::setStatus( Attendee::PartStat status )
00117 {
00118   d->mStatus = status;
00119 }
00120 
00121 Attendee::PartStat Attendee::status() const
00122 {
00123   return d->mStatus;
00124 }
00125 
00126 QString Attendee::statusStr() const
00127 {
00128   return statusName( d->mStatus );
00129 }
00130 
00131 QString Attendee::statusName( Attendee::PartStat status )
00132 {
00133   switch ( status ) {
00134   default:
00135   case NeedsAction:
00136     return i18nc( "@item event, to-do or journal needs action", "Needs Action" );
00137     break;
00138   case Accepted:
00139     return i18nc( "@item event, to-do or journal accepted", "Accepted" );
00140     break;
00141   case Declined:
00142     return i18nc( "@item event, to-do or journal declined", "Declined" );
00143     break;
00144   case Tentative:
00145     return i18nc( "@item event or to-do tentatively accepted", "Tentative" );
00146     break;
00147   case Delegated:
00148     return i18nc( "@item event or to-do delegated", "Delegated" );
00149     break;
00150   case Completed:
00151     return i18nc( "@item to-do completed", "Completed" );
00152     break;
00153   case InProcess:
00154     return i18nc( "@item to-do in process of being completed", "In Process" );
00155     break;
00156   case None:
00157     return i18nc( "@item event or to-do status unknown", "Unknown" );
00158     break;
00159   }
00160 }
00161 
00162 QStringList Attendee::statusList()
00163 {
00164   QStringList list;
00165   list << statusName( NeedsAction );
00166   list << statusName( Accepted );
00167   list << statusName( Declined );
00168   list << statusName( Tentative );
00169   list << statusName( Delegated );
00170   list << statusName( Completed );
00171   list << statusName( InProcess );
00172 
00173   return list;
00174 }
00175 
00176 void Attendee::setRole( Attendee::Role role )
00177 {
00178   d->mRole = role;
00179 }
00180 
00181 Attendee::Role Attendee::role() const
00182 {
00183   return d->mRole;
00184 }
00185 
00186 QString Attendee::roleStr() const
00187 {
00188   return roleName( d->mRole );
00189 }
00190 
00191 void Attendee::setUid( const QString &uid )
00192 {
00193   d->mUid = uid;
00194 }
00195 
00196 QString Attendee::uid() const
00197 {
00198   return d->mUid;
00199 }
00200 
00201 QString Attendee::roleName( Attendee::Role role )
00202 {
00203   switch ( role ) {
00204   case Chair:
00205     return i18nc( "@item chairperson", "Chair" );
00206     break;
00207   default:
00208   case ReqParticipant:
00209     return i18nc( "@item participation is required", "Participant" );
00210     break;
00211   case OptParticipant:
00212     return i18nc( "@item participation is optional", "Optional Participant" );
00213     break;
00214   case NonParticipant:
00215     return i18nc( "@item non-participant copied for information", "Observer" );
00216     break;
00217   }
00218 }
00219 
00220 QStringList Attendee::roleList()
00221 {
00222   QStringList list;
00223   list << roleName( ReqParticipant );
00224   list << roleName( OptParticipant );
00225   list << roleName( NonParticipant );
00226   list << roleName( Chair );
00227 
00228   return list;
00229 }
00230 
00231 void Attendee::setDelegate( const QString &delegate )
00232 {
00233   d->mDelegate = delegate;
00234 }
00235 
00236 QString Attendee::delegate() const
00237 {
00238   return d->mDelegate;
00239 }
00240 
00241 void Attendee::setDelegator( const QString &delegator )
00242 {
00243   d->mDelegator = delegator;
00244 }
00245 
00246 QString Attendee::delegator() const
00247 {
00248   return d->mDelegator;
00249 }

KCal Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.9
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