libkcal Library API Documentation

incidencebase.h

00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2001-2003 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., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 #ifndef KCAL_INCIDENCEBASE_H
00022 #define KCAL_INCIDENCEBASE_H
00023 
00024 #include <qdatetime.h>
00025 #include <qstringlist.h>
00026 #include <qvaluelist.h>
00027 #include <qptrlist.h>
00028 
00029 #include "customproperties.h"
00030 #include "attendee.h"
00031 
00032 namespace KCal {
00033 
00034 typedef QValueList<QDate> DateList;
00035 typedef QValueList<QDateTime> DateTimeList;
00036 
00040 class IncidenceBase : public CustomProperties
00041 {
00042   public:
00043     class Observer {
00044       public:
00045         virtual ~Observer(){}
00046         virtual void incidenceUpdated( IncidenceBase * ) = 0;
00047         virtual void incidenceUpdatedSilent( IncidenceBase * ) {};
00048     };
00049 
00050     IncidenceBase();
00051     IncidenceBase( const IncidenceBase & );
00052     virtual ~IncidenceBase();
00053     bool operator==( const IncidenceBase & ) const;
00054 
00055     virtual QCString type() const = 0;
00056 
00058     void setUid( const QString & );
00060     QString uid() const;
00061 
00063     void setLastModified( const QDateTime &lm );
00065     QDateTime lastModified() const;
00066 
00068     void setOrganizer( const Person &o );
00069     void setOrganizer( const QString &o );
00070     Person organizer() const;
00071 
00073     virtual void setReadOnly( bool );
00075     bool isReadOnly() const { return mReadOnly; }
00076 
00078     virtual void setDtStart( const QDateTime &dtStart );
00080     virtual QDateTime dtStart() const;
00083     virtual QString dtStartTimeStr() const;
00086     virtual QString dtStartDateStr( bool shortfmt = true ) const;
00089     virtual QString dtStartStr() const;
00090 
00091     virtual void setDuration( int seconds );
00092     int duration() const;
00093     void setHasDuration( bool );
00094     bool hasDuration() const;
00095 
00098     bool doesFloat() const;
00100     void setFloats( bool f );
00101 
00102     //
00103     // Comments
00104     //
00105 
00113     void addComment(const QString& comment);
00114 
00123     bool removeComment(QString& comment);
00124 
00126     void clearComments();
00127 
00129     QStringList comments() const;
00130 
00137     void addAttendee( Attendee *a, bool doUpdate = true );
00141     void clearAttendees();
00145     const Attendee::List &attendees() const { return mAttendees; };
00149     int attendeeCount() const { return mAttendees.count(); };
00153     Attendee *attendeeByMail( const QString & ) const;
00157     Attendee *attendeeByMails( const QStringList &,
00158                                const QString &email = QString::null ) const;
00162     Attendee *attendeeByUid( const QString &uid ) const;
00163 
00167     enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
00171     void setSyncStatus( int status );
00172     void setSyncStatusSilent( int status );
00176     int syncStatus() const;
00177 
00181     void setPilotId( unsigned long id );
00185     unsigned long pilotId() const;
00186 
00191     void registerObserver( Observer * );
00195     void unRegisterObserver( Observer * );
00200     void updated();
00201     void updatedSilent();
00202 
00203   protected:
00204     bool mReadOnly;
00205 
00206   private:
00207     // base components
00208     QDateTime mDtStart;
00209     Person mOrganizer;
00210     QString mUid;
00211     QDateTime mLastModified;
00212     Attendee::List mAttendees;
00213     QStringList mComments;
00214 
00215     bool mFloats;
00216 
00217     int mDuration;
00218     bool mHasDuration;
00219 
00220     // PILOT SYNCHRONIZATION STUFF
00221     unsigned long mPilotId;                         // unique id for pilot sync
00222     int mSyncStatus;                      // status (for sync)
00223 
00224     QPtrList<Observer> mObservers;
00225 
00226     class Private;
00227     Private *d;
00228 };
00229 
00230 }
00231 
00232 #endif
KDE Logo
This file is part of the documentation for libkcal Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 23 18:18:40 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003