-rw-r--r-- | libkcal/event.cpp | 16 | ||||
-rw-r--r-- | libkcal/event.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index 235ae55..46e8174 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp @@ -170,9 +170,9 @@ void Event::setDuration(int seconds) { setHasEndDate(false); Incidence::setDuration(seconds); } -bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFutureOnly ) +bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT ) { if ( testEvent == this ) return false; if ( ! doesRecur() && !testEvent->doesRecur() ) { @@ -190,10 +190,10 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut if ( mDtStart < testEvent->mDtStart ) *overlapDT = testEvent->mDtStart; else *overlapDT = mDtStart; - if ( inFutureOnly ) - return (*overlapDT >= QDateTime::currentDateTime() ); + if ( startDT ) + return (*overlapDT >= *startDT ); return true; } return false; } @@ -214,9 +214,9 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut else enr = nonRecur->mDtEnd; if ( enr < recurEvent->mDtStart ) return false; - if ( inFutureOnly && enr < QDateTime::currentDateTime() ) + if ( startDT && enr < *startDT ) return false; int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd ); if ( recurEvent->doesFloat() ) recDuration += 86400; @@ -232,10 +232,10 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut if ( nonRecur->mDtStart < recStart ) *overlapDT = recStart; else *overlapDT = nonRecur->mDtStart; - if ( inFutureOnly ) { - if ( *overlapDT >= QDateTime::currentDateTime() ) + if ( startDT ) { + if ( *overlapDT >= *startDT ) return true; } else return true; } @@ -273,10 +273,10 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut if ( incidenceStart < testincidenceStart ) *overlapDT = testincidenceStart; else *overlapDT = incidenceStart; - if ( inFutureOnly ) { - if ( *overlapDT >= QDateTime::currentDateTime() ) + if ( startDT ) { + if ( *overlapDT >= *startDT ) return true; } else return true; } diff --git a/libkcal/event.h b/libkcal/event.h index 80c11c4..e6055a5 100644 --- a/libkcal/event.h +++ b/libkcal/event.h @@ -73,9 +73,9 @@ class Event : public Incidence void setDuration(int seconds); bool contains ( Event*); - bool isOverlapping ( Event*, QDateTime*, bool inFutureOnly ); + bool isOverlapping ( Event*, QDateTime*, QDateTime* ); private: bool accept(Visitor &v) { return v.visit(this); } |