summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-07 21:34:31 (UTC)
committer zautrix <zautrix>2005-07-07 21:34:31 (UTC)
commit3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc (patch) (unidiff)
tree6fceb199e62afe671ed34acb308749ea09cac578
parentde5621f2fd3924f27c05459ae555b3bd06c5e584 (diff)
downloadkdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.zip
kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.tar.gz
kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp52
-rw-r--r--libkcal/event.cpp16
-rw-r--r--libkcal/event.h2
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 @@
1495{ "Show not Running","Zeige nicht Laufende" }, 1495{ "Show not Running","Zeige nicht Laufende" },
1496{ "Click to add new Todo","Klick für neues Todo!" }, 1496{ "Click to add new Todo","Klick für neues Todo!" },
1497{ "Show next conflict for","Zeige nächsten Konflikt für" }, 1497{ "Show next conflict for","Zeige nächsten Konflikt für" },
1498{ "All events","Alle Termine" }, 1498{ "All events","Alle Termine" },
1499{ "Allday events","Ganztagestermine" }, 1499{ "Allday events","Ganztagestermine" },
1500{ "Events with time","Termine mit Zeit" }, 1500{ "Events with time","Termine mit Zeit" },
1501{ "No conflict found within the next two years","Kein Konflikt innerhalb der nächsten zwei Jahre gefunden" }, 1501{ "No conflict found","Kein Konflikt gefunden" },
1502{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, 1502{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" },
1503{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, 1503{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " },
1504{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, 1504{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" },
1505{ "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" }, 1505{ "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" },
1506{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, 1506{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" },
1507{ "Show date","Zeige Datum" }, 1507{ "Show date","Zeige Datum" },
1508{ "No problem!","Kein Problem!" }, 1508{ "No problem!","Null Problemo!" },
1509{ "","" }, 1509{ "","" },
1510{ "","" }, 1510{ "","" },
1511{ "","" }, 1511{ "","" },
1512{ "","" }, 1512{ "","" },
1513{ "","" }, 1513{ "","" },
1514{ "","" }, 1514{ "","" },
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 )
658{ 658{
659 659
660 QPtrList<Event> testlist = mCalendar->events(); 660 QPtrList<Event> testlist = mCalendar->events();
661 Event * test = testlist.first(); 661 Event * test = testlist.first();
662 while ( test ) { 662 while ( test ) {
663 test->setTagged( false ); 663 test->setTagged( false );
664 test = testlist.next();
664 } 665 }
665 QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); 666 QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0));
666 QDateTime conflict; 667 QDateTime conflict;
667 QDateTime retVal; 668 QDateTime retVal;
668 bool found = false; 669 bool found = false;
669 Event * cE = 0; 670 Event * cE = 0;
671 Event * cE2 = 0;
670 QPtrList<Event> testlist2 = testlist; 672 QPtrList<Event> testlist2 = testlist;
673 test = testlist.first();
674 bool skip = false;
671 while ( test ) { 675 while ( test ) {
672 Event * test2 = testlist2.first(); 676 skip = false;
673 while ( test2 ) { 677 if ( !all ) skip = ( allday != test->doesFloat() );
674 if ( !test2->isTagged() ) { 678 if ( !skip ) {
675 if ( test->isOverlapping ( test2, &retVal, true ) ) { 679 Event * test2 = testlist2.first();
676 if ( ! found ) { 680 while ( test2 ) {
677 if ( retVal >= startDT ) { 681 skip = false;
678 conflict = retVal; 682 if ( !all ) skip = ( allday != test2->doesFloat() );
679 cE = test; 683 if ( !skip ) {
680 found = true; 684 if ( !test2->isTagged() ) {
681 } 685 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
682 } else { 686 //qDebug("overlap ");
683 if ( retVal >= startDT && retVal < conflict ) { 687 if ( ! found ) {
684 conflict = retVal; 688 if ( retVal >= startDT ) {
685 cE = test; 689 conflict = retVal;
690 cE = test;
691 cE2 = test2;
692 found = true;
693 }
694 } else {
695 if ( retVal >= startDT && retVal < conflict ) {
696 conflict = retVal;
697 cE = test;
698 cE2 = test2;
699 }
700 }
686 } 701 }
687 } 702 }
688 } 703 }
704 test2 = testlist2.next();
689 } 705 }
690 test2 = testlist2.next();
691 } 706 }
692 test->setTagged( true ); 707 test->setTagged( true );
693 test = testlist.next(); 708 test = testlist.next();
694 } 709 }
695 if ( found ) { 710 if ( found ) {
696 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 711 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
697 mViewManager->showDayView(); 712 mViewManager->showDayView();
698 mNavigator->slotDaySelect( conflict.date() ); 713 mNavigator->slotDaySelect( conflict.date() );
699 int hour = conflict.time().hour(); 714 int hour = conflict.time().hour();
700 mViewManager->agendaView()->setStartHour( hour ); 715 mViewManager->agendaView()->setStartHour( hour );
701 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 716 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
702 return; 717 return;
703 } 718 }
704 719
705 topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); 720 topLevelWidget()->setCaption( i18n("No conflict found") );
706 qDebug("No conflict found "); 721 qDebug("No conflict found ");
707 return; 722 return;
708 723
709 724
710 725
711 726
@@ -2791,15 +2806,16 @@ void CalendarView::checkConflictForEvent()
2791 QPtrList<Event> testlist = mCalendar->events(); 2806 QPtrList<Event> testlist = mCalendar->events();
2792 Event * test = testlist.first(); 2807 Event * test = testlist.first();
2793 QDateTime conflict; 2808 QDateTime conflict;
2794 QDateTime retVal; 2809 QDateTime retVal;
2795 bool found = false; 2810 bool found = false;
2796 Event * cE = 0; 2811 Event * cE = 0;
2812 QDateTime current = QDateTime::currentDateTime();
2797 while ( test ) { 2813 while ( test ) {
2798 if ( !test->doesFloat() ) { 2814 if ( !test->doesFloat() ) {
2799 if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) { 2815 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
2800 if ( ! found ) { 2816 if ( ! found ) {
2801 conflict = retVal; 2817 conflict = retVal;
2802 cE = test; 2818 cE = test;
2803 } else { 2819 } else {
2804 if ( retVal < conflict ) { 2820 if ( retVal < conflict ) {
2805 conflict = retVal; 2821 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
168 168
169void Event::setDuration(int seconds) 169void Event::setDuration(int seconds)
170{ 170{
171 setHasEndDate(false); 171 setHasEndDate(false);
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFutureOnly ) 174bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT )
175{ 175{
176 if ( testEvent == this ) 176 if ( testEvent == this )
177 return false; 177 return false;
178 if ( ! doesRecur() && !testEvent->doesRecur() ) { 178 if ( ! doesRecur() && !testEvent->doesRecur() ) {
179 QDateTime te; 179 QDateTime te;
180 if ( testEvent->doesFloat() ) 180 if ( testEvent->doesFloat() )
@@ -188,14 +188,14 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut
188 e = mDtEnd; 188 e = mDtEnd;
189 if ( mDtStart < te && testEvent->mDtStart < e ) { 189 if ( mDtStart < te && testEvent->mDtStart < e ) {
190 if ( mDtStart < testEvent->mDtStart ) 190 if ( mDtStart < testEvent->mDtStart )
191 *overlapDT = testEvent->mDtStart; 191 *overlapDT = testEvent->mDtStart;
192 else 192 else
193 *overlapDT = mDtStart; 193 *overlapDT = mDtStart;
194 if ( inFutureOnly ) 194 if ( startDT )
195 return (*overlapDT >= QDateTime::currentDateTime() ); 195 return (*overlapDT >= *startDT );
196 return true; 196 return true;
197 } 197 }
198 return false; 198 return false;
199 } 199 }
200 Event *nonRecur = 0; 200 Event *nonRecur = 0;
201 Event *recurEvent = 0; 201 Event *recurEvent = 0;
@@ -212,13 +212,13 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut
212 if ( nonRecur->doesFloat() ) 212 if ( nonRecur->doesFloat() )
213 enr = nonRecur->mDtEnd.addDays( 1 ); 213 enr = nonRecur->mDtEnd.addDays( 1 );
214 else 214 else
215 enr = nonRecur->mDtEnd; 215 enr = nonRecur->mDtEnd;
216 if ( enr < recurEvent->mDtStart ) 216 if ( enr < recurEvent->mDtStart )
217 return false; 217 return false;
218 if ( inFutureOnly && enr < QDateTime::currentDateTime() ) 218 if ( startDT && enr < *startDT )
219 return false; 219 return false;
220 int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd ); 220 int recDuration = recurEvent->mDtStart.secsTo( recurEvent->mDtEnd );
221 if ( recurEvent->doesFloat() ) 221 if ( recurEvent->doesFloat() )
222 recDuration += 86400; 222 recDuration += 86400;
223 bool ok = true; 223 bool ok = true;
224 QDateTime recStart = recurEvent->mDtStart.addSecs( -300);; 224 QDateTime recStart = recurEvent->mDtStart.addSecs( -300);;
@@ -230,14 +230,14 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut
230 QDateTime recEnd = recStart.addSecs( recDuration ); 230 QDateTime recEnd = recStart.addSecs( recDuration );
231 if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) { 231 if ( nonRecur->mDtStart < recEnd && recStart < nonRecur->mDtEnd ) {
232 if ( nonRecur->mDtStart < recStart ) 232 if ( nonRecur->mDtStart < recStart )
233 *overlapDT = recStart; 233 *overlapDT = recStart;
234 else 234 else
235 *overlapDT = nonRecur->mDtStart; 235 *overlapDT = nonRecur->mDtStart;
236 if ( inFutureOnly ) { 236 if ( startDT ) {
237 if ( *overlapDT >= QDateTime::currentDateTime() ) 237 if ( *overlapDT >= *startDT )
238 return true; 238 return true;
239 } else 239 } else
240 return true; 240 return true;
241 } 241 }
242 } 242 }
243 } 243 }
@@ -271,14 +271,14 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, bool inFut
271 if ( ok ) { 271 if ( ok ) {
272 if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) { 272 if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) {
273 if ( incidenceStart < testincidenceStart ) 273 if ( incidenceStart < testincidenceStart )
274 *overlapDT = testincidenceStart; 274 *overlapDT = testincidenceStart;
275 else 275 else
276 *overlapDT = incidenceStart; 276 *overlapDT = incidenceStart;
277 if ( inFutureOnly ) { 277 if ( startDT ) {
278 if ( *overlapDT >= QDateTime::currentDateTime() ) 278 if ( *overlapDT >= *startDT )
279 return true; 279 return true;
280 } else 280 } else
281 return true; 281 return true;
282 } 282 }
283 computeThis = ( incidenceStart < testincidenceStart ); 283 computeThis = ( incidenceStart < testincidenceStart );
284 } 284 }
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
71 Transparency transparency() const; 71 Transparency transparency() const;
72 72
73 void setDuration(int seconds); 73 void setDuration(int seconds);
74 74
75 bool contains ( Event*); 75 bool contains ( Event*);
76 76
77 bool isOverlapping ( Event*, QDateTime*, bool inFutureOnly ); 77 bool isOverlapping ( Event*, QDateTime*, QDateTime* );
78 78
79 private: 79 private:
80 bool accept(Visitor &v) { return v.visit(this); } 80 bool accept(Visitor &v) { return v.visit(this); }
81 81
82 QDateTime mDtEnd; 82 QDateTime mDtEnd;
83 bool mHasEndDate; 83 bool mHasEndDate;