libopie PIM API Documentation

oevent.h

Go to the documentation of this file.
00001 // CONTAINS GPLed code of TT
00002 
00003 #ifndef OPIE_PIM_EVENT_H
00004 #define OPIE_PIM_EVENT_H
00005 
00006 #include <qstring.h>
00007 #include <qdatetime.h>
00008 #include <qvaluelist.h>
00009 
00010 #include <qpe/recordfields.h>
00011 #include <qpe/palmtopuidgen.h>
00012 
00013 #include "otimezone.h"
00014 #include "opimrecord.h"
00015 
00016 struct OCalendarHelper {
00018     static int week( const QDate& );
00020     static int ocurrence( const QDate& );
00021 
00022     // returns the dayOfWeek for the *first* day it finds (ignores
00023     // any further days!). Returns 1 (Monday) if there isn't any day found
00024     static int dayOfWeek( char day );
00025 
00027     static int monthDiff( const QDate& first, const QDate& second );
00028 
00029 };
00030 
00031 class OPimNotifyManager;
00032 class ORecur;
00033 
00039 class OEvent : public OPimRecord {
00040 public:
00041     typedef QValueList<OEvent> ValueList;
00046     enum RecordFields {
00047         FUid = Qtopia::UID_ID,
00048         FCategories = Qtopia::CATEGORY_ID,
00049         FDescription = 0,
00050         FLocation,
00051     FType,
00052     FAlarm,
00053     FSound,
00054     FRType,
00055     FRWeekdays,
00056     FRPosition,
00057     FRFreq,
00058     FRHasEndDate,
00059     FREndDate,
00060     FRCreated,
00061     FRExceptions,
00062     FStart,
00063     FEnd,
00064     FNote,
00065         FTimeZone,
00066         FRecParent,
00067         FRecChildren,
00068     };
00069 
00073     OEvent(int uid = 0);
00074 
00078     OEvent( const OEvent& );
00079 
00084     OEvent( const QMap<int, QString> map );
00085     ~OEvent();
00086     OEvent &operator=( const OEvent& );
00087 
00088     QString description()const;
00089     void setDescription( const QString& description );
00090 
00091     QString location()const;
00092    void setLocation( const QString& loc );
00093 
00094     bool hasNotifiers()const;
00095     OPimNotifyManager &notifiers()const;
00096 
00097     ORecur recurrence()const;
00098     void setRecurrence( const ORecur& );
00099     bool hasRecurrence()const;
00100 
00101     QString note()const;
00102     void setNote( const QString& note );
00103 
00104 
00105     QDateTime createdDateTime()const;
00106     void setCreatedDateTime( const QDateTime& dt);
00107 
00109     void setStartDateTime( const QDateTime& );
00111     QDateTime startDateTime()const;
00112 
00114     QDateTime startDateTimeInZone()const;
00115 
00117     void setEndDateTime( const QDateTime& );
00119     QDateTime endDateTime()const;
00120     QDateTime endDateTimeInZone()const;
00121 
00122     bool isMultipleDay()const;
00123     bool isAllDay()const;
00124     void setAllDay( bool isAllDay );
00125 
00126     /* pin this event to a timezone! FIXME */
00127     void setTimeZone( const QString& timeZone );
00128     QString timeZone()const;
00129 
00130 
00131     virtual bool match( const QRegExp& )const;
00132 
00134     QArray<int> children()const;
00135     void setChildren( const QArray<int>& );
00136     void addChild( int uid );
00137     void removeChild( int uid );
00138 
00140     int parent()const;
00141     void setParent( int uid );
00142 
00143 
00144     /* needed reimp */
00145     QString toRichText()const;
00146     QString toShortText()const;
00147     QString type()const;
00148 
00149     QMap<int, QString> toMap()const;
00150     void fromMap( const QMap<int, QString>& map );
00151     QString recordField(int )const;
00152 
00153     static int rtti();
00154 
00155     bool loadFromStream( QDataStream& );
00156     bool saveToStream( QDataStream& )const;
00157 
00158 /*    bool operator==( const OEvent& );
00159     bool operator!=( const OEvent& );
00160     bool operator<( const OEvent& );
00161     bool operator<=( const OEvent& );
00162     bool operator>( const OEvent& );
00163     bool operator>=(const OEvent& );
00164 */
00165 private:
00166     inline void changeOrModify();
00167     void deref();
00168     struct Data;
00169     Data* data;
00170     class Private;
00171     Private* priv;
00172 
00173 };
00174 
00178 class OEffectiveEvent {
00179 public:
00180     typedef QValueList<OEffectiveEvent> ValueList;
00181     enum Position { MidWay, Start, End, StartEnd };
00182         // If we calculate the effective event of a multi-day event
00183     // we have to figure out whether we are at the first day,
00184     // at the end, or anywhere else ("middle"). This is important
00185     // for the start/end times (00:00/23:59)
00186     // MidWay: 00:00 -> 23:59, as we are "in the middle" of a multi-
00187     //         day event
00188     // Start: start time -> 23:59
00189     // End: 00:00 -> end time
00190     // Start | End == StartEnd: for single-day events (default)
00191     //                          here we draw start time -> end time
00192     OEffectiveEvent();
00193     OEffectiveEvent( const OEvent& event, const QDate& startDate, Position pos = StartEnd );
00194     OEffectiveEvent( const OEffectiveEvent& );
00195     OEffectiveEvent &operator=(const OEffectiveEvent& );
00196     ~OEffectiveEvent();
00197 
00198     void setStartTime( const QTime& );
00199     void setEndTime( const QTime& );
00200     void setEvent( const OEvent& );
00201     void setDate( const QDate& );
00202 
00203     void setEffectiveDates( const QDate& from, const QDate& to );
00204 
00205     QString description()const;
00206     QString location()const;
00207     QString note()const;
00208     OEvent event()const;
00209     QTime startTime()const;
00210     QTime endTime()const;
00211     QDate date()const;
00212 
00213     /* return the length in hours */
00214     int length()const;
00215     int size()const;
00216 
00217     QDate startDate()const;
00218     QDate endDate()const;
00219 
00220     bool operator<( const OEffectiveEvent &e ) const;
00221     bool operator<=( const OEffectiveEvent &e ) const;
00222     bool operator==( const OEffectiveEvent &e ) const;
00223     bool operator!=( const OEffectiveEvent &e ) const;
00224     bool operator>( const OEffectiveEvent &e ) const;
00225     bool operator>= ( const OEffectiveEvent &e ) const;
00226 
00227 private:
00228     void deref();
00229     inline void changeOrModify();
00230     class Private;
00231     Private* priv;
00232     struct Data;
00233     Data* data;
00234 
00235 };
00236 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:25:20 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001