-rw-r--r-- | libkcal/incidence.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index a312ba5..6bca12c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -345,97 +345,102 @@ void Incidence::setCategories(const QStringList &categories) | |||
345 | void Incidence::setCategories(const QString &catStr) | 345 | void Incidence::setCategories(const QString &catStr) |
346 | { | 346 | { |
347 | if (mReadOnly) return; | 347 | if (mReadOnly) return; |
348 | mCategories.clear(); | 348 | mCategories.clear(); |
349 | 349 | ||
350 | if (catStr.isEmpty()) return; | 350 | if (catStr.isEmpty()) return; |
351 | 351 | ||
352 | mCategories = QStringList::split(",",catStr); | 352 | mCategories = QStringList::split(",",catStr); |
353 | 353 | ||
354 | QStringList::Iterator it; | 354 | QStringList::Iterator it; |
355 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 355 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
356 | *it = (*it).stripWhiteSpace(); | 356 | *it = (*it).stripWhiteSpace(); |
357 | } | 357 | } |
358 | checkCategories(); | 358 | checkCategories(); |
359 | updated(); | 359 | updated(); |
360 | } | 360 | } |
361 | 361 | ||
362 | QStringList Incidence::categories() const | 362 | QStringList Incidence::categories() const |
363 | { | 363 | { |
364 | return mCategories; | 364 | return mCategories; |
365 | } | 365 | } |
366 | 366 | ||
367 | QString Incidence::categoriesStr() | 367 | QString Incidence::categoriesStr() |
368 | { | 368 | { |
369 | return mCategories.join(","); | 369 | return mCategories.join(","); |
370 | } | 370 | } |
371 | 371 | ||
372 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 372 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
373 | { | 373 | { |
374 | if (mReadOnly) return; | 374 | if (mReadOnly) return; |
375 | mRelatedToUid = relatedToUid; | 375 | mRelatedToUid = relatedToUid; |
376 | } | 376 | } |
377 | 377 | ||
378 | QString Incidence::relatedToUid() const | 378 | QString Incidence::relatedToUid() const |
379 | { | 379 | { |
380 | return mRelatedToUid; | 380 | return mRelatedToUid; |
381 | } | 381 | } |
382 | 382 | ||
383 | void Incidence::setRelatedTo(Incidence *relatedTo) | 383 | void Incidence::setRelatedTo(Incidence *relatedTo) |
384 | { | 384 | { |
385 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 385 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
386 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 386 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
387 | if (mReadOnly || mRelatedTo == relatedTo) return; | 387 | if (mReadOnly || mRelatedTo == relatedTo) return; |
388 | if(mRelatedTo) { | 388 | if(mRelatedTo) { |
389 | // updated(); | 389 | // updated(); |
390 | mRelatedTo->removeRelation(this); | 390 | mRelatedTo->removeRelation(this); |
391 | } | 391 | } |
392 | mRelatedTo = relatedTo; | 392 | mRelatedTo = relatedTo; |
393 | if (mRelatedTo) mRelatedTo->addRelation(this); | 393 | if (mRelatedTo) { |
394 | mRelatedTo->addRelation(this); | ||
395 | mRelatedToUid = mRelatedTo->uid(); | ||
396 | } else { | ||
397 | mRelatedToUid = ""; | ||
398 | } | ||
394 | } | 399 | } |
395 | 400 | ||
396 | Incidence *Incidence::relatedTo() const | 401 | Incidence *Incidence::relatedTo() const |
397 | { | 402 | { |
398 | return mRelatedTo; | 403 | return mRelatedTo; |
399 | } | 404 | } |
400 | 405 | ||
401 | QPtrList<Incidence> Incidence::relations() const | 406 | QPtrList<Incidence> Incidence::relations() const |
402 | { | 407 | { |
403 | return mRelations; | 408 | return mRelations; |
404 | } | 409 | } |
405 | 410 | ||
406 | void Incidence::addRelation(Incidence *event) | 411 | void Incidence::addRelation(Incidence *event) |
407 | { | 412 | { |
408 | if( mRelations.findRef( event ) == -1 ) { | 413 | if( mRelations.findRef( event ) == -1 ) { |
409 | mRelations.append(event); | 414 | mRelations.append(event); |
410 | //updated(); | 415 | //updated(); |
411 | } | 416 | } |
412 | } | 417 | } |
413 | 418 | ||
414 | void Incidence::removeRelation(Incidence *event) | 419 | void Incidence::removeRelation(Incidence *event) |
415 | { | 420 | { |
416 | 421 | ||
417 | mRelations.removeRef(event); | 422 | mRelations.removeRef(event); |
418 | 423 | ||
419 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 424 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
420 | } | 425 | } |
421 | 426 | ||
422 | bool Incidence::recursOn(const QDate &qd) const | 427 | bool Incidence::recursOn(const QDate &qd) const |
423 | { | 428 | { |
424 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 429 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
425 | else return false; | 430 | else return false; |
426 | } | 431 | } |
427 | 432 | ||
428 | void Incidence::setExDates(const DateList &exDates) | 433 | void Incidence::setExDates(const DateList &exDates) |
429 | { | 434 | { |
430 | if (mReadOnly) return; | 435 | if (mReadOnly) return; |
431 | mExDates = exDates; | 436 | mExDates = exDates; |
432 | 437 | ||
433 | recurrence()->setRecurExDatesCount(mExDates.count()); | 438 | recurrence()->setRecurExDatesCount(mExDates.count()); |
434 | 439 | ||
435 | updated(); | 440 | updated(); |
436 | } | 441 | } |
437 | 442 | ||
438 | void Incidence::addExDate(const QDate &date) | 443 | void Incidence::addExDate(const QDate &date) |
439 | { | 444 | { |
440 | if (mReadOnly) return; | 445 | if (mReadOnly) return; |
441 | mExDates.append(date); | 446 | mExDates.append(date); |