author | zautrix <zautrix> | 2005-02-07 20:05:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 20:05:18 (UTC) |
commit | da5e47069d88fa9aa656423ce4c60bf505728e1c (patch) (unidiff) | |
tree | fdbaf29835a028f1204a19fc10dea97d469c0b29 /libkcal/todo.cpp | |
parent | 456b0246521847635fe98471691ceecae211e0c3 (diff) | |
download | kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.zip kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.gz kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.bz2 |
fixes
-rw-r--r-- | libkcal/todo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index d81a68f..9c04a7e 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -67,65 +67,65 @@ bool Todo::contains ( Todo* from ) | |||
67 | return false; | 67 | return false; |
68 | if ( from->dtStart() != dtStart()) | 68 | if ( from->dtStart() != dtStart()) |
69 | return false; | 69 | return false; |
70 | } | 70 | } |
71 | if ( from->hasDueDate() ){ | 71 | if ( from->hasDueDate() ){ |
72 | if ( !hasDueDate() ) | 72 | if ( !hasDueDate() ) |
73 | return false; | 73 | return false; |
74 | if ( from->dtDue() != dtDue()) | 74 | if ( from->dtDue() != dtDue()) |
75 | return false; | 75 | return false; |
76 | } | 76 | } |
77 | if ( !from->location().isEmpty() ) | 77 | if ( !from->location().isEmpty() ) |
78 | if ( !location().startsWith( from->location() ) ) | 78 | if ( !location().startsWith( from->location() ) ) |
79 | return false; | 79 | return false; |
80 | if ( !from->description().isEmpty() ) | 80 | if ( !from->description().isEmpty() ) |
81 | if ( !description().startsWith( from->description() )) | 81 | if ( !description().startsWith( from->description() )) |
82 | return false; | 82 | return false; |
83 | if ( from->alarms().count() ) { | 83 | if ( from->alarms().count() ) { |
84 | Alarm *a = from->alarms().first(); | 84 | Alarm *a = from->alarms().first(); |
85 | if ( a->enabled() ){ | 85 | if ( a->enabled() ){ |
86 | if ( !alarms().count() ) | 86 | if ( !alarms().count() ) |
87 | return false; | 87 | return false; |
88 | Alarm *b = alarms().first(); | 88 | Alarm *b = alarms().first(); |
89 | if( ! b->enabled() ) | 89 | if( ! b->enabled() ) |
90 | return false; | 90 | return false; |
91 | if ( ! (a->offset() == b->offset() )) | 91 | if ( ! (a->offset() == b->offset() )) |
92 | return false; | 92 | return false; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | QStringList cat = categories(); | 96 | QStringList cat = categories(); |
97 | QStringList catFrom = from->categories(); | 97 | QStringList catFrom = from->categories(); |
98 | QString nCat; | 98 | QString nCat; |
99 | int iii; | 99 | unsigned int iii; |
100 | for ( iii = 0; iii < catFrom.count();++iii ) { | 100 | for ( iii = 0; iii < catFrom.count();++iii ) { |
101 | nCat = catFrom[iii]; | 101 | nCat = catFrom[iii]; |
102 | if ( !nCat.isEmpty() ) | 102 | if ( !nCat.isEmpty() ) |
103 | if ( !cat.contains( nCat )) { | 103 | if ( !cat.contains( nCat )) { |
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | if ( from->isCompleted() ) { | 107 | if ( from->isCompleted() ) { |
108 | if ( !isCompleted() ) | 108 | if ( !isCompleted() ) |
109 | return false; | 109 | return false; |
110 | } | 110 | } |
111 | if( priority() != from->priority() ) | 111 | if( priority() != from->priority() ) |
112 | return false; | 112 | return false; |
113 | 113 | ||
114 | 114 | ||
115 | return true; | 115 | return true; |
116 | 116 | ||
117 | } | 117 | } |
118 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 118 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
119 | { | 119 | { |
120 | 120 | ||
121 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 121 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
122 | if ( ! ret ) | 122 | if ( ! ret ) |
123 | return false; | 123 | return false; |
124 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 124 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
125 | if ( t1.hasDueDate() ) { | 125 | if ( t1.hasDueDate() ) { |
126 | if ( t1.doesFloat() == t2.doesFloat() ) { | 126 | if ( t1.doesFloat() == t2.doesFloat() ) { |
127 | if ( t1.doesFloat() ) { | 127 | if ( t1.doesFloat() ) { |
128 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 128 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
129 | return false; | 129 | return false; |
130 | } else | 130 | } else |
131 | if ( t1.dtDue() != t2.dtDue() ) | 131 | if ( t1.dtDue() != t2.dtDue() ) |
@@ -346,65 +346,65 @@ void Todo::setCompleted(const QDateTime &completed) | |||
346 | mPercentComplete = 100; | 346 | mPercentComplete = 100; |
347 | mCompleted = getEvenTime(completed); | 347 | mCompleted = getEvenTime(completed); |
348 | updated(); | 348 | updated(); |
349 | } | 349 | } |
350 | 350 | ||
351 | bool Todo::hasCompletedDate() const | 351 | bool Todo::hasCompletedDate() const |
352 | { | 352 | { |
353 | return mHasCompletedDate; | 353 | return mHasCompletedDate; |
354 | } | 354 | } |
355 | 355 | ||
356 | int Todo::percentComplete() const | 356 | int Todo::percentComplete() const |
357 | { | 357 | { |
358 | return mPercentComplete; | 358 | return mPercentComplete; |
359 | } | 359 | } |
360 | 360 | ||
361 | void Todo::setPercentComplete(int v) | 361 | void Todo::setPercentComplete(int v) |
362 | { | 362 | { |
363 | mPercentComplete = v; | 363 | mPercentComplete = v; |
364 | if ( v != 100 ) | 364 | if ( v != 100 ) |
365 | mHasCompletedDate = false; | 365 | mHasCompletedDate = false; |
366 | updated(); | 366 | updated(); |
367 | } | 367 | } |
368 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const | 368 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const |
369 | { | 369 | { |
370 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { | 370 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { |
371 | *ok = false; | 371 | *ok = false; |
372 | return QDateTime (); | 372 | return QDateTime (); |
373 | } | 373 | } |
374 | QDateTime incidenceStart; | 374 | QDateTime incidenceStart; |
375 | incidenceStart = dtDue(); | 375 | incidenceStart = dtDue(); |
376 | bool enabled = false; | 376 | bool enabled = false; |
377 | Alarm* alarm; | 377 | Alarm* alarm; |
378 | int off; | 378 | int off = 0; |
379 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 379 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
380 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 380 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
381 | // *ok = false; | 381 | // *ok = false; |
382 | // return incidenceStart; | 382 | // return incidenceStart; |
383 | // } | 383 | // } |
384 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 384 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
385 | if (alarm->enabled()) { | 385 | if (alarm->enabled()) { |
386 | if ( alarm->hasTime () ) { | 386 | if ( alarm->hasTime () ) { |
387 | if ( alarm->time() < alarmStart ) { | 387 | if ( alarm->time() < alarmStart ) { |
388 | alarmStart = alarm->time(); | 388 | alarmStart = alarm->time(); |
389 | enabled = true; | 389 | enabled = true; |
390 | off = alarmStart.secsTo( incidenceStart ); | 390 | off = alarmStart.secsTo( incidenceStart ); |
391 | } | 391 | } |
392 | 392 | ||
393 | } else { | 393 | } else { |
394 | int secs = alarm->startOffset().asSeconds(); | 394 | int secs = alarm->startOffset().asSeconds(); |
395 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 395 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
396 | alarmStart = incidenceStart.addSecs( secs ); | 396 | alarmStart = incidenceStart.addSecs( secs ); |
397 | enabled = true; | 397 | enabled = true; |
398 | off = -secs; | 398 | off = -secs; |
399 | } | 399 | } |
400 | } | 400 | } |
401 | } | 401 | } |
402 | } | 402 | } |
403 | if ( enabled ) { | 403 | if ( enabled ) { |
404 | if ( alarmStart > QDateTime::currentDateTime() ) { | 404 | if ( alarmStart > QDateTime::currentDateTime() ) { |
405 | *ok = true; | 405 | *ok = true; |
406 | * offset = off; | 406 | * offset = off; |
407 | return alarmStart; | 407 | return alarmStart; |
408 | } | 408 | } |
409 | } | 409 | } |
410 | *ok = false; | 410 | *ok = false; |