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

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
  • 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.4
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