libkcal

todo.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef KCAL_TODO_H
00022 #define KCAL_TODO_H
00023 
00024 #include "incidence.h"
00025 
00026 namespace KCal {
00027 
00031 class LIBKCAL_EXPORT Todo : public Incidence
00032 {
00033   public:
00034     typedef ListBase<Todo> List;
00035 
00036     Todo();
00037     Todo( const Todo & );
00038     ~Todo();
00039     Todo& operator=( const Todo& );
00040     bool operator==( const Todo& ) const;
00041 
00042     QCString type() const { return "Todo"; }
00043 
00048     Todo *clone();
00049 
00056     void setDtDue(const QDateTime &dtDue, bool first = false);
00065     QDateTime dtDue( bool first = false ) const;
00070     QString dtDueTimeStr() const;
00078     QString dtDueDateStr( bool shortfmt = true ) const;
00083     QString dtDueStr() const;
00084 
00088     bool hasDueDate() const;
00094     void setHasDueDate( bool hasDueDate );
00095 
00099     bool hasStartDate() const;
00105     void setHasStartDate( bool hasStartDate );
00106 
00114     QDateTime dtStart( bool first = false ) const;
00115 
00119     void setDtStart( const QDateTime &dtStart );
00120 
00128     QString dtStartTimeStr( bool first = false ) const;
00138     QString dtStartDateStr( bool shortfmt = true, bool first = false ) const;
00146     QString dtStartStr( bool first = false ) const;
00147 
00151     bool isCompleted() const;
00158     void setCompleted( bool completed );
00159 
00164     int percentComplete() const;
00169     void setPercentComplete( int );
00170 
00174     QDateTime completed() const;
00179     QString completedStr() const;
00183     void setCompleted( const QDateTime &completed );
00184 
00189     bool hasCompletedDate() const;
00190 
00194     void setDtRecurrence( const QDateTime &dt );
00195 
00199     QDateTime dtRecurrence() const;
00200 
00207     virtual bool recursOn( const QDate &date ) const;
00208 
00213       bool isOverdue() const;
00214 
00215   protected:
00217     virtual QDateTime endDateRecurrenceBase() const { return dtDue(); }
00218 
00219   private:
00220     bool accept(Visitor &v) { return v.visit( this ); }
00222     bool recurTodo();
00223 
00224     QDateTime mDtDue;                    // due date of todo
00225                                          // (first occurrence if recurrent)
00226     QDateTime mDtRecurrence;             // due date of recurrence
00227 
00228     bool mHasDueDate;                    // if todo has associated due date
00229     bool mHasStartDate;                  // if todo has associated start date
00230 
00231     QDateTime mCompleted;
00232     bool mHasCompletedDate;
00233 
00234     int mPercentComplete;
00235 
00236     class Private;
00237     Private *d;
00238 };
00239 
00240 }
00241 
00242 #endif