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 /korganizer | |
parent | de5621f2fd3924f27c05459ae555b3bd06c5e584 (diff) | |
download | kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.zip kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.tar.gz kdepimpi-3fe323e4e63f3b7c1cf8c96093fa14fd63fb4efc.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 65750af..426e8f9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -616,138 +616,153 @@ void CalendarView::init() mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); mEventEditor = mDialogManager->getEventEditor(); mTodoEditor = mDialogManager->getTodoEditor(); mFlagEditDescription = false; mSuspendTimer = new QTimer( this ); mAlarmTimer = new QTimer( this ); mRecheckAlarmTimer = new QTimer( this ); connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); mAlarmDialog = new AlarmDialog( this ); connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); mAlarmDialog->setServerNotification( false ); mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); #ifndef DESKTOP_VERSION //US listen for arriving address resultsets connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); #endif mDateNavigator->setCalendar( mCalendar ); } CalendarView::~CalendarView() { // kdDebug() << "~CalendarView()" << endl; //qDebug("CalendarView::~CalendarView() "); delete mDialogManager; delete mViewManager; delete mStorage; delete mDateFrame ; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } 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 ) { + 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, true ) ) { + 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(); } + } 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; #if 0 QDate end = start.addDays( 365*2); while ( start < end ) { QPtrList<Event> eventList = calendar()->events( start ); Event * ev = eventList.first(); QPtrList<Event> test = eventList; while ( ev ) { //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); Event * t_ev = test.first(); QDateTime es = ev->dtStart(); QDateTime ee = ev->dtEnd(); if ( ev->doesFloat() ) ee = ee.addDays( 1 ); if ( ! all ) { if ( ev->doesFloat() != allday ) t_ev = 0; } while ( t_ev ) { bool skip = false; if ( ! all ) { if ( t_ev->doesFloat() != allday ) skip = true; } if ( !skip && ev != t_ev ) { QDateTime ets = t_ev->dtStart(); QDateTime ete = t_ev->dtEnd(); if ( t_ev->doesFloat() ) ete = ete.addDays( 1 ); //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); if ( es < ete && ets < ee ) { if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) mViewManager->showDayView(); mNavigator->slotDaySelect( start ); int hour = es.time().hour(); if ( ets > es ) hour = ets.time().hour(); mViewManager->agendaView()->setStartHour( hour ); topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); return; @@ -2749,99 +2764,100 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action) // most of the changeEventDisplays() right now just call the view's // total update mode, but they SHOULD be recoded to be more refresh-efficient. void CalendarView::changeEventDisplay(Event *which, int action) { // kdDebug() << "CalendarView::changeEventDisplay" << endl; changeIncidenceDisplay((Incidence *)which, action); static bool clearallviews = false; if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { if ( clearallviews ) { clearAllViews(); clearallviews = false; } return; } clearallviews = true; mDateNavigator->updateView(); //mDialogManager->updateSearchDialog(); if (which) { // If there is an event view visible update the display mViewManager->currentView()->changeEventDisplay(which,action); // TODO: check, if update needed // if (which->getTodoStatus()) { mTodoList->updateView(); if ( action != KOGlobals::EVENTDELETED ) { mConflictingEvent = which ; QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); } // } } else { mViewManager->currentView()->updateView(); } } void CalendarView::checkConflictForEvent() { if (!KOPrefs::instance()->mConfirm) return; if ( ! mConflictingEvent ) return; if ( mConflictingEvent->doesFloat() ) { mConflictingEvent = 0; return; } 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; cE = test; } } found = true; } } test = testlist.next(); } if ( found ) { QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; qApp->processEvents(); int km = KMessageBox::warningContinueCancel(this,mess, i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); if ( km != KMessageBox::Continue ) return; 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 ) ) ); return; } return; } void CalendarView::updateTodoViews() { mTodoList->updateView(); mViewManager->currentView()->updateView(); } void CalendarView::clearAllViews() { mTodoList->clearList(); mViewManager->clearAllViews(); |