summaryrefslogtreecommitdiffstats
path: root/libkcal/recurrence.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkcal/recurrence.cpp')
-rw-r--r--libkcal/recurrence.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index 5d1505df2..c2d7897a0 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -27,7 +27,7 @@
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
-#include <qbitarray.h>
+#include <tqbitarray.h>
#include "recurrence.h"
#include "recurrencerule.h"
@@ -124,10 +124,10 @@ void Recurrence::removeObserver( Observer *observer )
}
-QDateTime Recurrence::startDateTime() const
+TQDateTime Recurrence::startDateTime() const
{
if ( mFloating )
- return QDateTime( mStartDateTime.date(), QTime( 0, 0, 0 ) );
+ return TQDateTime( mStartDateTime.date(), TQTime( 0, 0, 0 ) );
else return mStartDateTime;
}
@@ -176,7 +176,7 @@ void Recurrence::updated()
{
// recurrenceType() re-calculates the type if it's rMax
mCachedType = rMax;
- for ( QValueList<Observer*>::ConstIterator it = mObservers.begin();
+ for ( TQValueList<Observer*>::ConstIterator it = mObservers.begin();
it != mObservers.end(); ++it ) {
if ( (*it) ) (*it)->recurrenceUpdated( this );
}
@@ -266,7 +266,7 @@ ushort Recurrence::recurrenceType( const RecurrenceRule *rrule )
return rOther;
}
-bool Recurrence::recursOn(const QDate &qd) const
+bool Recurrence::recursOn(const TQDate &qd) const
{
TimeList tms;
// First handle dates. Exrules override
@@ -327,7 +327,7 @@ bool Recurrence::recursOn(const QDate &qd) const
}
}
-bool Recurrence::recursAt( const QDateTime &dt ) const
+bool Recurrence::recursAt( const TQDateTime &dt ) const
{
// if it's excluded anyway, don't bother to check if it recurs at all.
if ( mExDateTimes.contains( dt )) return false;
@@ -350,42 +350,42 @@ bool Recurrence::recursAt( const QDateTime &dt ) const
/** Calculates the cumulative end of the whole recurrence (rdates and rrules).
If any rrule is infinite, or the recurrence doesn't have any rrules or
rdates, an invalid date is returned. */
-QDateTime Recurrence::endDateTime() const
+TQDateTime Recurrence::endDateTime() const
{
DateTimeList dts;
dts << startDateTime();
- if ( !mRDates.isEmpty() ) dts << QDateTime( mRDates.last(), QTime( 0, 0, 0 ) );
+ if ( !mRDates.isEmpty() ) dts << TQDateTime( mRDates.last(), TQTime( 0, 0, 0 ) );
if ( !mRDateTimes.isEmpty() ) dts << mRDateTimes.last();
for ( RecurrenceRule::List::ConstIterator rr = mRRules.begin(); rr != mRRules.end(); ++rr ) {
- QDateTime rl( (*rr)->endDt() );
+ TQDateTime rl( (*rr)->endDt() );
// if any of the rules is infinite, the whole recurrence is
- if ( !rl.isValid() ) return QDateTime();
+ if ( !rl.isValid() ) return TQDateTime();
dts << rl;
}
qSortUnique( dts );
- if ( dts.isEmpty() ) return QDateTime();
+ if ( dts.isEmpty() ) return TQDateTime();
else return dts.last();
}
/** Calculates the cumulative end of the whole recurrence (rdates and rrules).
If any rrule is infinite, or the recurrence doesn't have any rrules or
rdates, an invalid date is returned. */
-QDate Recurrence::endDate() const
+TQDate Recurrence::endDate() const
{
- QDateTime end( endDateTime() );
+ TQDateTime end( endDateTime() );
if ( end.isValid() ) { return end.date(); }
- else return QDate();
+ else return TQDate();
}
-void Recurrence::setEndDate( const QDate &date )
+void Recurrence::setEndDate( const TQDate &date )
{
if ( doesFloat() )
- setEndDateTime( QDateTime( date, QTime( 23, 59, 59 ) ) );
+ setEndDateTime( TQDateTime( date, TQTime( 23, 59, 59 ) ) );
else
- setEndDateTime( QDateTime( date, mStartDateTime.time() ) );
+ setEndDateTime( TQDateTime( date, mStartDateTime.time() ) );
}
-void Recurrence::setEndDateTime( const QDateTime &dateTime )
+void Recurrence::setEndDateTime( const TQDateTime &dateTime )
{
if ( mRecurReadOnly ) return;
RecurrenceRule *rrule = defaultRRule( true );
@@ -401,12 +401,12 @@ int Recurrence::duration() const
else return 0;
}
-// int Recurrence::durationTo( const QDate &/*date*/ ) const
+// int Recurrence::durationTo( const TQDate &/*date*/ ) const
// {
// return 0;
// }
-int Recurrence::durationTo( const QDateTime &datetime ) const
+int Recurrence::durationTo( const TQDateTime &datetime ) const
{
// Emulate old behavior: This is just an interface to the first rule!
RecurrenceRule *rrule = defaultRRuleConst();
@@ -443,7 +443,7 @@ void Recurrence::clear()
updated();
}
-void Recurrence::setStartDateTime( const QDateTime &start )
+void Recurrence::setStartDateTime( const TQDateTime &start )
{
if ( mRecurReadOnly ) return;
mStartDateTime = start;
@@ -458,9 +458,9 @@ void Recurrence::setStartDateTime( const QDateTime &start )
updated();
}
-void Recurrence::setStartDate( const QDate &start )
+void Recurrence::setStartDate( const TQDate &start )
{
- setStartDateTime( QDateTime( start, QTime(0,0,0) ) );
+ setStartDateTime( TQDateTime( start, TQTime(0,0,0) ) );
setFloats( true );
}
@@ -493,14 +493,14 @@ int Recurrence::weekStart() const
}
// Emulate the old behavior
-QBitArray Recurrence::days() const
+TQBitArray Recurrence::days() const
{
- QBitArray days( 7 );
+ TQBitArray days( 7 );
days.fill( 0 );
RecurrenceRule *rrule = defaultRRuleConst();
if ( rrule ) {
- QValueList<RecurrenceRule::WDayPos> bydays = rrule->byDays();
- for ( QValueListConstIterator<RecurrenceRule::WDayPos> it = bydays.begin();
+ TQValueList<RecurrenceRule::WDayPos> bydays = rrule->byDays();
+ for ( TQValueListConstIterator<RecurrenceRule::WDayPos> it = bydays.begin();
it != bydays.end(); ++it ) {
if ( (*it).pos() == 0 ) {
days.setBit( (*it).day() - 1 );
@@ -514,44 +514,44 @@ QBitArray Recurrence::days() const
// MONTHLY
// Emulate the old behavior
-QValueList<int> Recurrence::monthDays() const
+TQValueList<int> Recurrence::monthDays() const
{
RecurrenceRule *rrule = defaultRRuleConst();
if ( rrule ) return rrule->byMonthDays();
- else return QValueList<int>();
+ else return TQValueList<int>();
}
// Emulate the old behavior
-QValueList<RecurrenceRule::WDayPos> Recurrence::monthPositions() const
+TQValueList<RecurrenceRule::WDayPos> Recurrence::monthPositions() const
{
RecurrenceRule *rrule = defaultRRuleConst();
if ( rrule ) return rrule->byDays();
- else return QValueList<RecurrenceRule::WDayPos>();
+ else return TQValueList<RecurrenceRule::WDayPos>();
}
// YEARLY
-QValueList<int> Recurrence::yearDays() const
+TQValueList<int> Recurrence::yearDays() const
{
RecurrenceRule *rrule = defaultRRuleConst();
if ( rrule ) return rrule->byYearDays();
- else return QValueList<int>();
+ else return TQValueList<int>();
}
-QValueList<int> Recurrence::yearDates() const
+TQValueList<int> Recurrence::yearDates() const
{
return monthDays();
}
-QValueList<int> Recurrence::yearMonths() const
+TQValueList<int> Recurrence::yearMonths() const
{
RecurrenceRule *rrule = defaultRRuleConst();
if ( rrule ) return rrule->byMonths();
- else return QValueList<int>();
+ else return TQValueList<int>();
}
-QValueList<RecurrenceRule::WDayPos> Recurrence::yearPositions() const
+TQValueList<RecurrenceRule::WDayPos> Recurrence::yearPositions() const
{
return monthPositions();
}
@@ -597,13 +597,13 @@ void Recurrence::setWeekly( int freq, int weekStart )
updated();
}
-void Recurrence::setWeekly( int freq, const QBitArray &days, int weekStart )
+void Recurrence::setWeekly( int freq, const TQBitArray &days, int weekStart )
{
setWeekly( freq, weekStart );
addMonthlyPos( 0, days );
}
-void Recurrence::addWeeklyDays( const QBitArray &days )
+void Recurrence::addWeeklyDays( const TQBitArray &days )
{
addMonthlyPos( 0, days );
}
@@ -614,14 +614,14 @@ void Recurrence::setMonthly( int freq )
updated();
}
-void Recurrence::addMonthlyPos( short pos, const QBitArray &days )
+void Recurrence::addMonthlyPos( short pos, const TQBitArray &days )
{
// Allow 53 for yearly!
if ( mRecurReadOnly || pos > 53 || pos < -53 ) return;
RecurrenceRule *rrule = defaultRRule( false );
if ( !rrule ) return;
bool changed = false;
- QValueList<RecurrenceRule::WDayPos> positions = rrule->byDays();
+ TQValueList<RecurrenceRule::WDayPos> positions = rrule->byDays();
for ( int i = 0; i < 7; ++i ) {
if ( days.testBit(i) ) {
@@ -645,7 +645,7 @@ void Recurrence::addMonthlyPos( short pos, ushort day )
if ( mRecurReadOnly || pos > 53 || pos < -53 ) return;
RecurrenceRule *rrule = defaultRRule( false );
if ( !rrule ) return;
- QValueList<RecurrenceRule::WDayPos> positions = rrule->byDays();
+ TQValueList<RecurrenceRule::WDayPos> positions = rrule->byDays();
RecurrenceRule::WDayPos p( pos, day );
if ( !positions.contains( p ) ) {
@@ -662,7 +662,7 @@ void Recurrence::addMonthlyDate( short day )
RecurrenceRule *rrule = defaultRRule( true );
if ( !rrule ) return;
- QValueList<int> monthDays = rrule->byMonthDays();
+ TQValueList<int> monthDays = rrule->byMonthDays();
if ( !monthDays.contains( day ) ) {
monthDays.append( day );
rrule->setByMonthDays( monthDays );
@@ -683,7 +683,7 @@ void Recurrence::addYearlyDay( int day )
RecurrenceRule *rrule = defaultRRule( false ); // It must already exist!
if ( !rrule ) return;
- QValueList<int> days = rrule->byYearDays();
+ TQValueList<int> days = rrule->byYearDays();
if ( !days.contains( day ) ) {
days << day;
rrule->setByYearDays( days );
@@ -698,7 +698,7 @@ void Recurrence::addYearlyDate( int day )
}
// day part of date within year, given as position (n-th weekday)
-void Recurrence::addYearlyPos( short pos, const QBitArray &days )
+void Recurrence::addYearlyPos( short pos, const TQBitArray &days )
{
addMonthlyPos( pos, days );
}
@@ -711,7 +711,7 @@ void Recurrence::addYearlyMonth( short month )
RecurrenceRule *rrule = defaultRRule( false );
if ( !rrule ) return;
- QValueList<int> months = rrule->byMonths();
+ TQValueList<int> months = rrule->byMonths();
if ( !months.contains(month) ) {
months << month;
rrule->setByMonths( months );
@@ -720,7 +720,7 @@ void Recurrence::addYearlyMonth( short month )
}
-TimeList Recurrence::recurTimesOn( const QDate &date ) const
+TimeList Recurrence::recurTimesOn( const TQDate &date ) const
{
TimeList times;
// The whole day is excepted
@@ -771,10 +771,10 @@ TimeList Recurrence::recurTimesOn( const QDate &date ) const
}
-QDateTime Recurrence::getNextDateTime( const QDateTime &preDateTime ) const
+TQDateTime Recurrence::getNextDateTime( const TQDateTime &preDateTime ) const
{
//kdDebug(5800) << " Recurrence::getNextDateTime after " << preDateTime << endl;
- QDateTime nextDT = preDateTime;
+ TQDateTime nextDT = preDateTime;
// prevent infinite loops, e.g. when an exrule extinguishes an rrule (e.g.
// the exrule is identical to the rrule). If an occurrence is found, break
// out of the loop by returning that QDateTime
@@ -787,7 +787,7 @@ QDateTime Recurrence::getNextDateTime( const QDateTime &preDateTime ) const
// 1.0) Add the start date if it's after preDateTime
// 1.1) Use the next occurrence from the explicit RDATE lists
// 1.2) Add the next recurrence for each of the RRULEs
- // 2) Take the earliest recurrence of these = QDateTime nextDT
+ // 2) Take the earliest recurrence of these = TQDateTime nextDT
// 3) If that date/time is not excluded, either explicitly by an EXDATE or
// by an EXRULE, return nextDT as the next date/time of the recurrence
// 4) If it's excluded, start all at 1), but starting at nextDT (instead
@@ -804,12 +804,12 @@ QDateTime Recurrence::getNextDateTime( const QDateTime &preDateTime ) const
/*kdDebug(5800) << " nextDT: " << nextDT << ", startDT: " << startDateTime() << endl;
kdDebug(5800) << " getNextDateTime: found " << dates.count() << " RDATES and DTSTART in loop " << loop << endl;*/
DateList::ConstIterator dit = mRDates.begin();
- while ( dit != mRDates.end() && QDateTime( (*dit), startDateTime().time() ) <= nextDT ) ++dit;
- if ( dit != mRDates.end() ) dates << QDateTime( (*dit), startDateTime().time() );
+ while ( dit != mRDates.end() && TQDateTime( (*dit), startDateTime().time() ) <= nextDT ) ++dit;
+ if ( dit != mRDates.end() ) dates << TQDateTime( (*dit), startDateTime().time() );
// Add the next occurrences from all RRULEs.
for ( RecurrenceRule::List::ConstIterator rr = mRRules.begin(); rr != mRRules.end(); ++rr ) {
- QDateTime dt = (*rr)->getNextDate( nextDT );
+ TQDateTime dt = (*rr)->getNextDate( nextDT );
if ( dt.isValid() ) dates << dt;
}
@@ -817,7 +817,7 @@ kdDebug(5800) << " getNextDateTime: found " << dates.count() << " RDATES and D
qSortUnique( dates );
// kdDebug(5800) << " getNextDateTime: found " << dates.count() << " dates in loop " << loop << endl;
- if ( dates.isEmpty() ) return QDateTime();
+ if ( dates.isEmpty() ) return TQDateTime();
nextDT = dates.first();
// Check if that date/time is excluded explicitly or by an exrule:
@@ -833,12 +833,12 @@ kdDebug(5800) << " getNextDateTime: found " << dates.count() << " RDATES and D
}
// Couldn't find a valid occurrences in 1000 loops, something is wrong!
- return QDateTime();
+ return TQDateTime();
}
-QDateTime Recurrence::getPreviousDateTime( const QDateTime &afterDateTime ) const
+TQDateTime Recurrence::getPreviousDateTime( const TQDateTime &afterDateTime ) const
{
- QDateTime prevDT = afterDateTime;
+ TQDateTime prevDT = afterDateTime;
// prevent infinite loops, e.g. when an exrule extinguishes an rrule (e.g.
// the exrule is identical to the rrule). If an occurrence is found, break
// out of the loop by returning that QDateTime
@@ -848,7 +848,7 @@ QDateTime Recurrence::getPreviousDateTime( const QDateTime &afterDateTime ) cons
// 1) Find the next date/time after preDateTime when the event could recur
// 1.1) Use the next occurrence from the explicit RDATE lists
// 1.2) Add the next recurrence for each of the RRULEs
- // 2) Take the earliest recurrence of these = QDateTime nextDT
+ // 2) Take the earliest recurrence of these = TQDateTime nextDT
// 3) If that date/time is not excluded, either explicitly by an EXDATE or
// by an EXRULE, return nextDT as the next date/time of the recurrence
// 4) If it's excluded, start all at 1), but starting at nextDT (instead
@@ -870,21 +870,21 @@ QDateTime Recurrence::getPreviousDateTime( const QDateTime &afterDateTime ) cons
if ( dit != mRDates.begin() ) {
do {
--dit;
- } while ( dit != mRDates.begin() && QDateTime((*dit), startDateTime().time()) >= prevDT );
- if ( QDateTime((*dit), startDateTime().time()) < prevDT )
- dates << QDateTime( (*dit), startDateTime().time() );
+ } while ( dit != mRDates.begin() && TQDateTime((*dit), startDateTime().time()) >= prevDT );
+ if ( TQDateTime((*dit), startDateTime().time()) < prevDT )
+ dates << TQDateTime( (*dit), startDateTime().time() );
}
// Add the previous occurrences from all RRULEs.
for ( RecurrenceRule::List::ConstIterator rr = mRRules.begin(); rr != mRRules.end(); ++rr ) {
- QDateTime dt = (*rr)->getPreviousDate( prevDT );
+ TQDateTime dt = (*rr)->getPreviousDate( prevDT );
if ( dt.isValid() ) dates << dt;
}
//kdDebug(5800) << " getPreviousDateTime: found " << dates.count() << " dates in loop " << loop << endl;
// Take the last of these (all others can't be used later on)
qSortUnique( dates );
- if ( dates.isEmpty() ) return QDateTime();
+ if ( dates.isEmpty() ) return TQDateTime();
prevDT = dates.last();
// Check if that date/time is excluded explicitly or by an exrule:
@@ -898,7 +898,7 @@ QDateTime Recurrence::getPreviousDateTime( const QDateTime &afterDateTime ) cons
}
// Couldn't find a valid occurrences in 1000 loops, something is wrong!
- return QDateTime();
+ return TQDateTime();
}
@@ -963,7 +963,7 @@ void Recurrence::setRDateTimes( const DateTimeList &rdates )
updated();
}
-void Recurrence::addRDateTime( const QDateTime &rdate )
+void Recurrence::addRDateTime( const TQDateTime &rdate )
{
if ( mRecurReadOnly ) return;
mRDateTimes.append( rdate );
@@ -985,7 +985,7 @@ void Recurrence::setRDates( const DateList &rdates )
updated();
}
-void Recurrence::addRDate( const QDate &rdate )
+void Recurrence::addRDate( const TQDate &rdate )
{
if ( mRecurReadOnly ) return;
mRDates.append( rdate );
@@ -1006,7 +1006,7 @@ void Recurrence::setExDateTimes( const DateTimeList &exdates )
qSortUnique( mExDateTimes );
}
-void Recurrence::addExDateTime( const QDateTime &exdate )
+void Recurrence::addExDateTime( const TQDateTime &exdate )
{
if ( mRecurReadOnly ) return;
mExDateTimes.append( exdate );
@@ -1028,7 +1028,7 @@ void Recurrence::setExDates( const DateList &exdates )
updated();
}
-void Recurrence::addExDate( const QDate &exdate )
+void Recurrence::addExDate( const TQDate &exdate )
{
if ( mRecurReadOnly ) return;
mExDates.append( exdate );