author | zautrix <zautrix> | 2005-01-31 16:29:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 16:29:05 (UTC) |
commit | ec037c4616342c1b3976c55db98b775f48e0d455 (patch) (side-by-side diff) | |
tree | 9d568c8f6ad6005f822c12644596b7a553837c7f /libkcal/incidence.cpp | |
parent | 5d52c81be9b43887c13f8534a04164d3b44b821f (diff) | |
download | kdepimpi-ec037c4616342c1b3976c55db98b775f48e0d455.zip kdepimpi-ec037c4616342c1b3976c55db98b775f48e0d455.tar.gz kdepimpi-ec037c4616342c1b3976c55db98b775f48e0d455.tar.bz2 |
fix
-rw-r--r-- | libkcal/incidence.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 28402ae..f9e1e9e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -499,119 +499,118 @@ QStringList Incidence::secrecyList() list << secrecyName(SecrecyPrivate); list << secrecyName(SecrecyConfidential); return list; } QPtrList<Alarm> Incidence::alarms() const { return mAlarms; } Alarm* Incidence::newAlarm() { Alarm* alarm = new Alarm(this); mAlarms.append(alarm); // updated(); return alarm; } void Incidence::addAlarm(Alarm *alarm) { mAlarms.append(alarm); updated(); } void Incidence::removeAlarm(Alarm *alarm) { mAlarms.removeRef(alarm); updated(); } void Incidence::clearAlarms() { mAlarms.clear(); updated(); } bool Incidence::isAlarmEnabled() const { Alarm* alarm; for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { if (alarm->enabled()) return true; } return false; } Recurrence *Incidence::recurrence() const { return mRecurrence; } void Incidence::setRecurrence( Recurrence * r) { delete mRecurrence; mRecurrence = r; } void Incidence::setLocation(const QString &location) { if (mReadOnly) return; mLocation = location; updated(); } QString Incidence::location() const { return mLocation; } ushort Incidence::doesRecur() const { if ( mRecurrence ) return mRecurrence->doesRecur(); else return Recurrence::rNone; } QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const { QDateTime incidenceStart = dt; *ok = false; if ( doesRecur() ) { bool last; recurrence()->getPreviousDateTime( incidenceStart , &last ); int count = 0; if ( !last ) { while ( !last ) { ++count; incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); if ( recursOn( incidenceStart.date() ) ) { last = true; // exit while llop } else { if ( last ) { // no alarm on last recurrence return QDateTime (); } int year = incidenceStart.date().year(); // workaround for bug in recurrence - if ( count == 100 || year < 1980 || year > 5000 ) { + if ( count == 100 || year < 1000 || year > 5000 ) { return QDateTime (); } incidenceStart = incidenceStart.addSecs( 1 ); } } } else { return QDateTime (); } } else { if ( hasStartDate () ) { incidenceStart = dtStart(); } if ( type() =="Todo" ) { if ( ((Todo*)this)->hasDueDate() ) incidenceStart = ((Todo*)this)->dtDue(); - } } if ( incidenceStart > dt ) *ok = true; return incidenceStart; } |