-rw-r--r-- | libkcal/incidence.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index f446197..4382416 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -405,96 +405,107 @@ QStringList Incidence::categories() const QString Incidence::categoriesStr() { return mCategories.join(","); } QString Incidence::categoriesStrWithSpace() { return mCategories.join(", "); } void Incidence::setRelatedToUid(const QString &relatedToUid) { if (mReadOnly) return; mRelatedToUid = relatedToUid; } QString Incidence::relatedToUid() const { return mRelatedToUid; } void Incidence::setRelatedTo(Incidence *relatedTo) { //qDebug("Incidence::setRelatedTo %d ", relatedTo); //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); if (mReadOnly || mRelatedTo == relatedTo) return; if(mRelatedTo) { // updated(); mRelatedTo->removeRelation(this); } mRelatedTo = relatedTo; if (mRelatedTo) { mRelatedTo->addRelation(this); mRelatedToUid = mRelatedTo->uid(); } else { mRelatedToUid = ""; } } Incidence *Incidence::relatedTo() const { return mRelatedTo; } QPtrList<Incidence> Incidence::relations() const { return mRelations; } +void Incidence::addRelationsToList(QPtrList<Incidence> *rel) +{ + Incidence* inc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + inc->addRelationsToList( rel ); + } + if ( rel->findRef( this ) == -1 ) + rel->append( this ); +} + void Incidence::addRelation(Incidence *event) { if( mRelations.findRef( event ) == -1 ) { mRelations.append(event); //updated(); } } void Incidence::removeRelation(Incidence *event) { mRelations.removeRef(event); // if (event->getRelatedTo() == this) event->setRelatedTo(0); } bool Incidence::recursOn(const QDate &qd) const { if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; else return false; } void Incidence::setExDates(const DateList &exDates) { if (mReadOnly) return; mExDates = exDates; recurrence()->setRecurExDatesCount(mExDates.count()); updated(); } void Incidence::addExDate(const QDate &date) { if (mReadOnly) return; mExDates.append(date); recurrence()->setRecurExDatesCount(mExDates.count()); updated(); } DateList Incidence::exDates() const { return mExDates; } bool Incidence::isException(const QDate &date) const |