author | zautrix <zautrix> | 2005-04-18 10:41:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-18 10:41:31 (UTC) |
commit | 409e329447a7d00a93a56855fcddadbb0f793163 (patch) (unidiff) | |
tree | 1c92498d2dfb4c89358c64a6944aca1300a27d11 /libkcal/incidence.cpp | |
parent | 0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff) | |
download | kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2 |
morefixes
-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 | |||
@@ -336,30 +336,56 @@ void Incidence::setSummary(const QString &summary) | |||
336 | 336 | ||
337 | QString Incidence::summary() const | 337 | QString Incidence::summary() const |
338 | { | 338 | { |
339 | return mSummary; | 339 | return mSummary; |
340 | } | 340 | } |
341 | void Incidence::checkCategories() | 341 | void Incidence::checkCategories() |
342 | { | 342 | { |
343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
346 | } | 346 | } |
347 | 347 | ||
348 | void Incidence::setCategories(const QStringList &categories) | 348 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
349 | { | ||
350 | if (mReadOnly) return; | ||
351 | int i; | ||
352 | for( i = 0; i < categories.count(); ++i ) { | ||
353 | if ( !mCategories.contains (categories[i])) | ||
354 | mCategories.append( categories[i] ); | ||
355 | } | ||
356 | checkCategories(); | ||
357 | updated(); | ||
358 | if ( addToRelations ) { | ||
359 | Incidence * inc; | ||
360 | QPtrList<Incidence> Relations = relations(); | ||
361 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
362 | inc->addCategories( categories, true ); | ||
363 | } | ||
364 | } | ||
365 | } | ||
366 | |||
367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | ||
349 | { | 368 | { |
350 | if (mReadOnly) return; | 369 | if (mReadOnly) return; |
351 | mCategories = categories; | 370 | mCategories = categories; |
352 | checkCategories(); | 371 | checkCategories(); |
353 | updated(); | 372 | updated(); |
373 | if ( setForRelations ) { | ||
374 | Incidence * inc; | ||
375 | QPtrList<Incidence> Relations = relations(); | ||
376 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
377 | inc->setCategories( categories, true ); | ||
378 | } | ||
379 | } | ||
354 | } | 380 | } |
355 | 381 | ||
356 | // TODO: remove setCategories(QString) function | 382 | // TODO: remove setCategories(QString) function |
357 | void Incidence::setCategories(const QString &catStr) | 383 | void Incidence::setCategories(const QString &catStr) |
358 | { | 384 | { |
359 | if (mReadOnly) return; | 385 | if (mReadOnly) return; |
360 | mCategories.clear(); | 386 | mCategories.clear(); |
361 | 387 | ||
362 | if (catStr.isEmpty()) return; | 388 | if (catStr.isEmpty()) return; |
363 | 389 | ||
364 | mCategories = QStringList::split(",",catStr); | 390 | mCategories = QStringList::split(",",catStr); |
365 | 391 | ||