summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
authorzautrix <zautrix>2004-08-30 07:47:56 (UTC)
committer zautrix <zautrix>2004-08-30 07:47:56 (UTC)
commitb36bcd92b643c87ee5e2bfc39076ea56abf4c7d2 (patch) (unidiff)
tree99223dd8edf0e00a4f060610ea0642f915cf4703 /libkcal/incidence.cpp
parent78f44f13835e3fa501997f485b505b193bd474f5 (diff)
downloadkdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.zip
kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.gz
kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.bz2
Changes in gammu connection
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index d9bda64..56c9801 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -473,122 +473,127 @@ QString Incidence::secrecyName(int secrecy)
473 return i18n("Confidential"); 473 return i18n("Confidential");
474 break; 474 break;
475 default: 475 default:
476 return i18n("Undefined"); 476 return i18n("Undefined");
477 break; 477 break;
478 } 478 }
479} 479}
480 480
481QStringList Incidence::secrecyList() 481QStringList Incidence::secrecyList()
482{ 482{
483 QStringList list; 483 QStringList list;
484 list << secrecyName(SecrecyPublic); 484 list << secrecyName(SecrecyPublic);
485 list << secrecyName(SecrecyPrivate); 485 list << secrecyName(SecrecyPrivate);
486 list << secrecyName(SecrecyConfidential); 486 list << secrecyName(SecrecyConfidential);
487 487
488 return list; 488 return list;
489} 489}
490 490
491 491
492QPtrList<Alarm> Incidence::alarms() const 492QPtrList<Alarm> Incidence::alarms() const
493{ 493{
494 return mAlarms; 494 return mAlarms;
495} 495}
496 496
497Alarm* Incidence::newAlarm() 497Alarm* Incidence::newAlarm()
498{ 498{
499 Alarm* alarm = new Alarm(this); 499 Alarm* alarm = new Alarm(this);
500 mAlarms.append(alarm); 500 mAlarms.append(alarm);
501// updated(); 501// updated();
502 return alarm; 502 return alarm;
503} 503}
504 504
505void Incidence::addAlarm(Alarm *alarm) 505void Incidence::addAlarm(Alarm *alarm)
506{ 506{
507 mAlarms.append(alarm); 507 mAlarms.append(alarm);
508 updated(); 508 updated();
509} 509}
510 510
511void Incidence::removeAlarm(Alarm *alarm) 511void Incidence::removeAlarm(Alarm *alarm)
512{ 512{
513 mAlarms.removeRef(alarm); 513 mAlarms.removeRef(alarm);
514 updated(); 514 updated();
515} 515}
516 516
517void Incidence::clearAlarms() 517void Incidence::clearAlarms()
518{ 518{
519 mAlarms.clear(); 519 mAlarms.clear();
520 updated(); 520 updated();
521} 521}
522 522
523bool Incidence::isAlarmEnabled() const 523bool Incidence::isAlarmEnabled() const
524{ 524{
525 Alarm* alarm; 525 Alarm* alarm;
526 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 526 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
527 if (alarm->enabled()) 527 if (alarm->enabled())
528 return true; 528 return true;
529 } 529 }
530 return false; 530 return false;
531} 531}
532 532
533Recurrence *Incidence::recurrence() const 533Recurrence *Incidence::recurrence() const
534{ 534{
535 return mRecurrence; 535 return mRecurrence;
536} 536}
537void Incidence::setRecurrence( Recurrence * r)
538{
539 delete mRecurrence;
540 mRecurrence = r;
541}
537 542
538void Incidence::setLocation(const QString &location) 543void Incidence::setLocation(const QString &location)
539{ 544{
540 if (mReadOnly) return; 545 if (mReadOnly) return;
541 mLocation = location; 546 mLocation = location;
542 updated(); 547 updated();
543} 548}
544 549
545QString Incidence::location() const 550QString Incidence::location() const
546{ 551{
547 return mLocation; 552 return mLocation;
548} 553}
549 554
550ushort Incidence::doesRecur() const 555ushort Incidence::doesRecur() const
551{ 556{
552 if ( mRecurrence ) return mRecurrence->doesRecur(); 557 if ( mRecurrence ) return mRecurrence->doesRecur();
553 else return Recurrence::rNone; 558 else return Recurrence::rNone;
554} 559}
555 560
556QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const 561QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
557{ 562{
558 QDateTime incidenceStart = dt; 563 QDateTime incidenceStart = dt;
559 *ok = false; 564 *ok = false;
560 if ( doesRecur() ) { 565 if ( doesRecur() ) {
561 bool last; 566 bool last;
562 recurrence()->getPreviousDateTime( incidenceStart , &last ); 567 recurrence()->getPreviousDateTime( incidenceStart , &last );
563 int count = 0; 568 int count = 0;
564 if ( !last ) { 569 if ( !last ) {
565 while ( !last ) { 570 while ( !last ) {
566 ++count; 571 ++count;
567 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); 572 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
568 if ( recursOn( incidenceStart.date() ) ) { 573 if ( recursOn( incidenceStart.date() ) ) {
569 last = true; // exit while llop 574 last = true; // exit while llop
570 } else { 575 } else {
571 if ( last ) { // no alarm on last recurrence 576 if ( last ) { // no alarm on last recurrence
572 return QDateTime (); 577 return QDateTime ();
573 } 578 }
574 int year = incidenceStart.date().year(); 579 int year = incidenceStart.date().year();
575 // workaround for bug in recurrence 580 // workaround for bug in recurrence
576 if ( count == 100 || year < 1980 || year > 5000 ) { 581 if ( count == 100 || year < 1980 || year > 5000 ) {
577 return QDateTime (); 582 return QDateTime ();
578 } 583 }
579 incidenceStart = incidenceStart.addSecs( 1 ); 584 incidenceStart = incidenceStart.addSecs( 1 );
580 } 585 }
581 } 586 }
582 } else { 587 } else {
583 return QDateTime (); 588 return QDateTime ();
584 } 589 }
585 } else { 590 } else {
586 if ( hasStartDate () ) { 591 if ( hasStartDate () ) {
587 incidenceStart = dtStart(); 592 incidenceStart = dtStart();
588 593
589 } 594 }
590 } 595 }
591 if ( incidenceStart > dt ) 596 if ( incidenceStart > dt )
592 *ok = true; 597 *ok = true;
593 return incidenceStart; 598 return incidenceStart;
594} 599}