-rw-r--r-- | libkcal/incidence.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 9c35b1d..762103f 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -347,3 +347,22 @@ void Incidence::checkCategories() -void Incidence::setCategories(const QStringList &categories) +void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false +{ + if (mReadOnly) return; + int i; + for( i = 0; i < categories.count(); ++i ) { + if ( !mCategories.contains (categories[i])) + mCategories.append( categories[i] ); + } + checkCategories(); + updated(); + if ( addToRelations ) { + Incidence * inc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + inc->addCategories( categories, true ); + } + } +} + +void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false { @@ -353,2 +372,9 @@ void Incidence::setCategories(const QStringList &categories) updated(); + if ( setForRelations ) { + Incidence * inc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + inc->setCategories( categories, true ); + } + } } |