author | zautrix <zautrix> | 2004-08-30 07:47:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-30 07:47:56 (UTC) |
commit | b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2 (patch) (unidiff) | |
tree | 99223dd8edf0e00a4f060610ea0642f915cf4703 /libkcal/incidence.cpp | |
parent | 78f44f13835e3fa501997f485b505b193bd474f5 (diff) | |
download | kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.zip kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.gz kdepimpi-b36bcd92b643c87ee5e2bfc39076ea56abf4c7d2.tar.bz2 |
Changes in gammu connection
-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 d9bda64..56c9801 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -489,96 +489,101 @@ QStringList Incidence::secrecyList() | |||
489 | } | 489 | } |
490 | 490 | ||
491 | 491 | ||
492 | QPtrList<Alarm> Incidence::alarms() const | 492 | QPtrList<Alarm> Incidence::alarms() const |
493 | { | 493 | { |
494 | return mAlarms; | 494 | return mAlarms; |
495 | } | 495 | } |
496 | 496 | ||
497 | Alarm* Incidence::newAlarm() | 497 | Alarm* 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 | ||
505 | void Incidence::addAlarm(Alarm *alarm) | 505 | void Incidence::addAlarm(Alarm *alarm) |
506 | { | 506 | { |
507 | mAlarms.append(alarm); | 507 | mAlarms.append(alarm); |
508 | updated(); | 508 | updated(); |
509 | } | 509 | } |
510 | 510 | ||
511 | void Incidence::removeAlarm(Alarm *alarm) | 511 | void Incidence::removeAlarm(Alarm *alarm) |
512 | { | 512 | { |
513 | mAlarms.removeRef(alarm); | 513 | mAlarms.removeRef(alarm); |
514 | updated(); | 514 | updated(); |
515 | } | 515 | } |
516 | 516 | ||
517 | void Incidence::clearAlarms() | 517 | void Incidence::clearAlarms() |
518 | { | 518 | { |
519 | mAlarms.clear(); | 519 | mAlarms.clear(); |
520 | updated(); | 520 | updated(); |
521 | } | 521 | } |
522 | 522 | ||
523 | bool Incidence::isAlarmEnabled() const | 523 | bool 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 | ||
533 | Recurrence *Incidence::recurrence() const | 533 | Recurrence *Incidence::recurrence() const |
534 | { | 534 | { |
535 | return mRecurrence; | 535 | return mRecurrence; |
536 | } | 536 | } |
537 | void Incidence::setRecurrence( Recurrence * r) | ||
538 | { | ||
539 | delete mRecurrence; | ||
540 | mRecurrence = r; | ||
541 | } | ||
537 | 542 | ||
538 | void Incidence::setLocation(const QString &location) | 543 | void 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 | ||
545 | QString Incidence::location() const | 550 | QString Incidence::location() const |
546 | { | 551 | { |
547 | return mLocation; | 552 | return mLocation; |
548 | } | 553 | } |
549 | 554 | ||
550 | ushort Incidence::doesRecur() const | 555 | ushort 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 | ||
556 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | 561 | QDateTime 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 | } |