summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-07 20:46:00 (UTC)
committer zautrix <zautrix>2005-07-07 20:46:00 (UTC)
commitde5621f2fd3924f27c05459ae555b3bd06c5e584 (patch) (side-by-side diff)
tree589d19415e3c0ff6c08cec375db145242581c143 /korganizer
parent766b53919de14b8faec22db32b6a750acde0b760 (diff)
downloadkdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.zip
kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.tar.gz
kdepimpi-de5621f2fd3924f27c05459ae555b3bd06c5e584.tar.bz2
fixxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp153
-rw-r--r--korganizer/kotodoview.cpp16
2 files changed, 110 insertions, 59 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e766b8f..65750af 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -656,7 +656,63 @@ CalendarView::~CalendarView()
}
void CalendarView::nextConflict( bool all, bool allday )
{
- QDate start = mNavigator->selectedDates().first().addDays(1);
+
+ QPtrList<Event> testlist = mCalendar->events();
+ Event * test = testlist.first();
+ while ( test ) {
+ test->setTagged( false );
+ }
+ QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0));
+ QDateTime conflict;
+ QDateTime retVal;
+ bool found = false;
+ Event * cE = 0;
+ QPtrList<Event> testlist2 = testlist;
+ 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;
+ }
+ }
+ }
+ }
+ 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 ) ) );
+ return;
+ }
+
+ topLevelWidget()->setCaption( i18n("No conflict found within the next two years") );
+ qDebug("No conflict found ");
+ return;
+
+
+
+
+
+#if 0
+
+
QDate end = start.addDays( 365*2);
while ( start < end ) {
QPtrList<Event> eventList = calendar()->events( start );
@@ -705,6 +761,7 @@ void CalendarView::nextConflict( bool all, bool allday )
}
topLevelWidget()->setCaption( i18n("No conflict found within the next two years") );
qDebug("No conflict found ");
+#endif
}
void CalendarView::conflictAll()
@@ -2695,8 +2752,6 @@ 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 ) {
@@ -2706,12 +2761,8 @@ void CalendarView::changeEventDisplay(Event *which, int action)
return;
}
clearallviews = true;
-
-
-
mDateNavigator->updateView();
//mDialogManager->updateSearchDialog();
-
if (which) {
// If there is an event view visible update the display
mViewManager->currentView()->changeEventDisplay(which,action);
@@ -2737,62 +2788,48 @@ void CalendarView::checkConflictForEvent()
mConflictingEvent = 0;
return;
}
- bool all = false;
- bool allday = false;
- Event * ev = mConflictingEvent;
- mConflictingEvent = 0;
- QDate start = ev->dtStart().date();
- QDate end = ev->dtEnd().date().addDays(1);
- while ( start < end ) {
- QPtrList<Event> test = calendar()->events( start );
- //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 ) {
- QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( ev->summary(),0 ) ).arg( KGlobal::formatMessage ( t_ev->summary(),0 )).arg(KGlobal::locale()->formatDate(start) ) ;
- 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( 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;
+ QPtrList<Event> testlist = mCalendar->events();
+ Event * test = testlist.first();
+ QDateTime conflict;
+ QDateTime retVal;
+ bool found = false;
+ Event * cE = 0;
+ while ( test ) {
+ if ( !test->doesFloat() ) {
+ if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) {
+ if ( ! found ) {
+ conflict = retVal;
+ cE = test;
+ } else {
+ if ( retVal < conflict ) {
+ conflict = retVal;
+ cE = test;
+ }
}
+ found = true;
}
- t_ev = test.next();
}
- start = start.addDays( 1 );
+ test = testlist.next();
}
- qDebug("No conflict found ");
-
+ 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()
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 2c017e1..c2ad886 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -402,6 +402,10 @@ void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
void KOTodoListView::keyPressEvent ( QKeyEvent * e )
{
qApp->processEvents();
+ if ( !isVisible() ) {
+ e->ignore();
+ return;
+ }
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->ignore();
// qDebug(" ignore %d",e->isAutoRepeat() );
@@ -1599,7 +1603,11 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e )
{
// e->ignore();
//return;
- //qDebug("KOTodoView::keyPressEvent ");
+ //qDebug("KOTodoView::keyPressEvent ");
+ if ( !isVisible() ) {
+ e->ignore();
+ return;
+ }
switch ( e->key() ) {
case Qt::Key_Down:
case Qt::Key_Up:
@@ -1607,6 +1615,12 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e )
break;
case Qt::Key_Q:
+
+
+ if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
+ e->ignore();
+ break;
+ }
toggleQuickTodo();
break;
case Qt::Key_U: