• Skip to content
  • Skip to link menu
KDE 4.0 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 s, Attendee::Role r, const QString &u )
00060   : d( new KCal::Attendee::Private )
00061 {
00062   setName( name );
00063   setEmail( email );
00064   d->mRSVP = rsvp;
00065   d->mStatus = s;
00066   d->mRole = r;
00067   d->mUid = u;
00068 }
00069 
00070 Attendee::~Attendee()
00071 {
00072   delete d;
00073 }
00074 
00075 bool KCal::Attendee::operator==( const Attendee &attendee )
00076 {
00077   return
00078     ( Person & )*this == ( const Person & )attendee &&
00079     d->mRSVP == attendee.d->mRSVP &&
00080     d->mRole == attendee.d->mRole &&
00081     d->mStatus == attendee.d->mStatus &&
00082     d->mUid == attendee.d->mUid &&
00083     d->mDelegate == attendee.d->mDelegate &&
00084     d->mDelegator == attendee.d->mDelegator;
00085 }
00086 
00087 void Attendee::setRSVP( bool r )
00088 {
00089   d->mRSVP = r;
00090 }
00091 
00092 bool Attendee::RSVP() const
00093 {
00094   return d->mRSVP;
00095 }
00096 
00097 void Attendee::setStatus( Attendee::PartStat s )
00098 {
00099   d->mStatus = s;
00100 }
00101 
00102 Attendee::PartStat Attendee::status() const
00103 {
00104   return d->mStatus;
00105 }
00106 
00107 QString Attendee::statusStr() const
00108 {
00109   return statusName( d->mStatus );
00110 }
00111 
00112 QString Attendee::statusName( Attendee::PartStat status )
00113 {
00114   switch ( status ) {
00115   default:
00116   case NeedsAction:
00117     return i18nc( "@item event, to-do or journal needs action", "Needs Action" );
00118     break;
00119   case Accepted:
00120     return i18nc( "@item event, to-do or journal accepted", "Accepted" );
00121     break;
00122   case Declined:
00123     return i18nc( "@item event, to-do or journal declined", "Declined" );
00124     break;
00125   case Tentative:
00126     return i18nc( "@item event or to-do tentatively accepted", "Tentative" );
00127     break;
00128   case Delegated:
00129     return i18nc( "@item event or to-do delegated", "Delegated" );
00130     break;
00131   case Completed:
00132     return i18nc( "@item to-do completed", "Completed" );
00133     break;
00134   case InProcess:
00135     return i18nc( "@item to-do in process of being completed", "In Process" );
00136     break;
00137   }
00138 }
00139 
00140 QStringList Attendee::statusList()
00141 {
00142   QStringList list;
00143   list << statusName( NeedsAction );
00144   list << statusName( Accepted );
00145   list << statusName( Declined );
00146   list << statusName( Tentative );
00147   list << statusName( Delegated );
00148   list << statusName( Completed );
00149   list << statusName( InProcess );
00150 
00151   return list;
00152 }
00153 
00154 void Attendee::setRole( Attendee::Role r )
00155 {
00156   d->mRole = r;
00157 }
00158 
00159 Attendee::Role Attendee::role() const
00160 {
00161   return d->mRole;
00162 }
00163 
00164 QString Attendee::roleStr() const
00165 {
00166   return roleName( d->mRole );
00167 }
00168 
00169 void Attendee::setUid( const QString &uid )
00170 {
00171   d->mUid = uid;
00172 }
00173 
00174 QString Attendee::uid() const
00175 {
00176   return d->mUid;
00177 }
00178 
00179 QString Attendee::roleName( Attendee::Role role )
00180 {
00181   switch ( role ) {
00182   case Chair:
00183     return i18nc( "@item chairperson", "Chair" );
00184     break;
00185   default:
00186   case ReqParticipant:
00187     return i18nc( "@item participation is required", "Participant" );
00188     break;
00189   case OptParticipant:
00190     return i18nc( "@item participation is optional", "Optional Participant" );
00191     break;
00192   case NonParticipant:
00193     return i18nc( "@item non-participant copied for information", "Observer" );
00194     break;
00195   }
00196 }
00197 
00198 QStringList Attendee::roleList()
00199 {
00200   QStringList list;
00201   list << roleName( ReqParticipant );
00202   list << roleName( OptParticipant );
00203   list << roleName( NonParticipant );
00204   list << roleName( Chair );
00205 
00206   return list;
00207 }
00208 
00209 void Attendee::setDelegate( const QString &delegate )
00210 {
00211   d->mDelegate = delegate;
00212 }
00213 
00214 QString Attendee::delegate() const
00215 {
00216   return d->mDelegate;
00217 }
00218 
00219 void Attendee::setDelegator( const QString &delegator )
00220 {
00221   d->mDelegator = delegator;
00222 }
00223 
00224 QString Attendee::delegator() const
00225 {
00226   return d->mDelegator;
00227 }

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