summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
authorzautrix <zautrix>2005-04-18 10:41:31 (UTC)
committer zautrix <zautrix>2005-04-18 10:41:31 (UTC)
commit409e329447a7d00a93a56855fcddadbb0f793163 (patch) (unidiff)
tree1c92498d2dfb4c89358c64a6944aca1300a27d11 /libkcal/incidence.cpp
parent0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff)
downloadkdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz
kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2
morefixes
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
@@ -324,54 +324,80 @@ void Incidence::setDescription(const QString &description)
324QString Incidence::description() const 324QString Incidence::description() const
325{ 325{
326 return mDescription; 326 return mDescription;
327} 327}
328 328
329 329
330void Incidence::setSummary(const QString &summary) 330void Incidence::setSummary(const QString &summary)
331{ 331{
332 if (mReadOnly) return; 332 if (mReadOnly) return;
333 mSummary = summary; 333 mSummary = summary;
334 updated(); 334 updated();
335} 335}
336 336
337QString Incidence::summary() const 337QString Incidence::summary() const
338{ 338{
339 return mSummary; 339 return mSummary;
340} 340}
341void Incidence::checkCategories() 341void 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
348void Incidence::setCategories(const QStringList &categories) 348void 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
367void 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
357void Incidence::setCategories(const QString &catStr) 383void 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
366 QStringList::Iterator it; 392 QStringList::Iterator it;
367 for(it = mCategories.begin();it != mCategories.end(); ++it) { 393 for(it = mCategories.begin();it != mCategories.end(); ++it) {
368 *it = (*it).stripWhiteSpace(); 394 *it = (*it).stripWhiteSpace();
369 } 395 }
370 checkCategories(); 396 checkCategories();
371 updated(); 397 updated();
372} 398}
373 399
374QStringList Incidence::categories() const 400QStringList Incidence::categories() const
375{ 401{
376 return mCategories; 402 return mCategories;
377} 403}