author | zecke <zecke> | 2002-11-30 11:28:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-30 11:28:47 (UTC) |
commit | 9b8b30fa6cbdf1424b29cde21fae112e8bf96e6d (patch) (unidiff) | |
tree | 896dd858dc2ec2f0b7e1b265cae66ccceecc82da /libopie/pim/otodo.cpp | |
parent | 599c58c6ab2ab936890cbbfa4e6299493c141f8a (diff) | |
download | opie-9b8b30fa6cbdf1424b29cde21fae112e8bf96e6d.zip opie-9b8b30fa6cbdf1424b29cde21fae112e8bf96e6d.tar.gz opie-9b8b30fa6cbdf1424b29cde21fae112e8bf96e6d.tar.bz2 |
More infrastructure
ORecur has now the nextOccurence function
exceptions
We've now Notifers like Alarms and DatebookEntries
we may add to execute applications...
AppName replaced with service cause it is a service
Add rtti to OPimRecord as a static function
This is used inside the BackEnd classes to static_cast...
added removeAllCompleted to the todobackends...
add a common Opie PIM mainwindow which takes care of some simple
scripting enchangements..
much more
-rw-r--r-- | libopie/pim/otodo.cpp | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 6fcf9f6..ece624a 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "opimstate.h" | 15 | #include "opimstate.h" |
16 | #include "orecur.h" | 16 | #include "orecur.h" |
17 | #include "opimmaintainer.h" | 17 | #include "opimmaintainer.h" |
18 | #include "opimnotifymanager.h" | ||
18 | 19 | ||
19 | #include "otodo.h" | 20 | #include "otodo.h" |
20 | 21 | ||
@@ -31,11 +32,12 @@ struct OTodo::OTodoData : public QShared { | |||
31 | QString sum; | 32 | QString sum; |
32 | QMap<QString, QString> extra; | 33 | QMap<QString, QString> extra; |
33 | ushort prog; | 34 | ushort prog; |
34 | bool hasAlarmDateTime :1; | ||
35 | QDateTime alarmDateTime; | ||
36 | OPimState state; | 35 | OPimState state; |
37 | ORecur recur; | 36 | ORecur recur; |
38 | OPimMaintainer maintainer; | 37 | OPimMaintainer maintainer; |
38 | QDate start; | ||
39 | QDate completed; | ||
40 | OPimNotifyManager notifiers; | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | OTodo::OTodo(const OTodo &event ) | 43 | OTodo::OTodo(const OTodo &event ) |
@@ -73,8 +75,6 @@ OTodo::OTodo(bool completed, int priority, | |||
73 | data->sum = summary; | 75 | data->sum = summary; |
74 | data->prog = progress; | 76 | data->prog = progress; |
75 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 77 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
76 | data->hasAlarmDateTime = false; | ||
77 | |||
78 | } | 78 | } |
79 | OTodo::OTodo(bool completed, int priority, | 79 | OTodo::OTodo(bool completed, int priority, |
80 | const QStringList &category, | 80 | const QStringList &category, |
@@ -96,8 +96,6 @@ OTodo::OTodo(bool completed, int priority, | |||
96 | data->sum = summary; | 96 | data->sum = summary; |
97 | data->prog = progress; | 97 | data->prog = progress; |
98 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 98 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
99 | data->hasAlarmDateTime = false; | ||
100 | |||
101 | } | 99 | } |
102 | bool OTodo::match( const QRegExp ®Exp )const | 100 | bool OTodo::match( const QRegExp ®Exp )const |
103 | { | 101 | { |
@@ -120,9 +118,11 @@ bool OTodo::hasDueDate() const | |||
120 | { | 118 | { |
121 | return data->hasDate; | 119 | return data->hasDate; |
122 | } | 120 | } |
123 | bool OTodo::hasAlarmDateTime() const | 121 | bool OTodo::hasStartDate()const { |
124 | { | 122 | return data->start.isValid(); |
125 | return data->hasAlarmDateTime; | 123 | } |
124 | bool OTodo::hasCompletedDate()const { | ||
125 | return data->completed.isValid(); | ||
126 | } | 126 | } |
127 | int OTodo::priority()const | 127 | int OTodo::priority()const |
128 | { | 128 | { |
@@ -140,12 +140,12 @@ QDate OTodo::dueDate()const | |||
140 | { | 140 | { |
141 | return data->date; | 141 | return data->date; |
142 | } | 142 | } |
143 | 143 | QDate OTodo::startDate()const { | |
144 | QDateTime OTodo::alarmDateTime() const | 144 | return data->start; |
145 | { | 145 | } |
146 | return data->alarmDateTime; | 146 | QDate OTodo::completedDate()const { |
147 | return data->completed; | ||
147 | } | 148 | } |
148 | |||
149 | QString OTodo::description()const | 149 | QString OTodo::description()const |
150 | { | 150 | { |
151 | return data->desc; | 151 | return data->desc; |
@@ -169,11 +169,6 @@ void OTodo::setHasDueDate( bool hasDate ) | |||
169 | changeOrModify(); | 169 | changeOrModify(); |
170 | data->hasDate = hasDate; | 170 | data->hasDate = hasDate; |
171 | } | 171 | } |
172 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | ||
173 | { | ||
174 | changeOrModify(); | ||
175 | data->hasAlarmDateTime = hasAlarmDateTime; | ||
176 | } | ||
177 | void OTodo::setDescription(const QString &desc ) | 172 | void OTodo::setDescription(const QString &desc ) |
178 | { | 173 | { |
179 | // qWarning( "desc " + desc ); | 174 | // qWarning( "desc " + desc ); |
@@ -190,15 +185,18 @@ void OTodo::setPriority(int prio ) | |||
190 | changeOrModify(); | 185 | changeOrModify(); |
191 | data->priority = prio; | 186 | data->priority = prio; |
192 | } | 187 | } |
193 | void OTodo::setDueDate( QDate date ) | 188 | void OTodo::setDueDate( const QDate& date ) |
194 | { | 189 | { |
195 | changeOrModify(); | 190 | changeOrModify(); |
196 | data->date = date; | 191 | data->date = date; |
197 | } | 192 | } |
198 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) | 193 | void OTodo::setStartDate( const QDate& date ) { |
199 | { | ||
200 | changeOrModify(); | 194 | changeOrModify(); |
201 | data->alarmDateTime = alarm; | 195 | data->start = date; |
196 | } | ||
197 | void OTodo::setCompletedDate( const QDate& date ) { | ||
198 | changeOrModify(); | ||
199 | data->completed = date; | ||
202 | } | 200 | } |
203 | void OTodo::setState( const OPimState& state ) { | 201 | void OTodo::setState( const OPimState& state ) { |
204 | changeOrModify(); | 202 | changeOrModify(); |
@@ -254,11 +252,6 @@ QString OTodo::toRichText() const | |||
254 | text += dueDate().toString(); | 252 | text += dueDate().toString(); |
255 | text += "<br>"; | 253 | text += "<br>"; |
256 | } | 254 | } |
257 | if (hasAlarmDateTime() ){ | ||
258 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; | ||
259 | text += alarmDateTime().toString(); | ||
260 | text += "<br>"; | ||
261 | } | ||
262 | 255 | ||
263 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 256 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
264 | text += categoryNames().join(", "); | 257 | text += categoryNames().join(", "); |
@@ -266,6 +259,9 @@ QString OTodo::toRichText() const | |||
266 | 259 | ||
267 | return text; | 260 | return text; |
268 | } | 261 | } |
262 | OPimNotifyManager& OTodo::notifiers() { | ||
263 | return data->notifiers; | ||
264 | } | ||
269 | 265 | ||
270 | bool OTodo::operator<( const OTodo &toDoEvent )const{ | 266 | bool OTodo::operator<( const OTodo &toDoEvent )const{ |
271 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 267 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
@@ -327,10 +323,6 @@ bool OTodo::operator==(const OTodo &toDoEvent )const | |||
327 | if ( data->date != toDoEvent.data->date ) return false; | 323 | if ( data->date != toDoEvent.data->date ) return false; |
328 | if ( data->sum != toDoEvent.data->sum ) return false; | 324 | if ( data->sum != toDoEvent.data->sum ) return false; |
329 | if ( data->desc != toDoEvent.data->desc ) return false; | 325 | if ( data->desc != toDoEvent.data->desc ) return false; |
330 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) | ||
331 | return false; | ||
332 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) | ||
333 | return false; | ||
334 | if ( data->maintainer != toDoEvent.data->maintainer ) | 326 | if ( data->maintainer != toDoEvent.data->maintainer ) |
335 | return false; | 327 | return false; |
336 | 328 | ||
@@ -371,9 +363,11 @@ QMap<int, QString> OTodo::toMap() const { | |||
371 | map.insert( DateYear, QString::number( data->date.year() ) ); | 363 | map.insert( DateYear, QString::number( data->date.year() ) ); |
372 | map.insert( Progress, QString::number( data->prog ) ); | 364 | map.insert( Progress, QString::number( data->prog ) ); |
373 | // map.insert( CrossReference, crossToString() ); | 365 | // map.insert( CrossReference, crossToString() ); |
374 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); | 366 | /* FIXME!!! map.insert( State, ); |
375 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); | 367 | map.insert( Recurrence, ); |
376 | 368 | map.insert( Reminders, ); | |
369 | map. | ||
370 | */ | ||
377 | return map; | 371 | return map; |
378 | } | 372 | } |
379 | 373 | ||
@@ -408,11 +402,12 @@ void OTodo::copy( OTodoData* src, OTodoData* dest ) { | |||
408 | dest->sum = src->sum; | 402 | dest->sum = src->sum; |
409 | dest->extra = src->extra; | 403 | dest->extra = src->extra; |
410 | dest->prog = src->prog; | 404 | dest->prog = src->prog; |
411 | dest->hasAlarmDateTime = src->hasAlarmDateTime; | ||
412 | dest->alarmDateTime = src->alarmDateTime; | ||
413 | dest->state = src->state; | 405 | dest->state = src->state; |
414 | dest->recur = src->recur; | 406 | dest->recur = src->recur; |
415 | dest->maintainer = src->maintainer; | 407 | dest->maintainer = src->maintainer; |
408 | dest->start = src->start; | ||
409 | dest->completed = src->completed; | ||
410 | dest->notifiers = src->notifiers; | ||
416 | } | 411 | } |
417 | QString OTodo::type() const { | 412 | QString OTodo::type() const { |
418 | return QString::fromLatin1("OTodo"); | 413 | return QString::fromLatin1("OTodo"); |
@@ -421,3 +416,6 @@ QString OTodo::recordField(int /*id*/ )const { | |||
421 | return QString::null; | 416 | return QString::null; |
422 | } | 417 | } |
423 | 418 | ||
419 | int OTodo::rtti(){ | ||
420 | return 1; | ||
421 | } | ||