summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 65750af..426e8f9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -661,33 +661,48 @@ void CalendarView::nextConflict( bool all, bool allday )
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();
@@ -698,11 +713,11 @@ void CalendarView::nextConflict( bool all, bool allday )
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
@@ -2794,9 +2809,10 @@ void CalendarView::checkConflictForEvent()
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;