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

opimtodo.h

Go to the documentation of this file.
00001 /*
00002                             This file is part of the Opie Project
00003                             Copyright (C) The Main Author <main-author@whereever.org>
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 
00030 #ifndef OTODOEVENT_H
00031 #define OTODOEVENT_H
00032 
00033 /* OPIE */
00034 #include <opie2/opimrecord.h>
00035 #include <qpe/recordfields.h>
00036 #include <qpe/palmtopuidgen.h>
00037 
00038 /* QT */
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 //ADDITIONAL FOR RECORDFIELD
00078         DueDate,
00079     };
00080   public:
00081     // priorities from Very low to very high
00082     enum TaskPriority { VeryHigh = 1, High, Normal, Low, VeryLow };
00083 
00084     /* Constructs a new ToDoEvent
00085        @param completed Is the TodoEvent completed
00086        @param priority What is the priority of this ToDoEvent
00087        @param category Which category does it belong( uid )
00088        @param summary A small summary of the todo
00089        @param description What is this ToDoEvent about
00090        @param hasDate Does this Event got a deadline
00091        @param date what is the deadline?
00092        @param uid what is the UUID of this Event
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 /*empty*/ );
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 /* empty */ );
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      * FIXME check if the sharing is still fine!! -zecke
00206      * ### CHECK If API is fine
00207      */
00211     OPimNotifyManager &notifiers();
00212 
00216     const OPimNotifyManager &notifiers() 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     // FIXME we do not have these for start, completed
00241     // cause we'll use the isNull() of QDate for figuring
00242     // out if it's has a date...
00243     // decide what to do here? -zecke
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

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