summaryrefslogtreecommitdiffstats
path: root/kalarm/karecurrence.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kalarm/karecurrence.cpp')
-rw-r--r--kalarm/karecurrence.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/kalarm/karecurrence.cpp b/kalarm/karecurrence.cpp
index 9461d71e..8b7e9068 100644
--- a/kalarm/karecurrence.cpp
+++ b/kalarm/karecurrence.cpp
@@ -20,7 +20,7 @@
#include "kalarm.h"
-#include <qbitarray.h>
+#include <tqbitarray.h>
#include <kdebug.h>
#include <libkcal/icalformat.h>
@@ -57,7 +57,7 @@ KARecurrence::Feb29Type KARecurrence::mDefaultFeb29 = KARecurrence::FEB29_FEB29;
* Only a restricted subset of recurrence types is allowed.
* Reply = true if successful.
*/
-bool KARecurrence::set(Type recurType, int freq, int count, int f29, const DateTime& start, const QDateTime& end)
+bool KARecurrence::set(Type recurType, int freq, int count, int f29, const DateTime& start, const TQDateTime& end)
{
mCachedType = -1;
RecurrenceRule::PeriodType rrtype;
@@ -78,7 +78,7 @@ bool KARecurrence::set(Type recurType, int freq, int count, int f29, const DateT
{
case WEEKLY:
{
- QBitArray days(7);
+ TQBitArray days(7);
days.setBit(start.date().dayOfWeek() - 1);
addWeeklyDays(days);
break;
@@ -101,7 +101,7 @@ bool KARecurrence::set(Type recurType, int freq, int count, int f29, const DateT
* Reply = true if successful.
*/
bool KARecurrence::init(RecurrenceRule::PeriodType recurType, int freq, int count, int f29, const DateTime& start,
- const QDateTime& end)
+ const TQDateTime& end)
{
mCachedType = -1;
Feb29Type feb29Type = (f29 == -1) ? mDefaultFeb29 : static_cast<Feb29Type>(f29);
@@ -133,12 +133,12 @@ bool KARecurrence::init(RecurrenceRule::PeriodType recurType, int freq, int coun
setEndDate(end.date());
else
setEndDateTime(end);
- QDateTime startdt = start.dateTime();
+ TQDateTime startdt = start.dateTime();
if (recurType == RecurrenceRule::rYearly
&& feb29Type == FEB29_FEB28 || feb29Type == FEB29_MAR1)
{
int year = startdt.date().year();
- if (!QDate::leapYear(year)
+ if (!TQDate::leapYear(year)
&& startdt.date().dayOfYear() == (feb29Type == FEB29_MAR1 ? 60 : 59))
{
/* The event start date is February 28th or March 1st, but it
@@ -148,8 +148,8 @@ bool KARecurrence::init(RecurrenceRule::PeriodType recurType, int freq, int coun
* This is necessary because KARecurrence represents all types
* of 29th February recurrences by a simple 29th February.
*/
- while (!QDate::leapYear(--year)) ;
- startdt.setDate(QDate(year, 2, 29));
+ while (!TQDate::leapYear(--year)) ;
+ startdt.setDate(TQDate(year, 2, 29));
}
mFeb29Type = feb29Type;
}
@@ -163,9 +163,9 @@ bool KARecurrence::init(RecurrenceRule::PeriodType recurType, int freq, int coun
/******************************************************************************
* Initialise the recurrence from an iCalendar RRULE string.
*/
-bool KARecurrence::set(const QString& icalRRULE)
+bool KARecurrence::set(const TQString& icalRRULE)
{
- static QString RRULE = QString::fromLatin1("RRULE:");
+ static TQString RRULE = TQString::fromLatin1("RRULE:");
mCachedType = -1;
clear();
if (icalRRULE.isEmpty())
@@ -237,7 +237,7 @@ void KARecurrence::fix()
|| rrule->startDt() != rrules[0]->startDt())
break;
}
- QValueList<int> ds = rrule->byYearDays();
+ TQValueList<int> ds = rrule->byYearDays();
if (!ds.isEmpty() && ds.first() == 60)
{
++convert; // this rule needs to be converted
@@ -249,7 +249,7 @@ void KARecurrence::fix()
}
case rYearlyMonth:
{
- QValueList<int> ds = rrule->byMonthDays();
+ TQValueList<int> ds = rrule->byMonthDays();
if (!ds.isEmpty())
{
int day = ds.first();
@@ -271,7 +271,7 @@ void KARecurrence::fix()
if (day == -1)
{
// Last day of the month - only combine if it's February
- QValueList<int> months = rrule->byMonths();
+ TQValueList<int> months = rrule->byMonths();
if (months.count() != 1 || months.first() != 2)
day = 0;
}
@@ -301,9 +301,9 @@ void KARecurrence::fix()
delete *rr;
}
- QDate end;
+ TQDate end;
int count;
- QValueList<int> months;
+ TQValueList<int> months;
if (convert == 2)
{
// There are two yearly recurrence rules to combine into a February 29th recurrence.
@@ -344,7 +344,7 @@ void KARecurrence::fix()
RecurrenceRule* rrule = defaultRRule();
months.append(2);
rrule->setByMonths(months);
- QValueList<int> ds;
+ TQValueList<int> ds;
ds.append(29);
rrule->setByMonthDays(ds);
if (count)
@@ -356,7 +356,7 @@ void KARecurrence::fix()
/******************************************************************************
* Get the next time the recurrence occurs, strictly after a specified time.
*/
-QDateTime KARecurrence::getNextDateTime(const QDateTime& preDateTime) const
+TQDateTime KARecurrence::getNextDateTime(const TQDateTime& preDateTime) const
{
switch (type())
{
@@ -375,7 +375,7 @@ QDateTime KARecurrence::getNextDateTime(const QDateTime& preDateTime) const
/******************************************************************************
* Get the previous time the recurrence occurred, strictly before a specified time.
*/
-QDateTime KARecurrence::getPreviousDateTime(const QDateTime& afterDateTime) const
+TQDateTime KARecurrence::getPreviousDateTime(const TQDateTime& afterDateTime) const
{
switch (type())
{
@@ -430,8 +430,8 @@ void KARecurrence::writeRecurrence(KCal::Recurrence& recur) const
break;
case ANNUAL_DATE:
{
- QValueList<int> months = rrule->byMonths();
- QValueList<int> days = monthDays();
+ TQValueList<int> months = rrule->byMonths();
+ TQValueList<int> days = monthDays();
bool special = (mFeb29Type != FEB29_FEB29 && !days.isEmpty()
&& days.first() == 29 && months.remove(2));
RecurrenceRule* rrule1 = recur.defaultRRule();
@@ -451,16 +451,16 @@ void KARecurrence::writeRecurrence(KCal::Recurrence& recur) const
rrule2->setEndDt(endDateTime());
if (mFeb29Type == FEB29_MAR1)
{
- QValueList<int> ds;
+ TQValueList<int> ds;
ds.append(60);
rrule2->setByYearDays(ds);
}
else
{
- QValueList<int> ds;
+ TQValueList<int> ds;
ds.append(-1);
rrule2->setByMonthDays(ds);
- QValueList<int> ms;
+ TQValueList<int> ms;
ms.append(2);
rrule2->setByMonths(ms);
}
@@ -492,7 +492,7 @@ void KARecurrence::writeRecurrence(KCal::Recurrence& recur) const
* all. In that case, retain it so that the February 29th characteristic
* is not lost should the user later change the recurrence count.
*/
- QDateTime end = endDateTime();
+ TQDateTime end = endDateTime();
kdDebug()<<"29th recurrence: count="<<count<<", end date="<<end.toString()<<endl;
int count1 = rrule1->durationTo(end)
- (rrule1->recursOn(startDate()) ? 0 : 1);
@@ -520,7 +520,7 @@ kdDebug()<<"29th recurrence: count="<<count<<", end date="<<end.toString()<<endl
/******************************************************************************
* Return the date/time of the last recurrence.
*/
-QDateTime KARecurrence::endDateTime() const
+TQDateTime KARecurrence::endDateTime() const
{
if (mFeb29Type == FEB29_FEB29 || duration() <= 1)
{
@@ -539,8 +539,8 @@ QDateTime KARecurrence::endDateTime() const
*/
RecurrenceRule* rrule = new RecurrenceRule();
rrule->setRecurrenceType(RecurrenceRule::rYearly);
- QDateTime dt = startDateTime();
- QDate d = dt.date();
+ TQDateTime dt = startDateTime();
+ TQDate d = dt.date();
switch (d.day())
{
case 29:
@@ -549,14 +549,14 @@ QDateTime KARecurrence::endDateTime() const
d.setYMD(d.year(), d.month(), 28);
break;
case 28:
- if (d.month() != 2 || mFeb29Type != FEB29_FEB28 || QDate::leapYear(d.year()))
+ if (d.month() != 2 || mFeb29Type != FEB29_FEB28 || TQDate::leapYear(d.year()))
{
// Start date is not a recurrence date, so shift it to 27th
d.setYMD(d.year(), d.month(), 27);
}
break;
case 1:
- if (d.month() == 3 && mFeb29Type == FEB29_MAR1 && !QDate::leapYear(d.year()))
+ if (d.month() == 3 && mFeb29Type == FEB29_MAR1 && !TQDate::leapYear(d.year()))
{
// Start date is a March 1st recurrence date, so shift
// start date to the temporary recurrence date of the 28th
@@ -571,7 +571,7 @@ QDateTime KARecurrence::endDateTime() const
rrule->setFloats(doesFloat());
rrule->setFrequency(frequency());
rrule->setDuration(duration());
- QValueList<int> ds;
+ TQValueList<int> ds;
ds.append(28);
rrule->setByMonthDays(ds);
rrule->setByMonths(defaultRRuleConst()->byMonths());
@@ -580,7 +580,7 @@ QDateTime KARecurrence::endDateTime() const
// We've found the end date for a recurrence on the 28th. Unless that date
// is a real February 28th recurrence, adjust to the actual recurrence date.
- if (mFeb29Type == FEB29_FEB28 && dt.date().month() == 2 && !QDate::leapYear(dt.date().year()))
+ if (mFeb29Type == FEB29_FEB28 && dt.date().month() == 2 && !TQDate::leapYear(dt.date().year()))
return dt;
return dt.addDays(1);
}
@@ -588,17 +588,17 @@ QDateTime KARecurrence::endDateTime() const
/******************************************************************************
* Return the date/time of the last recurrence.
*/
-QDate KARecurrence::endDate() const
+TQDate KARecurrence::endDate() const
{
- QDateTime end = endDateTime();
- return end.isValid() ? end.date() : QDate();
+ TQDateTime end = endDateTime();
+ return end.isValid() ? end.date() : TQDate();
}
/******************************************************************************
* Return whether the event will recur on the specified date.
* The start date only returns true if it matches the recurrence rules.
*/
-bool KARecurrence::recursOn(const QDate& dt) const
+bool KARecurrence::recursOn(const TQDate& dt) const
{
if (!Recurrence::recursOn(dt))
return false;
@@ -623,7 +623,7 @@ bool KARecurrence::recursOn(const QDate& dt) const
* Find the duration of two RRULEs combined.
* Use the shorter of the two if they differ.
*/
-int KARecurrence::combineDurations(const RecurrenceRule* rrule1, const RecurrenceRule* rrule2, QDate& end) const
+int KARecurrence::combineDurations(const RecurrenceRule* rrule1, const RecurrenceRule* rrule2, TQDate& end) const
{
int count1 = rrule1->duration();
int count2 = rrule2->duration();
@@ -644,8 +644,8 @@ int KARecurrence::combineDurations(const RecurrenceRule* rrule1, const Recurrenc
if (!count1 || !count2)
count1 = count2 = 0;
// Get the two rules sorted by end date.
- QDateTime end1 = rrule1->endDt();
- QDateTime end2 = rrule2->endDt();
+ TQDateTime end1 = rrule1->endDt();
+ TQDateTime end2 = rrule2->endDt();
if (end1.date() == end2.date())
{
end = end1.date();
@@ -659,7 +659,7 @@ int KARecurrence::combineDurations(const RecurrenceRule* rrule1, const Recurrenc
// Swap the two rules to make rr1 have the earlier end date
rr1 = rrule2;
rr2 = rrule1;
- QDateTime e = end1;
+ TQDateTime e = end1;
end1 = end2;
end2 = e;
}
@@ -672,7 +672,7 @@ int KARecurrence::combineDurations(const RecurrenceRule* rrule1, const Recurrenc
// Get the date of the next occurrence after the end of the earlier ending rule
RecurrenceRule rr(*rr1);
rr.setDuration(-1);
- QDateTime next1(rr.getNextDate(end1).date());
+ TQDateTime next1(rr.getNextDate(end1).date());
if (!next1.isValid())
end = end1.date();
else
@@ -685,7 +685,7 @@ int KARecurrence::combineDurations(const RecurrenceRule* rrule1, const Recurrenc
end = end2.date();
return count1 + count2;
}
- QDate prev2 = rr2->getPreviousDate(next1).date();
+ TQDate prev2 = rr2->getPreviousDate(next1).date();
end = (prev2 > end1.date()) ? prev2 : end1.date();
}
if (count2)
@@ -707,14 +707,14 @@ int KARecurrence::longestInterval() const
case DAILY:
{
- QValueList<RecurrenceRule::WDayPos> days = defaultRRuleConst()->byDays();
+ TQValueList<RecurrenceRule::WDayPos> days = defaultRRuleConst()->byDays();
if (days.isEmpty())
return freq * 1440;
// It recurs only on certain days of the week, so the maximum interval
// may be greater than the frequency.
bool ds[7] = { false, false, false, false, false, false, false };
- for (QValueList<RecurrenceRule::WDayPos>::ConstIterator it = days.begin(); it != days.end(); ++it)
+ for (TQValueList<RecurrenceRule::WDayPos>::ConstIterator it = days.begin(); it != days.end(); ++it)
if ((*it).pos() == 0)
ds[(*it).day() - 1] = true;
if (freq % 7)
@@ -751,7 +751,7 @@ int KARecurrence::longestInterval() const
{
// Find which days of the week it recurs on, and if on more than
// one, reduce the maximum interval accordingly.
- QBitArray ds = days();
+ TQBitArray ds = days();
int first = -1;
int last = -1;
int maxgap = 1;
@@ -784,7 +784,7 @@ int KARecurrence::longestInterval() const
{
// Find which months of the year it recurs on, and if on more than
// one, reduce the maximum interval accordingly.
- const QValueList<int> months = yearMonths(); // month list is sorted
+ const TQValueList<int> months = yearMonths(); // month list is sorted
if (months.isEmpty())
break; // no months recur
if (months.count() == 1)
@@ -792,19 +792,19 @@ int KARecurrence::longestInterval() const
int first = -1;
int last = -1;
int maxgap = 0;
- for (QValueListConstIterator<int> it = months.begin(); it != months.end(); ++it)
+ for (TQValueListConstIterator<int> it = months.begin(); it != months.end(); ++it)
{
if (first < 0)
first = *it;
else
{
- int span = QDate(2001, last, 1).daysTo(QDate(2001, *it, 1));
+ int span = TQDate(2001, last, 1).daysTo(TQDate(2001, *it, 1));
if (span > maxgap)
maxgap = span;
}
last = *it;
}
- int span = QDate(2001, first, 1).daysTo(QDate(2001, last, 1));
+ int span = TQDate(2001, first, 1).daysTo(TQDate(2001, last, 1));
if (freq > 1)
return (freq*365 - span) * 1440;
if (365 - span > maxgap)
@@ -860,12 +860,12 @@ bool KARecurrence::dailyType(const RecurrenceRule* rrule)
|| !rrule->bySetPos().isEmpty()
|| !rrule->byYearDays().isEmpty())
return false;
- QValueList<RecurrenceRule::WDayPos> days = rrule->byDays();
+ TQValueList<RecurrenceRule::WDayPos> days = rrule->byDays();
if (days.isEmpty())
return true;
// Check that all the positions are zero (i.e. every time)
bool found = false;
- for (QValueList<RecurrenceRule::WDayPos>::ConstIterator it = days.begin(); it != days.end(); ++it)
+ for (TQValueList<RecurrenceRule::WDayPos>::ConstIterator it = days.begin(); it != days.end(); ++it)
{
if ((*it).pos() != 0)
return false;