• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.3 API Reference
  • KDE Home
  • 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 #include <kglobal.h>
00037 
00038 #include <QtCore/QStringList>
00039 
00040 static const KCatalogLoader loader("libkcal");
00041 
00042 using namespace KCal;
00043 
00048 //@cond PRIVATE
00049 class KCal::Attendee::Private
00050 {
00051   public:
00052     bool mRSVP;
00053     Role mRole;
00054     PartStat mStatus;
00055     QString mUid;
00056     QString mDelegate;
00057     QString mDelegator;
00058     CustomProperties mCustomProperties;
00059 };
00060 //@endcond
00061 
00062 Attendee::Attendee( const QString &name, const QString &email, bool rsvp,
00063                     Attendee::PartStat status, Attendee::Role role, const QString &uid )
00064   : d( new Attendee::Private )
00065 {
00066   setName( name );
00067   setEmail( email );
00068   d->mRSVP = rsvp;
00069   d->mStatus = status;
00070   d->mRole = role;
00071   d->mUid = uid;
00072 }
00073 
00074 Attendee::Attendee( const Attendee &attendee )
00075   : Person( attendee ),
00076     d( new Attendee::Private( *attendee.d ) )
00077 {
00078 }
00079 
00080 Attendee::~Attendee()
00081 {
00082   delete d;
00083 }
00084 
00085 bool KCal::Attendee::operator==( const Attendee &attendee )
00086 {
00087   return
00088     ( Person & )*this == ( const Person & )attendee &&
00089     d->mRSVP == attendee.d->mRSVP &&
00090     d->mRole == attendee.d->mRole &&
00091     d->mStatus == attendee.d->mStatus &&
00092     d->mUid == attendee.d->mUid &&
00093     d->mDelegate == attendee.d->mDelegate &&
00094     d->mDelegator == attendee.d->mDelegator;
00095 }
00096 
00097 Attendee &KCal::Attendee::operator=( const Attendee &attendee )
00098 {
00099   // check for self assignment
00100   if ( &attendee == this ) {
00101     return *this;
00102   }
00103 
00104   *d = *attendee.d;
00105   setName( attendee.name() );
00106   setEmail( attendee.email() );
00107   return *this;
00108 }
00109 
00110 void Attendee::setRSVP( bool r )
00111 {
00112   d->mRSVP = r;
00113 }
00114 
00115 bool Attendee::RSVP() const
00116 {
00117   return d->mRSVP;
00118 }
00119 
00120 void Attendee::setStatus( Attendee::PartStat status )
00121 {
00122   d->mStatus = status;
00123 }
00124 
00125 Attendee::PartStat Attendee::status() const
00126 {
00127   return d->mStatus;
00128 }
00129 
00130 QString Attendee::statusStr() const
00131 {
00132   return statusName( d->mStatus );
00133 }
00134 
00135 QString Attendee::statusName( Attendee::PartStat status )
00136 {
00137   switch ( status ) {
00138   default:
00139   case NeedsAction:
00140     return i18nc( "@item event, to-do or journal needs action", "Needs Action" );
00141     break;
00142   case Accepted:
00143     return i18nc( "@item event, to-do or journal accepted", "Accepted" );
00144     break;
00145   case Declined:
00146     return i18nc( "@item event, to-do or journal declined", "Declined" );
00147     break;
00148   case Tentative:
00149     return i18nc( "@item event or to-do tentatively accepted", "Tentative" );
00150     break;
00151   case Delegated:
00152     return i18nc( "@item event or to-do delegated", "Delegated" );
00153     break;
00154   case Completed:
00155     return i18nc( "@item to-do completed", "Completed" );
00156     break;
00157   case InProcess:
00158     return i18nc( "@item to-do in process of being completed", "In Process" );
00159     break;
00160   case None:
00161     return i18nc( "@item event or to-do status unknown", "Unknown" );
00162     break;
00163   }
00164 }
00165 
00166 QStringList Attendee::statusList()
00167 {
00168   QStringList list;
00169   list << statusName( NeedsAction );
00170   list << statusName( Accepted );
00171   list << statusName( Declined );
00172   list << statusName( Tentative );
00173   list << statusName( Delegated );
00174   list << statusName( Completed );
00175   list << statusName( InProcess );
00176 
00177   return list;
00178 }
00179 
00180 void Attendee::setRole( Attendee::Role role )
00181 {
00182   d->mRole = role;
00183 }
00184 
00185 Attendee::Role Attendee::role() const
00186 {
00187   return d->mRole;
00188 }
00189 
00190 QString Attendee::roleStr() const
00191 {
00192   return roleName( d->mRole );
00193 }
00194 
00195 void Attendee::setUid( const QString &uid )
00196 {
00197   d->mUid = uid;
00198 }
00199 
00200 QString Attendee::uid() const
00201 {
00202   return d->mUid;
00203 }
00204 
00205 QString Attendee::roleName( Attendee::Role role )
00206 {
00207   switch ( role ) {
00208   case Chair:
00209     return i18nc( "@item chairperson", "Chair" );
00210     break;
00211   default:
00212   case ReqParticipant:
00213     return i18nc( "@item participation is required", "Participant" );
00214     break;
00215   case OptParticipant:
00216     return i18nc( "@item participation is optional", "Optional Participant" );
00217     break;
00218   case NonParticipant:
00219     return i18nc( "@item non-participant copied for information", "Observer" );
00220     break;
00221   }
00222 }
00223 
00224 QStringList Attendee::roleList()
00225 {
00226   QStringList list;
00227   list << roleName( ReqParticipant );
00228   list << roleName( OptParticipant );
00229   list << roleName( NonParticipant );
00230   list << roleName( Chair );
00231 
00232   return list;
00233 }
00234 
00235 void Attendee::setDelegate( const QString &delegate )
00236 {
00237   d->mDelegate = delegate;
00238 }
00239 
00240 QString Attendee::delegate() const
00241 {
00242   return d->mDelegate;
00243 }
00244 
00245 void Attendee::setDelegator( const QString &delegator )
00246 {
00247   d->mDelegator = delegator;
00248 }
00249 
00250 QString Attendee::delegator() const
00251 {
00252   return d->mDelegator;
00253 }
00254 
00255 void Attendee::setCustomProperty( const QByteArray &xname, const QString &xvalue )
00256 {
00257   d->mCustomProperties.setNonKDECustomProperty( xname, xvalue );
00258 }
00259 
00260 CustomProperties &Attendee::customProperties()
00261 {
00262   return d->mCustomProperties;
00263 }
00264 
00265 const CustomProperties &Attendee::customProperties() const
00266 {
00267   return d->mCustomProperties;
00268 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:19:46 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

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

kdepimlibs-4.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal