libkcal Library API Documentation

attendee.cpp

00001 /*
00002     This file is part of libkcal.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #include <qstringlist.h>
00022 
00023 #include <kdebug.h>
00024 #include <klocale.h>
00025 
00026 #include "attendee.h"
00027 
00028 using namespace KCal;
00029 
00030 Attendee::Attendee(const QString &name, const QString &email, bool _rsvp, Attendee::PartStat s,
00031                    Attendee::Role r,const QString &u) :
00032   Person(name,email)
00033 {
00034   mFlag = TRUE;
00035   mRSVP = _rsvp;
00036   mStatus = s;
00037   mRole = r;
00038   mUid = u;
00039 }
00040 
00041 Attendee::~Attendee()
00042 {
00043 }
00044 
00045 
00046 void Attendee::setStatus(Attendee::PartStat s)
00047 {
00048   mStatus = s;
00049 }
00050 
00051 Attendee::PartStat Attendee::status() const
00052 {
00053   return mStatus;
00054 }
00055 
00056 QString Attendee::statusStr() const
00057 {
00058   return statusName(mStatus);
00059 }
00060 
00061 QString Attendee::statusName( Attendee::PartStat s )
00062 {
00063     switch (s) {
00064         default:
00065         case NeedsAction:
00066             return i18n("Needs Action");
00067             break;
00068         case Accepted:
00069             return i18n("Accepted");
00070             break;
00071         case Declined:
00072             return i18n("Declined");
00073             break;
00074         case Tentative:
00075             return i18n("Tentative");
00076             break;
00077         case Delegated:
00078             return i18n("Delegated");
00079             break;
00080         case Completed:
00081             return i18n("Completed");
00082             break;
00083         case InProcess:
00084             return i18n("In Process");
00085             break;
00086     }
00087 }
00088 
00089 QStringList Attendee::statusList()
00090 {
00091     QStringList list;
00092     list << statusName(NeedsAction);
00093     list << statusName(Accepted);
00094     list << statusName(Declined);
00095     list << statusName(Tentative);
00096     list << statusName(Delegated);
00097     list << statusName(Completed);
00098     list << statusName(InProcess);
00099 
00100     return list;
00101 }
00102 
00103 
00104 void Attendee::setRole(Attendee::Role r)
00105 {
00106   mRole = r;
00107 }
00108 
00109 Attendee::Role Attendee::role() const
00110 {
00111   return mRole;
00112 }
00113 
00114 QString Attendee::roleStr() const
00115 {
00116   return roleName(mRole);
00117 }
00118 
00119 void Attendee::setUid(QString uid)
00120 {
00121 mUid = uid;
00122 }
00123 
00124 QString Attendee::uid()
00125 {
00126 return mUid;
00127 }
00128 
00129 QString Attendee::roleName( Attendee::Role r )
00130 {
00131     switch (r) {
00132         case Chair:
00133             return i18n("Chair");
00134             break;
00135         default:
00136         case ReqParticipant:
00137             return i18n("Participant");
00138             break;
00139         case OptParticipant:
00140             return i18n("Optional Participant");
00141             break;
00142         case NonParticipant:
00143             return i18n("Observer");
00144             break;
00145     }
00146 }
00147 
00148 QStringList Attendee::roleList()
00149 {
00150     QStringList list;
00151     list << roleName(ReqParticipant);
00152     list << roleName(OptParticipant);
00153     list << roleName(NonParticipant);
00154     list << roleName(Chair);
00155 
00156     return list;
00157 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:26 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001