author | zautrix <zautrix> | 2005-02-13 19:07:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-13 19:07:45 (UTC) |
commit | 7bd83e913399b8be68a7d37e8f02118ec9eab90e (patch) (unidiff) | |
tree | 284d1592687ea4d3e0c220fafd289a702718dee4 /libkcal | |
parent | 293271fe9e6a9061da329183f8f488d79580f7da (diff) | |
download | kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.zip kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.gz kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.bz2 |
todo fixi
-rw-r--r-- | libkcal/icalformatimpl.cpp | 2 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 16 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 12 | ||||
-rw-r--r-- | libkcal/todo.cpp | 4 |
4 files changed, 27 insertions, 7 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index bb9cb29..2e38ae3 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -1189,49 +1189,49 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
1189 | incidence->setDescription(QString::fromUtf8(text)); | 1189 | incidence->setDescription(QString::fromUtf8(text)); |
1190 | break; | 1190 | break; |
1191 | 1191 | ||
1192 | case ICAL_SUMMARY_PROPERTY: // summary | 1192 | case ICAL_SUMMARY_PROPERTY: // summary |
1193 | { | 1193 | { |
1194 | text = icalproperty_get_summary(p); | 1194 | text = icalproperty_get_summary(p); |
1195 | incidence->setSummary(QString::fromUtf8(text)); | 1195 | incidence->setSummary(QString::fromUtf8(text)); |
1196 | } | 1196 | } |
1197 | break; | 1197 | break; |
1198 | case ICAL_STATUS_PROPERTY: // summary | 1198 | case ICAL_STATUS_PROPERTY: // summary |
1199 | { | 1199 | { |
1200 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) | 1200 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) |
1201 | incidence->setCancelled( true ); | 1201 | incidence->setCancelled( true ); |
1202 | } | 1202 | } |
1203 | break; | 1203 | break; |
1204 | 1204 | ||
1205 | case ICAL_LOCATION_PROPERTY: // location | 1205 | case ICAL_LOCATION_PROPERTY: // location |
1206 | text = icalproperty_get_location(p); | 1206 | text = icalproperty_get_location(p); |
1207 | incidence->setLocation(QString::fromUtf8(text)); | 1207 | incidence->setLocation(QString::fromUtf8(text)); |
1208 | break; | 1208 | break; |
1209 | 1209 | ||
1210 | case ICAL_RECURRENCEID_PROPERTY: | 1210 | case ICAL_RECURRENCEID_PROPERTY: |
1211 | icaltime = icalproperty_get_recurrenceid(p); | 1211 | icaltime = icalproperty_get_recurrenceid(p); |
1212 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); | 1212 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); |
1213 | qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); | 1213 | //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); |
1214 | break; | 1214 | break; |
1215 | #if 0 | 1215 | #if 0 |
1216 | // status | 1216 | // status |
1217 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { | 1217 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { |
1218 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); | 1218 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); |
1219 | deleteStr(s); | 1219 | deleteStr(s); |
1220 | } | 1220 | } |
1221 | else | 1221 | else |
1222 | incidence->setStatus("NEEDS ACTION"); | 1222 | incidence->setStatus("NEEDS ACTION"); |
1223 | #endif | 1223 | #endif |
1224 | 1224 | ||
1225 | case ICAL_PRIORITY_PROPERTY: // priority | 1225 | case ICAL_PRIORITY_PROPERTY: // priority |
1226 | intvalue = icalproperty_get_priority(p); | 1226 | intvalue = icalproperty_get_priority(p); |
1227 | incidence->setPriority(intvalue); | 1227 | incidence->setPriority(intvalue); |
1228 | break; | 1228 | break; |
1229 | 1229 | ||
1230 | case ICAL_CATEGORIES_PROPERTY: // categories | 1230 | case ICAL_CATEGORIES_PROPERTY: // categories |
1231 | text = icalproperty_get_categories(p); | 1231 | text = icalproperty_get_categories(p); |
1232 | categories.append(QString::fromUtf8(text)); | 1232 | categories.append(QString::fromUtf8(text)); |
1233 | break; | 1233 | break; |
1234 | //******************************************* | 1234 | //******************************************* |
1235 | case ICAL_RRULE_PROPERTY: | 1235 | case ICAL_RRULE_PROPERTY: |
1236 | // we do need (maybe )start datetime of incidence for recurrence | 1236 | // we do need (maybe )start datetime of incidence for recurrence |
1237 | // such that we can read recurrence only after we read incidence completely | 1237 | // such that we can read recurrence only after we read incidence completely |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 0684af2..708ee6b 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -192,52 +192,60 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
192 | return | 192 | return |
193 | // i1.created() == i2.created() && | 193 | // i1.created() == i2.created() && |
194 | stringCompare( i1.description(), i2.description() ) && | 194 | stringCompare( i1.description(), i2.description() ) && |
195 | stringCompare( i1.summary(), i2.summary() ) && | 195 | stringCompare( i1.summary(), i2.summary() ) && |
196 | i1.categories() == i2.categories() && | 196 | i1.categories() == i2.categories() && |
197 | // no need to compare mRelatedTo | 197 | // no need to compare mRelatedTo |
198 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 198 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
199 | // i1.relations() == i2.relations() && | 199 | // i1.relations() == i2.relations() && |
200 | i1.exDates() == i2.exDates() && | 200 | i1.exDates() == i2.exDates() && |
201 | i1.attachments() == i2.attachments() && | 201 | i1.attachments() == i2.attachments() && |
202 | i1.resources() == i2.resources() && | 202 | i1.resources() == i2.resources() && |
203 | i1.secrecy() == i2.secrecy() && | 203 | i1.secrecy() == i2.secrecy() && |
204 | i1.priority() == i2.priority() && | 204 | i1.priority() == i2.priority() && |
205 | i1.cancelled() == i2.cancelled() && | 205 | i1.cancelled() == i2.cancelled() && |
206 | stringCompare( i1.location(), i2.location() ); | 206 | stringCompare( i1.location(), i2.location() ); |
207 | } | 207 | } |
208 | 208 | ||
209 | Incidence* Incidence::recreateCloneException( QDate d ) | 209 | Incidence* Incidence::recreateCloneException( QDate d ) |
210 | { | 210 | { |
211 | Incidence* newInc = clone(); | 211 | Incidence* newInc = clone(); |
212 | newInc->recreate(); | 212 | newInc->recreate(); |
213 | if ( doesRecur() ) { | 213 | if ( doesRecur() ) { |
214 | addExDate( d ); | 214 | addExDate( d ); |
215 | newInc->recurrence()->unsetRecurs(); | 215 | newInc->recurrence()->unsetRecurs(); |
216 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 216 | if ( type() == "Event") { |
217 | QTime tim = dtStart().time(); | 217 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
218 | newInc->setDtStart( QDateTime(d, tim) ); | 218 | QTime tim = dtStart().time(); |
219 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 219 | newInc->setDtStart( QDateTime(d, tim) ); |
220 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | ||
221 | } else { | ||
222 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | ||
223 | QTime tim = ((Todo*)this)->dtDue().time(); | ||
224 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | ||
225 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | ||
226 | ((Todo*)this)->setRecurDates(); | ||
227 | } | ||
220 | } | 228 | } |
221 | return newInc; | 229 | return newInc; |
222 | } | 230 | } |
223 | 231 | ||
224 | void Incidence::recreate() | 232 | void Incidence::recreate() |
225 | { | 233 | { |
226 | setCreated(QDateTime::currentDateTime()); | 234 | setCreated(QDateTime::currentDateTime()); |
227 | 235 | ||
228 | setUid(CalFormat::createUniqueId()); | 236 | setUid(CalFormat::createUniqueId()); |
229 | 237 | ||
230 | setRevision(0); | 238 | setRevision(0); |
231 | setIDStr( ":" ); | 239 | setIDStr( ":" ); |
232 | setLastModified(QDateTime::currentDateTime()); | 240 | setLastModified(QDateTime::currentDateTime()); |
233 | } | 241 | } |
234 | 242 | ||
235 | void Incidence::setReadOnly( bool readOnly ) | 243 | void Incidence::setReadOnly( bool readOnly ) |
236 | { | 244 | { |
237 | IncidenceBase::setReadOnly( readOnly ); | 245 | IncidenceBase::setReadOnly( readOnly ); |
238 | recurrence()->setRecurReadOnly( readOnly); | 246 | recurrence()->setRecurReadOnly( readOnly); |
239 | } | 247 | } |
240 | 248 | ||
241 | void Incidence::setCreated(QDateTime created) | 249 | void Incidence::setCreated(QDateTime created) |
242 | { | 250 | { |
243 | if (mReadOnly) return; | 251 | if (mReadOnly) return; |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 0d9c3f4..cc3088a 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -171,48 +171,60 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
171 | } | 171 | } |
172 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 172 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
173 | if ( mColorMode ) | 173 | if ( mColorMode ) |
174 | mText += "</font>"; | 174 | mText += "</font>"; |
175 | } | 175 | } |
176 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 176 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
177 | mText +="<font color=\"#B00000\">"; | 177 | mText +="<font color=\"#B00000\">"; |
178 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); | 178 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); |
179 | mText += "</font>"; | 179 | mText += "</font>"; |
180 | } else { | 180 | } else { |
181 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 181 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
182 | .arg(event->percentComplete())); | 182 | .arg(event->percentComplete())); |
183 | } | 183 | } |
184 | if (event->cancelled ()) { | 184 | if (event->cancelled ()) { |
185 | mText +="<font color=\"#B00000\">"; | 185 | mText +="<font color=\"#B00000\">"; |
186 | addTag("i",i18n("This todo has been cancelled!")); | 186 | addTag("i",i18n("This todo has been cancelled!")); |
187 | mText.append("<br>"); | 187 | mText.append("<br>"); |
188 | mText += "</font>"; | 188 | mText += "</font>"; |
189 | } | 189 | } |
190 | 190 | ||
191 | if (!event->location().isEmpty()) { | 191 | if (!event->location().isEmpty()) { |
192 | addTag("b",i18n("Location: ")); | 192 | addTag("b",i18n("Location: ")); |
193 | mText.append(event->location()+"<br>"); | 193 | mText.append(event->location()+"<br>"); |
194 | } | 194 | } |
195 | |||
196 | if (event->recurrence()->doesRecur()) { | ||
197 | |||
198 | QString recurText = event->recurrence()->recurrenceText(); | ||
199 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | ||
200 | } | ||
201 | |||
202 | if (event->hasStartDate()) { | ||
203 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); | ||
204 | } | ||
205 | |||
206 | |||
195 | if (event->hasDueDate()) { | 207 | if (event->hasDueDate()) { |
196 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 208 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
197 | } | 209 | } |
198 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 210 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
199 | .arg(QString::number(event->priority()))); | 211 | .arg(QString::number(event->priority()))); |
200 | 212 | ||
201 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 213 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
202 | formatCategories(event); | 214 | formatCategories(event); |
203 | if (!event->description().isEmpty()) { | 215 | if (!event->description().isEmpty()) { |
204 | addTag("p",i18n("<b>Details: </b>")); | 216 | addTag("p",i18n("<b>Details: </b>")); |
205 | addTag("p",event->description()); | 217 | addTag("p",event->description()); |
206 | } | 218 | } |
207 | 219 | ||
208 | 220 | ||
209 | 221 | ||
210 | formatReadOnly(event); | 222 | formatReadOnly(event); |
211 | formatAttendees(event); | 223 | formatAttendees(event); |
212 | 224 | ||
213 | } | 225 | } |
214 | 226 | ||
215 | void KIncidenceFormatter::setJournal(Journal* ) | 227 | void KIncidenceFormatter::setJournal(Journal* ) |
216 | { | 228 | { |
217 | 229 | ||
218 | } | 230 | } |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 1f54c2f..39d16b6 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -348,49 +348,49 @@ void Todo::setCompleted(const QDateTime &completed) | |||
348 | // qDebug("has completed data - return "); | 348 | // qDebug("has completed data - return "); |
349 | return; | 349 | return; |
350 | } | 350 | } |
351 | mHasCompletedDate = true; | 351 | mHasCompletedDate = true; |
352 | mPercentComplete = 100; | 352 | mPercentComplete = 100; |
353 | mCompleted = getEvenTime(completed); | 353 | mCompleted = getEvenTime(completed); |
354 | updated(); | 354 | updated(); |
355 | } | 355 | } |
356 | 356 | ||
357 | bool Todo::hasCompletedDate() const | 357 | bool Todo::hasCompletedDate() const |
358 | { | 358 | { |
359 | return mHasCompletedDate; | 359 | return mHasCompletedDate; |
360 | } | 360 | } |
361 | 361 | ||
362 | int Todo::percentComplete() const | 362 | int Todo::percentComplete() const |
363 | { | 363 | { |
364 | return mPercentComplete; | 364 | return mPercentComplete; |
365 | } | 365 | } |
366 | bool Todo::setRecurDates() | 366 | bool Todo::setRecurDates() |
367 | { | 367 | { |
368 | if ( !mHasRecurrenceID ) | 368 | if ( !mHasRecurrenceID ) |
369 | return true; | 369 | return true; |
370 | int secs = mDtStart.secsTo( dtDue() ); | 370 | int secs = mDtStart.secsTo( dtDue() ); |
371 | bool ok; | 371 | bool ok; |
372 | qDebug("--------------------setRecurDates() "); | 372 | qDebug("T:setRecurDates() "); |
373 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 373 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
374 | QDateTime next = getNextOccurence( mRecurrenceID, &ok ); | 374 | QDateTime next = getNextOccurence( mRecurrenceID, &ok ); |
375 | if ( ok ) { | 375 | if ( ok ) { |
376 | mRecurrenceID = next; | 376 | mRecurrenceID = next; |
377 | mDtStart = next; | 377 | mDtStart = next; |
378 | setDtDue( next.addSecs( secs ) ); | 378 | setDtDue( next.addSecs( secs ) ); |
379 | if ( QDateTime::currentDateTime() > next) | 379 | if ( QDateTime::currentDateTime() > next) |
380 | return false; | 380 | return false; |
381 | } else { | 381 | } else { |
382 | setHasRecurrenceID( false ); | 382 | setHasRecurrenceID( false ); |
383 | recurrence()->unsetRecurs(); | 383 | recurrence()->unsetRecurs(); |
384 | } | 384 | } |
385 | return true; | 385 | return true; |
386 | } | 386 | } |
387 | void Todo::setPercentComplete(int v) | 387 | void Todo::setPercentComplete(int v) |
388 | { | 388 | { |
389 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { | 389 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { |
390 | if ( !setRecurDates() ) | 390 | if ( !setRecurDates() ) |
391 | v = 0; | 391 | v = 0; |
392 | } | 392 | } |
393 | mPercentComplete = v; | 393 | mPercentComplete = v; |
394 | if ( v != 100 ) | 394 | if ( v != 100 ) |
395 | mHasCompletedDate = false; | 395 | mHasCompletedDate = false; |
396 | updated(); | 396 | updated(); |
@@ -431,27 +431,27 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const | |||
431 | } | 431 | } |
432 | } | 432 | } |
433 | if ( enabled ) { | 433 | if ( enabled ) { |
434 | if ( alarmStart > QDateTime::currentDateTime() ) { | 434 | if ( alarmStart > QDateTime::currentDateTime() ) { |
435 | *ok = true; | 435 | *ok = true; |
436 | * offset = off; | 436 | * offset = off; |
437 | return alarmStart; | 437 | return alarmStart; |
438 | } | 438 | } |
439 | } | 439 | } |
440 | *ok = false; | 440 | *ok = false; |
441 | return QDateTime (); | 441 | return QDateTime (); |
442 | 442 | ||
443 | } | 443 | } |
444 | 444 | ||
445 | void Todo::checkSetCompletedFalse() | 445 | void Todo::checkSetCompletedFalse() |
446 | { | 446 | { |
447 | if ( !hasRecurrenceID() ) { | 447 | if ( !hasRecurrenceID() ) { |
448 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); | 448 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); |
449 | } | 449 | } |
450 | // qDebug("Todo::checkSetCompletedFalse()"); | 450 | // qDebug("Todo::checkSetCompletedFalse()"); |
451 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 451 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
452 | if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { | 452 | if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { |
453 | qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 453 | qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
454 | setCompleted( false ); | 454 | setCompleted( false ); |
455 | qDebug("Todo::checkSetCompletedFalse++++++++++++++++++++++++++++ "); | 455 | qDebug("Todo::checkSetCompletedFalse "); |
456 | } | 456 | } |
457 | } | 457 | } |