summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp28
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
@@ -345,12 +345,38 @@ void Incidence::checkCategories()
mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
}
-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
{
if (mReadOnly) return;
mCategories = categories;
checkCategories();
updated();
+ if ( setForRelations ) {
+ Incidence * inc;
+ QPtrList<Incidence> Relations = relations();
+ for (inc=Relations.first();inc;inc=Relations.next()) {
+ inc->setCategories( categories, true );
+ }
+ }
}
// TODO: remove setCategories(QString) function