-rw-r--r-- | libkcal/incidence.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 4382416..11f7ecc 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -367,64 +367,69 @@ void Incidence::addCategories(const QStringList &categories, bool addToRelations | |||
367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | 367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false |
368 | { | 368 | { |
369 | if (mReadOnly) return; | 369 | if (mReadOnly) return; |
370 | mCategories = categories; | 370 | mCategories = categories; |
371 | checkCategories(); | 371 | checkCategories(); |
372 | updated(); | 372 | updated(); |
373 | if ( setForRelations ) { | 373 | if ( setForRelations ) { |
374 | Incidence * inc; | 374 | Incidence * inc; |
375 | QPtrList<Incidence> Relations = relations(); | 375 | QPtrList<Incidence> Relations = relations(); |
376 | for (inc=Relations.first();inc;inc=Relations.next()) { | 376 | for (inc=Relations.first();inc;inc=Relations.next()) { |
377 | inc->setCategories( categories, true ); | 377 | inc->setCategories( categories, true ); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | // TODO: remove setCategories(QString) function | 382 | // TODO: remove setCategories(QString) function |
383 | void Incidence::setCategories(const QString &catStr) | 383 | void Incidence::setCategories(const QString &catStr) |
384 | { | 384 | { |
385 | if (mReadOnly) return; | 385 | if (mReadOnly) return; |
386 | mCategories.clear(); | 386 | mCategories.clear(); |
387 | 387 | ||
388 | if (catStr.isEmpty()) return; | 388 | if (catStr.isEmpty()) return; |
389 | 389 | ||
390 | mCategories = QStringList::split(",",catStr); | 390 | mCategories = QStringList::split(",",catStr); |
391 | 391 | ||
392 | QStringList::Iterator it; | 392 | QStringList::Iterator it; |
393 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 393 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
394 | *it = (*it).stripWhiteSpace(); | 394 | *it = (*it).stripWhiteSpace(); |
395 | } | 395 | } |
396 | checkCategories(); | 396 | checkCategories(); |
397 | updated(); | 397 | updated(); |
398 | } | 398 | } |
399 | // using this makes filtering 3 times faster | ||
400 | QStringList* Incidence::categoriesP() | ||
401 | { | ||
402 | return &mCategories; | ||
403 | } | ||
399 | 404 | ||
400 | QStringList Incidence::categories() const | 405 | QStringList Incidence::categories() const |
401 | { | 406 | { |
402 | return mCategories; | 407 | return mCategories; |
403 | } | 408 | } |
404 | 409 | ||
405 | QString Incidence::categoriesStr() | 410 | QString Incidence::categoriesStr() |
406 | { | 411 | { |
407 | return mCategories.join(","); | 412 | return mCategories.join(","); |
408 | } | 413 | } |
409 | QString Incidence::categoriesStrWithSpace() | 414 | QString Incidence::categoriesStrWithSpace() |
410 | { | 415 | { |
411 | return mCategories.join(", "); | 416 | return mCategories.join(", "); |
412 | } | 417 | } |
413 | 418 | ||
414 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 419 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
415 | { | 420 | { |
416 | if (mReadOnly) return; | 421 | if (mReadOnly) return; |
417 | mRelatedToUid = relatedToUid; | 422 | mRelatedToUid = relatedToUid; |
418 | } | 423 | } |
419 | 424 | ||
420 | QString Incidence::relatedToUid() const | 425 | QString Incidence::relatedToUid() const |
421 | { | 426 | { |
422 | return mRelatedToUid; | 427 | return mRelatedToUid; |
423 | } | 428 | } |
424 | 429 | ||
425 | void Incidence::setRelatedTo(Incidence *relatedTo) | 430 | void Incidence::setRelatedTo(Incidence *relatedTo) |
426 | { | 431 | { |
427 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 432 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
428 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 433 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
429 | if (mReadOnly || mRelatedTo == relatedTo) return; | 434 | if (mReadOnly || mRelatedTo == relatedTo) return; |
430 | if(mRelatedTo) { | 435 | if(mRelatedTo) { |