-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 | |||
@@ -1197,33 +1197,33 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
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 | ||
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 0684af2..708ee6b 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -200,36 +200,44 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
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 ) |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 0d9c3f4..cc3088a 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -179,32 +179,44 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
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); |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 1f54c2f..39d16b6 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -356,33 +356,33 @@ void Todo::setCompleted(const QDateTime &completed) | |||
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 | { |
@@ -439,19 +439,19 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const | |||
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 | } |