summaryrefslogtreecommitdiffabout
path: root/korganizer
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 /korganizer
parent0ef9fe870982bd005806d7f51898a740cd52fec8 (diff)
downloadkdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.zip
kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.tar.gz
kdepimpi-1ebfa83d28d9eb3f48d8240e65212bbe22defb3c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (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
@@ -144,7 +144,7 @@ void DateNavigatorContainer::setBaseDates()
KDateNavigator *n;
bool doRepaint = false; // skip first repaint
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 );
doRepaint = true;
}
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 1cde616..619ae39 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -271,7 +271,11 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
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();
}
void KODayMatrix::clearSelection()
{
@@ -638,32 +642,54 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
p.fillRect(pevent->rect(), mDefaultBackColor);
p.setPen(mDefaultTextColor);
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 {
// draw first row to the right
p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth,
dheight, selcol);
// draw full block till last line
- selh = mSelEnd/7-row;
+ selh = mSelEndT/7-row;
if (selh > 1) {
p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol);
}
- // 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,
selw*dwidth, dheight, selcol);
}
+ }
}
// iterate over all days in the matrix and draw the day label in appropriate colors
@@ -683,9 +709,13 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
p.setPen(actcol);
}
-
+ if (actcol == mDefaultTextColorShaded) {
+ if ( ! mouseDown ) {
+ continue;
+ }
+ }
//Reset pen color after selected days block
- if (i == mSelEnd+1) {
+ if (i == mSelEndT+1) {
p.setPen(actcol);
}
@@ -704,7 +734,7 @@ 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");
mTodayPen.setColor(grey);
}
@@ -735,7 +765,7 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
// draw selected days with special color
// DO NOT specially highlight holidays in selection !
- if (i >= mSelStart && i <= mSelEnd) {
+ if (i >= mSelStartT && i <= mSelEndT) {
;//p.setPen(mSelectedDaysColor);
}