-rw-r--r-- | korganizer/kodaymatrix.cpp | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 17a1d13..df606d0 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -366,7 +366,9 @@ void KODayMatrix::computeEvent(Event *event, int i ) | |||
366 | if ( !event->location().isEmpty() ) | 366 | if ( !event->location().isEmpty() ) |
367 | holiStr += " (" + event->location() + ")"; | 367 | holiStr += " (" + event->location() + ")"; |
368 | mHolidays[i] =holiStr ; | 368 | mHolidays[i] =holiStr ; |
369 | eDays.setBit(i); | ||
369 | } | 370 | } |
371 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) { | ||
370 | if ( event->isBirthday()) { | 372 | if ( event->isBirthday()) { |
371 | pDays.setBit(i); | 373 | pDays.setBit(i); |
372 | if ( !holiStr.isEmpty() ) | 374 | if ( !holiStr.isEmpty() ) |
@@ -377,6 +379,8 @@ void KODayMatrix::computeEvent(Event *event, int i ) | |||
377 | bDays.setBit(i); | 379 | bDays.setBit(i); |
378 | mHolidays[i] =holiStr ; | 380 | mHolidays[i] =holiStr ; |
379 | } | 381 | } |
382 | } | ||
383 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) | ||
380 | eDays.setBit(i); | 384 | eDays.setBit(i); |
381 | } | 385 | } |
382 | void KODayMatrix::updateViewTimed() | 386 | void KODayMatrix::updateViewTimed() |
@@ -388,6 +392,7 @@ void KODayMatrix::updateViewTimed() | |||
388 | } | 392 | } |
389 | #if 1 | 393 | #if 1 |
390 | 394 | ||
395 | |||
391 | int i; | 396 | int i; |
392 | int timeSpan = NUMDAYS-1; | 397 | int timeSpan = NUMDAYS-1; |
393 | QPtrList<Event> events = mCalendar->events(); | 398 | QPtrList<Event> events = mCalendar->events(); |
@@ -469,22 +474,52 @@ void KODayMatrix::updateViewTimed() | |||
469 | pDays.setBit(i); | 474 | pDays.setBit(i); |
470 | } | 475 | } |
471 | } | 476 | } |
472 | 477 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | |
473 | #if 0 | 478 | bDays.fill( false); |
474 | // insert due todos | 479 | // insert due todos |
475 | QPtrList<Todo> todos = calendar()->todos( ); | 480 | QPtrList<Todo> todos = mCalendar->todos( ); |
476 | Todo *todo; | 481 | Todo *todo; |
477 | for(todo = todos.first(); todo; todo = todos.next()) { | 482 | for(todo = todos.first(); todo; todo = todos.next()) { |
478 | //insertTodo( todo ); | 483 | //insertTodo( todo ); |
479 | if ( todo->hasDueDate() ) { | 484 | if ( todo->hasDueDate() ) { |
480 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 485 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
481 | if ( day >= 0 && day < timeSpan + 1) { | 486 | if ( day >= 0 && day < timeSpan + 1) { |
482 | (*cells)[day]->insertTodo( todo ); | 487 | int i = day; |
488 | QString holiStr = mHolidays[i]; | ||
489 | pDays.setBit(i); | ||
490 | if ( !holiStr.isEmpty() ) | ||
491 | holiStr += "\n"; | ||
492 | holiStr += i18n("Todo") + ": "+todo->summary(); | ||
493 | if ( !todo->location().isEmpty() ) | ||
494 | holiStr += " (" + todo->location() + ")"; | ||
495 | bDays.setBit(i); | ||
496 | mHolidays[i] =holiStr ; | ||
497 | eDays.setBit(i); | ||
483 | } | 498 | } |
484 | } | 499 | } |
485 | } | 500 | } |
486 | #endif | 501 | } |
502 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | ||
503 | bDays.fill( false); | ||
504 | // insert due todos | ||
505 | QPtrList<Journal> todos = mCalendar->journals( ); | ||
506 | Journal *todo; | ||
507 | for(todo = todos.first(); todo; todo = todos.next()) { | ||
508 | int day = mStartDate.daysTo( todo->dtStart().date() ); | ||
509 | if ( day >= 0 && day < timeSpan + 1) { | ||
510 | int i = day; | ||
511 | QString holiStr = mHolidays[i]; | ||
512 | pDays.setBit(i); | ||
513 | if ( !holiStr.isEmpty() ) | ||
514 | holiStr += "\n"; | ||
515 | holiStr += i18n("Journal"); | ||
516 | bDays.setBit(i); | ||
517 | mHolidays[i] =holiStr ; | ||
518 | eDays.setBit(i); | ||
487 | 519 | ||
520 | } | ||
521 | } | ||
522 | } | ||
488 | #else | 523 | #else |
489 | //qDebug("KODayMatrix::updateViewTimed "); | 524 | //qDebug("KODayMatrix::updateViewTimed "); |
490 | for(int i = 0; i < NUMDAYS; i++) { | 525 | for(int i = 0; i < NUMDAYS; i++) { |
@@ -536,7 +571,9 @@ void KODayMatrix::updateViewTimed() | |||
536 | } | 571 | } |
537 | void KODayMatrix::updateView(QDate actdate) | 572 | void KODayMatrix::updateView(QDate actdate) |
538 | { | 573 | { |
539 | 574 | if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView ) | |
575 | mRedrawNeeded = true; | ||
576 | mLastView = KOPrefs::instance()->mCurrentDisplayedView; | ||
540 | if ( ! actdate.isValid() ) { | 577 | if ( ! actdate.isValid() ) { |
541 | //qDebug("date not valid "); | 578 | //qDebug("date not valid "); |
542 | return; | 579 | return; |
@@ -1052,9 +1089,9 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
1052 | if ( pDays.testBit(i)) { | 1089 | if ( pDays.testBit(i)) { |
1053 | if ( bDays.testBit(i) ) { | 1090 | if ( bDays.testBit(i) ) { |
1054 | if ( hDays.testBit(i) ) | 1091 | if ( hDays.testBit(i) ) |
1055 | p.setPen(QColor(Qt::green)); | 1092 | p.setPen(QColor(0,200,0)); |
1056 | else | 1093 | else |
1057 | p.setPen(QColor(Qt::green).dark()); | 1094 | p.setPen(QColor(Qt::blue)); |
1058 | } else { | 1095 | } else { |
1059 | if (actcol == mDefaultTextColor ) { | 1096 | if (actcol == mDefaultTextColor ) { |
1060 | p.setPen(KOPrefs::instance()->mHolidayColor); | 1097 | p.setPen(KOPrefs::instance()->mHolidayColor); |