summaryrefslogtreecommitdiffstats
path: root/libkcal/recurrencerule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkcal/recurrencerule.cpp')
-rw-r--r--libkcal/recurrencerule.cpp228
1 files changed, 114 insertions, 114 deletions
diff --git a/libkcal/recurrencerule.cpp b/libkcal/recurrencerule.cpp
index ef6f9ccd..ce64aadc 100644
--- a/libkcal/recurrencerule.cpp
+++ b/libkcal/recurrencerule.cpp
@@ -24,8 +24,8 @@
#include <kdebug.h>
#include <kglobal.h>
-#include <qdatetime.h>
-#include <qstringlist.h>
+#include <tqdatetime.h>
+#include <tqstringlist.h>
#include <limits.h>
#include <math.h>
@@ -33,14 +33,14 @@
using namespace KCal;
-// FIXME: If Qt is ever changed so that QDateTime:::addSecs takes into account
+// FIXME: If Qt is ever changed so that TQDateTime:::addSecs takes into account
// DST shifts, we need to use our own addSecs method, too, since we
// need to caalculate things in UTC!
-/** Workaround for broken QDateTime::secsTo (at least in Qt 3.3). While
- QDateTime::secsTo does take time zones into account, QDateTime::addSecs
+/** Workaround for broken TQDateTime::secsTo (at least in Qt 3.3). While
+ TQDateTime::secsTo does take time zones into account, TQDateTime::addSecs
does not, so we have a problem:
- QDateTime d1(QDate(2005, 10, 30), QTime(1, 30, 0) );
- QDateTime d2(QDate(2005, 10, 30), QTime(3, 30, 0) );
+ TQDateTime d1(TQDate(2005, 10, 30), TQTime(1, 30, 0) );
+ TQDateTime d2(TQDate(2005, 10, 30), TQTime(3, 30, 0) );
kdDebug(5800) << "d1=" << d1 << ", d2=" << d2 << endl;
kdDebug(5800) << "d1.secsTo(d2)=" << d1.secsTo(d2) << endl;
@@ -51,11 +51,11 @@ using namespace KCal;
libkcal: d1.addSecs(d1.secsTo(d2))=Son Okt 30 04:30:00 2005
Notice that secsTo counts the hour between 2:00 and 3:00 twice, while
adddSecs doesn't and so has one additional hour. This basically makes it
- impossible to use QDateTime for *any* calculations, in local time zone as
+ impossible to use TQDateTime for *any* calculations, in local time zone as
well as in UTC. Since we don't want to use
time zones anyway, but do all secondsly/minutely/hourly calculations in UTC,
we simply use our own secsTo, which ignores all time zone shifts. */
-long long ownSecsTo( const QDateTime &dt1, const QDateTime &dt2 )
+long long ownSecsTo( const TQDateTime &dt1, const TQDateTime &dt2 )
{
long long res = static_cast<long long>( dt1.date().daysTo( dt2.date() ) ) * 24*3600;
res += dt1.time().secsTo( dt2.time() );
@@ -72,17 +72,17 @@ long long ownSecsTo( const QDateTime &dt1, const QDateTime &dt2 )
class DateHelper {
public:
#ifndef NDEBUG
- static QString dayName( short day );
+ static TQString dayName( short day );
#endif
- static QDate getNthWeek( int year, int weeknumber, short weekstart = 1 );
+ static TQDate getNthWeek( int year, int weeknumber, short weekstart = 1 );
static int weekNumbersInYear( int year, short weekstart = 1 );
- static int getWeekNumber( const QDate &date, short weekstart, int *year = 0 );
- static int getWeekNumberNeg( const QDate &date, short weekstart, int *year = 0 );
+ static int getWeekNumber( const TQDate &date, short weekstart, int *year = 0 );
+ static int getWeekNumberNeg( const TQDate &date, short weekstart, int *year = 0 );
};
#ifndef NDEBUG
-QString DateHelper::dayName( short day )
+TQString DateHelper::dayName( short day )
{
switch ( day ) {
case 1: return "MO"; break;
@@ -98,11 +98,11 @@ QString DateHelper::dayName( short day )
#endif
-QDate DateHelper::getNthWeek( int year, int weeknumber, short weekstart )
+TQDate DateHelper::getNthWeek( int year, int weeknumber, short weekstart )
{
- if ( weeknumber == 0 ) return QDate();
+ if ( weeknumber == 0 ) return TQDate();
// Adjust this to the first day of week #1 of the year and add 7*weekno days.
- QDate dt( year, 1, 4 ); // Week #1 is the week that contains Jan 4
+ TQDate dt( year, 1, 4 ); // Week #1 is the week that contains Jan 4
int adjust = -(7 + dt.dayOfWeek() - weekstart) % 7;
if ( weeknumber > 0 ) {
dt = dt.addDays( 7 * (weeknumber-1) + adjust );
@@ -114,20 +114,20 @@ QDate DateHelper::getNthWeek( int year, int weeknumber, short weekstart )
}
-int DateHelper::getWeekNumber( const QDate &date, short weekstart, int *year )
+int DateHelper::getWeekNumber( const TQDate &date, short weekstart, int *year )
{
// kdDebug(5800) << "Getting week number for " << date << " with weekstart="<<weekstart<<endl;
if ( year ) *year = date.year();
- QDate dt( date.year(), 1, 4 ); // <= definitely in week #1
+ TQDate dt( date.year(), 1, 4 ); // <= definitely in week #1
dt = dt.addDays( -(7 + dt.dayOfWeek() - weekstart) % 7 ); // begin of week #1
- QDate dtn( date.year()+1, 1, 4 ); // <= definitely first week of next year
+ TQDate dtn( date.year()+1, 1, 4 ); // <= definitely first week of next year
dtn = dtn.addDays( -(7 + dtn.dayOfWeek() - weekstart) % 7 );
int daysto = dt.daysTo( date );
int dayston = dtn.daysTo( date );
if ( daysto < 0 ) {
if ( year ) *year = date.year()-1;
- dt = QDate( date.year()-1, 1, 4 );
+ dt = TQDate( date.year()-1, 1, 4 );
dt = dt.addDays( -(7 + dt.dayOfWeek() - weekstart) % 7 ); // begin of week #1
daysto = dt.daysTo( date );
} else if ( dayston >= 0 ) {
@@ -141,13 +141,13 @@ int DateHelper::getWeekNumber( const QDate &date, short weekstart, int *year )
int DateHelper::weekNumbersInYear( int year, short weekstart )
{
- QDate dt( year, 1, weekstart );
- QDate dt1( year + 1, 1, weekstart );
+ TQDate dt( year, 1, weekstart );
+ TQDate dt1( year + 1, 1, weekstart );
return dt.daysTo( dt1 ) / 7;
}
// Week number from the end of the year
-int DateHelper::getWeekNumberNeg( const QDate &date, short weekstart, int *year )
+int DateHelper::getWeekNumberNeg( const TQDate &date, short weekstart, int *year )
{
int weekpos = getWeekNumber( date, weekstart, year );
return weekNumbersInYear( *year, weekstart ) - weekpos - 1;
@@ -168,7 +168,7 @@ RecurrenceRule::Constraint::Constraint( int wkst )
clear();
}
-RecurrenceRule::Constraint::Constraint( const QDateTime &preDate, PeriodType type, int wkst )
+RecurrenceRule::Constraint::Constraint( const TQDateTime &preDate, PeriodType type, int wkst )
{
weekstart = wkst;
readDateTime( preDate, type );
@@ -188,7 +188,7 @@ void RecurrenceRule::Constraint::clear()
yearday = 0;
}
-bool RecurrenceRule::Constraint::matches( const QDate &dt, RecurrenceRule::PeriodType type ) const
+bool RecurrenceRule::Constraint::matches( const TQDate &dt, RecurrenceRule::PeriodType type ) const
{
// If the event recurs in week 53 or 1, the day might not belong to the same
// year as the week it is in. E.g. Jan 1, 2005 is in week 53 of year 2004.
@@ -233,7 +233,7 @@ bool RecurrenceRule::Constraint::matches( const QDate &dt, RecurrenceRule::Perio
return true;
}
-bool RecurrenceRule::Constraint::matches( const QDateTime &dt, RecurrenceRule::PeriodType type ) const
+bool RecurrenceRule::Constraint::matches( const TQDateTime &dt, RecurrenceRule::PeriodType type ) const
{
if ( !matches( dt.date(), type ) ) return false;
if ( hour >= 0 && hour != dt.time().hour() ) return false;
@@ -248,28 +248,28 @@ bool RecurrenceRule::Constraint::isConsistent( PeriodType /*period*/) const
return true;
}
-QDateTime RecurrenceRule::Constraint::intervalDateTime( RecurrenceRule::PeriodType type ) const
+TQDateTime RecurrenceRule::Constraint::intervalDateTime( RecurrenceRule::PeriodType type ) const
{
- QDateTime dt;
- dt.setTime( QTime( 0, 0, 0 ) );
- dt.setDate( QDate( year, (month>0)?month:1, (day>0)?day:1 ) );
+ TQDateTime dt;
+ dt.setTime( TQTime( 0, 0, 0 ) );
+ dt.setDate( TQDate( year, (month>0)?month:1, (day>0)?day:1 ) );
if ( day < 0 )
dt = dt.addDays( dt.date().daysInMonth() + day );
switch ( type ) {
case rSecondly:
- dt.setTime( QTime( hour, minute, second ) ); break;
+ dt.setTime( TQTime( hour, minute, second ) ); break;
case rMinutely:
- dt.setTime( QTime( hour, minute, 1 ) ); break;
+ dt.setTime( TQTime( hour, minute, 1 ) ); break;
case rHourly:
- dt.setTime( QTime( hour, 1, 1 ) ); break;
+ dt.setTime( TQTime( hour, 1, 1 ) ); break;
case rDaily:
break;
case rWeekly:
dt = DateHelper::getNthWeek( year, weeknumber, weekstart ); break;
case rMonthly:
- dt.setDate( QDate( year, month, 1 ) ); break;
+ dt.setDate( TQDate( year, month, 1 ) ); break;
case rYearly:
- dt.setDate( QDate( year, 1, 1 ) ); break;
+ dt.setDate( TQDate( year, 1, 1 ) ); break;
default:
break;
}
@@ -300,16 +300,16 @@ DateTimeList RecurrenceRule::Constraint::dateTimes( RecurrenceRule::PeriodType t
DateTimeList result;
bool done = false;
// TODO_Recurrence: Handle floating
- QTime tm( hour, minute, second );
+ TQTime tm( hour, minute, second );
if ( !isConsistent( type ) ) return result;
if ( !done && day > 0 && month > 0 ) {
- QDateTime dt( QDate( year, month, day ), tm );
+ TQDateTime dt( TQDate( year, month, day ), tm );
if ( dt.isValid() ) result.append( dt );
done = true;
}
if ( !done && day < 0 && month > 0 ) {
- QDateTime dt( QDate( year, month, 1 ), tm );
+ TQDateTime dt( TQDate( year, month, 1 ), tm );
dt = dt.addDays( dt.date().daysInMonth() + day );
if ( dt.isValid() ) result.append( dt );
done = true;
@@ -325,15 +325,15 @@ DateTimeList RecurrenceRule::Constraint::dateTimes( RecurrenceRule::PeriodType t
if ( day > 0 ) {
dstart = dend = day;
} else if ( day < 0 ) {
- QDate date( year, month, 1 );
+ TQDate date( year, month, 1 );
dstart = dend = date.daysInMonth() + day + 1;
} else {
- QDate date( year, month, 1 );
+ TQDate date( year, month, 1 );
dstart = 1;
dend = date.daysInMonth();
}
for ( uint d = dstart; d <= dend; ++d ) {
- QDateTime dt( QDate( year, m, d ), tm );
+ TQDateTime dt( TQDate( year, m, d ), tm );
if ( dt.isValid() ) result.append( dt );
}
}
@@ -344,21 +344,21 @@ DateTimeList RecurrenceRule::Constraint::dateTimes( RecurrenceRule::PeriodType t
// If we have a yearday (and of course a year), we know the exact date
if ( !done && yearday != 0 ) {
// yearday < 0 means from end of year, so we'll need Jan 1 of the next year
- QDate d( year + ((yearday>0)?0:1), 1, 1 );
+ TQDate d( year + ((yearday>0)?0:1), 1, 1 );
d = d.addDays( yearday - ((yearday>0)?1:0) );
- result.append( QDateTime( d, tm ) );
+ result.append( TQDateTime( d, tm ) );
done = true;
}
// Else: If we have a weeknumber, we have at most 7 possible dates, loop through them
if ( !done && weeknumber != 0 ) {
- QDate wst( DateHelper::getNthWeek( year, weeknumber, weekstart ) );
+ TQDate wst( DateHelper::getNthWeek( year, weeknumber, weekstart ) );
if ( weekday != 0 ) {
wst = wst.addDays( (7 + weekday - weekstart ) % 7 );
- result.append( QDateTime( wst, tm ) );
+ result.append( TQDateTime( wst, tm ) );
} else {
for ( int i = 0; i < 7; ++i ) {
- result.append( QDateTime( wst, tm ) );
+ result.append( TQDateTime( wst, tm ) );
wst = wst.addDays( 1 );
}
}
@@ -367,13 +367,13 @@ DateTimeList RecurrenceRule::Constraint::dateTimes( RecurrenceRule::PeriodType t
// weekday is given
if ( !done && weekday != 0 ) {
- QDate dt( year, 1, 1 );
+ TQDate dt( year, 1, 1 );
// If type == yearly and month is given, pos is still in month not year!
// TODO_Recurrence: Correct handling of n-th BYDAY...
int maxloop = 53;
bool inMonth = ( type == rMonthly) || ( type == rYearly && month > 0 );
if ( inMonth && month > 0 ) {
- dt = QDate( year, month, 1 );
+ dt = TQDate( year, month, 1 );
maxloop = 5;
}
if ( weekdaynr < 0 ) {
@@ -388,14 +388,14 @@ DateTimeList RecurrenceRule::Constraint::dateTimes( RecurrenceRule::PeriodType t
if ( weekdaynr > 0 ) {
dt = dt.addDays( ( weekdaynr - 1 ) * 7 );
- result.append( QDateTime( dt, tm ) );
+ result.append( TQDateTime( dt, tm ) );
} else if ( weekdaynr < 0 ) {
dt = dt.addDays( weekdaynr * 7 );
- result.append( QDateTime( dt, tm ) );
+ result.append( TQDateTime( dt, tm ) );
} else {
// loop through all possible weeks, non-matching will be filtered later
for ( int i = 0; i < maxloop; ++i ) {
- result.append( QDateTime( dt, tm ) );
+ result.append( TQDateTime( dt, tm ) );
dt = dt.addDays( 7 );
}
}
@@ -418,7 +418,7 @@ bool RecurrenceRule::Constraint::increase( RecurrenceRule::PeriodType type, int
{
// convert the first day of the interval to QDateTime
// Sub-daily types need to be converted to UTC to correctly handle DST shifts
- QDateTime dt( intervalDateTime( type ) );
+ TQDateTime dt( intervalDateTime( type ) );
// Now add the intervals
switch ( type ) {
@@ -439,13 +439,13 @@ bool RecurrenceRule::Constraint::increase( RecurrenceRule::PeriodType type, int
default:
break;
}
- // Convert back from QDateTime to the Constraint class
+ // Convert back from TQDateTime to the Constraint class
readDateTime( dt, type );
return true;
}
-bool RecurrenceRule::Constraint::readDateTime( const QDateTime &preDate, PeriodType type )
+bool RecurrenceRule::Constraint::readDateTime( const TQDateTime &preDate, PeriodType type )
{
clear();
switch ( type ) {
@@ -558,11 +558,11 @@ void RecurrenceRule::setRecurrenceType( PeriodType period )
setDirty();
}
-QDateTime RecurrenceRule::endDt( bool *result ) const
+TQDateTime RecurrenceRule::endDt( bool *result ) const
{
if ( result ) *result = false;
- if ( mPeriod == rNone ) return QDateTime();
- if ( mDuration < 0 ) return QDateTime();
+ if ( mPeriod == rNone ) return TQDateTime();
+ if ( mDuration < 0 ) return TQDateTime();
if ( mDuration == 0 ) {
if ( result ) *result = true;
return mDateEnd;
@@ -570,13 +570,13 @@ QDateTime RecurrenceRule::endDt( bool *result ) const
// N occurrences. Check if we have a full cache. If so, return the cached end date.
if ( ! mCached ) {
// If not enough occurrences can be found (i.e. inconsistent constraints)
- if ( !buildCache() ) return QDateTime();
+ if ( !buildCache() ) return TQDateTime();
}
if ( result ) *result = true;
return mCachedDateEnd;
}
-void RecurrenceRule::setEndDt( const QDateTime &dateTime )
+void RecurrenceRule::setEndDt( const TQDateTime &dateTime )
{
if ( isReadOnly() ) return;
mDateEnd = dateTime;
@@ -623,13 +623,13 @@ void RecurrenceRule::setDirty()
mDirty = true;
mCached = false;
mCachedDates.clear();
- for ( QValueList<Observer*>::ConstIterator it = mObservers.begin();
+ for ( TQValueList<Observer*>::ConstIterator it = mObservers.begin();
it != mObservers.end(); ++it ) {
if ( (*it) ) (*it)->recurrenceChanged( this );
}
}
-void RecurrenceRule::setStartDt( const QDateTime &start )
+void RecurrenceRule::setStartDt( const TQDateTime &start )
{
if ( isReadOnly() ) return;
mDateStart = start;
@@ -643,21 +643,21 @@ void RecurrenceRule::setFrequency(int freq)
setDirty();
}
-void RecurrenceRule::setBySeconds( const QValueList<int> bySeconds )
+void RecurrenceRule::setBySeconds( const TQValueList<int> bySeconds )
{
if ( isReadOnly() ) return;
mBySeconds = bySeconds;
setDirty();
}
-void RecurrenceRule::setByMinutes( const QValueList<int> byMinutes )
+void RecurrenceRule::setByMinutes( const TQValueList<int> byMinutes )
{
if ( isReadOnly() ) return;
mByMinutes = byMinutes;
setDirty();
}
-void RecurrenceRule::setByHours( const QValueList<int> byHours )
+void RecurrenceRule::setByHours( const TQValueList<int> byHours )
{
if ( isReadOnly() ) return;
mByHours = byHours;
@@ -665,42 +665,42 @@ void RecurrenceRule::setByHours( const QValueList<int> byHours )
}
-void RecurrenceRule::setByDays( const QValueList<WDayPos> byDays )
+void RecurrenceRule::setByDays( const TQValueList<WDayPos> byDays )
{
if ( isReadOnly() ) return;
mByDays = byDays;
setDirty();
}
-void RecurrenceRule::setByMonthDays( const QValueList<int> byMonthDays )
+void RecurrenceRule::setByMonthDays( const TQValueList<int> byMonthDays )
{
if ( isReadOnly() ) return;
mByMonthDays = byMonthDays;
setDirty();
}
-void RecurrenceRule::setByYearDays( const QValueList<int> byYearDays )
+void RecurrenceRule::setByYearDays( const TQValueList<int> byYearDays )
{
if ( isReadOnly() ) return;
mByYearDays = byYearDays;
setDirty();
}
-void RecurrenceRule::setByWeekNumbers( const QValueList<int> byWeekNumbers )
+void RecurrenceRule::setByWeekNumbers( const TQValueList<int> byWeekNumbers )
{
if ( isReadOnly() ) return;
mByWeekNumbers = byWeekNumbers;
setDirty();
}
-void RecurrenceRule::setByMonths( const QValueList<int> byMonths )
+void RecurrenceRule::setByMonths( const TQValueList<int> byMonths )
{
if ( isReadOnly() ) return;
mByMonths = byMonths;
setDirty();
}
-void RecurrenceRule::setBySetPos( const QValueList<int> bySetPos )
+void RecurrenceRule::setBySetPos( const TQValueList<int> bySetPos )
{
if ( isReadOnly() ) return;
mBySetPos = bySetPos;
@@ -781,7 +781,7 @@ void RecurrenceRule::buildConstraints()
Constraint::List tmp;
Constraint::List::const_iterator it;
- QValueList<int>::const_iterator intit;
+ TQValueList<int>::const_iterator intit;
#define intConstraint( list, element ) \
if ( !list.isEmpty() ) { \
@@ -807,7 +807,7 @@ void RecurrenceRule::buildConstraints()
if ( !mByDays.isEmpty() ) {
for ( it = mConstraints.constBegin(); it != mConstraints.constEnd(); ++it ) {
- QValueList<WDayPos>::const_iterator dayit;
+ TQValueList<WDayPos>::const_iterator dayit;
for ( dayit = mByDays.constBegin(); dayit != mByDays.constEnd(); ++dayit ) {
con = (*it);
con.weekday = (*dayit).day();
@@ -882,7 +882,7 @@ kdDebug(5800) << " RecurrenceRule::buildCache: " << endl;
// Build the list of all occurrences of this event (we need that to determine
// the end date!)
Constraint interval( getNextValidDateInterval( startDt(), recurrenceType() ) );
- QDateTime next;
+ TQDateTime next;
DateTimeList dts = datesForInterval( interval, recurrenceType() );
DateTimeList::Iterator it = dts.begin();
@@ -924,12 +924,12 @@ kdDebug(5800) << " Finished Building Cache, cache has " << dts.count() << " e
mCachedDateEnd = dts.last();
return true;
} else {
- mCachedDateEnd = QDateTime();
+ mCachedDateEnd = TQDateTime();
return false;
}
}
-bool RecurrenceRule::dateMatchesRules( const QDateTime &qdt ) const
+bool RecurrenceRule::dateMatchesRules( const TQDateTime &qdt ) const
{
bool match = false;
for ( Constraint::List::ConstIterator it = mConstraints.begin();
@@ -939,7 +939,7 @@ bool RecurrenceRule::dateMatchesRules( const QDateTime &qdt ) const
return match;
}
-bool RecurrenceRule::recursOn( const QDate &qd ) const
+bool RecurrenceRule::recursOn( const TQDate &qd ) const
{
// kdDebug(5800) << " RecurrenceRule::recursOn: " << qd << endl;
if ( qd < startDt().date() ) return false;
@@ -955,7 +955,7 @@ bool RecurrenceRule::recursOn( const QDate &qd ) const
match = match || ( (*it).matches( qd, recurrenceType() ) );
}
if ( !match ) return false;
- QDateTime tmp( qd, QTime( 0, 0, 0 ) );
+ TQDateTime tmp( qd, TQTime( 0, 0, 0 ) );
Constraint interval( getNextValidDateInterval( tmp, recurrenceType() ) );
// Constraint::matches is quite efficient, so first check if it can occur at
// all before we calculate all actual dates.
@@ -978,7 +978,7 @@ bool RecurrenceRule::recursOn( const QDate &qd ) const
}
-bool RecurrenceRule::recursAt( const QDateTime &qd ) const
+bool RecurrenceRule::recursAt( const TQDateTime &qd ) const
{
// kdDebug(5800) << " RecurrenceRule::recursAt: " << qd << endl;
if ( doesFloat() ) return recursOn( qd.date() );
@@ -1001,7 +1001,7 @@ bool RecurrenceRule::recursAt( const QDateTime &qd ) const
}
-TimeList RecurrenceRule::recurTimesOn( const QDate &date ) const
+TimeList RecurrenceRule::recurTimesOn( const TQDate &date ) const
{
// kdDebug(5800) << " RecurrenceRule::recurTimesOn: " << date << endl;
TimeList lst;
@@ -1009,7 +1009,7 @@ TimeList RecurrenceRule::recurTimesOn( const QDate &date ) const
if ( doesFloat() ) return lst;
- QDateTime dt( date, QTime( 0, 0, 0 ) );
+ TQDateTime dt( date, TQTime( 0, 0, 0 ) );
bool valid = dt.isValid() && ( dt.date() == date );
while ( valid ) {
// TODO: Add a flag so that the date is never increased!
@@ -1021,7 +1021,7 @@ TimeList RecurrenceRule::recurTimesOn( const QDate &date ) const
}
/** Returns the number of recurrences up to and including the date/time specified. */
-int RecurrenceRule::durationTo( const QDateTime &dt ) const
+int RecurrenceRule::durationTo( const TQDateTime &dt ) const
{
// kdDebug(5800) << " RecurrenceRule::durationTo: " << dt << endl;
// Easy cases: either before start, or after all recurrences and we know
@@ -1031,7 +1031,7 @@ int RecurrenceRule::durationTo( const QDateTime &dt ) const
// if ( dt == startDt() ) return 1;
if ( mDuration > 0 && dt >= endDt() ) return mDuration;
- QDateTime next( startDt() );
+ TQDateTime next( startDt() );
int found = 0;
while ( next.isValid() && next <= dt ) {
++found;
@@ -1041,15 +1041,15 @@ int RecurrenceRule::durationTo( const QDateTime &dt ) const
}
-QDateTime RecurrenceRule::getPreviousDate( const QDateTime& afterDate ) const
+TQDateTime RecurrenceRule::getPreviousDate( const TQDateTime& afterDate ) const
{
// kdDebug(5800) << " RecurrenceRule::getPreviousDate: " << afterDate << endl;
// Beyond end of recurrence
if ( afterDate < startDt() )
- return QDateTime();
+ return TQDateTime();
// If we have a cache (duration given), use that
- QDateTime prev;
+ TQDateTime prev;
if ( mDuration > 0 ) {
if ( !mCached ) buildCache();
DateTimeList::ConstIterator it = mCachedDates.begin();
@@ -1058,7 +1058,7 @@ QDateTime RecurrenceRule::getPreviousDate( const QDateTime& afterDate ) const
++it;
}
if ( prev.isValid() && prev < afterDate ) return prev;
- else return QDateTime();
+ else return TQDateTime();
}
// kdDebug(5800) << " getNext date after " << preDate << endl;
@@ -1077,7 +1077,7 @@ QDateTime RecurrenceRule::getPreviousDate( const QDateTime& afterDate ) const
} while ( dtit != dts.begin() && (*dtit) >= prev );
if ( (*dtit) < prev ) {
if ( (*dtit) >= startDt() ) return (*dtit);
- else return QDateTime();
+ else return TQDateTime();
}
}
@@ -1092,22 +1092,22 @@ QDateTime RecurrenceRule::getPreviousDate( const QDateTime& afterDate ) const
if ( dts.count() > 0 ) {
prev = dts.last();
if ( prev.isValid() && prev >= startDt() ) return prev;
- else return QDateTime();
+ else return TQDateTime();
}
}
- return QDateTime();
+ return TQDateTime();
}
-QDateTime RecurrenceRule::getNextDate( const QDateTime &preDate ) const
+TQDateTime RecurrenceRule::getNextDate( const TQDateTime &preDate ) const
{
// kdDebug(5800) << " RecurrenceRule::getNextDate: " << preDate << endl;
// Beyond end of recurrence
if ( mDuration >= 0 && endDt().isValid() && preDate >= endDt() )
- return QDateTime();
+ return TQDateTime();
// Start date is only included if it really matches
- QDateTime adjustedPreDate;
+ TQDateTime adjustedPreDate;
if ( preDate < startDt() )
adjustedPreDate = startDt().addSecs( -1 );
else
@@ -1129,7 +1129,7 @@ QDateTime RecurrenceRule::getNextDate( const QDateTime &preDate ) const
DateTimeList::Iterator dtit = dts.begin();
while ( dtit != dts.end() && (*dtit) <= adjustedPreDate ) ++dtit;
if ( dtit != dts.end() ) {
- if ( mDuration >= 0 && (*dtit) > endDt() ) return QDateTime();
+ if ( mDuration >= 0 && (*dtit) > endDt() ) return TQDateTime();
else return (*dtit);
}
@@ -1141,23 +1141,23 @@ QDateTime RecurrenceRule::getNextDate( const QDateTime &preDate ) const
interval.increase( recurrenceType(), frequency() );
DateTimeList dts = datesForInterval( interval, recurrenceType() );
if ( dts.count() > 0 ) {
- QDateTime ret( dts.first() );
- if ( mDuration >= 0 && ret > endDt() ) return QDateTime();
+ TQDateTime ret( dts.first() );
+ if ( mDuration >= 0 && ret > endDt() ) return TQDateTime();
else return ret;
}
++loopnr;
}
- return QDateTime();
+ return TQDateTime();
}
-RecurrenceRule::Constraint RecurrenceRule::getPreviousValidDateInterval( const QDateTime &preDate, PeriodType type ) const
+RecurrenceRule::Constraint RecurrenceRule::getPreviousValidDateInterval( const TQDateTime &preDate, PeriodType type ) const
{
// kdDebug(5800) << " (o) getPreviousValidDateInterval after " << preDate << ", type=" << type << endl;
long periods = 0;
- QDateTime nextValid = startDt();
- QDateTime start = startDt();
+ TQDateTime nextValid = startDt();
+ TQDateTime start = startDt();
int modifier = 1;
- QDateTime toDate( preDate );
+ TQDateTime toDate( preDate );
// for super-daily recurrences, don't care about the time part
// Find the #intervals since the dtstart and round to the next multiple of
@@ -1195,7 +1195,7 @@ RecurrenceRule::Constraint RecurrenceRule::getPreviousValidDateInterval( const Q
periods = ( periods / frequency() ) * frequency();
// set the day to the first day of the month, so we don't have problems
// with non-existent days like Feb 30 or April 31
- start.setDate( QDate( start.date().year(), start.date().month(), 1 ) );
+ start.setDate( TQDate( start.date().year(), start.date().month(), 1 ) );
nextValid.setDate( start.date().addMonths( periods ) );
break; }
case rYearly:
@@ -1212,15 +1212,15 @@ RecurrenceRule::Constraint RecurrenceRule::getPreviousValidDateInterval( const Q
return Constraint( nextValid, type, mWeekStart );
}
-RecurrenceRule::Constraint RecurrenceRule::getNextValidDateInterval( const QDateTime &preDate, PeriodType type ) const
+RecurrenceRule::Constraint RecurrenceRule::getNextValidDateInterval( const TQDateTime &preDate, PeriodType type ) const
{
// TODO: Simplify this!
kdDebug(5800) << " (o) getNextValidDateInterval after " << preDate << ", type=" << type << endl;
long periods = 0;
- QDateTime start = startDt();
- QDateTime nextValid( start );
+ TQDateTime start = startDt();
+ TQDateTime nextValid( start );
int modifier = 1;
- QDateTime toDate( preDate );
+ TQDateTime toDate( preDate );
// for super-daily recurrences, don't care about the time part
// Find the #intervals since the dtstart and round to the next multiple of
@@ -1262,7 +1262,7 @@ RecurrenceRule::Constraint RecurrenceRule::getNextValidDateInterval( const QDate
periods += (frequency() - 1 - ( (periods - 1) % frequency() ) );
// set the day to the first day of the month, so we don't have problems
// with non-existent days like Feb 30 or April 31
- start.setDate( QDate( start.date().year(), start.date().month(), 1 ) );
+ start.setDate( TQDate( start.date().year(), start.date().month(), 1 ) );
nextValid.setDate( start.date().addMonths( periods ) );
break; }
case rYearly:
@@ -1353,7 +1353,7 @@ DateTimeList RecurrenceRule::datesForInterval( const Constraint &interval, Perio
if ( !mBySetPos.isEmpty() ) {
DateTimeList tmplst = lst;
lst.clear();
- QValueList<int>::ConstIterator it;
+ TQValueList<int>::ConstIterator it;
for ( it = mBySetPos.begin(); it != mBySetPos.end(); ++it ) {
int pos = *it;
if ( pos > 0 ) --pos;
@@ -1385,10 +1385,10 @@ void RecurrenceRule::dump() const
#define dumpByIntList(list,label) \
if ( !list.isEmpty() ) {\
- QStringList lst;\
- for ( QValueList<int>::ConstIterator it = list.begin();\
+ TQStringList lst;\
+ for ( TQValueList<int>::ConstIterator it = list.begin();\
it != list.end(); ++it ) {\
- lst.append( QString::number( *it ) );\
+ lst.append( TQString::number( *it ) );\
}\
kdDebug(5800) << " " << label << lst.join(", ") << endl;\
}
@@ -1396,10 +1396,10 @@ void RecurrenceRule::dump() const
dumpByIntList( mByMinutes, "ByMinutes: " );
dumpByIntList( mByHours, "ByHours: " );
if ( !mByDays.isEmpty() ) {
- QStringList lst;
- for ( QValueList<WDayPos>::ConstIterator it = mByDays.begin();
+ TQStringList lst;
+ for ( TQValueList<WDayPos>::ConstIterator it = mByDays.begin();
it != mByDays.end(); ++it ) {
- lst.append( ( ((*it).pos()!=0) ? QString::number( (*it).pos() ) : "" ) +
+ lst.append( ( ((*it).pos()!=0) ? TQString::number( (*it).pos() ) : "" ) +
DateHelper::dayName( (*it).day() ) );
}
kdDebug(5800) << " ByDays: " << lst.join(", ") << endl;