-rw-r--r-- | libopie2/opiepim/otodo.h | 147 |
1 files changed, 76 insertions, 71 deletions
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h index 61add04..04dd269 100644 --- a/libopie2/opiepim/otodo.h +++ b/libopie2/opiepim/otodo.h | |||
@@ -1,61 +1,63 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #ifndef OPIE_TODO_EVENT_H | ||
30 | #define OPIE_TODO_EVENT_H | ||
31 | 29 | ||
30 | #ifndef OTODOEVENT_H | ||
31 | #define OTODOEVENT_H | ||
32 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/opimrecord.h> | ||
35 | #include <qpe/recordfields.h> | ||
36 | #include <qpe/palmtopuidgen.h> | ||
37 | |||
38 | /* QT */ | ||
33 | #include <qarray.h> | 39 | #include <qarray.h> |
34 | #include <qmap.h> | 40 | #include <qmap.h> |
35 | #include <qregexp.h> | 41 | #include <qregexp.h> |
36 | #include <qstringlist.h> | 42 | #include <qstringlist.h> |
37 | #include <qdatetime.h> | 43 | #include <qdatetime.h> |
38 | #include <qvaluelist.h> | 44 | #include <qvaluelist.h> |
39 | 45 | ||
40 | #include <qpe/recordfields.h> | 46 | namespace Opie |
41 | #include <qpe/palmtopuidgen.h> | 47 | { |
42 | |||
43 | #include <opie2/opimrecord.h> | ||
44 | |||
45 | |||
46 | namespace Opie { | ||
47 | 48 | ||
48 | class OPimState; | 49 | class OPimState; |
49 | class ORecur; | 50 | class ORecur; |
50 | class OPimMaintainer; | 51 | class OPimMaintainer; |
51 | class OPimNotifyManager; | 52 | class OPimNotifyManager; |
52 | class OTodo : public OPimRecord { | 53 | class OTodo : public OPimRecord |
53 | public: | 54 | { |
55 | public: | ||
54 | typedef QValueList<OTodo> ValueList; | 56 | typedef QValueList<OTodo> ValueList; |
55 | enum RecordFields { | 57 | enum RecordFields { |
56 | Uid = Qtopia::UID_ID, | 58 | Uid = Qtopia::UID_ID, |
57 | Category = Qtopia::CATEGORY_ID, | 59 | Category = Qtopia::CATEGORY_ID, |
58 | HasDate, | 60 | HasDate, |
59 | Completed, | 61 | Completed, |
60 | Description, | 62 | Description, |
61 | Summary, | 63 | Summary, |
@@ -69,19 +71,19 @@ public: | |||
69 | Recurrence, | 71 | Recurrence, |
70 | Alarms, | 72 | Alarms, |
71 | Reminders, | 73 | Reminders, |
72 | Notifiers, | 74 | Notifiers, |
73 | Maintainer, | 75 | Maintainer, |
74 | StartDate, | 76 | StartDate, |
75 | CompletedDate | 77 | CompletedDate |
76 | }; | 78 | }; |
77 | public: | 79 | public: |
78 | // priorities from Very low to very high | 80 | // priorities from Very low to very high |
79 | enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow }; | 81 | enum TaskPriority { VeryHigh = 1, High, Normal, Low, VeryLow }; |
80 | 82 | ||
81 | /* Constructs a new ToDoEvent | 83 | /* Constructs a new ToDoEvent |
82 | @param completed Is the TodoEvent completed | 84 | @param completed Is the TodoEvent completed |
83 | @param priority What is the priority of this ToDoEvent | 85 | @param priority What is the priority of this ToDoEvent |
84 | @param category Which category does it belong( uid ) | 86 | @param category Which category does it belong( uid ) |
85 | @param summary A small summary of the todo | 87 | @param summary A small summary of the todo |
86 | @param description What is this ToDoEvent about | 88 | @param description What is this ToDoEvent about |
87 | @param hasDate Does this Event got a deadline | 89 | @param hasDate Does this Event got a deadline |
@@ -96,158 +98,158 @@ public: | |||
96 | bool hasDate = false, QDate date = QDate::currentDate(), | 98 | bool hasDate = false, QDate date = QDate::currentDate(), |
97 | int uid = 0 /*empty*/ ); | 99 | int uid = 0 /*empty*/ ); |
98 | 100 | ||
99 | OTodo( bool completed, int priority, | 101 | OTodo( bool completed, int priority, |
100 | const QArray<int>& category, | 102 | const QArray<int>& category, |
101 | const QString& summary = QString::null, | 103 | const QString& summary = QString::null, |
102 | const QString& description = QString::null, | 104 | const QString& description = QString::null, |
103 | ushort progress = 0, | 105 | ushort progress = 0, |
104 | bool hasDate = false, QDate date = QDate::currentDate(), | 106 | bool hasDate = false, QDate date = QDate::currentDate(), |
105 | int uid = 0 /* empty */ ); | 107 | int uid = 0 /* empty */ ); |
106 | 108 | ||
107 | /** Copy c'tor | 109 | /** Copy c'tor |
108 | * | 110 | * |
109 | */ | 111 | */ |
110 | OTodo(const OTodo & ); | 112 | OTodo( const OTodo & ); |
111 | 113 | ||
112 | /** | 114 | /** |
113 | *destructor | 115 | *destructor |
114 | */ | 116 | */ |
115 | ~OTodo(); | 117 | ~OTodo(); |
116 | 118 | ||
117 | /** | 119 | /** |
118 | * Is this event completed? | 120 | * Is this event completed? |
119 | */ | 121 | */ |
120 | bool isCompleted() const; | 122 | bool isCompleted() const; |
121 | 123 | ||
122 | /** | 124 | /** |
123 | * Does this Event have a deadline | 125 | * Does this Event have a deadline |
124 | */ | 126 | */ |
125 | bool hasDueDate() const; | 127 | bool hasDueDate() const; |
126 | bool hasStartDate()const; | 128 | bool hasStartDate() const; |
127 | bool hasCompletedDate()const; | 129 | bool hasCompletedDate() const; |
128 | 130 | ||
129 | /** | 131 | /** |
130 | * What is the priority? | 132 | * What is the priority? |
131 | */ | 133 | */ |
132 | int priority()const ; | 134 | int priority() const ; |
133 | 135 | ||
134 | /** | 136 | /** |
135 | * progress as ushort 0, 20, 40, 60, 80 or 100% | 137 | * progress as ushort 0, 20, 40, 60, 80 or 100% |
136 | */ | 138 | */ |
137 | ushort progress() const; | 139 | ushort progress() const; |
138 | 140 | ||
139 | /** | 141 | /** |
140 | * The due Date | 142 | * The due Date |
141 | */ | 143 | */ |
142 | QDate dueDate()const; | 144 | QDate dueDate() const; |
143 | 145 | ||
144 | /** | 146 | /** |
145 | * When did it start? | 147 | * When did it start? |
146 | */ | 148 | */ |
147 | QDate startDate()const; | 149 | QDate startDate() const; |
148 | 150 | ||
149 | /** | 151 | /** |
150 | * When was it completed? | 152 | * When was it completed? |
151 | */ | 153 | */ |
152 | QDate completedDate()const; | 154 | QDate completedDate() const; |
153 | 155 | ||
154 | /** | 156 | /** |
155 | * does it have a state? | 157 | * does it have a state? |
156 | */ | 158 | */ |
157 | bool hasState()const; | 159 | bool hasState() const; |
158 | 160 | ||
159 | /** | 161 | /** |
160 | * What is the state of this OTodo? | 162 | * What is the state of this OTodo? |
161 | */ | 163 | */ |
162 | OPimState state()const; | 164 | OPimState state() const; |
163 | 165 | ||
164 | /** | 166 | /** |
165 | * has recurrence? | 167 | * has recurrence? |
166 | */ | 168 | */ |
167 | bool hasRecurrence()const; | 169 | bool hasRecurrence() const; |
168 | 170 | ||
169 | /** | 171 | /** |
170 | * the recurrance of this | 172 | * the recurrance of this |
171 | */ | 173 | */ |
172 | ORecur recurrence()const; | 174 | ORecur recurrence() const; |
173 | 175 | ||
174 | /** | 176 | /** |
175 | * does this OTodo have a maintainer? | 177 | * does this OTodo have a maintainer? |
176 | */ | 178 | */ |
177 | bool hasMaintainer()const; | 179 | bool hasMaintainer() const; |
178 | 180 | ||
179 | /** | 181 | /** |
180 | * the Maintainer of this OTodo | 182 | * the Maintainer of this OTodo |
181 | */ | 183 | */ |
182 | OPimMaintainer maintainer()const; | 184 | OPimMaintainer maintainer() const; |
183 | 185 | ||
184 | /** | 186 | /** |
185 | * The description of the todo | 187 | * The description of the todo |
186 | */ | 188 | */ |
187 | QString description()const; | 189 | QString description() const; |
188 | 190 | ||
189 | /** | 191 | /** |
190 | * A small summary of the todo | 192 | * A small summary of the todo |
191 | */ | 193 | */ |
192 | QString summary() const; | 194 | QString summary() const; |
193 | 195 | ||
194 | /** | 196 | /** |
195 | * @reimplemented | 197 | * @reimplemented |
196 | * Return this todoevent in a RichText formatted QString | 198 | * Return this todoevent in a RichText formatted QString |
197 | */ | 199 | */ |
198 | QString toRichText() const; | 200 | QString toRichText() const; |
199 | 201 | ||
200 | bool hasNotifiers()const; | 202 | bool hasNotifiers() const; |
201 | /* | 203 | /* |
202 | * FIXME check if the sharing is still fine!! -zecke | 204 | * FIXME check if the sharing is still fine!! -zecke |
203 | * ### CHECK If API is fine | 205 | * ### CHECK If API is fine |
204 | */ | 206 | */ |
205 | /** | 207 | /** |
206 | * return a reference to our notifiers... | 208 | * return a reference to our notifiers... |
207 | */ | 209 | */ |
208 | OPimNotifyManager ¬ifiers(); | 210 | OPimNotifyManager ¬ifiers(); |
209 | 211 | ||
210 | /** | 212 | /** |
211 | * | 213 | * |
212 | */ | 214 | */ |
213 | const OPimNotifyManager ¬ifiers()const; | 215 | const OPimNotifyManager ¬ifiers() const; |
214 | 216 | ||
215 | /** | 217 | /** |
216 | * reimplementations | 218 | * reimplementations |
217 | */ | 219 | */ |
218 | QString type()const; | 220 | QString type() const; |
219 | QString toShortText()const; | 221 | QString toShortText() const; |
220 | QString recordField(int id )const; | 222 | QString recordField( int id ) const; |
221 | 223 | ||
222 | /** | 224 | /** |
223 | * toMap puts all data into the map. int relates | 225 | * toMap puts all data into the map. int relates |
224 | * to ToDoEvent RecordFields enum | 226 | * to ToDoEvent RecordFields enum |
225 | */ | 227 | */ |
226 | QMap<int, QString> toMap()const; | 228 | QMap<int, QString> toMap() const; |
227 | 229 | ||
228 | /** | 230 | /** |
229 | * Set if this Todo is completed | 231 | * Set if this Todo is completed |
230 | */ | 232 | */ |
231 | void setCompleted(bool completed ); | 233 | void setCompleted( bool completed ); |
232 | 234 | ||
233 | /** | 235 | /** |
234 | * set if this todo got an end data | 236 | * set if this todo got an end data |
235 | */ | 237 | */ |
236 | void setHasDueDate( bool hasDate ); | 238 | void setHasDueDate( bool hasDate ); |
237 | // FIXME we do not have these for start, completed | 239 | // FIXME we do not have these for start, completed |
238 | // cause we'll use the isNull() of QDate for figuring | 240 | // cause we'll use the isNull() of QDate for figuring |
239 | // out if it's has a date... | 241 | // out if it's has a date... |
240 | // decide what to do here? -zecke | 242 | // decide what to do here? -zecke |
241 | 243 | ||
242 | /** | 244 | /** |
243 | * Set the priority of the Todo | 245 | * Set the priority of the Todo |
244 | */ | 246 | */ |
245 | void setPriority(int priority ); | 247 | void setPriority( int priority ); |
246 | 248 | ||
247 | /** | 249 | /** |
248 | * Set the progress. | 250 | * Set the progress. |
249 | */ | 251 | */ |
250 | void setProgress( ushort progress ); | 252 | void setProgress( ushort progress ); |
251 | 253 | ||
252 | /** | 254 | /** |
253 | * set the end date | 255 | * set the end date |
@@ -261,55 +263,58 @@ public: | |||
261 | 263 | ||
262 | /** | 264 | /** |
263 | * set the completed date | 265 | * set the completed date |
264 | */ | 266 | */ |
265 | void setCompletedDate( const QDate& date ); | 267 | void setCompletedDate( const QDate& date ); |
266 | 268 | ||
267 | void setRecurrence( const ORecur& ); | 269 | void setRecurrence( const ORecur& ); |
268 | 270 | ||
269 | void setDescription(const QString& ); | 271 | void setDescription( const QString& ); |
270 | void setSummary(const QString& ); | 272 | void setSummary( const QString& ); |
271 | 273 | ||
272 | /** | 274 | /** |
273 | * set the state of a Todo | 275 | * set the state of a Todo |
274 | * @param state State what the todo should take | 276 | * @param state State what the todo should take |
275 | */ | 277 | */ |
276 | void setState( const OPimState& state); | 278 | void setState( const OPimState& state ); |
277 | 279 | ||
278 | /** | 280 | /** |
279 | * set the Maintainer Mode | 281 | * set the Maintainer Mode |
280 | */ | 282 | */ |
281 | void setMaintainer( const OPimMaintainer& ); | 283 | void setMaintainer( const OPimMaintainer& ); |
282 | 284 | ||
283 | bool isOverdue(); | 285 | bool isOverdue(); |
284 | 286 | ||
285 | 287 | ||
286 | virtual bool match( const QRegExp &r )const; | 288 | virtual bool match( const QRegExp &r ) const; |
287 | 289 | ||
288 | bool operator<(const OTodo &toDoEvent )const; | 290 | bool operator<( const OTodo &toDoEvent ) const; |
289 | bool operator<=(const OTodo &toDoEvent )const; | 291 | bool operator<=( const OTodo &toDoEvent ) const; |
290 | bool operator!=(const OTodo &toDoEvent )const; | 292 | bool operator!=( const OTodo &toDoEvent ) const; |
291 | bool operator>(const OTodo &toDoEvent )const; | 293 | bool operator>( const OTodo &toDoEvent ) const; |
292 | bool operator>=(const OTodo &toDoEvent)const; | 294 | bool operator>=( const OTodo &toDoEvent ) const; |
293 | bool operator==(const OTodo &toDoEvent )const; | 295 | bool operator==( const OTodo &toDoEvent ) const; |
294 | OTodo &operator=(const OTodo &toDoEvent ); | 296 | OTodo &operator=( const OTodo &toDoEvent ); |
295 | 297 | ||
296 | static int rtti(); | 298 | static int rtti(); |
297 | 299 | ||
298 | private: | 300 | private: |
299 | class OTodoPrivate; | 301 | class OTodoPrivate; |
300 | struct OTodoData; | 302 | struct OTodoData; |
301 | 303 | ||
302 | void deref(); | 304 | void deref(); |
303 | inline void changeOrModify(); | 305 | inline void changeOrModify(); |
304 | void copy( OTodoData* src, OTodoData* dest ); | 306 | void copy( OTodoData* src, OTodoData* dest ); |
305 | OTodoPrivate *d; | 307 | OTodoPrivate *d; |
306 | OTodoData *data; | 308 | OTodoData *data; |
307 | 309 | ||
308 | }; | 310 | }; |
309 | inline bool OTodo::operator!=(const OTodo &toDoEvent )const { | 311 | |
310 | return !(*this == toDoEvent); | 312 | |
313 | inline bool OTodo::operator!=( const OTodo &toDoEvent ) const | ||
314 | { | ||
315 | return !( *this == toDoEvent ); | ||
311 | } | 316 | } |
312 | 317 | ||
313 | } | 318 | } |
314 | 319 | ||
315 | #endif | 320 | #endif |