summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
authorzautrix <zautrix>2005-07-30 14:43:57 (UTC)
committer zautrix <zautrix>2005-07-30 14:43:57 (UTC)
commit9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (unidiff)
tree549192e9e27e8972e2b48cf40e1599118df12da5 /libkcal/incidence.cpp
parent055928e26613f4ab249bd82be86890ed278372f6 (diff)
downloadkdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip
kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz
kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2
fixxx
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 52d94fb..549014e 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -238,513 +238,517 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
238 if ( i1.dtStart() != i2.dtStart() ) 238 if ( i1.dtStart() != i2.dtStart() )
239 return false; 239 return false;
240 } 240 }
241 } else { 241 } else {
242 return false; 242 return false;
243 } 243 }
244 if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) { 244 if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) {
245 if (!( *i1.mRecurrence == *i2.mRecurrence) ) { 245 if (!( *i1.mRecurrence == *i2.mRecurrence) ) {
246 //qDebug("recurrence is NOT equal "); 246 //qDebug("recurrence is NOT equal ");
247 return false; 247 return false;
248 } 248 }
249 } else { 249 } else {
250 // one ( or both ) recurrence is 0 250 // one ( or both ) recurrence is 0
251 if ( i1.mRecurrence == 0 ) { 251 if ( i1.mRecurrence == 0 ) {
252 if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone ) 252 if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone )
253 return false; 253 return false;
254 } else { 254 } else {
255 // i1.mRecurrence != 0 255 // i1.mRecurrence != 0
256 // i2.mRecurrence == 0 256 // i2.mRecurrence == 0
257 if ( i1.mRecurrence->doesRecur() != Recurrence::rNone ) 257 if ( i1.mRecurrence->doesRecur() != Recurrence::rNone )
258 return false; 258 return false;
259 } 259 }
260 } 260 }
261 261
262 return 262 return
263 // i1.created() == i2.created() && 263 // i1.created() == i2.created() &&
264 stringCompare( i1.description(), i2.description() ) && 264 stringCompare( i1.description(), i2.description() ) &&
265 stringCompare( i1.summary(), i2.summary() ) && 265 stringCompare( i1.summary(), i2.summary() ) &&
266 i1.categories() == i2.categories() && 266 i1.categories() == i2.categories() &&
267 // no need to compare mRelatedTo 267 // no need to compare mRelatedTo
268 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 268 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
269 // i1.relations() == i2.relations() && 269 // i1.relations() == i2.relations() &&
270 i1.exDates() == i2.exDates() && 270 i1.exDates() == i2.exDates() &&
271 i1.attachments() == i2.attachments() && 271 i1.attachments() == i2.attachments() &&
272 i1.resources() == i2.resources() && 272 i1.resources() == i2.resources() &&
273 i1.secrecy() == i2.secrecy() && 273 i1.secrecy() == i2.secrecy() &&
274 i1.priority() == i2.priority() && 274 i1.priority() == i2.priority() &&
275 i1.cancelled() == i2.cancelled() && 275 i1.cancelled() == i2.cancelled() &&
276 stringCompare( i1.location(), i2.location() ); 276 stringCompare( i1.location(), i2.location() );
277} 277}
278 278
279Incidence* Incidence::recreateCloneException( QDate d ) 279Incidence* Incidence::recreateCloneException( QDate d )
280{ 280{
281 Incidence* newInc = clone(); 281 Incidence* newInc = clone();
282 newInc->recreate(); 282 newInc->recreate();
283 if ( doesRecur() ) { 283 if ( doesRecur() ) {
284 addExDate( d ); 284 addExDate( d );
285 newInc->recurrence()->unsetRecurs(); 285 newInc->recurrence()->unsetRecurs();
286 if ( typeID() == eventID ) { 286 if ( typeID() == eventID ) {
287 int len = dtStart().secsTo( ((Event*)this)->dtEnd()); 287 int len = dtStart().secsTo( ((Event*)this)->dtEnd());
288 QTime tim = dtStart().time(); 288 QTime tim = dtStart().time();
289 newInc->setDtStart( QDateTime(d, tim) ); 289 newInc->setDtStart( QDateTime(d, tim) );
290 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 290 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
291 } else { 291 } else {
292 int len = dtStart().secsTo( ((Todo*)this)->dtDue()); 292 int len = dtStart().secsTo( ((Todo*)this)->dtDue());
293 QTime tim = ((Todo*)this)->dtDue().time(); 293 QTime tim = ((Todo*)this)->dtDue().time();
294 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); 294 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) );
295 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); 295 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) );
296 ((Todo*)this)->setRecurDates(); 296 ((Todo*)this)->setRecurDates();
297 } 297 }
298 newInc->setExDates( DateList () ); 298 newInc->setExDates( DateList () );
299 } 299 }
300 return newInc; 300 return newInc;
301} 301}
302 302
303void Incidence::recreate() 303void Incidence::recreate()
304{ 304{
305 setCreated(QDateTime::currentDateTime()); 305 setCreated(QDateTime::currentDateTime());
306 306
307 setUid(CalFormat::createUniqueId()); 307 setUid(CalFormat::createUniqueId());
308 308
309 setRevision(0); 309 setRevision(0);
310 setIDStr( ":" ); 310 setIDStr( ":" );
311 setLastModified(QDateTime::currentDateTime()); 311 setLastModified(QDateTime::currentDateTime());
312} 312}
313void Incidence::cloneRelations( Incidence * newInc ) 313void Incidence::cloneRelations( Incidence * newInc )
314{ 314{
315 // newInc is already a clone of this incidence 315 // newInc is already a clone of this incidence
316 Incidence * inc; 316 Incidence * inc;
317 Incidence * cloneInc; 317 Incidence * cloneInc;
318 QPtrList<Incidence> Relations = relations(); 318 QPtrList<Incidence> Relations = relations();
319 for (inc=Relations.first();inc;inc=Relations.next()) { 319 for (inc=Relations.first();inc;inc=Relations.next()) {
320 cloneInc = inc->clone(); 320 cloneInc = inc->clone();
321 cloneInc->recreate(); 321 cloneInc->recreate();
322 cloneInc->setRelatedTo( newInc ); 322 cloneInc->setRelatedTo( newInc );
323 inc->cloneRelations( cloneInc ); 323 inc->cloneRelations( cloneInc );
324 } 324 }
325} 325}
326void Incidence::setReadOnly( bool readOnly ) 326void Incidence::setReadOnly( bool readOnly )
327{ 327{
328 IncidenceBase::setReadOnly( readOnly ); 328 IncidenceBase::setReadOnly( readOnly );
329 if ( mRecurrence ) 329 if ( mRecurrence )
330 mRecurrence->setRecurReadOnly( readOnly); 330 mRecurrence->setRecurReadOnly( readOnly);
331} 331}
332void Incidence::setLastModifiedSubInvalid() 332void Incidence::setLastModifiedSubInvalid()
333{ 333{
334 mLastModifiedSub = QDateTime(); 334 mLastModifiedSub = QDateTime();
335 if ( mRelatedTo ) 335 if ( mRelatedTo )
336 mRelatedTo->setLastModifiedSubInvalid(); 336 mRelatedTo->setLastModifiedSubInvalid();
337} 337}
338QDateTime Incidence::lastModifiedSub() 338QDateTime Incidence::lastModifiedSub()
339{ 339{
340 if ( !mRelations.count() ) 340 if ( !mRelations.count() )
341 return lastModified(); 341 return lastModified();
342 if ( mLastModifiedSub.isValid() ) 342 if ( mLastModifiedSub.isValid() )
343 return mLastModifiedSub; 343 return mLastModifiedSub;
344 mLastModifiedSub = lastModified(); 344 mLastModifiedSub = lastModified();
345 Incidence * inc; 345 Incidence * inc;
346 QPtrList<Incidence> Relations = relations(); 346 QPtrList<Incidence> Relations = relations();
347 for (inc=Relations.first();inc;inc=Relations.next()) { 347 for (inc=Relations.first();inc;inc=Relations.next()) {
348 if ( inc->lastModifiedSub() > mLastModifiedSub ) 348 if ( inc->lastModifiedSub() > mLastModifiedSub )
349 mLastModifiedSub = inc->lastModifiedSub(); 349 mLastModifiedSub = inc->lastModifiedSub();
350 } 350 }
351 return mLastModifiedSub; 351 return mLastModifiedSub;
352} 352}
353void Incidence::setCreated(QDateTime created) 353void Incidence::setCreated(QDateTime created)
354{ 354{
355 if (mReadOnly) return; 355 if (mReadOnly) return;
356 mCreated = getEvenTime(created); 356 mCreated = getEvenTime(created);
357} 357}
358 358
359QDateTime Incidence::created() const 359QDateTime Incidence::created() const
360{ 360{
361 return mCreated; 361 return mCreated;
362} 362}
363 363
364void Incidence::setRevision(int rev) 364void Incidence::setRevision(int rev)
365{ 365{
366 if (mReadOnly) return; 366 if (mReadOnly) return;
367 mRevision = rev; 367 mRevision = rev;
368 368
369 updated(); 369 updated();
370} 370}
371 371
372int Incidence::revision() const 372int Incidence::revision() const
373{ 373{
374 return mRevision; 374 return mRevision;
375} 375}
376 376
377void Incidence::setDtStart(const QDateTime &dtStart) 377void Incidence::setDtStart(const QDateTime &dtStart)
378{ 378{
379 379
380 QDateTime dt = getEvenTime(dtStart); 380 QDateTime dt = getEvenTime(dtStart);
381 381
382 if ( mRecurrence ) 382 if ( mRecurrence )
383 mRecurrence->setRecurStart( dt); 383 mRecurrence->setRecurStart( dt);
384 IncidenceBase::setDtStart( dt ); 384 IncidenceBase::setDtStart( dt );
385} 385}
386 386
387void Incidence::setDescription(const QString &description) 387void Incidence::setDescription(const QString &description)
388{ 388{
389 if (mReadOnly) return; 389 if (mReadOnly) return;
390 mDescription = description; 390 mDescription = description;
391 updated(); 391 updated();
392} 392}
393 393
394QString Incidence::description() const 394QString Incidence::description() const
395{ 395{
396 return mDescription; 396 return mDescription;
397} 397}
398 398
399 399
400void Incidence::setSummary(const QString &summary) 400void Incidence::setSummary(const QString &summary)
401{ 401{
402 if (mReadOnly) return; 402 if (mReadOnly) return;
403 mSummary = summary; 403 mSummary = summary;
404 updated(); 404 updated();
405} 405}
406 406
407QString Incidence::summary() const 407QString Incidence::summary() const
408{ 408{
409 return mSummary; 409 return mSummary;
410} 410}
411void Incidence::checkCategories() 411void Incidence::checkCategories()
412{ 412{
413 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); 413 mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday"));
414 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); 414 mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
415 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); 415 mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
416} 416}
417 417
418void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false 418void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
419{ 419{
420 if (mReadOnly) return; 420 if (mReadOnly) return;
421 int i; 421 int i;
422 for( i = 0; i < categories.count(); ++i ) { 422 for( i = 0; i < categories.count(); ++i ) {
423 if ( !mCategories.contains (categories[i])) 423 if ( !mCategories.contains (categories[i]))
424 mCategories.append( categories[i] ); 424 mCategories.append( categories[i] );
425 } 425 }
426 checkCategories(); 426 checkCategories();
427 updated(); 427 updated();
428 if ( addToRelations ) { 428 if ( addToRelations ) {
429 Incidence * inc; 429 Incidence * inc;
430 QPtrList<Incidence> Relations = relations(); 430 QPtrList<Incidence> Relations = relations();
431 for (inc=Relations.first();inc;inc=Relations.next()) { 431 for (inc=Relations.first();inc;inc=Relations.next()) {
432 inc->addCategories( categories, true ); 432 inc->addCategories( categories, true );
433 } 433 }
434 } 434 }
435} 435}
436 436
437void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false 437void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
438{ 438{
439 if (mReadOnly) return; 439 if (mReadOnly) return;
440 mCategories = categories; 440 mCategories = categories;
441 checkCategories(); 441 checkCategories();
442 updated(); 442 updated();
443 if ( setForRelations ) { 443 if ( setForRelations ) {
444 Incidence * inc; 444 Incidence * inc;
445 QPtrList<Incidence> Relations = relations(); 445 QPtrList<Incidence> Relations = relations();
446 for (inc=Relations.first();inc;inc=Relations.next()) { 446 for (inc=Relations.first();inc;inc=Relations.next()) {
447 inc->setCategories( categories, true ); 447 inc->setCategories( categories, true );
448 } 448 }
449 } 449 }
450} 450}
451 451
452// TODO: remove setCategories(QString) function 452// TODO: remove setCategories(QString) function
453void Incidence::setCategories(const QString &catStr) 453void Incidence::setCategories(const QString &catStr)
454{ 454{
455 if (mReadOnly) return; 455 if (mReadOnly) return;
456 mCategories.clear(); 456 mCategories.clear();
457 457
458 if (catStr.isEmpty()) return; 458 if (catStr.isEmpty()) return;
459 459
460 mCategories = QStringList::split(",",catStr); 460 mCategories = QStringList::split(",",catStr);
461 461
462 QStringList::Iterator it; 462 QStringList::Iterator it;
463 for(it = mCategories.begin();it != mCategories.end(); ++it) { 463 for(it = mCategories.begin();it != mCategories.end(); ++it) {
464 *it = (*it).stripWhiteSpace(); 464 *it = (*it).stripWhiteSpace();
465 } 465 }
466 checkCategories(); 466 checkCategories();
467 updated(); 467 updated();
468} 468}
469// using this makes filtering 3 times faster 469// using this makes filtering 3 times faster
470QStringList* Incidence::categoriesP() 470QStringList* Incidence::categoriesP()
471{ 471{
472 return &mCategories; 472 return &mCategories;
473} 473}
474 474
475QStringList Incidence::categories() const 475QStringList Incidence::categories() const
476{ 476{
477 return mCategories; 477 return mCategories;
478} 478}
479 479
480QString Incidence::categoriesStr() 480QString Incidence::categoriesStr()
481{ 481{
482 return mCategories.join(","); 482 return mCategories.join(",");
483} 483}
484QString Incidence::categoriesStrWithSpace() 484QString Incidence::categoriesStrWithSpace()
485{ 485{
486 return mCategories.join(", "); 486 return mCategories.join(", ");
487} 487}
488 488
489void Incidence::setRelatedToUid(const QString &relatedToUid) 489void Incidence::setRelatedToUid(const QString &relatedToUid)
490{ 490{
491 if (mReadOnly) return; 491 if (mReadOnly) return;
492 mRelatedToUid = relatedToUid; 492 mRelatedToUid = relatedToUid;
493} 493}
494 494void Incidence::clearRelations()
495{
496 mRelatedTo = 0;
497 mRelations.clear();
498}
495QString Incidence::relatedToUid() const 499QString Incidence::relatedToUid() const
496{ 500{
497 return mRelatedToUid; 501 return mRelatedToUid;
498} 502}
499 503
500void Incidence::setRelatedTo(Incidence *relatedTo) 504void Incidence::setRelatedTo(Incidence *relatedTo)
501{ 505{
502 //qDebug("Incidence::setRelatedTo %d ", relatedTo); 506 //qDebug("Incidence::setRelatedTo %d ", relatedTo);
503 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); 507 //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
504 if (mReadOnly || mRelatedTo == relatedTo) return; 508 if (mReadOnly || mRelatedTo == relatedTo) return;
505 if(mRelatedTo) { 509 if(mRelatedTo) {
506 // updated(); 510 // updated();
507 mRelatedTo->removeRelation(this); 511 mRelatedTo->removeRelation(this);
508 } 512 }
509 mRelatedTo = relatedTo; 513 mRelatedTo = relatedTo;
510 if (mRelatedTo) { 514 if (mRelatedTo) {
511 mRelatedTo->addRelation(this); 515 mRelatedTo->addRelation(this);
512 mRelatedToUid = mRelatedTo->uid(); 516 mRelatedToUid = mRelatedTo->uid();
513 } else { 517 } else {
514 mRelatedToUid = ""; 518 mRelatedToUid = "";
515 } 519 }
516} 520}
517 521
518Incidence *Incidence::relatedTo() const 522Incidence *Incidence::relatedTo() const
519{ 523{
520 return mRelatedTo; 524 return mRelatedTo;
521} 525}
522 526
523QPtrList<Incidence> Incidence::relations() const 527QPtrList<Incidence> Incidence::relations() const
524{ 528{
525 return mRelations; 529 return mRelations;
526} 530}
527 531
528void Incidence::addRelationsToList(QPtrList<Incidence> *rel) 532void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
529{ 533{
530 Incidence* inc; 534 Incidence* inc;
531 QPtrList<Incidence> Relations = relations(); 535 QPtrList<Incidence> Relations = relations();
532 for (inc=Relations.first();inc;inc=Relations.next()) { 536 for (inc=Relations.first();inc;inc=Relations.next()) {
533 inc->addRelationsToList( rel ); 537 inc->addRelationsToList( rel );
534 } 538 }
535 if ( rel->findRef( this ) == -1 ) 539 if ( rel->findRef( this ) == -1 )
536 rel->append( this ); 540 rel->append( this );
537} 541}
538 542
539void Incidence::addRelation(Incidence *event) 543void Incidence::addRelation(Incidence *event)
540{ 544{
541 setLastModifiedSubInvalid(); 545 setLastModifiedSubInvalid();
542 if( mRelations.findRef( event ) == -1 ) { 546 if( mRelations.findRef( event ) == -1 ) {
543 mRelations.append(event); 547 mRelations.append(event);
544 //updated(); 548 //updated();
545 } 549 }
546} 550}
547 551
548void Incidence::removeRelation(Incidence *event) 552void Incidence::removeRelation(Incidence *event)
549{ 553{
550 setLastModifiedSubInvalid(); 554 setLastModifiedSubInvalid();
551 mRelations.removeRef(event); 555 mRelations.removeRef(event);
552// if (event->getRelatedTo() == this) event->setRelatedTo(0); 556// if (event->getRelatedTo() == this) event->setRelatedTo(0);
553} 557}
554 558
555bool Incidence::recursOn(const QDate &qd) const 559bool Incidence::recursOn(const QDate &qd) const
556{ 560{
557 if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true; 561 if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true;
558 else return false; 562 else return false;
559} 563}
560 564
561void Incidence::setExDates(const DateList &exDates) 565void Incidence::setExDates(const DateList &exDates)
562{ 566{
563 if (mReadOnly) return; 567 if (mReadOnly) return;
564 mExDates = exDates; 568 mExDates = exDates;
565 recurrence()->setRecurExDatesCount(mExDates.count()); 569 recurrence()->setRecurExDatesCount(mExDates.count());
566 570
567 updated(); 571 updated();
568} 572}
569 573
570void Incidence::addExDate(const QDate &date) 574void Incidence::addExDate(const QDate &date)
571{ 575{
572 if (mReadOnly) return; 576 if (mReadOnly) return;
573 mExDates.append(date); 577 mExDates.append(date);
574 578
575 recurrence()->setRecurExDatesCount(mExDates.count()); 579 recurrence()->setRecurExDatesCount(mExDates.count());
576 580
577 updated(); 581 updated();
578} 582}
579 583
580DateList Incidence::exDates() const 584DateList Incidence::exDates() const
581{ 585{
582 return mExDates; 586 return mExDates;
583} 587}
584 588
585bool Incidence::isException(const QDate &date) const 589bool Incidence::isException(const QDate &date) const
586{ 590{
587 DateList::ConstIterator it; 591 DateList::ConstIterator it;
588 for( it = mExDates.begin(); it != mExDates.end(); ++it ) { 592 for( it = mExDates.begin(); it != mExDates.end(); ++it ) {
589 if ( (*it) == date ) { 593 if ( (*it) == date ) {
590 return true; 594 return true;
591 } 595 }
592 } 596 }
593 597
594 return false; 598 return false;
595} 599}
596 600
597void Incidence::addAttachment(Attachment *attachment) 601void Incidence::addAttachment(Attachment *attachment)
598{ 602{
599 if (mReadOnly || !attachment) return; 603 if (mReadOnly || !attachment) return;
600 mAttachments.append(attachment); 604 mAttachments.append(attachment);
601 updated(); 605 updated();
602} 606}
603 607
604void Incidence::deleteAttachment(Attachment *attachment) 608void Incidence::deleteAttachment(Attachment *attachment)
605{ 609{
606 mAttachments.removeRef(attachment); 610 mAttachments.removeRef(attachment);
607} 611}
608 612
609void Incidence::deleteAttachments(const QString& mime) 613void Incidence::deleteAttachments(const QString& mime)
610{ 614{
611 Attachment *at = mAttachments.first(); 615 Attachment *at = mAttachments.first();
612 while (at) { 616 while (at) {
613 if (at->mimeType() == mime) 617 if (at->mimeType() == mime)
614 mAttachments.remove(); 618 mAttachments.remove();
615 else 619 else
616 at = mAttachments.next(); 620 at = mAttachments.next();
617 } 621 }
618} 622}
619 623
620QPtrList<Attachment> Incidence::attachments() const 624QPtrList<Attachment> Incidence::attachments() const
621{ 625{
622 return mAttachments; 626 return mAttachments;
623} 627}
624 628
625QPtrList<Attachment> Incidence::attachments(const QString& mime) const 629QPtrList<Attachment> Incidence::attachments(const QString& mime) const
626{ 630{
627 QPtrList<Attachment> attachments; 631 QPtrList<Attachment> attachments;
628 QPtrListIterator<Attachment> it( mAttachments ); 632 QPtrListIterator<Attachment> it( mAttachments );
629 Attachment *at; 633 Attachment *at;
630 while ( (at = it.current()) ) { 634 while ( (at = it.current()) ) {
631 if (at->mimeType() == mime) 635 if (at->mimeType() == mime)
632 attachments.append(at); 636 attachments.append(at);
633 ++it; 637 ++it;
634 } 638 }
635 639
636 return attachments; 640 return attachments;
637} 641}
638 642
639void Incidence::setResources(const QStringList &resources) 643void Incidence::setResources(const QStringList &resources)
640{ 644{
641 if (mReadOnly) return; 645 if (mReadOnly) return;
642 mResources = resources; 646 mResources = resources;
643 updated(); 647 updated();
644} 648}
645 649
646QStringList Incidence::resources() const 650QStringList Incidence::resources() const
647{ 651{
648 return mResources; 652 return mResources;
649} 653}
650 654
651 655
652void Incidence::setPriority(int priority) 656void Incidence::setPriority(int priority)
653{ 657{
654 if (mReadOnly) return; 658 if (mReadOnly) return;
655 mPriority = priority; 659 mPriority = priority;
656 updated(); 660 updated();
657} 661}
658 662
659int Incidence::priority() const 663int Incidence::priority() const
660{ 664{
661 return mPriority; 665 return mPriority;
662} 666}
663 667
664void Incidence::setSecrecy(int sec) 668void Incidence::setSecrecy(int sec)
665{ 669{
666 if (mReadOnly) return; 670 if (mReadOnly) return;
667 mSecrecy = sec; 671 mSecrecy = sec;
668 updated(); 672 updated();
669} 673}
670 674
671int Incidence::secrecy() const 675int Incidence::secrecy() const
672{ 676{
673 return mSecrecy; 677 return mSecrecy;
674} 678}
675 679
676QString Incidence::secrecyStr() const 680QString Incidence::secrecyStr() const
677{ 681{
678 return secrecyName(mSecrecy); 682 return secrecyName(mSecrecy);
679} 683}
680 684
681QString Incidence::secrecyName(int secrecy) 685QString Incidence::secrecyName(int secrecy)
682{ 686{
683 switch (secrecy) { 687 switch (secrecy) {
684 case SecrecyPublic: 688 case SecrecyPublic:
685 return i18n("Public"); 689 return i18n("Public");
686 break; 690 break;
687 case SecrecyPrivate: 691 case SecrecyPrivate:
688 return i18n("Private"); 692 return i18n("Private");
689 break; 693 break;
690 case SecrecyConfidential: 694 case SecrecyConfidential:
691 return i18n("Confidential"); 695 return i18n("Confidential");
692 break; 696 break;
693 default: 697 default:
694 return i18n("Undefined"); 698 return i18n("Undefined");
695 break; 699 break;
696 } 700 }
697} 701}
698 702
699QStringList Incidence::secrecyList() 703QStringList Incidence::secrecyList()
700{ 704{
701 QStringList list; 705 QStringList list;
702 list << secrecyName(SecrecyPublic); 706 list << secrecyName(SecrecyPublic);
703 list << secrecyName(SecrecyPrivate); 707 list << secrecyName(SecrecyPrivate);
704 list << secrecyName(SecrecyConfidential); 708 list << secrecyName(SecrecyConfidential);
705 709
706 return list; 710 return list;
707} 711}
708 712
709 713
710QPtrList<Alarm> Incidence::alarms() const 714QPtrList<Alarm> Incidence::alarms() const
711{ 715{
712 return mAlarms; 716 return mAlarms;
713} 717}
714 718
715Alarm* Incidence::newAlarm() 719Alarm* Incidence::newAlarm()
716{ 720{
717 Alarm* alarm = new Alarm(this); 721 Alarm* alarm = new Alarm(this);
718 mAlarms.append(alarm); 722 mAlarms.append(alarm);
719// updated(); 723// updated();
720 return alarm; 724 return alarm;
721} 725}
722 726
723void Incidence::addAlarm(Alarm *alarm) 727void Incidence::addAlarm(Alarm *alarm)
724{ 728{
725 mAlarms.append(alarm); 729 mAlarms.append(alarm);
726 updated(); 730 updated();
727} 731}
728 732
729void Incidence::removeAlarm(Alarm *alarm) 733void Incidence::removeAlarm(Alarm *alarm)
730{ 734{
731 mAlarms.removeRef(alarm); 735 mAlarms.removeRef(alarm);
732 updated(); 736 updated();
733} 737}
734 738
735void Incidence::clearAlarms() 739void Incidence::clearAlarms()
736{ 740{
737 mAlarms.clear(); 741 mAlarms.clear();
738 updated(); 742 updated();
739} 743}
740 744
741bool Incidence::isAlarmEnabled() const 745bool Incidence::isAlarmEnabled() const
742{ 746{
743 Alarm* alarm; 747 Alarm* alarm;
744 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 748 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
745 if (alarm->enabled()) 749 if (alarm->enabled())
746 return true; 750 return true;
747 } 751 }
748 return false; 752 return false;
749} 753}
750#include <stdlib.h> 754#include <stdlib.h>