Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opimevent.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003                              Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de>
00004               =.             Copyright (C) The Opie Team <opie-devel@handhelds.org>
00005             .=l.
00006            .>+-=
00007  _;:,     .>    :=|.         This program is free software; you can
00008 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00009 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00010 .="- .-=="i,     .._         License as published by the Free Software
00011  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00012      ._= =}       :          or (at your option) any later version.
00013     .%`+i>       _;_.
00014     .i_,=:_.      -<s.       This program is distributed in the hope that
00015      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00016     : ..    .:,     . . .    without even the implied warranty of
00017     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00018   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00019 ..}^=.=       =       ;      Library General Public License for more
00020 ++=   -.     .`     .:       details.
00021  :     =  ...= . :.=-
00022  -.   .:....=;==+<;          You should have received a copy of the GNU
00023   -_. . .   )=.  =           Library General Public License along with
00024     --        :-=`           this library; see the file COPYING.LIB.
00025                              If not, write to the Free Software Foundation,
00026                              Inc., 59 Temple Place - Suite 330,
00027                              Boston, MA 02111-1307, USA.
00028 */
00029 // CONTAINS GPLed code of TT
00030 
00031 #ifndef OEVENT_H
00032 #define OEVENT_H
00033 
00034 /* OPIE */
00035 #include <opie2/opimtimezone.h>
00036 #include <opie2/opimrecord.h>
00037 #include <qpe/recordfields.h>
00038 #include <qpe/palmtopuidgen.h>
00039 
00040 /* QT */
00041 #include <qstring.h>
00042 #include <qdatetime.h>
00043 #include <qvaluelist.h>
00044 
00045 namespace Opie
00046 {
00047 struct OCalendarHelper
00048 {
00050     static int week( const QDate& );
00052     static int ocurrence( const QDate& );
00053 
00054     // returns the dayOfWeek for the *first* day it finds (ignores
00055     // any further days!). Returns 1 (Monday) if there isn't any day found
00056     static int dayOfWeek( char day );
00057 
00059     static int monthDiff( const QDate& first, const QDate& second );
00060 
00061 };
00062 
00063 class OPimNotifyManager;
00064 class OPimRecurrence;
00065 
00071 class OPimEvent : public OPimRecord
00072 {
00073   public:
00074     typedef QValueList<OPimEvent> ValueList;
00079     enum RecordFields {
00080         FUid = Qtopia::UID_ID,
00081         FCategories = Qtopia::CATEGORY_ID,
00082         FDescription /* = 0 Why this ? (eilers) */,
00083         FLocation,
00084         FType,
00085         FAlarm,
00086         FSound,
00087         FRType,
00088         FRWeekdays,
00089         FRPosition,
00090         FRFreq,
00091         FRHasEndDate,
00092         FREndDate,
00093         FRCreated,
00094         FRExceptions,
00095         FStart,
00096         FEnd,
00097         FNote,
00098         FTimeZone,
00099         FRecParent,
00100         FRecChildren,
00101     };
00102 
00106     OPimEvent( int uid = 0 );
00107 
00111     OPimEvent( const OPimEvent& );
00112 
00117     OPimEvent( const QMap<int, QString> map );
00118     ~OPimEvent();
00119     OPimEvent &operator=( const OPimEvent& );
00120 
00122     QString description() const;
00123     void setDescription( const QString& description );
00124 
00125     QString location() const;
00126     void setLocation( const QString& loc );
00128 
00130     bool hasNotifiers() const;
00131     OPimNotifyManager &notifiers() const;
00133 
00135     OPimRecurrence recurrence() const;
00136     void setRecurrence( const OPimRecurrence& );
00137     bool hasRecurrence() const;
00139 
00141     QString note() const;
00142     void setNote( const QString& note );
00144 
00145 
00146     QDateTime createdDateTime() const;
00147     void setCreatedDateTime( const QDateTime& dt );
00148 
00150     void setStartDateTime( const QDateTime& );
00152     QDateTime startDateTime() const;
00153 
00155     QDateTime startDateTimeInZone() const;
00156 
00158     void setEndDateTime( const QDateTime& );
00160     QDateTime endDateTime() const;
00161     QDateTime endDateTimeInZone() const;
00162 
00163     bool isMultipleDay() const;
00164     bool isAllDay() const;
00165     void setAllDay( bool isAllDay );
00166 
00167     /* pin this event to a timezone! FIXME */
00168     void setTimeZone( const QString& timeZone );
00169     QString timeZone() const;
00170 
00171 
00173 
00174     QArray<int> children() const;
00175     void setChildren( const QArray<int>& );
00176     void addChild( int uid );
00177     void removeChild( int uid );
00179 
00181     int parent() const;
00182     void setParent( int uid );
00183 
00184 
00185     /* needed reimp */
00187     virtual bool match( const QRegExp& ) const;
00188     QString toRichText() const;
00189     QString toShortText() const;
00190     QString type() const;
00191 
00192     QMap<int, QString> toMap() const;
00193     void fromMap( const QMap<int, QString>& map );
00194     QString recordField( int ) const;
00195 
00196     bool loadFromStream( QDataStream& );
00197     bool saveToStream( QDataStream& ) const;
00199 
00201     int rtti() const;
00202     static OPimEvent* safeCast( const OPimRecord* );
00204 
00205   /*    bool operator==( const OPimEvent& );
00206         bool operator!=( const OPimEvent& );
00207         bool operator<( const OPimEvent& );
00208         bool operator<=( const OPimEvent& );
00209         bool operator>( const OPimEvent& );
00210         bool operator>=(const OPimEvent& );
00211     */
00212 
00213   private:
00214     inline void changeOrModify();
00215     void deref();
00216     struct Data;
00217     Data* data;
00218     class Private;
00219     Private* priv;
00220 
00221 };
00222 }
00223 
00224 #endif

Generated on Sat Nov 5 16:16:20 2005 for OPIE by  doxygen 1.4.2