summaryrefslogtreecommitdiffstats
path: root/kresources/exchange/dateset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kresources/exchange/dateset.cpp')
-rw-r--r--kresources/exchange/dateset.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/kresources/exchange/dateset.cpp b/kresources/exchange/dateset.cpp
index f79810960..a2372c874 100644
--- a/kresources/exchange/dateset.cpp
+++ b/kresources/exchange/dateset.cpp
@@ -20,9 +20,9 @@
// $Id$
-#include <qptrlist.h>
-#include <qdatetime.h>
-#include <qpair.h>
+#include <tqptrlist.h>
+#include <tqdatetime.h>
+#include <tqpair.h>
#include <kdebug.h>
@@ -42,34 +42,34 @@ DateSet::~DateSet()
delete mDates;
}
-void DateSet::add( QDate const& date )
+void DateSet::add( TQDate const& date )
{
if (mDates->isEmpty()) {
- mDates->insert( 0, new QPair<QDate,QDate>( date, date ) );
+ mDates->insert( 0, new QPair<TQDate,TQDate>( date, date ) );
return;
}
int i = find( date );
- mDates->insert( i, new QPair<QDate,QDate>( date, date ) );
+ mDates->insert( i, new QPair<TQDate,TQDate>( date, date ) );
tryMerge( i );
tryMerge( i-1 );
}
-void DateSet::add( QDate const& from, QDate const& to )
+void DateSet::add( TQDate const& from, TQDate const& to )
{
if (mDates->isEmpty()) {
- mDates->insert( 0, new QPair<QDate,QDate>( from, to ) );
+ mDates->insert( 0, new QPair<TQDate,TQDate>( from, to ) );
return;
}
uint i = find( from );
kdDebug() << "Adding range at position " << i << endl;
- mDates->insert( i, new QPair<QDate,QDate>( from, to ) );
+ mDates->insert( i, new QPair<TQDate,TQDate>( from, to ) );
do {
} while ( tryMerge( i ) );
do {
} while ( tryMerge( i-1 ) );
/*
- QPair<QDate,QDate>* item = mDates->at( i );
+ QPair<TQDate,TQDate>* item = mDates->at( i );
if (to >= item->first)
return;
@@ -77,11 +77,11 @@ void DateSet::add( QDate const& from, QDate const& to )
if (to.daysTo( item->first ) == 1 )
item->first = from;
else
- mDates->insert( i, new QPair<QDate,QDate>( from, to ) );
+ mDates->insert( i, new QPair<TQDate,TQDate>( from, to ) );
*/
}
-void DateSet::remove( QDate const& date )
+void DateSet::remove( TQDate const& date )
{
if (mDates->isEmpty()) {
return;
@@ -91,7 +91,7 @@ void DateSet::remove( QDate const& date )
if ( i == mDates->count() )
return;
- QPair<QDate,QDate>* item = mDates->at( i );
+ QPair<TQDate,TQDate>* item = mDates->at( i );
if ( date < item->first )
return;
if ( date == item->first ) {
@@ -106,12 +106,12 @@ void DateSet::remove( QDate const& date )
if ( date == item->second ) {
item->second = item->second.addDays( -1 );
} else {
- mDates->insert( i, new QPair<QDate,QDate>(item->first, date.addDays( -1 ) ) );
+ mDates->insert( i, new QPair<TQDate,TQDate>(item->first, date.addDays( -1 ) ) );
item->first = date.addDays( 1 );
}
}
-void DateSet::remove( QDate const& from, QDate const& to )
+void DateSet::remove( TQDate const& from, TQDate const& to )
{
if (mDates->isEmpty()) {
return;
@@ -122,7 +122,7 @@ void DateSet::remove( QDate const& from, QDate const& to )
return;
while( i < mDates->count() ) {
- QPair<QDate,QDate>* item = mDates->at( i );
+ QPair<TQDate,TQDate>* item = mDates->at( i );
// Check if we're done: next item is later dan removal period
if ( to < item->first )
break;
@@ -136,7 +136,7 @@ void DateSet::remove( QDate const& from, QDate const& to )
// Check if we should take a slice out of the middle of the item
if ( from > item->first && to < item->second ) {
- mDates->insert( i, new QPair<QDate,QDate>( item->first, from.addDays( -1 ) ) );
+ mDates->insert( i, new QPair<TQDate,TQDate>( item->first, from.addDays( -1 ) ) );
item->first = to.addDays( 1 );
break; // We're done
}
@@ -155,7 +155,7 @@ void DateSet::remove( QDate const& from, QDate const& to )
}
}
-bool DateSet::contains( QDate const& date )
+bool DateSet::contains( TQDate const& date )
{
if (mDates->isEmpty()) {
return false;
@@ -166,13 +166,13 @@ bool DateSet::contains( QDate const& date )
if ( i == mDates->count() )
return false;
- QPair<QDate,QDate>* item = mDates->at( i );
+ QPair<TQDate,TQDate>* item = mDates->at( i );
// kdDebug() << "contains looking at range " << item->first.toString() << " -- " << item->second.toString() << endl;
return ( item->first <= date );
}
// returns true if and only if the whole range is in the set
-bool DateSet::contains( QDate const& from, QDate const& to )
+bool DateSet::contains( TQDate const& from, TQDate const& to )
{
if (mDates->isEmpty()) {
return false;
@@ -182,7 +182,7 @@ bool DateSet::contains( QDate const& from, QDate const& to )
if ( i == mDates->count() )
return false;
- QPair<QDate,QDate>* item = mDates->at( i );
+ QPair<TQDate,TQDate>* item = mDates->at( i );
return ( from >= item->first && to <= item->second );
}
@@ -192,7 +192,7 @@ bool DateSet::contains( QDate const& from, QDate const& to )
// If mDates is empty, return 0.
// If date is later than the last item in mDates, return mDates->count()
-int DateSet::find( QDate const& date )
+int DateSet::find( TQDate const& date )
{
if ( mDates->isEmpty() )
return 0;
@@ -202,7 +202,7 @@ int DateSet::find( QDate const& date )
while ( start < end ) {
int i = start + (end-start) / 2;
// kdDebug() << start << ", " << i << ", " << end << endl;
- QPair<QDate,QDate> *item = mDates->at( i );
+ QPair<TQDate,TQDate> *item = mDates->at( i );
if ( item->first <= date && date <= item->second )
return i;
if ( date > item->second ) {
@@ -229,8 +229,8 @@ void DateSet::print()
{
for( uint i=0; i<mDates->count(); i++ )
{
- QDate start = mDates->at( i )->first;
- QDate end = mDates->at( i )->second;
+ TQDate start = mDates->at( i )->first;
+ TQDate end = mDates->at( i )->second;
if (start == end)
kdDebug() << start.toString() << endl;
else
@@ -246,8 +246,8 @@ bool DateSet::tryMerge( int i )
if ( i < 0 || i+1 >= (int)(mDates->count()) )
return false;
- QPair<QDate,QDate>* item1 = mDates->at( i );
- QPair<QDate,QDate>* item2 = mDates->at( i+1 );
+ QPair<TQDate,TQDate>* item1 = mDates->at( i );
+ QPair<TQDate,TQDate>* item2 = mDates->at( i+1 );
// First case: item1 starts before or on the same date as item2
if ( item1->first <= item2->first ) {