author | zautrix <zautrix> | 2005-04-01 18:10:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-01 18:10:09 (UTC) |
commit | edc032c21ae3788d02a632ea8066e4ac5a4feedb (patch) (unidiff) | |
tree | 8e59c8dcf1cc3021694025627d36e152f7adc389 /korganizer/kodaymatrix.cpp | |
parent | 5d88f92b76a760f100384ea5fa6ed143088d19bb (diff) | |
download | kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.zip kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.tar.gz kdepimpi-edc032c21ae3788d02a632ea8066e4ac5a4feedb.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kodaymatrix.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index dfc6af7..c55f7d7 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -280,24 +280,25 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | // apply normal routine to selection being entirely within matrix limits | 282 | // apply normal routine to selection being entirely within matrix limits |
283 | } else { | 283 | } else { |
284 | for (int i = i0; i <= mSelEnd; i++) { | 284 | for (int i = i0; i <= mSelEnd; i++) { |
285 | selDays.append(days[i]); | 285 | selDays.append(days[i]); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 290 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
291 | { | 291 | { |
292 | mRedrawNeeded = true; | ||
292 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); | 293 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); |
293 | mSelStart = startdate.daysTo(start); | 294 | mSelStart = startdate.daysTo(start); |
294 | if ( mSelStart < 0 ) | 295 | if ( mSelStart < 0 ) |
295 | mSelStart = 0; | 296 | mSelStart = 0; |
296 | mSelEnd = startdate.daysTo(end); | 297 | mSelEnd = startdate.daysTo(end); |
297 | if ( mSelEnd > NUMDAYS-1 ) | 298 | if ( mSelEnd > NUMDAYS-1 ) |
298 | mSelEnd = NUMDAYS-1; | 299 | mSelEnd = NUMDAYS-1; |
299 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { | 300 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { |
300 | clearSelection(); | 301 | clearSelection(); |
301 | if ( noSel ) | 302 | if ( noSel ) |
302 | return false; | 303 | return false; |
303 | } | 304 | } |
@@ -502,29 +503,31 @@ int KODayMatrix::getDayIndexFrom(int x, int y) | |||
502 | // M O U S E E V E N T H A N D L I N G | 503 | // M O U S E E V E N T H A N D L I N G |
503 | // ---------------------------------------------------------------------------- | 504 | // ---------------------------------------------------------------------------- |
504 | 505 | ||
505 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 506 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
506 | { | 507 | { |
507 | 508 | ||
508 | if ( e->button() == LeftButton ) | 509 | if ( e->button() == LeftButton ) |
509 | mouseDown = true; | 510 | mouseDown = true; |
510 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 511 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
511 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 512 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
512 | mSelInit = mSelStart; | 513 | mSelInit = mSelStart; |
513 | mSelEnd = mSelStart; | 514 | mSelEnd = mSelStart; |
515 | mRedrawNeeded = true; | ||
514 | repaint(false); | 516 | repaint(false); |
515 | } | 517 | } |
516 | 518 | ||
517 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 519 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
518 | { | 520 | { |
521 | mRedrawNeeded = true; | ||
519 | if ( e->button() == LeftButton ) | 522 | if ( e->button() == LeftButton ) |
520 | if ( ! mouseDown ) { | 523 | if ( ! mouseDown ) { |
521 | return; | 524 | return; |
522 | } | 525 | } |
523 | else | 526 | else |
524 | mouseDown = false; | 527 | mouseDown = false; |
525 | int tmp = getDayIndexFrom(e->x(), e->y()); | 528 | int tmp = getDayIndexFrom(e->x(), e->y()); |
526 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 529 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
527 | 530 | ||
528 | if (mSelInit > tmp) { | 531 | if (mSelInit > tmp) { |
529 | mSelEnd = mSelInit; | 532 | mSelEnd = mSelInit; |
530 | if (tmp != mSelStart) { | 533 | if (tmp != mSelStart) { |
@@ -547,24 +550,25 @@ void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | |||
547 | for (int i = mSelStart; i <= mSelEnd; i++) { | 550 | for (int i = mSelStart; i <= mSelEnd; i++) { |
548 | daylist.append(days[i]); | 551 | daylist.append(days[i]); |
549 | } | 552 | } |
550 | emit selected((const DateList)daylist); | 553 | emit selected((const DateList)daylist); |
551 | 554 | ||
552 | } | 555 | } |
553 | 556 | ||
554 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 557 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
555 | { | 558 | { |
556 | if ( ! mouseDown ) { | 559 | if ( ! mouseDown ) { |
557 | return; | 560 | return; |
558 | } | 561 | } |
562 | mRedrawNeeded = true; | ||
559 | int tmp = getDayIndexFrom(e->x(), e->y()); | 563 | int tmp = getDayIndexFrom(e->x(), e->y()); |
560 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 564 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
561 | 565 | ||
562 | if (mSelInit > tmp) { | 566 | if (mSelInit > tmp) { |
563 | mSelEnd = mSelInit; | 567 | mSelEnd = mSelInit; |
564 | if (tmp != mSelStart) { | 568 | if (tmp != mSelStart) { |
565 | mSelStart = tmp; | 569 | mSelStart = tmp; |
566 | repaint(false); | 570 | repaint(false); |
567 | } | 571 | } |
568 | } else { | 572 | } else { |
569 | mSelStart = mSelInit; | 573 | mSelStart = mSelInit; |
570 | 574 | ||