incidencebase.h
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 #ifndef KCAL_INCIDENCEBASE_H 00021 #define KCAL_INCIDENCEBASE_H 00022 // 00023 // Incidence - base class of calendaring components 00024 // 00025 00026 #include <qdatetime.h> 00027 #include <qstringlist.h> 00028 #include <qvaluelist.h> 00029 00030 #include "attendee.h" 00031 00032 namespace KCal { 00033 00034 typedef QValueList<QDate> DateList; 00035 00039 class IncidenceBase 00040 { 00041 public: 00042 class Observer { 00043 public: 00044 virtual void incidenceUpdated( IncidenceBase * ) = 0; 00045 }; 00046 00047 IncidenceBase(); 00048 IncidenceBase(const IncidenceBase &); 00049 virtual ~IncidenceBase(); 00050 00051 virtual QCString type() const = 0; 00052 00054 void setUid(const QString &); 00056 QString uid() const; 00057 00059 void setLastModified(const QDateTime &lm); 00061 QDateTime lastModified() const; 00062 00064 void setOrganizer(const QString &o); 00065 QString organizer() const; 00066 00068 virtual void setReadOnly( bool ); 00070 bool isReadOnly() const { return mReadOnly; } 00071 00073 virtual void setDtStart(const QDateTime &dtStart); 00075 QDateTime dtStart() const; 00078 QString dtStartTimeStr() const; 00081 QString dtStartDateStr(bool shortfmt=true) const; 00084 QString dtStartStr() const; 00085 00086 virtual void setDuration(int seconds); 00087 int duration() const; 00088 void setHasDuration(bool); 00089 bool hasDuration() const; 00090 00093 bool doesFloat() const; 00095 void setFloats(bool f); 00096 00101 void addAttendee(Attendee *a, bool doupdate=true ); 00102 // void removeAttendee(Attendee *a); 00103 // void removeAttendee(const char *n); 00105 void clearAttendees(); 00107 QPtrList<Attendee> attendees() const { return mAttendees; }; 00109 int attendeeCount() const { return mAttendees.count(); }; 00111 Attendee* attendeeByMail(const QString &); 00113 Attendee* attendeeByMails(const QStringList &, QString email =0); 00114 00116 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; 00118 void setSyncStatus(int stat); 00120 int syncStatus() const; 00121 00123 void setPilotId(int id); 00125 int pilotId() const; 00126 00127 void registerObserver( Observer * ); 00128 00129 void updated(); 00130 00131 protected: 00132 bool mReadOnly; 00133 00134 private: 00135 // base components 00136 QDateTime mDtStart; 00137 QString mOrganizer; 00138 QString mUid; 00139 QDateTime mLastModified; 00140 QPtrList<Attendee> mAttendees; 00141 00142 bool mFloats; 00143 00144 int mDuration; 00145 bool mHasDuration; 00146 00147 // PILOT SYNCHRONIZATION STUFF 00148 int mPilotId; // unique id for pilot sync 00149 int mSyncStatus; // status (for sync) 00150 00151 Observer *mObserver; 00152 }; 00153 00154 } 00155 00156 #endif