-rw-r--r-- | korganizer/kodaymatrix.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 120bc89..a2e0ae0 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -393,49 +393,50 @@ void KODayMatrix::updateView(QDate actdate) | |||
393 | if (mSelStart != NOSELECTION) { | 393 | if (mSelStart != NOSELECTION) { |
394 | int tmp = actdate.daysTo(startdate); | 394 | int tmp = actdate.daysTo(startdate); |
395 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 395 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
396 | // shift selection if new one would be visible at least partly ! | 396 | // shift selection if new one would be visible at least partly ! |
397 | 397 | ||
398 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 398 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
399 | // nested if is required for next X display pushed from a different month - correction required | 399 | // nested if is required for next X display pushed from a different month - correction required |
400 | // otherwise, for month forward and backward, it must be avoided | 400 | // otherwise, for month forward and backward, it must be avoided |
401 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 401 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
402 | mSelStart = mSelStart + tmp; | 402 | mSelStart = mSelStart + tmp; |
403 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 403 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
404 | mSelEnd = mSelEnd + tmp; | 404 | mSelEnd = mSelEnd + tmp; |
405 | } | 405 | } |
406 | } | 406 | } |
407 | startdate = actdate; | 407 | startdate = actdate; |
408 | mDayChanged = true; | 408 | mDayChanged = true; |
409 | recalculateToday(); | 409 | recalculateToday(); |
410 | } | 410 | } |
411 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 411 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
412 | if ( !isVisible() ) { | 412 | if ( !isVisible() ) { |
413 | mPendingUpdateBeforeRepaint = true; | 413 | mPendingUpdateBeforeRepaint = true; |
414 | } else { | 414 | } else { |
415 | #ifdef DESKTOP_VERSION | 415 | #ifdef DESKTOP_VERSION |
416 | //mRepaintTimer->start( 100 ); | 416 | //mRepaintTimer->start( 100 ); |
417 | mUpdateTimer->start( 100 ); | 417 | //updateViewTimed(); |
418 | mUpdateTimer->start( 20 ); | ||
418 | #else | 419 | #else |
419 | mRepaintTimer->start( 350 ); | 420 | mRepaintTimer->start( 350 ); |
420 | mUpdateTimer->start( 1200 ); | 421 | mUpdateTimer->start( 1200 ); |
421 | #endif | 422 | #endif |
422 | } | 423 | } |
423 | } | 424 | } |
424 | void KODayMatrix::updateEvents() | 425 | void KODayMatrix::updateEvents() |
425 | { | 426 | { |
426 | if ( !mCalendar ) return; | 427 | if ( !mCalendar ) return; |
427 | 428 | ||
428 | for( int i = 0; i < NUMDAYS; i++ ) { | 429 | for( int i = 0; i < NUMDAYS; i++ ) { |
429 | // if events are set for the day then remember to draw it bold | 430 | // if events are set for the day then remember to draw it bold |
430 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 431 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
431 | int numEvents = eventlist.count(); | 432 | int numEvents = eventlist.count(); |
432 | Event *event; | 433 | Event *event; |
433 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 434 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
434 | ushort recurType = event->doesRecur(); | 435 | ushort recurType = event->doesRecur(); |
435 | 436 | ||
436 | if ( ( recurType == Recurrence::rDaily && | 437 | if ( ( recurType == Recurrence::rDaily && |
437 | !KOPrefs::instance()->mDailyRecur ) || | 438 | !KOPrefs::instance()->mDailyRecur ) || |
438 | ( recurType == Recurrence::rWeekly && | 439 | ( recurType == Recurrence::rWeekly && |
439 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 440 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
440 | numEvents--; | 441 | numEvents--; |
441 | } | 442 | } |
@@ -822,50 +823,50 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
822 | if (actcol == mDefaultTextColor) { | 823 | if (actcol == mDefaultTextColor) { |
823 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 824 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
824 | } else { | 825 | } else { |
825 | mTodayPen.setColor(mHolidayColorShaded); | 826 | mTodayPen.setColor(mHolidayColorShaded); |
826 | } | 827 | } |
827 | } | 828 | } |
828 | //draw gray rectangle for today if in selection | 829 | //draw gray rectangle for today if in selection |
829 | if (i >= mSelStartT && i <= mSelEndT) { | 830 | if (i >= mSelStartT && i <= mSelEndT) { |
830 | QColor grey("grey"); | 831 | QColor grey("grey"); |
831 | mTodayPen.setColor(grey); | 832 | mTodayPen.setColor(grey); |
832 | } | 833 | } |
833 | p.setPen(mTodayPen); | 834 | p.setPen(mTodayPen); |
834 | 835 | ||
835 | 836 | ||
836 | int addCol = 0; | 837 | int addCol = 0; |
837 | int addRow = 0; | 838 | int addRow = 0; |
838 | if (rowModulo) { | 839 | if (rowModulo) { |
839 | if ( row >= 6 - rowModulo ) | 840 | if ( row >= 6 - rowModulo ) |
840 | addRow = row - 5 + rowModulo; | 841 | addRow = row - 5 + rowModulo; |
841 | } | 842 | } |
842 | if ( colModulo ) { | 843 | if ( colModulo ) { |
843 | if ( col >= 7 - colModulo ) | 844 | if ( col >= 7 - colModulo ) |
844 | addCol = col - 6 + colModulo-1; | 845 | addCol = col - 6 + colModulo-1; |
845 | } | 846 | } |
846 | if ( col == 0 ) | 847 | |
847 | addCol = 1; | 848 | addCol += 1; |
848 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); | 849 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); |
849 | p.setPen(tmppen); | 850 | p.setPen(tmppen); |
850 | } | 851 | } |
851 | 852 | ||
852 | // if any events are on that day then draw it using a bold font | 853 | // if any events are on that day then draw it using a bold font |
853 | if (events[i] > 0) { | 854 | if (events[i] > 0) { |
854 | QFont myFont = font(); | 855 | QFont myFont = font(); |
855 | myFont.setBold(true); | 856 | myFont.setBold(true); |
856 | p.setFont(myFont); | 857 | p.setFont(myFont); |
857 | } | 858 | } |
858 | 859 | ||
859 | // if it is a holiday then use the default holiday color | 860 | // if it is a holiday then use the default holiday color |
860 | if (!mHolidays[i].isNull()) { | 861 | if (!mHolidays[i].isNull()) { |
861 | if ( bDays.testBit(i) ) { | 862 | if ( bDays.testBit(i) ) { |
862 | p.setPen(Qt::green); | 863 | p.setPen(Qt::green); |
863 | } else { | 864 | } else { |
864 | if (actcol == mDefaultTextColor) { | 865 | if (actcol == mDefaultTextColor) { |
865 | p.setPen(KOPrefs::instance()->mHolidayColor); | 866 | p.setPen(KOPrefs::instance()->mHolidayColor); |
866 | } else { | 867 | } else { |
867 | p.setPen(mHolidayColorShaded); | 868 | p.setPen(mHolidayColorShaded); |
868 | } | 869 | } |
869 | } | 870 | } |
870 | } | 871 | } |
871 | 872 | ||