summaryrefslogtreecommitdiff
path: root/include/opie
Unidiff
Diffstat (limited to 'include/opie') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opie/tododb.h6
-rw-r--r--include/opie/todoevent.h1
-rw-r--r--include/opie/todoresource.h14
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 @@
1 1
2#ifndef tododb_h 2#ifndef tododb_h
3#define tododb_h 3#define tododb_h
4 4
5#include <qvaluelist.h> 5#include <qvaluelist.h>
6 6
7#include <opie/todoevent.h> 7#include <opie/todoevent.h>
8 8
9class ToDoResource;
9class ToDoDB 10class ToDoDB
10{ 11{
11 public: 12 public:
12 // if no argument is supplied pick the default book 13 // if no argument is supplied pick the default book
13 ToDoDB(const QString &fileName = QString::null ); 14 ToDoDB(const QString &fileName = QString::null, ToDoResource* resource= 0 );
14 ~ToDoDB(); 15 ~ToDoDB();
15 QValueList<ToDoEvent> effectiveToDos(const QDate &from, 16 QValueList<ToDoEvent> effectiveToDos(const QDate &from,
16 const QDate &to, 17 const QDate &to,
17 bool includeNoDates = true); 18 bool includeNoDates = true);
18 QValueList<ToDoEvent> effectiveToDos(const QDate &start, bool includeNoDates = true ); 19 QValueList<ToDoEvent> effectiveToDos(const QDate &start, bool includeNoDates = true );
19 QValueList<ToDoEvent> rawToDos(); // all events 20 QValueList<ToDoEvent> rawToDos(); // all events
20 QValueList<ToDoEvent> overDue(); 21 QValueList<ToDoEvent> overDue();
21 22
22 void addEvent(const ToDoEvent &event ); 23 void addEvent(const ToDoEvent &event );
23 void editEvent(const ToDoEvent &editEvent ); 24 void editEvent(const ToDoEvent &editEvent );
24 void removeEvent(const ToDoEvent &event); 25 void removeEvent(const ToDoEvent &event);
25 26
26 void reload(); 27 void reload();
27 void setFileName(const QString & ); 28 void setFileName(const QString & );
28 QString fileName()const; 29 QString fileName()const;
29 bool save(); 30 bool save();
31 ToDoResource *resource();
32 void setResource(ToDoResource* res);
30 33
31 private: 34 private:
32 class ToDoDBPrivate; 35 class ToDoDBPrivate;
33 ToDoDBPrivate *d; 36 ToDoDBPrivate *d;
34 QString m_fileName; 37 QString m_fileName;
38 ToDoResource *m_res;
35 QValueList<ToDoEvent> m_todos; 39 QValueList<ToDoEvent> m_todos;
36 void load(); 40 void load();
37}; 41};
38 42
39 43
40#endif 44#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
@@ -1,52 +1,53 @@
1 1
2#ifndef todoevent_h 2#ifndef todoevent_h
3#define todoevent_h 3#define todoevent_h
4 4
5#include <qdatetime.h> 5#include <qdatetime.h>
6 6
7class ToDoEvent { 7class ToDoEvent {
8 friend class ToDoDB; 8 friend class ToDoDB;
9 public: 9 public:
10 enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW }; 10 enum Priority { VERYHIGH=1, HIGH, NORMAL, LOW, VERYLOW };
11 ToDoEvent( bool completed = false, int priority = NORMAL, 11 ToDoEvent( bool completed = false, int priority = NORMAL,
12 const QString &category = QString::null, 12 const QString &category = QString::null,
13 const QString &description = QString::null , 13 const QString &description = QString::null ,
14 bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); 14 bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 );
15 bool isCompleted() const; 15 bool isCompleted() const;
16 bool hasDate() const; 16 bool hasDate() const;
17 int priority()const ; 17 int priority()const ;
18 QString category()const; 18 QString category()const;
19 QDate date()const; 19 QDate date()const;
20 QString description()const; 20 QString description()const;
21 21
22 int uid()const { return m_uid;}; 22 int uid()const { return m_uid;};
23 void setCompleted(bool completed ); 23 void setCompleted(bool completed );
24 void setHasDate( bool hasDate ); 24 void setHasDate( bool hasDate );
25 // if the category doesn't exist we will create it 25 // if the category doesn't exist we will create it
26 void setCategory( const QString &category ); 26 void setCategory( const QString &category );
27 void setPriority(int priority ); 27 void setPriority(int priority );
28 void setDate( QDate date ); 28 void setDate( QDate date );
29 void setDescription(const QString& ); 29 void setDescription(const QString& );
30 bool isOverdue(); 30 bool isOverdue();
31 31
32 void setUid(int id) {m_uid = id; };
32 bool operator<(const ToDoEvent &toDoEvent )const; 33 bool operator<(const ToDoEvent &toDoEvent )const;
33 bool operator<=(const ToDoEvent &toDoEvent )const; 34 bool operator<=(const ToDoEvent &toDoEvent )const;
34 bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); }; 35 bool operator!=(const ToDoEvent &toDoEvent )const { return !(*this == toDoEvent); };
35 bool operator>(const ToDoEvent &toDoEvent )const; 36 bool operator>(const ToDoEvent &toDoEvent )const;
36 bool operator>=(const ToDoEvent &toDoEvent)const; 37 bool operator>=(const ToDoEvent &toDoEvent)const;
37 bool operator==(const ToDoEvent &toDoEvent )const; 38 bool operator==(const ToDoEvent &toDoEvent )const;
38 ToDoEvent &operator=(const ToDoEvent &toDoEvent ); 39 ToDoEvent &operator=(const ToDoEvent &toDoEvent );
39 private: 40 private:
40 class ToDoEventPrivate; 41 class ToDoEventPrivate;
41 ToDoEventPrivate *d; 42 ToDoEventPrivate *d;
42 QDate m_date; 43 QDate m_date;
43 bool m_isCompleted:1; 44 bool m_isCompleted:1;
44 bool m_hasDate:1; 45 bool m_hasDate:1;
45 int m_priority; 46 int m_priority;
46 QString m_category; 47 QString m_category;
47 QString m_desc; 48 QString m_desc;
48 int m_uid; 49 int m_uid;
49}; 50};
50 51
51 52
52#endif 53#endif
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 @@
1
2
3#ifndef opietodoresource_h
4#define opietodoresource_h
5
6class ToDoEvent;
7class ToDoResource {
8 public:
9 ToDoResource( ) {};
10 virtual QValueList<ToDoEvent> load(const QString &file ) = 0;
11 virtual bool save( const QString &file, const QValueList<ToDoEvent> & ) = 0;
12};
13
14#endif