From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kresources/exchange/dateset.cpp | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'kresources/exchange/dateset.cpp') 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 -#include -#include +#include +#include +#include #include @@ -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( date, date ) ); + mDates->insert( 0, new QPair( date, date ) ); return; } int i = find( date ); - mDates->insert( i, new QPair( date, date ) ); + mDates->insert( i, new QPair( 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( from, to ) ); + mDates->insert( 0, new QPair( from, to ) ); return; } uint i = find( from ); kdDebug() << "Adding range at position " << i << endl; - mDates->insert( i, new QPair( from, to ) ); + mDates->insert( i, new QPair( from, to ) ); do { } while ( tryMerge( i ) ); do { } while ( tryMerge( i-1 ) ); /* - QPair* item = mDates->at( i ); + QPair* 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( from, to ) ); + mDates->insert( i, new QPair( 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* item = mDates->at( i ); + QPair* 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(item->first, date.addDays( -1 ) ) ); + mDates->insert( i, new QPair(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* item = mDates->at( i ); + QPair* 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( item->first, from.addDays( -1 ) ) ); + mDates->insert( i, new QPair( 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* item = mDates->at( i ); + QPair* 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* item = mDates->at( i ); + QPair* 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 *item = mDates->at( i ); + QPair *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; icount(); 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* item1 = mDates->at( i ); - QPair* item2 = mDates->at( i+1 ); + QPair* item1 = mDates->at( i ); + QPair* item2 = mDates->at( i+1 ); // First case: item1 starts before or on the same date as item2 if ( item1->first <= item2->first ) { -- cgit v1.2.1