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