-rw-r--r-- | korganizer/kodaymatrix.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 619ae39..9181936 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -703,96 +703,107 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
703 | // if it is the first day of a month switch color from normal to shaded and vice versa | 703 | // if it is the first day of a month switch color from normal to shaded and vice versa |
704 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 704 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
705 | if (actcol == mDefaultTextColorShaded) { | 705 | if (actcol == mDefaultTextColorShaded) { |
706 | actcol = mDefaultTextColor; | 706 | actcol = mDefaultTextColor; |
707 | } else { | 707 | } else { |
708 | actcol = mDefaultTextColorShaded; | 708 | actcol = mDefaultTextColorShaded; |
709 | } | 709 | } |
710 | p.setPen(actcol); | 710 | p.setPen(actcol); |
711 | } | 711 | } |
712 | if (actcol == mDefaultTextColorShaded) { | 712 | if (actcol == mDefaultTextColorShaded) { |
713 | if ( ! mouseDown ) { | 713 | if ( ! mouseDown ) { |
714 | continue; | 714 | continue; |
715 | } | 715 | } |
716 | } | 716 | } |
717 | //Reset pen color after selected days block | 717 | //Reset pen color after selected days block |
718 | if (i == mSelEndT+1) { | 718 | if (i == mSelEndT+1) { |
719 | p.setPen(actcol); | 719 | p.setPen(actcol); |
720 | } | 720 | } |
721 | 721 | ||
722 | // if today then draw rectangle around day | 722 | // if today then draw rectangle around day |
723 | if (today == i) { | 723 | if (today == i) { |
724 | tmppen = p.pen(); | 724 | tmppen = p.pen(); |
725 | QPen mTodayPen(p.pen()); | 725 | QPen mTodayPen(p.pen()); |
726 | 726 | ||
727 | mTodayPen.setWidth(mTodayMarginWidth); | 727 | mTodayPen.setWidth(mTodayMarginWidth); |
728 | //draw red rectangle for holidays | 728 | //draw red rectangle for holidays |
729 | if (!mHolidays[i].isNull()) { | 729 | if (!mHolidays[i].isNull()) { |
730 | if (actcol == mDefaultTextColor) { | 730 | if (actcol == mDefaultTextColor) { |
731 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 731 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
732 | } else { | 732 | } else { |
733 | mTodayPen.setColor(mHolidayColorShaded); | 733 | mTodayPen.setColor(mHolidayColorShaded); |
734 | } | 734 | } |
735 | } | 735 | } |
736 | //draw gray rectangle for today if in selection | 736 | //draw gray rectangle for today if in selection |
737 | if (i >= mSelStartT && i <= mSelEndT) { | 737 | if (i >= mSelStartT && i <= mSelEndT) { |
738 | QColor grey("grey"); | 738 | QColor grey("grey"); |
739 | mTodayPen.setColor(grey); | 739 | mTodayPen.setColor(grey); |
740 | } | 740 | } |
741 | p.setPen(mTodayPen); | 741 | p.setPen(mTodayPen); |
742 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); | 742 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); |
743 | p.setPen(tmppen); | 743 | p.setPen(tmppen); |
744 | } | 744 | } |
745 | 745 | ||
746 | // if any events are on that day then draw it using a bold font | 746 | // if any events are on that day then draw it using a bold font |
747 | if (events[i] > 0) { | 747 | if (events[i] > 0) { |
748 | QFont myFont = font(); | 748 | QFont myFont = font(); |
749 | myFont.setBold(true); | 749 | myFont.setBold(true); |
750 | p.setFont(myFont); | 750 | p.setFont(myFont); |
751 | } | 751 | } |
752 | 752 | ||
753 | // if it is a holiday then use the default holiday color | 753 | // if it is a holiday then use the default holiday color |
754 | if (!mHolidays[i].isNull()) { | 754 | if (!mHolidays[i].isNull()) { |
755 | if ( bDays.testBit(i) ) { | 755 | if ( bDays.testBit(i) ) { |
756 | p.setPen(Qt::green); | 756 | p.setPen(Qt::green); |
757 | } else { | 757 | } else { |
758 | if (actcol == mDefaultTextColor) { | 758 | if (actcol == mDefaultTextColor) { |
759 | p.setPen(KOPrefs::instance()->mHolidayColor); | 759 | p.setPen(KOPrefs::instance()->mHolidayColor); |
760 | } else { | 760 | } else { |
761 | p.setPen(mHolidayColorShaded); | 761 | p.setPen(mHolidayColorShaded); |
762 | } | 762 | } |
763 | } | 763 | } |
764 | } | 764 | } |
765 | 765 | ||
766 | // draw selected days with special color | 766 | // draw selected days with special color |
767 | // DO NOT specially highlight holidays in selection ! | 767 | // DO NOT specially highlight holidays in selection ! |
768 | if (i >= mSelStartT && i <= mSelEndT) { | 768 | if (i >= mSelStartT && i <= mSelEndT) { |
769 | ;//p.setPen(mSelectedDaysColor); | 769 | ;//p.setPen(mSelectedDaysColor); |
770 | } | 770 | } |
771 | 771 | ||
772 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, | 772 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, |
773 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 773 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
774 | 774 | ||
775 | // reset color to actual color | 775 | // reset color to actual color |
776 | if (!mHolidays[i].isNull()) { | 776 | if (!mHolidays[i].isNull()) { |
777 | p.setPen(actcol); | 777 | p.setPen(actcol); |
778 | } | 778 | } |
779 | // reset bold font to plain font | 779 | // reset bold font to plain font |
780 | if (events[i] > 0) { | 780 | if (events[i] > 0) { |
781 | QFont myFont = font(); | 781 | QFont myFont = font(); |
782 | myFont.setBold(false); | 782 | myFont.setBold(false); |
783 | p.setFont(myFont); | 783 | p.setFont(myFont); |
784 | } | 784 | } |
785 | } | 785 | } |
786 | bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | 786 | bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); |
787 | } | 787 | } |
788 | 788 | ||
789 | // ---------------------------------------------------------------------------- | 789 | // ---------------------------------------------------------------------------- |
790 | // R E SI Z E E V E N T H A N D L I N G | 790 | // R E SI Z E E V E N T H A N D L I N G |
791 | // ---------------------------------------------------------------------------- | 791 | // ---------------------------------------------------------------------------- |
792 | 792 | ||
793 | void KODayMatrix::resizeEvent(QResizeEvent *) | 793 | void KODayMatrix::resizeEvent(QResizeEvent *) |
794 | { | 794 | { |
795 | QRect sz = frameRect(); | 795 | QRect sz = frameRect(); |
796 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 796 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
797 | daysize.setWidth(sz.width() / 7); | 797 | daysize.setWidth(sz.width() / 7); |
798 | } | 798 | } |
799 | |||
800 | QSize KODayMatrix::sizeHint() const | ||
801 | { | ||
802 | |||
803 | QFontMetrics fm ( font() ); | ||
804 | int wid = fm.width( "30") *7+7; | ||
805 | int hei = fm.height() * 6+4; | ||
806 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | ||
807 | return QSize ( wid, hei ); | ||
808 | |||
809 | } | ||