[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kdepim-3.5.5+/libkcal
From: Allen Winter <winter () kde ! org>
Date: 2007-02-23 13:53:37
Message-ID: 1172238817.010317.843.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 636594 by winterz:
merge SVN commit 635257 by wstephens:
Fix 'spurious reminders from korgac', bug #200859 at bugzilla.novell.com. This is \
actually a bug in libkcal that causes the next recurrence to be wrongly calculated if \
the event recurs weekly/monthly/...ly and does not have a fixed numbe of recurrences.
M +16 -7 branches/work/kdepim-3.5.5+/libkcal/recurrencerule.cpp
--- branches/work/kdepim-3.5.5+/libkcal/recurrencerule.cpp #636593:636594
@@ -1115,22 +1115,27 @@
return QDateTime();
// Start date is only included if it really matches
-// if ( preDate < startDt() ) return startDt();
+ QDateTime adjustedPreDate;
+ if ( preDate < startDt() )
+ adjustedPreDate = startDt().addSecs( -1 );
+ else
+ adjustedPreDate = preDate;
+
if ( mDuration > 0 ) {
if ( !mCached ) buildCache();
DateTimeList::ConstIterator it = mCachedDates.begin();
- while ( it != mCachedDates.end() && (*it) <= preDate ) ++it;
+ while ( it != mCachedDates.end() && (*it) <= adjustedPreDate ) ++it;
if ( it != mCachedDates.end() ) {
-// kdDebug(5800) << " getNext date after " << preDate << ", cached date: " << \
*it << endl; +// kdDebug(5800) << " getNext date after " << adjustedPreDate << ", \
cached date: " << *it << endl; return (*it);
}
}
-// kdDebug(5800) << " getNext date after " << preDate << endl;
- Constraint interval( getNextValidDateInterval( preDate, recurrenceType() ) );
+// kdDebug(5800) << " getNext date after " << adjustedPreDate << endl;
+ Constraint interval( getNextValidDateInterval( adjustedPreDate, recurrenceType() ) \
); DateTimeList dts = datesForInterval( interval, recurrenceType() );
DateTimeList::Iterator dtit = dts.begin();
- while ( dtit != dts.end() && (*dtit) <= preDate ) ++dtit;
+ while ( dtit != dts.end() && (*dtit) <= adjustedPreDate ) ++dtit;
if ( dtit != dts.end() ) {
if ( mDuration >= 0 && (*dtit) > endDt() ) return QDateTime();
else return (*dtit);
@@ -1218,7 +1223,7 @@
RecurrenceRule::Constraint RecurrenceRule::getNextValidDateInterval( const QDateTime \
&preDate, PeriodType type ) const {
// TODO: Simplify this!
-// kdDebug(5800) << " (o) getNextValidDateInterval after " << preDate << ", \
type=" << type << endl; + kdDebug(5800) << " (o) getNextValidDateInterval \
after " << preDate << ", type=" << type << endl; long periods = 0;
QDateTime start = startDt();
QDateTime nextValid( start );
@@ -1238,6 +1243,7 @@
case rMinutely: modifier *= 60;
case rSecondly:
periods = ownSecsTo( start, toDate ) / modifier;
+ periods = QMAX( 0, periods);
if ( periods > 0 )
periods += ( frequency() - 1 - ( (periods - 1) % frequency() ) );
nextValid = start.addSecs( modifier * periods );
@@ -1250,6 +1256,7 @@
modifier *= 7;
case rDaily:
periods = start.daysTo( toDate ) / modifier;
+ periods = QMAX( 0, periods);
if ( periods > 0 )
periods += (frequency() - 1 - ( (periods - 1) % frequency() ) );
nextValid = start.addDays( modifier * periods );
@@ -1258,6 +1265,7 @@
case rMonthly: {
periods = 12*( toDate.date().year() - start.date().year() ) +
( toDate.date().month() - start.date().month() );
+ periods = QMAX( 0, periods);
if ( periods > 0 )
periods += (frequency() - 1 - ( (periods - 1) % frequency() ) );
// set the day to the first day of the month, so we don't have problems
@@ -1267,6 +1275,7 @@
break; }
case rYearly:
periods = ( toDate.date().year() - start.date().year() );
+ periods = QMAX( 0, periods);
if ( periods > 0 )
periods += ( frequency() - 1 - ( (periods - 1) % frequency() ) );
nextValid.setDate( start.date().addYears( periods ) );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic