summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-20 01:37:34 (UTC)
committer zautrix <zautrix>2005-03-20 01:37:34 (UTC)
commit1ebfa83d28d9eb3f48d8240e65212bbe22defb3c (patch) (side-by-side diff)
treec82bb3fb86c4d5494edb8d0b512f08e9e1339a24
parent0ef9fe870982bd005806d7f51898a740cd52fec8 (diff)
downloadkdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.zip
kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.tar.gz
kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp2
-rw-r--r--korganizer/kodaymatrix.cpp58
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
@@ -146,3 +146,3 @@ void DateNavigatorContainer::setBaseDates()
for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
- baseDate = baseDate.addDays( baseDate.daysInMonth () );
+ baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 );
n->setBaseDate( baseDate, doRepaint );
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 1cde616..619ae39 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -273,3 +273,7 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
mSelStart = startdate.daysTo(start);
+ if ( mSelStart < 0 )
+ mSelStart = 0;
mSelEnd = startdate.daysTo(end);
+ if ( mSelEnd < 0 )
+ clearSelection();
}
@@ -640,14 +644,35 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
p.drawRect(0, 0, sz.width()+1, sz.height()+1);
-
+ int mSelStartT = mSelStart;
+ int mSelEndT = mSelEnd;
+ if ( mSelEndT >= NUMDAYS )
+ mSelEndT = NUMDAYS-1;
// draw selected days with highlighted background color
if (mSelStart != NOSELECTION) {
-
- row = mSelStart/7;
- col = mSelStart -row*7;
+ bool skip = false;
+ if ( ! mouseDown ) {
+ int mo = days[20].month();
+ //qDebug("-- %d %d ", mSelStartT, mSelEndT);
+ //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() );
+ if ( days[mSelStartT].month() > mo || days[mSelEndT].month() < mo ) {
+ skip = true;
+ } else {
+ if ( days[mSelStartT].month() != mo ) {
+ int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day();
+ mSelStartT += add +1;
+ }
+ if ( days[mSelEndT].month() != mo ) {
+ int sub = days[mSelEndT].day();
+ mSelEndT -= sub ;
+ }
+ }
+ }
+ if ( ! skip ) {
+ row = mSelStartT/7;
+ col = mSelStartT -row*7;
QColor selcol = KOPrefs::instance()->mHighlightColor;
- if (row == mSelEnd/7) {
+ if (row == mSelEndT/7) {
// Single row selection
- p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth,
- row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol);
+ p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth,
+ row*dheight, (mSelEndT-mSelStartT+1)*dwidth, dheight, selcol);
} else {
@@ -657,3 +682,3 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
// draw full block till last line
- selh = mSelEnd/7-row;
+ selh = mSelEndT/7-row;
if (selh > 1) {
@@ -661,4 +686,4 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
- // draw last block from left to mSelEnd
- selw = mSelEnd-7*(mSelEnd/7)+1;
+ // draw last block from left to mSelEndT
+ selw = mSelEndT-7*(mSelEndT/7)+1;
p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight,
@@ -666,2 +691,3 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
+ }
}
@@ -685,5 +711,9 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
-
+ if (actcol == mDefaultTextColorShaded) {
+ if ( ! mouseDown ) {
+ continue;
+ }
+ }
//Reset pen color after selected days block
- if (i == mSelEnd+1) {
+ if (i == mSelEndT+1) {
p.setPen(actcol);
@@ -706,3 +736,3 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
//draw gray rectangle for today if in selection
- if (i >= mSelStart && i <= mSelEnd) {
+ if (i >= mSelStartT && i <= mSelEndT) {
QColor grey("grey");
@@ -737,3 +767,3 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
// DO NOT specially highlight holidays in selection !
- if (i >= mSelStart && i <= mSelEnd) {
+ if (i >= mSelStartT && i <= mSelEndT) {
;//p.setPen(mSelectedDaysColor);