• 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   }
00157 }
00158 
00159 QStringList Attendee::statusList()
00160 {
00161   QStringList list;
00162   list << statusName( NeedsAction );
00163   list << statusName( Accepted );
00164   list << statusName( Declined );
00165   list << statusName( Tentative );
00166   list << statusName( Delegated );
00167   list << statusName( Completed );
00168   list << statusName( InProcess );
00169 
00170   return list;
00171 }
00172 
00173 void Attendee::setRole( Attendee::Role role )
00174 {
00175   d->mRole = role;
00176 }
00177 
00178 Attendee::Role Attendee::role() const
00179 {
00180   return d->mRole;
00181 }
00182 
00183 QString Attendee::roleStr() const
00184 {
00185   return roleName( d->mRole );
00186 }
00187 
00188 void Attendee::setUid( const QString &uid )
00189 {
00190   d->mUid = uid;
00191 }
00192 
00193 QString Attendee::uid() const
00194 {
00195   return d->mUid;
00196 }
00197 
00198 QString Attendee::roleName( Attendee::Role role )
00199 {
00200   switch ( role ) {
00201   case Chair:
00202     return i18nc( "@item chairperson", "Chair" );
00203     break;
00204   default:
00205   case ReqParticipant:
00206     return i18nc( "@item participation is required", "Participant" );
00207     break;
00208   case OptParticipant:
00209     return i18nc( "@item participation is optional", "Optional Participant" );
00210     break;
00211   case NonParticipant:
00212     return i18nc( "@item non-participant copied for information", "Observer" );
00213     break;
00214   }
00215 }
00216 
00217 QStringList Attendee::roleList()
00218 {
00219   QStringList list;
00220   list << roleName( ReqParticipant );
00221   list << roleName( OptParticipant );
00222   list << roleName( NonParticipant );
00223   list << roleName( Chair );
00224 
00225   return list;
00226 }
00227 
00228 void Attendee::setDelegate( const QString &delegate )
00229 {
00230   d->mDelegate = delegate;
00231 }
00232 
00233 QString Attendee::delegate() const
00234 {
00235   return d->mDelegate;
00236 }
00237 
00238 void Attendee::setDelegator( const QString &delegator )
00239 {
00240   d->mDelegator = delegator;
00241 }
00242 
00243 QString Attendee::delegator() const
00244 {
00245   return d->mDelegator;
00246 }

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.8
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