00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef OTODOEVENT_H
00031 #define OTODOEVENT_H
00032
00033
00034 #include <opie2/opimrecord.h>
00035 #include <qpe/recordfields.h>
00036 #include <qpe/palmtopuidgen.h>
00037
00038
00039 #include <qarray.h>
00040 #include <qmap.h>
00041 #include <qregexp.h>
00042 #include <qstringlist.h>
00043 #include <qdatetime.h>
00044 #include <qvaluelist.h>
00045
00046 namespace Opie
00047 {
00048
00049 class OPimState;
00050 class OPimRecurrence;
00051 class OPimMaintainer;
00052 class OPimNotifyManager;
00053 class OPimTodo : public OPimRecord
00054 {
00055 public:
00056 typedef QValueList<OPimTodo> ValueList;
00057 enum RecordFields {
00058 Uid = Qtopia::UID_ID,
00059 Category = Qtopia::CATEGORY_ID,
00060 HasDate,
00061 Completed,
00062 Description,
00063 Summary,
00064 Priority,
00065 DateDay,
00066 DateMonth,
00067 DateYear,
00068 Progress,
00069 CrossReference,
00070 State,
00071 Recurrence,
00072 Alarms,
00073 Reminders,
00074 Maintainer,
00075 StartDate,
00076 CompletedDate,
00077
00078 DueDate,
00079 };
00080 public:
00081
00082 enum TaskPriority { VeryHigh = 1, High, Normal, Low, VeryLow };
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 OPimTodo( bool completed = false, int priority = Normal,
00095 const QStringList &category = QStringList(),
00096 const QString &summary = QString::null ,
00097 const QString &description = QString::null,
00098 ushort progress = 0,
00099 bool hasDate = false, QDate date = QDate::currentDate(),
00100 int uid = 0 );
00101
00102 OPimTodo( bool completed, int priority,
00103 const QArray<int>& category,
00104 const QString& summary = QString::null,
00105 const QString& description = QString::null,
00106 ushort progress = 0,
00107 bool hasDate = false, QDate date = QDate::currentDate(),
00108 int uid = 0 );
00109
00113 OPimTodo( const OPimTodo & );
00114
00118 ~OPimTodo();
00119
00123 bool isCompleted() const;
00124
00128 bool hasDueDate() const;
00129 bool hasStartDate() const;
00130 bool hasCompletedDate() const;
00131
00135 int priority() const ;
00136
00140 ushort progress() const;
00141
00145 QDate dueDate() const;
00146
00150 QDate startDate() const;
00151
00155 QDate completedDate() const;
00156
00160 bool hasState() const;
00161
00165 OPimState state() const;
00166
00170 bool hasRecurrence() const;
00171
00175 OPimRecurrence recurrence() const;
00176
00180 bool hasMaintainer() const;
00181
00185 OPimMaintainer maintainer() const;
00186
00190 QString description() const;
00191
00195 QString summary() const;
00196
00201 QString toRichText() const;
00202
00203 bool hasNotifiers() const;
00204
00205
00206
00207
00211 OPimNotifyManager ¬ifiers();
00212
00216 const OPimNotifyManager ¬ifiers() const;
00217
00221 QString type() const;
00222 QString toShortText() const;
00223 QString recordField( int id ) const;
00224
00229 QMap<int, QString> toMap() const;
00230
00234 void setCompleted( bool completed );
00235
00239 void setHasDueDate( bool hasDate );
00240
00241
00242
00243
00244
00248 void setPriority( int priority );
00249
00253 void setProgress( ushort progress );
00254
00258 void setDueDate( const QDate& date );
00259
00263 void setStartDate( const QDate& date );
00264
00268 void setCompletedDate( const QDate& date );
00269
00270 void setRecurrence( const OPimRecurrence& );
00271
00272 void setDescription( const QString& );
00273 void setSummary( const QString& );
00274
00279 void setState( const OPimState& state );
00280
00284 void setMaintainer( const OPimMaintainer& );
00285
00286 bool isOverdue()const;
00287
00288
00289 virtual bool match( const QRegExp &r ) const;
00290
00291 bool operator<( const OPimTodo &toDoEvent ) const;
00292 bool operator<=( const OPimTodo &toDoEvent ) const;
00293 bool operator!=( const OPimTodo &toDoEvent ) const;
00294 bool operator>( const OPimTodo &toDoEvent ) const;
00295 bool operator>=( const OPimTodo &toDoEvent ) const;
00296 bool operator==( const OPimTodo &toDoEvent ) const;
00297 OPimTodo &operator=( const OPimTodo &toDoEvent );
00298
00300 int rtti() const;
00301 static OPimTodo* safeCast( const OPimRecord* );
00303
00304
00305 private:
00306 class OPimTodoPrivate;
00307 struct OPimTodoData;
00308
00309 void deref();
00310 inline void changeOrModify();
00311 void copy( OPimTodoData* src, OPimTodoData* dest );
00312 OPimTodoPrivate *d;
00313 OPimTodoData *data;
00314
00315 };
00316
00317
00318 inline bool OPimTodo::operator!=( const OPimTodo &toDoEvent ) const
00319 {
00320 return !( *this == toDoEvent );
00321 }
00322
00323 }
00324
00325 #endif