summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp134
-rw-r--r--korganizer/koagendaview.h2
-rw-r--r--korganizer/kodaymatrix.cpp493
-rw-r--r--korganizer/kodaymatrix.h1
4 files changed, 326 insertions, 304 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 2996acb..218396d 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -82,6 +82,8 @@ TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 myPix.resize( 1, 1 );
84 mRows = rows; 85 mRows = rows;
85 86
87 mRedrawNeeded = true;
86 setMinimumHeight( 20 ); 88 setMinimumHeight( 20 );
87 mCellHeight = KOPrefs::instance()->mHourSize*4; 89 mCellHeight = KOPrefs::instance()->mHourSize*4;
@@ -117,71 +119,78 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
117 // now, for a workaround... 119 // now, for a workaround...
118 // these two assignments fix the weird redraw bug 120 // these two assignments fix the weird redraw bug
119 cx = contentsX() + 2; 121 if ( mRedrawNeeded ) {
120 cw = contentsWidth() - 2; 122 cx = contentsX() + 2;
121 // end of workaround 123 cw = contentsWidth() - 2;
122 124 // end of workaround
123 int cell = ((int)(cy/mCellHeight)); 125
124 int y = cell * mCellHeight; 126 int cell = ((int)(cy/mCellHeight));
125 QFontMetrics fm = fontMetrics(); 127 int y = cell * mCellHeight;
126 QString hour; 128 QFontMetrics fm = fontMetrics();
127 QString suffix; 129 QString hour;
128 int tW = fm.width("24:00i"); 130 QString suffix;
129 int timeHeight = fm.height(); 131 int tW = fm.width("24:00i");
130 //timeHeight -= (timeHeight/4-2); 132 int timeHeight = fm.height();
131 int borderWidth = 0; 133 //timeHeight -= (timeHeight/4-2);
132 QFont nFont = p->font(); 134 int borderWidth = 0;
135 QFont nFont = p->font();
133 136
134 if (!KGlobal::locale()->use12Clock()) 137 if (!KGlobal::locale()->use12Clock())
135 suffix = "00"; 138 suffix = "00";
136 else 139 else
137 borderWidth = 0; 140 borderWidth = 0;
138 if ( timeHeight > mCellHeight ) { 141 if ( timeHeight > mCellHeight ) {
139 timeHeight = mCellHeight-1; 142 timeHeight = mCellHeight-1;
140 int pointS = nFont.pointSize(); 143 int pointS = nFont.pointSize();
141 while ( pointS > 4 ) { 144 while ( pointS > 4 ) {
142 nFont.setPointSize( pointS ); 145 nFont.setPointSize( pointS );
146 fm = QFontMetrics( nFont );
147 if ( fm.height() < mCellHeight )
148 break;
149 -- pointS;
150 }
143 fm = QFontMetrics( nFont ); 151 fm = QFontMetrics( nFont );
144 if ( fm.height() < mCellHeight ) 152 borderWidth = 4;
145 break; 153 timeHeight = fm.height();
146 -- pointS;
147 }
148 fm = QFontMetrics( nFont );
149 borderWidth = 4;
150 timeHeight = fm.height();
151 }
152 timeHeight -= (timeHeight/4-2);
153 QFont sFont = nFont;
154 sFont.setPointSize( sFont.pointSize()/2+2 );
155 QFontMetrics fmS( sFont );
156 int sHei = fmS.height();
157 sHei -= (sHei/4-2);
158 int startW = this->width() - frameWidth();
159 while (y < cy + ch) {
160 p->drawLine(cx,y,cx+tW,y);
161 hour.setNum(cell);
162
163 // handle 24h and am/pm time formats
164 if (KGlobal::locale()->use12Clock()) {
165 if (cell > 11) suffix = "pm";
166 else
167 suffix = "am";
168 if (cell == 0) hour.setNum(12);
169 if (cell > 12) hour.setNum(cell - 12);
170 } 154 }
155 timeHeight -= (timeHeight/4-2);
156 QFont sFont = nFont;
157 sFont.setPointSize( sFont.pointSize()/2+2 );
158 QFontMetrics fmS( sFont );
159 int sHei = fmS.height();
160 sHei -= (sHei/4-2);
161 int startW = this->width() - frameWidth();
162 while (y < cy + ch) {
163 p->drawLine(cx,y,cx+tW,y);
164 hour.setNum(cell);
165
166 // handle 24h and am/pm time formats
167 if (KGlobal::locale()->use12Clock()) {
168 if (cell > 11) suffix = "pm";
169 else
170 suffix = "am";
171 if (cell == 0) hour.setNum(12);
172 if (cell > 12) hour.setNum(cell - 12);
173 }
171 174
172 // center and draw the time label 175 // center and draw the time label
173 int timeWidth = fm.width(hour+"i"); 176 int timeWidth = fm.width(hour+"i");
174 int tw2 = fm.width(suffix); 177 int tw2 = fm.width(suffix);
175 int offset = startW - timeWidth - tw2 ; 178 int offset = startW - timeWidth - tw2 ;
176 p->setFont( nFont ); 179 p->setFont( nFont );
177 p->drawText(cx - borderWidth + offset, y+ timeHeight, hour); 180 p->drawText(cx - borderWidth + offset, y+ timeHeight, hour);
178 p->setFont( sFont ); 181 p->setFont( sFont );
179 offset = startW - tw2-1; 182 offset = startW - tw2-1;
180 p->drawText(cx - borderWidth + offset, y+ sHei, suffix); 183 p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
181 184
182 // increment indices 185 // increment indices
183 y += mCellHeight; 186 y += mCellHeight;
184 cell++; 187 cell++;
188 }
189 } else {
190 //qDebug("NO redraw ");
185 } 191 }
192 // double buffer not yet implemented
193 //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
194 //mRedrawNeeded = false;
186} 195}
187 196
@@ -197,4 +206,5 @@ int TimeLabels::minimumWidth() const
197void TimeLabels::updateConfig() 206void TimeLabels::updateConfig()
198{ 207{
208 mRedrawNeeded = true;
199 // set the font 209 // set the font
200 // config->setGroup("Fonts"); 210 // config->setGroup("Fonts");
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 6dc81c6..30c9b05 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -102,4 +102,6 @@ class TimeLabels : public QScrollView {
102 102
103 private: 103 private:
104 QPixmap myPix;
105 bool mRedrawNeeded;
104 int mMiniWidth; 106 int mMiniWidth;
105 int mMouseDownY; 107 int mMouseDownY;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index d543aaf..dfc6af7 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -111,4 +111,5 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const
111#endif 111#endif
112{ 112{
113 mRedrawNeeded = true;
113 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 114 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
114 mPendingUpdateBeforeRepaint = false; 115 mPendingUpdateBeforeRepaint = false;
@@ -387,4 +388,5 @@ void KODayMatrix::updateViewTimed()
387 } 388 }
388 } 389 }
390 mRedrawNeeded = true;
389 if ( ! mPendingUpdateBeforeRepaint ) 391 if ( ! mPendingUpdateBeforeRepaint )
390 repaint(false); 392 repaint(false);
@@ -421,4 +423,5 @@ void KODayMatrix::updateView(QDate actdate)
421 mDayChanged = true; 423 mDayChanged = true;
422 recalculateToday(); 424 recalculateToday();
425 mRedrawNeeded = true;
423 } 426 }
424 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 427 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
@@ -429,5 +432,5 @@ void KODayMatrix::updateView(QDate actdate)
429 //mRepaintTimer->start( 100 ); 432 //mRepaintTimer->start( 100 );
430 //updateViewTimed(); 433 //updateViewTimed();
431 mUpdateTimer->start( 20 ); 434 mUpdateTimer->start( 50 );
432#else 435#else
433 mRepaintTimer->start( 350 ); 436 mRepaintTimer->start( 350 );
@@ -679,256 +682,262 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
679 if ( myPix.width() != width() || myPix.height()!=height() ) { 682 if ( myPix.width() != width() || myPix.height()!=height() ) {
680 myPix.resize(size() ); 683 myPix.resize(size() );
684 mRedrawNeeded = true;
681 } 685 }
682 QPainter p(&myPix);
683 p.setFont(font());
684 686
687 if ( mRedrawNeeded ) {
688 //qDebug("REDRAW ");
689 QPainter p(&myPix);
690 p.setFont(font());
685 691
686 int dheight = daysize.height(); 692
687 int dwidth = daysize.width(); 693 int dheight = daysize.height();
688 int row,col; 694 int dwidth = daysize.width();
689 int selw, selh; 695 int row,col;
690 int xyOff = frameWidth(); 696 int selw, selh;
691 int colModulo = (width()-2) % 7; 697 int xyOff = frameWidth();
692 int rowModulo = (height()-2) % 6; 698 int colModulo = (width()-2) % 7;
693 //qDebug("col %d row %d ",colModulo,rowModulo ); 699 int rowModulo = (height()-2) % 6;
700 //qDebug("col %d row %d ",colModulo,rowModulo );
694 701
695 bool isRTL = KOGlobals::self()->reverseLayout(); 702 bool isRTL = KOGlobals::self()->reverseLayout();
696 703
697 // draw background and topleft frame 704 // draw background and topleft frame
698 p.fillRect(0,0,width(),height(), mDefaultBackColor); 705 p.fillRect(0,0,width(),height(), mDefaultBackColor);
699 p.setPen(mDefaultTextColor); 706 p.setPen(mDefaultTextColor);
700 p.drawRect(0, 0, width(), height()); 707 p.drawRect(0, 0, width(), height());
701 int mSelStartT = mSelStart; 708 int mSelStartT = mSelStart;
702 int mSelEndT = mSelEnd; 709 int mSelEndT = mSelEnd;
703 if ( mSelEndT >= NUMDAYS ) 710 if ( mSelEndT >= NUMDAYS )
704 mSelEndT = NUMDAYS-1; 711 mSelEndT = NUMDAYS-1;
705 // draw selected days with highlighted background color 712 // draw selected days with highlighted background color
706 if (mSelStart != NOSELECTION) { 713 if (mSelStart != NOSELECTION) {
707 bool skip = false; 714 bool skip = false;
708 if ( ! mouseDown ) { 715 if ( ! mouseDown ) {
709 int mo = days[20].month(); 716 int mo = days[20].month();
710 //qDebug("-- %d %d ", mSelStartT, mSelEndT); 717 //qDebug("-- %d %d ", mSelStartT, mSelEndT);
711 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); 718 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() );
712 int startMo = days[mSelStartT].month(); 719 int startMo = days[mSelStartT].month();
713 int endMo = days[mSelEndT].month(); 720 int endMo = days[mSelEndT].month();
714 if ( startMo == 12 && mo == 1 && endMo <= 2 ) 721 if ( startMo == 12 && mo == 1 && endMo <= 2 )
715 startMo = 1; 722 startMo = 1;
716 if ( endMo == 1 && mo == 12 ) 723 if ( endMo == 1 && mo == 12 )
717 endMo = 12; 724 endMo = 12;
718 if ( mo == 12 && startMo == 1 ) 725 if ( mo == 12 && startMo == 1 )
719 startMo = 13; 726 startMo = 13;
720 if ( (startMo > mo || endMo < mo) ) { 727 if ( (startMo > mo || endMo < mo) ) {
721 skip = true; 728 skip = true;
722 } else { 729 } else {
723 if ( days[mSelStartT].month() != mo ) { 730 if ( days[mSelStartT].month() != mo ) {
724 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); 731 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day();
725 mSelStartT += add +1; 732 mSelStartT += add +1;
726 } 733 }
727 if ( days[mSelEndT].month() != mo ) { 734 if ( days[mSelEndT].month() != mo ) {
728 int sub = days[mSelEndT].day(); 735 int sub = days[mSelEndT].day();
729 mSelEndT -= sub ; 736 mSelEndT -= sub ;
730 } 737 }
731 } 738 }
732 } 739 }
733 //qDebug("SKIP %d ", skip); 740 //qDebug("SKIP %d ", skip);
734 if ( ! skip ) { 741 if ( ! skip ) {
735 row = mSelStartT/7; 742 row = mSelStartT/7;
736 col = mSelStartT -row*7; 743 col = mSelStartT -row*7;
737 QColor selcol = KOPrefs::instance()->mHighlightColor; 744 QColor selcol = KOPrefs::instance()->mHighlightColor;
738 int addCol = 0; 745 int addCol = 0;
739 int addRow = 0; 746 int addRow = 0;
740 int addRow2 = 0; 747 int addRow2 = 0;
741 int addCol2 = 0; 748 int addCol2 = 0;
742 if (row == mSelEndT/7) { 749 if (row == mSelEndT/7) {
743 if ( rowModulo ) { 750 if ( rowModulo ) {
744 if ( row >= 6 - rowModulo ) 751 if ( row >= 6 - rowModulo )
745 addRow = row - 5 + rowModulo; 752 addRow = row - 5 + rowModulo;
746 } 753 }
747 if ( colModulo ) { 754 if ( colModulo ) {
748 int colt1 = mSelEndT%7; 755 int colt1 = mSelEndT%7;
749 //qDebug("colt1 %d ", colt1 ); 756 //qDebug("colt1 %d ", colt1 );
750 if ( colt1 >= 7 - colModulo ) 757 if ( colt1 >= 7 - colModulo )
751 addCol = colt1 - 7 + colModulo+1; 758 addCol = colt1 - 7 + colModulo+1;
752 int colt = mSelStartT%7; 759 int colt = mSelStartT%7;
753 if ( colt >= 7 - colModulo ) 760 if ( colt >= 7 - colModulo )
754 addCol2 = colt - 7 + colModulo; 761 addCol2 = colt - 7 + colModulo;
755 addCol -= addCol2; 762 addCol -= addCol2;
756 //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); 763 //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 );
757 } 764 }
758 // Single row selection 765 // Single row selection
759 if ( row == 0) 766 if ( row == 0)
760 addRow = 1; 767 addRow = 1;
761 p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, 768 p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2,
762 row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); 769 row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol);
763 } else { 770 } else {
764 // draw first row to the right 771 // draw first row to the right
765 if ( colModulo ) { 772 if ( colModulo ) {
766 if ( col >= 7 - colModulo ) 773 if ( col >= 7 - colModulo )
767 addCol2 = col - 7 + colModulo; 774 addCol2 = col - 7 + colModulo;
768 } 775 }
769 if ( rowModulo ) { 776 if ( rowModulo ) {
770 if ( row >= 6 - rowModulo ) 777 if ( row >= 6 - rowModulo )
771 addRow = row - 5 + rowModulo; 778 addRow = row - 5 + rowModulo;
772 } 779 }
773 if ( row == 0) 780 if ( row == 0)
774 addRow = 1; 781 addRow = 1;
775 int drawWid = width()-(col*dwidth+1+addCol2)-1; 782 int drawWid = width()-(col*dwidth+1+addCol2)-1;
776 p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, 783 p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid,
777 dheight+1, selcol); 784 dheight+1, selcol);
778 // draw full block till last line 785 // draw full block till last line
779 selh = mSelEndT/7-row; 786 selh = mSelEndT/7-row;
780 addRow = 0; 787 addRow = 0;
781 if ( rowModulo ) { 788 if ( rowModulo ) {
782 if ( mSelEndT/7 >= 6 - rowModulo ) 789 if ( mSelEndT/7 >= 6 - rowModulo )
783 addRow = mSelEndT/7 - 5 + rowModulo; 790 addRow = mSelEndT/7 - 5 + rowModulo;
784 } 791 }
785 if (selh > 1) { 792 if (selh > 1) {
786 p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); 793 p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol);
787 } 794 }
788 // draw last block from left to mSelEndT 795 // draw last block from left to mSelEndT
789 selw = mSelEndT-7*(mSelEndT/7)+1; 796 selw = mSelEndT-7*(mSelEndT/7)+1;
790 //qDebug("esl %d ",selw ); 797 //qDebug("esl %d ",selw );
791 int add = 0; 798 int add = 0;
792 if ( colModulo ) { 799 if ( colModulo ) {
793 add = 7 - colModulo; 800 add = 7 - colModulo;
794 if ( selw > add ) 801 if ( selw > add )
795 add = selw - add; 802 add = selw - add;
796 else 803 else
797 add = 0; 804 add = 0;
798 } 805 }
799 //qDebug("add %d ", add); 806 //qDebug("add %d ", add);
800 p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, 807 p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow,
801 selw*dwidth+add, dheight+1, selcol); 808 selw*dwidth+add, dheight+1, selcol);
802 } 809 }
803 } 810 }
804 } 811 }
805 812
806 // iterate over all days in the matrix and draw the day label in appropriate colors 813 // iterate over all days in the matrix and draw the day label in appropriate colors
807 QColor actcol = mDefaultTextColorShaded; 814 QColor actcol = mDefaultTextColorShaded;
808 p.setPen(actcol); 815 p.setPen(actcol);
809 QPen tmppen; 816 QPen tmppen;
810 for(int i = 0; i < NUMDAYS; i++) { 817 for(int i = 0; i < NUMDAYS; i++) {
811 row = i/7; 818 row = i/7;
812 col = isRTL ? 6-(i-row*7) : i-row*7; 819 col = isRTL ? 6-(i-row*7) : i-row*7;
813 820
814 // if it is the first day of a month switch color from normal to shaded and vice versa 821 // if it is the first day of a month switch color from normal to shaded and vice versa
815 if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { 822 if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) {
816 if (actcol == mDefaultTextColorShaded) { 823 if (actcol == mDefaultTextColorShaded) {
817 actcol = mDefaultTextColor; 824 actcol = mDefaultTextColor;
818 } else { 825 } else {
819 actcol = mDefaultTextColorShaded; 826 actcol = mDefaultTextColorShaded;
820 } 827 }
821 p.setPen(actcol); 828 p.setPen(actcol);
822 } 829 }
823 if (actcol == mDefaultTextColorShaded) { 830 if (actcol == mDefaultTextColorShaded) {
824 if ( ! mouseDown ) { 831 if ( ! mouseDown ) {
825 continue; 832 continue;
826 } 833 }
827 } 834 }
828 //Reset pen color after selected days block 835 //Reset pen color after selected days block
829 if (i == mSelEndT+1) { 836 if (i == mSelEndT+1) {
830 p.setPen(actcol); 837 p.setPen(actcol);
831 } 838 }
832 839
833 // if today then draw rectangle around day 840 // if today then draw rectangle around day
834 if (today == i) { 841 if (today == i) {
835 tmppen = p.pen(); 842 tmppen = p.pen();
836 QPen mTodayPen(p.pen()); 843 QPen mTodayPen(p.pen());
837 if ( daysize.width() < 20 ) 844 if ( daysize.width() < 20 )
838 mTodayPen.setWidth(1); 845 mTodayPen.setWidth(1);
839 else 846 else
840 mTodayPen.setWidth(mTodayMarginWidth); 847 mTodayPen.setWidth(mTodayMarginWidth);
841 //draw red rectangle for holidays 848 //draw red rectangle for holidays
842 if (!mHolidays[i].isNull()) { 849 if (!mHolidays[i].isNull()) {
843 if (actcol == mDefaultTextColor) { 850 if (actcol == mDefaultTextColor) {
844 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); 851 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor);
845 } else { 852 } else {
846 mTodayPen.setColor(mHolidayColorShaded); 853 mTodayPen.setColor(mHolidayColorShaded);
847 } 854 }
848 } 855 }
849 //draw gray rectangle for today if in selection 856 //draw gray rectangle for today if in selection
850 if (i >= mSelStartT && i <= mSelEndT) { 857 if (i >= mSelStartT && i <= mSelEndT) {
851 QColor grey("grey"); 858 QColor grey("grey");
852 mTodayPen.setColor(grey); 859 mTodayPen.setColor(grey);
853 } 860 }
854 p.setPen(mTodayPen); 861 p.setPen(mTodayPen);
855 862
856 863
857 int addCol = 0; 864 int addCol = 0;
858 int addRow = 0; 865 int addRow = 0;
859 if (rowModulo) { 866 if (rowModulo) {
860 if ( row >= 6 - rowModulo ) 867 if ( row >= 6 - rowModulo )
861 addRow = row - 5 + rowModulo; 868 addRow = row - 5 + rowModulo;
862 } 869 }
863 if ( colModulo ) { 870 if ( colModulo ) {
864 if ( col >= 7 - colModulo ) 871 if ( col >= 7 - colModulo )
865 addCol = col - 6 + colModulo-1; 872 addCol = col - 6 + colModulo-1;
866 } 873 }
867 874
868 addCol += 1; 875 addCol += 1;
869 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); 876 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1);
870 p.setPen(tmppen); 877 p.setPen(tmppen);
871 } 878 }
872 879
873 // if any events are on that day then draw it using a bold font 880 // if any events are on that day then draw it using a bold font
874 if ( eDays.testBit(i) ) { 881 if ( eDays.testBit(i) ) {
875 QFont myFont = font(); 882 QFont myFont = font();
876 myFont.setBold(true); 883 myFont.setBold(true);
877 p.setFont(myFont); 884 p.setFont(myFont);
878 } 885 }
879 886
880 // if it is a holiday then use the default holiday color 887 // if it is a holiday then use the default holiday color
881 if ( !mHolidays[i].isNull()) { 888 if ( !mHolidays[i].isNull()) {
882 if ( bDays.testBit(i) ) { 889 if ( bDays.testBit(i) ) {
883 if ( hDays.testBit(i) ) 890 if ( hDays.testBit(i) )
884 p.setPen(QColor(Qt::green)); 891 p.setPen(QColor(Qt::green));
885 else 892 else
886 p.setPen(QColor(Qt::green).dark()); 893 p.setPen(QColor(Qt::green).dark());
887 } else { 894 } else {
888 if (actcol == mDefaultTextColor ) { 895 if (actcol == mDefaultTextColor ) {
889 p.setPen(KOPrefs::instance()->mHolidayColor); 896 p.setPen(KOPrefs::instance()->mHolidayColor);
890 } else { 897 } else {
891 p.setPen(mHolidayColorShaded); 898 p.setPen(mHolidayColorShaded);
892 } 899 }
893 } 900 }
894 } 901 }
895 902
896 // draw selected days with special color 903 // draw selected days with special color
897 // DO NOT specially highlight holidays in selection ! 904 // DO NOT specially highlight holidays in selection !
898 if (i >= mSelStartT && i <= mSelEndT) { 905 if (i >= mSelStartT && i <= mSelEndT) {
899 ;//p.setPen(mSelectedDaysColor); 906 ;//p.setPen(mSelectedDaysColor);
900 } 907 }
901 908
902 int addCol = 0; 909 int addCol = 0;
903 int addRow = 0; 910 int addRow = 0;
904 if ( colModulo ) { 911 if ( colModulo ) {
905 if ( col >= 7 - colModulo ) 912 if ( col >= 7 - colModulo )
906 addCol = col - 7 + colModulo; 913 addCol = col - 7 + colModulo;
907 } 914 }
908 if ( rowModulo ) { 915 if ( rowModulo ) {
909 if ( row >= 6 - rowModulo ) 916 if ( row >= 6 - rowModulo )
910 addRow = row - 5 + rowModulo; 917 addRow = row - 5 + rowModulo;
911 } 918 }
912 //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); 919 //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow);
913 ++addCol;//++addCol; 920 ++addCol;//++addCol;
914 if ( row == 0) 921 if ( row == 0)
915 addRow = 1; 922 addRow = 1;
916 p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, 923 p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight,
917 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); 924 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]);
918 925
919 // reset color to actual color 926 // reset color to actual color
920 if (!mHolidays[i].isNull()) { 927 if (!mHolidays[i].isNull()) {
921 p.setPen(actcol); 928 p.setPen(actcol);
922 } 929 }
923 // reset bold font to plain font 930 // reset bold font to plain font
924 if ( eDays.testBit(i)) { 931 if ( eDays.testBit(i)) {
925 QFont myFont = font(); 932 QFont myFont = font();
926 myFont.setBold(false); 933 myFont.setBold(false);
927 p.setFont(myFont); 934 p.setFont(myFont);
928 } 935 }
929 } 936 }
930 int off = 0;//xyOff; 937 } else {
931 bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); 938 //qDebug("NO redraw ");
932 //qDebug("ffffffffff %d ", off); 939 }
940 bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
941 mRedrawNeeded = false;
933} 942}
934 943
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 38a7f92..731117c 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -228,4 +228,5 @@ protected:
228 228
229private: 229private:
230 bool mRedrawNeeded;
230 KODaymatrixWhatsThis* mKODaymatrixWhatsThis; 231 KODaymatrixWhatsThis* mKODaymatrixWhatsThis;
231 bool mouseDown; 232 bool mouseDown;