-rw-r--r-- | include/opie/tododb.h | 6 | ||||
-rw-r--r-- | include/opie/todoevent.h | 1 | ||||
-rw-r--r-- | include/opie/todoresource.h | 14 |
3 files changed, 20 insertions, 1 deletions
diff --git a/include/opie/tododb.h b/include/opie/tododb.h index 6478363..945f343 100644 --- a/include/opie/tododb.h +++ b/include/opie/tododb.h @@ -1,40 +1,44 @@ #ifndef tododb_h #define tododb_h #include <qvaluelist.h> #include <opie/todoevent.h> +class ToDoResource; class ToDoDB { public: // if no argument is supplied pick the default book - ToDoDB(const QString &fileName = QString::null ); + ToDoDB(const QString &fileName = QString::null, ToDoResource* resource= 0 ); ~ToDoDB(); QValueList<ToDoEvent> effectiveToDos(const QDate &from, const QDate &to, bool includeNoDates = true); QValueList<ToDoEvent> effectiveToDos(const QDate &start, bool includeNoDates = true ); QValueList<ToDoEvent> rawToDos(); // all events QValueList<ToDoEvent> 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(); + ToDoResource *resource(); + void setResource(ToDoResource* res); private: class ToDoDBPrivate; ToDoDBPrivate *d; QString m_fileName; + ToDoResource *m_res; QValueList<ToDoEvent> m_todos; void load(); }; #endif diff --git a/include/opie/todoevent.h b/include/opie/todoevent.h index dd8c0c9..79522b2 100644 --- a/include/opie/todoevent.h +++ b/include/opie/todoevent.h @@ -16,32 +16,33 @@ class ToDoEvent { 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(); + void setUid(int id) {m_uid = id; }; 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; diff --git a/include/opie/todoresource.h b/include/opie/todoresource.h new file mode 100644 index 0000000..34edb04 --- a/dev/null +++ b/include/opie/todoresource.h @@ -0,0 +1,14 @@ + + +#ifndef opietodoresource_h +#define opietodoresource_h + +class ToDoEvent; +class ToDoResource { + public: + ToDoResource( ) {}; + virtual QValueList<ToDoEvent> load(const QString &file ) = 0; + virtual bool save( const QString &file, const QValueList<ToDoEvent> & ) = 0; +}; + +#endif |