summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
authorzautrix <zautrix>2005-07-30 14:43:57 (UTC)
committer zautrix <zautrix>2005-07-30 14:43:57 (UTC)
commit9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (unidiff)
tree549192e9e27e8972e2b48cf40e1599118df12da5 /libkcal/incidence.cpp
parent055928e26613f4ab249bd82be86890ed278372f6 (diff)
downloadkdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip
kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz
kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2
fixxx
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 52d94fb..549014e 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -446,97 +446,101 @@ void Incidence::setCategories(const QStringList &categories, bool setForRelation
446 for (inc=Relations.first();inc;inc=Relations.next()) { 446 for (inc=Relations.first();inc;inc=Relations.next()) {
447 inc->setCategories( categories, true ); 447 inc->setCategories( categories, true );
448 } 448 }
449 } 449 }
450} 450}
451 451
452// TODO: remove setCategories(QString) function 452// TODO: remove setCategories(QString) function
453void Incidence::setCategories(const QString &catStr) 453void Incidence::setCategories(const QString &catStr)
454{ 454{
455 if (mReadOnly) return; 455 if (mReadOnly) return;
456 mCategories.clear(); 456 mCategories.clear();
457 457
458 if (catStr.isEmpty()) return; 458 if (catStr.isEmpty()) return;
459 459
460 mCategories = QStringList::split(",",catStr); 460 mCategories = QStringList::split(",",catStr);
461 461
462 QStringList::Iterator it; 462 QStringList::Iterator it;
463 for(it = mCategories.begin();it != mCategories.end(); ++it) { 463 for(it = mCategories.begin();it != mCategories.end(); ++it) {
464 *it = (*it).stripWhiteSpace(); 464 *it = (*it).stripWhiteSpace();
465 } 465 }
466 checkCategories(); 466 checkCategories();
467 updated(); 467 updated();
468} 468}
469// using this makes filtering 3 times faster 469// using this makes filtering 3 times faster
470QStringList* Incidence::categoriesP() 470QStringList* Incidence::categoriesP()
471{ 471{
472 return &mCategories; 472 return &mCategories;
473} 473}
474 474
475QStringList Incidence::categories() const 475QStringList Incidence::categories() const
476{ 476{
477 return mCategories; 477 return mCategories;
478} 478}
479 479
480QString Incidence::categoriesStr() 480QString Incidence::categoriesStr()
481{ 481{
482 return mCategories.join(","); 482 return mCategories.join(",");
483} 483}
484QString Incidence::categoriesStrWithSpace() 484QString Incidence::categoriesStrWithSpace()
485{ 485{
486 return mCategories.join(", "); 486 return mCategories.join(", ");
487} 487}
488 488
489void Incidence::setRelatedToUid(const QString &relatedToUid) 489void Incidence::setRelatedToUid(const QString &relatedToUid)
490{ 490{
491 if (mReadOnly) return; 491 if (mReadOnly) return;
492 mRelatedToUid = relatedToUid; 492 mRelatedToUid = relatedToUid;
493} 493}
494 494void Incidence::clearRelations()
495{
496 mRelatedTo = 0;
497 mRelations.clear();
498}
495QString Incidence::relatedToUid() const 499QString Incidence::relatedToUid() const
496{ 500{
497 return mRelatedToUid; 501 return mRelatedToUid;
498} 502}
499 503
500void Incidence::setRelatedTo(Incidence *relatedTo) 504void Incidence::setRelatedTo(Incidence *relatedTo)
501{ 505{
502 //qDebug("Incidence::setRelatedTo %d ", relatedTo); 506 //qDebug("Incidence::setRelatedTo %d ", relatedTo);
503 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); 507 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
504 if (mReadOnly || mRelatedTo == relatedTo) return; 508 if (mReadOnly || mRelatedTo == relatedTo) return;
505 if(mRelatedTo) { 509 if(mRelatedTo) {
506 // updated(); 510 // updated();
507 mRelatedTo->removeRelation(this); 511 mRelatedTo->removeRelation(this);
508 } 512 }
509 mRelatedTo = relatedTo; 513 mRelatedTo = relatedTo;
510 if (mRelatedTo) { 514 if (mRelatedTo) {
511 mRelatedTo->addRelation(this); 515 mRelatedTo->addRelation(this);
512 mRelatedToUid = mRelatedTo->uid(); 516 mRelatedToUid = mRelatedTo->uid();
513 } else { 517 } else {
514 mRelatedToUid = ""; 518 mRelatedToUid = "";
515 } 519 }
516} 520}
517 521
518Incidence *Incidence::relatedTo() const 522Incidence *Incidence::relatedTo() const
519{ 523{
520 return mRelatedTo; 524 return mRelatedTo;
521} 525}
522 526
523QPtrList<Incidence> Incidence::relations() const 527QPtrList<Incidence> Incidence::relations() const
524{ 528{
525 return mRelations; 529 return mRelations;
526} 530}
527 531
528void Incidence::addRelationsToList(QPtrList<Incidence> *rel) 532void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
529{ 533{
530 Incidence* inc; 534 Incidence* inc;
531 QPtrList<Incidence> Relations = relations(); 535 QPtrList<Incidence> Relations = relations();
532 for (inc=Relations.first();inc;inc=Relations.next()) { 536 for (inc=Relations.first();inc;inc=Relations.next()) {
533 inc->addRelationsToList( rel ); 537 inc->addRelationsToList( rel );
534 } 538 }
535 if ( rel->findRef( this ) == -1 ) 539 if ( rel->findRef( this ) == -1 )
536 rel->append( this ); 540 rel->append( this );
537} 541}
538 542
539void Incidence::addRelation(Incidence *event) 543void Incidence::addRelation(Incidence *event)
540{ 544{
541 setLastModifiedSubInvalid(); 545 setLastModifiedSubInvalid();
542 if( mRelations.findRef( event ) == -1 ) { 546 if( mRelations.findRef( event ) == -1 ) {