summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp1
-rw-r--r--korganizer/kodaymatrix.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index d43712f..aa36553 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -727,192 +727,193 @@ void KOAgendaView::createDayLabels()
727 dayLabel->setMaximumWidth( 2048 ); 727 dayLabel->setMaximumWidth( 2048 );
728 dayLabel->setFont( dlf ); 728 dayLabel->setFont( dlf );
729 dayLabel->show(); 729 dayLabel->show();
730 dayLabel->setCaption(QString::number( counter )); 730 dayLabel->setCaption(QString::number( counter ));
731 QString str; 731 QString str;
732 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); 732 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
733 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); 733 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
734 switch ( maxLen ) { 734 switch ( maxLen ) {
735 case 2: 735 case 2:
736 str = QString::number( date.day() ); 736 str = QString::number( date.day() );
737 break; 737 break;
738 738
739 case 3: 739 case 3:
740 str = dayName.left( 1 ) +QString::number( date.day()); 740 str = dayName.left( 1 ) +QString::number( date.day());
741 741
742 break; 742 break;
743 case 4: 743 case 4:
744 str = dayName.left( 1 ) + " " +QString::number( date.day()); 744 str = dayName.left( 1 ) + " " +QString::number( date.day());
745 745
746 break; 746 break;
747 case 5: 747 case 5:
748 str = dayName.left( 2 ) + " " +QString::number( date.day()); 748 str = dayName.left( 2 ) + " " +QString::number( date.day());
749 749
750 break; 750 break;
751 case 6: 751 case 6:
752 str = dayName.left( 3 ) + " " +QString::number( date.day()); 752 str = dayName.left( 3 ) + " " +QString::number( date.day());
753 break; 753 break;
754 754
755 default: 755 default:
756 break; 756 break;
757 } 757 }
758 if ( oneday ) { 758 if ( oneday ) {
759 QString addString; 759 QString addString;
760 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 760 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
761 addString = i18n("Today"); 761 addString = i18n("Today");
762 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 762 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
763 addString = i18n("Tomorrow"); 763 addString = i18n("Tomorrow");
764 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 764 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
765 addString = i18n("Yesterday"); 765 addString = i18n("Yesterday");
766 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 766 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
767 addString = i18n("Day before yesterday"); 767 addString = i18n("Day before yesterday");
768 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 768 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
769 addString = i18n("Day after tomorrow"); 769 addString = i18n("Day after tomorrow");
770 if ( !addString.isEmpty() ) { 770 if ( !addString.isEmpty() ) {
771 str = addString+", " + str; 771 str = addString+", " + str;
772 } 772 }
773 } 773 }
774 dayLabel->setText(str); 774 dayLabel->setText(str);
775 //dayLabel->setAlignment(QLabel::AlignHCenter); 775 //dayLabel->setAlignment(QLabel::AlignHCenter);
776 if (date == QDate::currentDate()) { 776 if (date == QDate::currentDate()) {
777 QFont bFont = dlf; 777 QFont bFont = dlf;
778 bFont.setBold( true ); 778 bFont.setBold( true );
779 dayLabel->setFont(bFont); 779 dayLabel->setFont(bFont);
780 } 780 }
781 //dayLayout->addWidget(dayLabel); 781 //dayLayout->addWidget(dayLabel);
782 782
783#ifndef KORG_NOPLUGINS 783#ifndef KORG_NOPLUGINS
784 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 784 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
785 CalendarDecoration *it; 785 CalendarDecoration *it;
786 for(it = cds.first(); it; it = cds.next()) { 786 for(it = cds.first(); it; it = cds.next()) {
787 QString text = it->shortText( date ); 787 QString text = it->shortText( date );
788 if ( !text.isEmpty() ) { 788 if ( !text.isEmpty() ) {
789 QLabel *label = new QLabel(text,mDayLabels); 789 QLabel *label = new QLabel(text,mDayLabels);
790 label->setAlignment(AlignCenter); 790 label->setAlignment(AlignCenter);
791 dayLayout->addWidget(label); 791 dayLayout->addWidget(label);
792 } 792 }
793 } 793 }
794 794
795 for(it = cds.first(); it; it = cds.next()) { 795 for(it = cds.first(); it; it = cds.next()) {
796 QWidget *wid = it->smallWidget(mDayLabels,date); 796 QWidget *wid = it->smallWidget(mDayLabels,date);
797 if ( wid ) { 797 if ( wid ) {
798 // wid->setHeight(20); 798 // wid->setHeight(20);
799 dayLayout->addWidget(wid); 799 dayLayout->addWidget(wid);
800 } 800 }
801 } 801 }
802#endif 802#endif
803 } 803 }
804 if ( ! appendLabels ) { 804 if ( ! appendLabels ) {
805 dayLabel = mDayLabelsList.next(); 805 dayLabel = mDayLabelsList.next();
806 if ( !dayLabel ) 806 if ( !dayLabel )
807 appendLabels = true; 807 appendLabels = true;
808 } 808 }
809 if ( appendLabels ) { 809 if ( appendLabels ) {
810 dayLabel = new QPushButton(mDayLabels); 810 dayLabel = new QPushButton(mDayLabels);
811 dayLabel->setFlat( true ); 811 dayLabel->setFlat( true );
812 connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); 812 connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
813 dayLabel->setFocusPolicy(NoFocus); 813 dayLabel->setFocusPolicy(NoFocus);
814 mDayLabelsList.append( dayLabel ); 814 mDayLabelsList.append( dayLabel );
815 mLayoutDayLabels->addWidget(dayLabel); 815 mLayoutDayLabels->addWidget(dayLabel);
816 } 816 }
817 //dayLabel->hide();//test only 817 //dayLabel->hide();//test only
818 818
819 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 819 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
820 if ( offset < 0 ) offset = 0; 820 if ( offset < 0 ) offset = 0;
821 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 821 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
822 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); 822 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
823 dayLabel->setFont( dlf );
823 dayLabel->show(); 824 dayLabel->show();
824 dayLabel->setCaption("last"); 825 dayLabel->setCaption("last");
825 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); 826 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
826 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); 827 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
827 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 828 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
828 if ( !appendLabels ) { 829 if ( !appendLabels ) {
829 dayLabel = mDayLabelsList.next(); 830 dayLabel = mDayLabelsList.next();
830 while ( dayLabel ) { 831 while ( dayLabel ) {
831 //qDebug("!dayLabel %d",dayLabel ); 832 //qDebug("!dayLabel %d",dayLabel );
832 dayLabel->hide(); 833 dayLabel->hide();
833 dayLabel = mDayLabelsList.next(); 834 dayLabel = mDayLabelsList.next();
834 } 835 }
835 } 836 }
836 //mDayLabelsFrame->show(); 837 //mDayLabelsFrame->show();
837 //mDayLabels->show(); 838 //mDayLabels->show();
838 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); 839 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
839 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); 840 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
840 mDayLabelsFrame->setFixedHeight( newHight ); 841 mDayLabelsFrame->setFixedHeight( newHight );
841} 842}
842 843
843int KOAgendaView::maxDatesHint() 844int KOAgendaView::maxDatesHint()
844{ 845{
845 // Not sure about the max number of events, so return 0 for now. 846 // Not sure about the max number of events, so return 0 for now.
846 return 0; 847 return 0;
847} 848}
848 849
849int KOAgendaView::currentDateCount() 850int KOAgendaView::currentDateCount()
850{ 851{
851 return mSelectedDates.count(); 852 return mSelectedDates.count();
852} 853}
853 854
854QPtrList<Incidence> KOAgendaView::selectedIncidences() 855QPtrList<Incidence> KOAgendaView::selectedIncidences()
855{ 856{
856 QPtrList<Incidence> selected; 857 QPtrList<Incidence> selected;
857 Incidence *incidence; 858 Incidence *incidence;
858 859
859 incidence = mAgenda->selectedIncidence(); 860 incidence = mAgenda->selectedIncidence();
860 if (incidence) selected.append(incidence); 861 if (incidence) selected.append(incidence);
861 862
862 incidence = mAllDayAgenda->selectedIncidence(); 863 incidence = mAllDayAgenda->selectedIncidence();
863 if (incidence) selected.append(incidence); 864 if (incidence) selected.append(incidence);
864 865
865 return selected; 866 return selected;
866} 867}
867 868
868DateList KOAgendaView::selectedDates() 869DateList KOAgendaView::selectedDates()
869{ 870{
870 DateList selected; 871 DateList selected;
871 QDate qd; 872 QDate qd;
872 873
873 qd = mAgenda->selectedIncidenceDate(); 874 qd = mAgenda->selectedIncidenceDate();
874 if (qd.isValid()) selected.append(qd); 875 if (qd.isValid()) selected.append(qd);
875 876
876 qd = mAllDayAgenda->selectedIncidenceDate(); 877 qd = mAllDayAgenda->selectedIncidenceDate();
877 if (qd.isValid()) selected.append(qd); 878 if (qd.isValid()) selected.append(qd);
878 879
879 return selected; 880 return selected;
880} 881}
881 882
882 883
883void KOAgendaView::updateView() 884void KOAgendaView::updateView()
884{ 885{
885 if ( mBlockUpdating ) 886 if ( mBlockUpdating )
886 return; 887 return;
887 // kdDebug() << "KOAgendaView::updateView()" << endl; 888 // kdDebug() << "KOAgendaView::updateView()" << endl;
888 fillAgenda(); 889 fillAgenda();
889 890
890} 891}
891 892
892 893
893/* 894/*
894 Update configuration settings for the agenda view. This method is not 895 Update configuration settings for the agenda view. This method is not
895 complete. 896 complete.
896*/ 897*/
897void KOAgendaView::updateConfig() 898void KOAgendaView::updateConfig()
898{ 899{
899 if ( mBlockUpdating ) 900 if ( mBlockUpdating )
900 return; 901 return;
901 // kdDebug() << "KOAgendaView::updateConfig()" << endl; 902 // kdDebug() << "KOAgendaView::updateConfig()" << endl;
902 903
903 // update config for children 904 // update config for children
904 mTimeLabels->updateConfig(); 905 mTimeLabels->updateConfig();
905 mAgenda->storePosition(); 906 mAgenda->storePosition();
906 mAgenda->updateConfig(); 907 mAgenda->updateConfig();
907 mAllDayAgenda->updateConfig(); 908 mAllDayAgenda->updateConfig();
908 // widget synchronization 909 // widget synchronization
909 //TODO: find a better way, maybe signal/slot 910 //TODO: find a better way, maybe signal/slot
910 mTimeLabels->positionChanged(); 911 mTimeLabels->positionChanged();
911 912
912 // for some reason, this needs to be called explicitly 913 // for some reason, this needs to be called explicitly
913 mTimeLabels->repaint(); 914 mTimeLabels->repaint();
914 915
915 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 916 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
916 917
917 // ToolTips displaying summary of events 918 // ToolTips displaying summary of events
918 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 919 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 549ef2a..dd83d48 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -397,192 +397,193 @@ void KODayMatrix::dragEnterEvent(QDragEnterEvent *e)
397 } 397 }
398 398
399 // some visual feedback 399 // some visual feedback
400// oldPalette = palette(); 400// oldPalette = palette();
401// setPalette(my_HilitePalette); 401// setPalette(my_HilitePalette);
402// update(); 402// update();
403#endif 403#endif
404} 404}
405 405
406void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) 406void KODayMatrix::dragMoveEvent(QDragMoveEvent *e)
407{ 407{
408#ifndef KORG_NODND 408#ifndef KORG_NODND
409 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 409 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
410 e->ignore(); 410 e->ignore();
411 return; 411 return;
412 } 412 }
413 413
414 e->accept(); 414 e->accept();
415#endif 415#endif
416} 416}
417 417
418void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) 418void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/)
419{ 419{
420#ifndef KORG_NODND 420#ifndef KORG_NODND
421// setPalette(oldPalette); 421// setPalette(oldPalette);
422// update(); 422// update();
423#endif 423#endif
424} 424}
425 425
426void KODayMatrix::dropEvent(QDropEvent *e) 426void KODayMatrix::dropEvent(QDropEvent *e)
427{ 427{
428#ifndef KORG_NODND 428#ifndef KORG_NODND
429// kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; 429// kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl;
430 430
431 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 431 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
432 e->ignore(); 432 e->ignore();
433 return; 433 return;
434 } 434 }
435 435
436 DndFactory factory( mCalendar ); 436 DndFactory factory( mCalendar );
437 Event *event = factory.createDrop(e); 437 Event *event = factory.createDrop(e);
438 438
439 if (event) { 439 if (event) {
440 e->acceptAction(); 440 e->acceptAction();
441 441
442 Event *existingEvent = mCalendar->event(event->uid()); 442 Event *existingEvent = mCalendar->event(event->uid());
443 443
444 if(existingEvent) { 444 if(existingEvent) {
445 // uniquify event 445 // uniquify event
446 event->recreate(); 446 event->recreate();
447/* 447/*
448 KMessageBox::sorry(this, 448 KMessageBox::sorry(this,
449 i18n("Event already exists in this calendar."), 449 i18n("Event already exists in this calendar."),
450 i18n("Drop Event")); 450 i18n("Drop Event"));
451 delete event; 451 delete event;
452 return; 452 return;
453*/ 453*/
454 } 454 }
455// kdDebug() << "Drop new Event" << endl; 455// kdDebug() << "Drop new Event" << endl;
456 // Adjust date 456 // Adjust date
457 QDateTime start = event->dtStart(); 457 QDateTime start = event->dtStart();
458 QDateTime end = event->dtEnd(); 458 QDateTime end = event->dtEnd();
459 int duration = start.daysTo(end); 459 int duration = start.daysTo(end);
460 int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); 460 int idx = getDayIndexFrom(e->pos().x(), e->pos().y());
461 461
462 start.setDate(days[idx]); 462 start.setDate(days[idx]);
463 end.setDate(days[idx].addDays(duration)); 463 end.setDate(days[idx].addDays(duration));
464 464
465 event->setDtStart(start); 465 event->setDtStart(start);
466 event->setDtEnd(end); 466 event->setDtEnd(end);
467 mCalendar->addEvent(event); 467 mCalendar->addEvent(event);
468 468
469 emit eventDropped(event); 469 emit eventDropped(event);
470 } else { 470 } else {
471// kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; 471// kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl;
472 e->ignore(); 472 e->ignore();
473 } 473 }
474#endif 474#endif
475} 475}
476 476
477// ---------------------------------------------------------------------------- 477// ----------------------------------------------------------------------------
478// P A I N T E V E N T H A N D L I N G 478// P A I N T E V E N T H A N D L I N G
479// ---------------------------------------------------------------------------- 479// ----------------------------------------------------------------------------
480 480
481void KODayMatrix::paintEvent(QPaintEvent * pevent) 481void KODayMatrix::paintEvent(QPaintEvent * pevent)
482{ 482{
483 if ( width() <= 0 || height() <= 0 ) 483 if ( width() <= 0 || height() <= 0 )
484 return; 484 return;
485 if ( mPendingUpdateBeforeRepaint ) { 485 if ( mPendingUpdateBeforeRepaint ) {
486 updateViewTimed(); 486 updateViewTimed();
487 mPendingUpdateBeforeRepaint = false; 487 mPendingUpdateBeforeRepaint = false;
488 } 488 }
489 if ( myPix.width() != width() || myPix.height()!=height() ) { 489 if ( myPix.width() != width() || myPix.height()!=height() ) {
490 myPix.resize(size() ); 490 myPix.resize(size() );
491 } 491 }
492 QPainter p(&myPix); 492 QPainter p(&myPix);
493 p.setFont(font());
493 494
494 QRect sz = frameRect(); 495 QRect sz = frameRect();
495 int dheight = daysize.height(); 496 int dheight = daysize.height();
496 int dwidth = daysize.width(); 497 int dwidth = daysize.width();
497 int row,col; 498 int row,col;
498 int selw, selh; 499 int selw, selh;
499 bool isRTL = KOGlobals::self()->reverseLayout(); 500 bool isRTL = KOGlobals::self()->reverseLayout();
500 501
501 // draw background and topleft frame 502 // draw background and topleft frame
502 p.fillRect(pevent->rect(), mDefaultBackColor); 503 p.fillRect(pevent->rect(), mDefaultBackColor);
503 p.setPen(mDefaultTextColor); 504 p.setPen(mDefaultTextColor);
504 p.drawRect(0, 0, sz.width()+1, sz.height()+1); 505 p.drawRect(0, 0, sz.width()+1, sz.height()+1);
505 506
506 // draw selected days with highlighted background color 507 // draw selected days with highlighted background color
507 if (mSelStart != NOSELECTION) { 508 if (mSelStart != NOSELECTION) {
508 509
509 row = mSelStart/7; 510 row = mSelStart/7;
510 col = mSelStart -row*7; 511 col = mSelStart -row*7;
511 QColor selcol = KOPrefs::instance()->mHighlightColor; 512 QColor selcol = KOPrefs::instance()->mHighlightColor;
512 513
513 if (row == mSelEnd/7) { 514 if (row == mSelEnd/7) {
514 // Single row selection 515 // Single row selection
515 p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, 516 p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth,
516 row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); 517 row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol);
517 } else { 518 } else {
518 // draw first row to the right 519 // draw first row to the right
519 p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, 520 p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth,
520 dheight, selcol); 521 dheight, selcol);
521 // draw full block till last line 522 // draw full block till last line
522 selh = mSelEnd/7-row; 523 selh = mSelEnd/7-row;
523 if (selh > 1) { 524 if (selh > 1) {
524 p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); 525 p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol);
525 } 526 }
526 // draw last block from left to mSelEnd 527 // draw last block from left to mSelEnd
527 selw = mSelEnd-7*(mSelEnd/7)+1; 528 selw = mSelEnd-7*(mSelEnd/7)+1;
528 p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, 529 p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight,
529 selw*dwidth, dheight, selcol); 530 selw*dwidth, dheight, selcol);
530 } 531 }
531 } 532 }
532 533
533 // iterate over all days in the matrix and draw the day label in appropriate colors 534 // iterate over all days in the matrix and draw the day label in appropriate colors
534 QColor actcol = mDefaultTextColorShaded; 535 QColor actcol = mDefaultTextColorShaded;
535 p.setPen(actcol); 536 p.setPen(actcol);
536 QPen tmppen; 537 QPen tmppen;
537 for(int i = 0; i < NUMDAYS; i++) { 538 for(int i = 0; i < NUMDAYS; i++) {
538 row = i/7; 539 row = i/7;
539 col = isRTL ? 6-(i-row*7) : i-row*7; 540 col = isRTL ? 6-(i-row*7) : i-row*7;
540 541
541 // if it is the first day of a month switch color from normal to shaded and vice versa 542 // if it is the first day of a month switch color from normal to shaded and vice versa
542 if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { 543 if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) {
543 if (actcol == mDefaultTextColorShaded) { 544 if (actcol == mDefaultTextColorShaded) {
544 actcol = mDefaultTextColor; 545 actcol = mDefaultTextColor;
545 } else { 546 } else {
546 actcol = mDefaultTextColorShaded; 547 actcol = mDefaultTextColorShaded;
547 } 548 }
548 p.setPen(actcol); 549 p.setPen(actcol);
549 } 550 }
550 551
551 //Reset pen color after selected days block 552 //Reset pen color after selected days block
552 if (i == mSelEnd+1) { 553 if (i == mSelEnd+1) {
553 p.setPen(actcol); 554 p.setPen(actcol);
554 } 555 }
555 556
556 // if today then draw rectangle around day 557 // if today then draw rectangle around day
557 if (today == i) { 558 if (today == i) {
558 tmppen = p.pen(); 559 tmppen = p.pen();
559 QPen mTodayPen(p.pen()); 560 QPen mTodayPen(p.pen());
560 561
561 mTodayPen.setWidth(mTodayMarginWidth); 562 mTodayPen.setWidth(mTodayMarginWidth);
562 //draw red rectangle for holidays 563 //draw red rectangle for holidays
563 if (!mHolidays[i].isNull()) { 564 if (!mHolidays[i].isNull()) {
564 if (actcol == mDefaultTextColor) { 565 if (actcol == mDefaultTextColor) {
565 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); 566 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor);
566 } else { 567 } else {
567 mTodayPen.setColor(mHolidayColorShaded); 568 mTodayPen.setColor(mHolidayColorShaded);
568 } 569 }
569 } 570 }
570 //draw gray rectangle for today if in selection 571 //draw gray rectangle for today if in selection
571 if (i >= mSelStart && i <= mSelEnd) { 572 if (i >= mSelStart && i <= mSelEnd) {
572 QColor grey("grey"); 573 QColor grey("grey");
573 mTodayPen.setColor(grey); 574 mTodayPen.setColor(grey);
574 } 575 }
575 p.setPen(mTodayPen); 576 p.setPen(mTodayPen);
576 p.drawRect(col*dwidth, row*dheight, dwidth, dheight); 577 p.drawRect(col*dwidth, row*dheight, dwidth, dheight);
577 p.setPen(tmppen); 578 p.setPen(tmppen);
578 } 579 }
579 580
580 // if any events are on that day then draw it using a bold font 581 // if any events are on that day then draw it using a bold font
581 if (events[i] > 0) { 582 if (events[i] > 0) {
582 QFont myFont = font(); 583 QFont myFont = font();
583 myFont.setBold(true); 584 myFont.setBold(true);
584 p.setFont(myFont); 585 p.setFont(myFont);
585 } 586 }
586 587
587 // if it is a holiday then use the default holiday color 588 // if it is a holiday then use the default holiday color
588 if (!mHolidays[i].isNull()) { 589 if (!mHolidays[i].isNull()) {