-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 @@ -168,13 +168,13 @@ Event::Transparency Event::transparency() const 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() ) { QDateTime te; if ( testEvent->doesFloat() ) @@ -188,14 +188,14 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut e = mDtEnd; if ( mDtStart < te && testEvent->mDtStart < e ) { 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; } Event *nonRecur = 0; Event *recurEvent = 0; @@ -212,13 +212,13 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut if ( nonRecur->doesFloat() ) enr = nonRecur->mDtEnd.addDays( 1 ); 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; bool ok = true; QDateTime recStart = recurEvent->mDtStart.addSecs( -300);; @@ -230,14 +230,14 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut QDateTime recEnd = recStart.addSecs( recDuration ); if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) { 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; } } } @@ -271,14 +271,14 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut if ( ok ) { if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) { if ( incidenceStart < testincidenceStart ) *overlapDT = testincidenceStart; else *overlapDT = incidenceStart; - if ( inFutureOnly ) { - if ( *overlapDT >= QDateTime::currentDateTime() ) + if ( startDT ) { + if ( *overlapDT >= *startDT ) return true; } else return true; } computeThis = ( incidenceStart < testincidenceStart ); } diff --git a/libkcal/event.h b/libkcal/event.h index 80c11c4..e6055a5 100644 --- a/libkcal/event.h +++ b/libkcal/event.h @@ -71,13 +71,13 @@ class Event : public Incidence Transparency transparency() const; 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); } QDateTime mDtEnd; bool mHasEndDate; |