From 0a553fa7c46beb00d2a852ecf61233569b5a5e4e Mon Sep 17 00:00:00 2001 From: harlekin Date: Mon, 18 Mar 2002 21:24:16 +0000 Subject: tododb - simular to datebookdb but for todos, initial import --- (limited to 'include') diff --git a/include/opie/tododb.h b/include/opie/tododb.h new file mode 100644 index 0000000..6478363 --- a/dev/null +++ b/include/opie/tododb.h @@ -0,0 +1,40 @@ + +#ifndef tododb_h +#define tododb_h + +#include + +#include + +class ToDoDB +{ + public: + // if no argument is supplied pick the default book + ToDoDB(const QString &fileName = QString::null ); + ~ToDoDB(); + QValueList effectiveToDos(const QDate &from, + const QDate &to, + bool includeNoDates = true); + QValueList effectiveToDos(const QDate &start, bool includeNoDates = true ); + QValueList rawToDos(); // all events + QValueList overDue(); + + void addEvent(const ToDoEvent &event ); + void editEvent(const ToDoEvent &editEvent ); + void removeEvent(const ToDoEvent &event); + + void reload(); + void setFileName(const QString & ); + QString fileName()const; + bool save(); + + private: + class ToDoDBPrivate; + ToDoDBPrivate *d; + QString m_fileName; + QValueList m_todos; + void load(); +}; + + +#endif diff --git a/include/opie/todoevent.h b/include/opie/todoevent.h new file mode 100644 index 0000000..dd8c0c9 --- a/dev/null +++ b/include/opie/todoevent.h @@ -0,0 +1,52 @@ + +#ifndef todoevent_h +#define todoevent_h + +#include + +class ToDoEvent { + friend class ToDoDB; + public: + enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW }; + ToDoEvent( bool completed = false, int priority = NORMAL, + const QString &category = QString::null, + const QString &description = QString::null , + bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); + bool isCompleted() const; + bool hasDate() const; + int priority()const ; + QString category()const; + QDate date()const; + QString description()const; + + int uid()const { return m_uid;}; + void setCompleted(bool completed ); + void setHasDate( bool hasDate ); + // if the category doesn't exist we will create it + void setCategory( const QString &category ); + void setPriority(int priority ); + void setDate( QDate date ); + void setDescription(const QString& ); + bool isOverdue(); + + bool operator<(const ToDoEvent &toDoEvent )const; + bool operator<=(const ToDoEvent &toDoEvent )const; + bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); }; + bool operator>(const ToDoEvent &toDoEvent )const; + bool operator>=(const ToDoEvent &toDoEvent)const; + bool operator==(const ToDoEvent &toDoEvent )const; + ToDoEvent &operator=(const ToDoEvent &toDoEvent ); + private: + class ToDoEventPrivate; + ToDoEventPrivate *d; + QDate m_date; + bool m_isCompleted:1; + bool m_hasDate:1; + int m_priority; + QString m_category; + QString m_desc; + int m_uid; +}; + + +#endif -- cgit v0.9.0.2