author | zautrix <zautrix> | 2005-03-20 01:37:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-20 01:37:34 (UTC) |
commit | 1ebfa83d28d9eb3f48d8240e65212bbe22defb3c (patch) (unidiff) | |
tree | c82bb3fb86c4d5494edb8d0b512f08e9e1339a24 | |
parent | 0ef9fe870982bd005806d7f51898a740cd52fec8 (diff) | |
download | kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.zip kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.tar.gz kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.tar.bz2 |
fixes
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 58 |
2 files changed, 45 insertions, 15 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index d09f484..b9bd1b9 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -145,5 +145,5 @@ void DateNavigatorContainer::setBaseDates() | |||
145 | bool doRepaint = false; // skip first repaint | 145 | bool doRepaint = false; // skip first repaint |
146 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 146 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
147 | baseDate = baseDate.addDays( baseDate.daysInMonth () ); | 147 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); |
148 | n->setBaseDate( baseDate, doRepaint ); | 148 | n->setBaseDate( baseDate, doRepaint ); |
149 | doRepaint = true; | 149 | doRepaint = true; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 1cde616..619ae39 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -272,5 +272,9 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | |||
272 | { | 272 | { |
273 | mSelStart = startdate.daysTo(start); | 273 | mSelStart = startdate.daysTo(start); |
274 | if ( mSelStart < 0 ) | ||
275 | mSelStart = 0; | ||
274 | mSelEnd = startdate.daysTo(end); | 276 | mSelEnd = startdate.daysTo(end); |
277 | if ( mSelEnd < 0 ) | ||
278 | clearSelection(); | ||
275 | } | 279 | } |
276 | void KODayMatrix::clearSelection() | 280 | void KODayMatrix::clearSelection() |
@@ -639,16 +643,37 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
639 | p.setPen(mDefaultTextColor); | 643 | p.setPen(mDefaultTextColor); |
640 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 644 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); |
641 | 645 | int mSelStartT = mSelStart; | |
646 | int mSelEndT = mSelEnd; | ||
647 | if ( mSelEndT >= NUMDAYS ) | ||
648 | mSelEndT = NUMDAYS-1; | ||
642 | // draw selected days with highlighted background color | 649 | // draw selected days with highlighted background color |
643 | if (mSelStart != NOSELECTION) { | 650 | if (mSelStart != NOSELECTION) { |
644 | 651 | bool skip = false; | |
645 | row = mSelStart/7; | 652 | if ( ! mouseDown ) { |
646 | col = mSelStart -row*7; | 653 | int mo = days[20].month(); |
654 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); | ||
655 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); | ||
656 | if ( days[mSelStartT].month() > mo || days[mSelEndT].month() < mo ) { | ||
657 | skip = true; | ||
658 | } else { | ||
659 | if ( days[mSelStartT].month() != mo ) { | ||
660 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); | ||
661 | mSelStartT += add +1; | ||
662 | } | ||
663 | if ( days[mSelEndT].month() != mo ) { | ||
664 | int sub = days[mSelEndT].day(); | ||
665 | mSelEndT -= sub ; | ||
666 | } | ||
667 | } | ||
668 | } | ||
669 | if ( ! skip ) { | ||
670 | row = mSelStartT/7; | ||
671 | col = mSelStartT -row*7; | ||
647 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 672 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
648 | 673 | ||
649 | if (row == mSelEnd/7) { | 674 | if (row == mSelEndT/7) { |
650 | // Single row selection | 675 | // Single row selection |
651 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, | 676 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth, |
652 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); | 677 | row*dheight, (mSelEndT-mSelStartT+1)*dwidth, dheight, selcol); |
653 | } else { | 678 | } else { |
654 | // draw first row to the right | 679 | // draw first row to the right |
@@ -656,13 +681,14 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
656 | dheight, selcol); | 681 | dheight, selcol); |
657 | // draw full block till last line | 682 | // draw full block till last line |
658 | selh = mSelEnd/7-row; | 683 | selh = mSelEndT/7-row; |
659 | if (selh > 1) { | 684 | if (selh > 1) { |
660 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); | 685 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); |
661 | } | 686 | } |
662 | // draw last block from left to mSelEnd | 687 | // draw last block from left to mSelEndT |
663 | selw = mSelEnd-7*(mSelEnd/7)+1; | 688 | selw = mSelEndT-7*(mSelEndT/7)+1; |
664 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, | 689 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, |
665 | selw*dwidth, dheight, selcol); | 690 | selw*dwidth, dheight, selcol); |
666 | } | 691 | } |
692 | } | ||
667 | } | 693 | } |
668 | 694 | ||
@@ -684,7 +710,11 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
684 | p.setPen(actcol); | 710 | p.setPen(actcol); |
685 | } | 711 | } |
686 | 712 | if (actcol == mDefaultTextColorShaded) { | |
713 | if ( ! mouseDown ) { | ||
714 | continue; | ||
715 | } | ||
716 | } | ||
687 | //Reset pen color after selected days block | 717 | //Reset pen color after selected days block |
688 | if (i == mSelEnd+1) { | 718 | if (i == mSelEndT+1) { |
689 | p.setPen(actcol); | 719 | p.setPen(actcol); |
690 | } | 720 | } |
@@ -705,5 +735,5 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
705 | } | 735 | } |
706 | //draw gray rectangle for today if in selection | 736 | //draw gray rectangle for today if in selection |
707 | if (i >= mSelStart && i <= mSelEnd) { | 737 | if (i >= mSelStartT && i <= mSelEndT) { |
708 | QColor grey("grey"); | 738 | QColor grey("grey"); |
709 | mTodayPen.setColor(grey); | 739 | mTodayPen.setColor(grey); |
@@ -736,5 +766,5 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
736 | // draw selected days with special color | 766 | // draw selected days with special color |
737 | // DO NOT specially highlight holidays in selection ! | 767 | // DO NOT specially highlight holidays in selection ! |
738 | if (i >= mSelStart && i <= mSelEnd) { | 768 | if (i >= mSelStartT && i <= mSelEndT) { |
739 | ;//p.setPen(mSelectedDaysColor); | 769 | ;//p.setPen(mSelectedDaysColor); |
740 | } | 770 | } |