author | zautrix <zautrix> | 2005-07-07 21:34:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-07 21:34:31 (UTC) |
commit | 3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc (patch) (side-by-side diff) | |
tree | 6fceb199e62afe671ed34acb308749ea09cac578 | |
parent | de5621f2fd3924f27c05459ae555b3bd06c5e584 (diff) | |
download | kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.zip kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.tar.gz kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.tar.bz2 |
fixxx
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 52 | ||||
-rw-r--r-- | libkcal/event.cpp | 16 | ||||
-rw-r--r-- | libkcal/event.h | 2 |
4 files changed, 45 insertions, 29 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 43bc343..34e9b7f 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1495,20 +1495,20 @@ { "Show not Running","Zeige nicht Laufende" }, { "Click to add new Todo","Klick für neues Todo!" }, { "Show next conflict for","Zeige nächsten Konflikt für" }, { "All events","Alle Termine" }, { "Allday events","Ganztagestermine" }, { "Events with time","Termine mit Zeit" }, -{ "No conflict found within the next two years","Kein Konflikt innerhalb der nächsten zwei Jahre gefunden" }, +{ "No conflict found","Kein Konflikt gefunden" }, { "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, { "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, { "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, { "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, { "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, { "Show date","Zeige Datum" }, -{ "No problem!","Kein Problem!" }, +{ "No problem!","Null Problemo!" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 65750af..426e8f9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -658,54 +658,69 @@ void CalendarView::nextConflict( bool all, bool allday ) { QPtrList<Event> testlist = mCalendar->events(); Event * test = testlist.first(); while ( test ) { test->setTagged( false ); + test = testlist.next(); } QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); QDateTime conflict; QDateTime retVal; bool found = false; Event * cE = 0; + Event * cE2 = 0; QPtrList<Event> testlist2 = testlist; + test = testlist.first(); + bool skip = false; while ( test ) { - Event * test2 = testlist2.first(); - while ( test2 ) { - if ( !test2->isTagged() ) { - if ( test->isOverlapping ( test2, &retVal, true ) ) { - if ( ! found ) { - if ( retVal >= startDT ) { - conflict = retVal; - cE = test; - found = true; - } - } else { - if ( retVal >= startDT && retVal < conflict ) { - conflict = retVal; - cE = test; + skip = false; + if ( !all ) skip = ( allday != test->doesFloat() ); + if ( !skip ) { + Event * test2 = testlist2.first(); + while ( test2 ) { + skip = false; + if ( !all ) skip = ( allday != test2->doesFloat() ); + if ( !skip ) { + if ( !test2->isTagged() ) { + if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { + //qDebug("overlap "); + if ( ! found ) { + if ( retVal >= startDT ) { + conflict = retVal; + cE = test; + cE2 = test2; + found = true; + } + } else { + if ( retVal >= startDT && retVal < conflict ) { + conflict = retVal; + cE = test; + cE2 = test2; + } + } } } } + test2 = testlist2.next(); } - test2 = testlist2.next(); } test->setTagged( true ); test = testlist.next(); } if ( found ) { if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) mViewManager->showDayView(); mNavigator->slotDaySelect( conflict.date() ); int hour = conflict.time().hour(); mViewManager->agendaView()->setStartHour( hour ); - topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); + topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); return; } - topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); + topLevelWidget()->setCaption( i18n("No conflict found") ); qDebug("No conflict found "); return; @@ -2791,15 +2806,16 @@ void CalendarView::checkConflictForEvent() QPtrList<Event> testlist = mCalendar->events(); Event * test = testlist.first(); QDateTime conflict; QDateTime retVal; bool found = false; Event * cE = 0; + QDateTime current = QDateTime::currentDateTime(); while ( test ) { if ( !test->doesFloat() ) { - if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) { + if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { if ( ! found ) { conflict = retVal; cE = test; } else { if ( retVal < conflict ) { conflict = retVal; 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; |