author | zecke <zecke> | 2002-03-19 19:14:32 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-19 19:14:32 (UTC) |
commit | c23db0c35b77cc1656ac8822ca948e73c50e8ee6 (patch) (unidiff) | |
tree | f1f61cd24074a9ce60561e13681c386e89088dc9 /include | |
parent | 51762a579019d09fc1af83ef4838260493b534a7 (diff) | |
download | opie-c23db0c35b77cc1656ac8822ca948e73c50e8ee6.zip opie-c23db0c35b77cc1656ac8822ca948e73c50e8ee6.tar.gz opie-c23db0c35b77cc1656ac8822ca948e73c50e8ee6.tar.bz2 |
Make multiple backends possible
-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 | |||
@@ -6,11 +6,12 @@ | |||
6 | 6 | ||
7 | #include <opie/todoevent.h> | 7 | #include <opie/todoevent.h> |
8 | 8 | ||
9 | class ToDoResource; | ||
9 | class ToDoDB | 10 | class 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, |
@@ -27,11 +28,14 @@ class ToDoDB | |||
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 | }; |
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 | |||
@@ -29,6 +29,7 @@ class ToDoEvent { | |||
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); }; |
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 | |||
6 | class ToDoEvent; | ||
7 | class 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 | ||