author | zautrix <zautrix> | 2005-06-25 10:59:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-25 10:59:43 (UTC) |
commit | 70e025b560e0060804610c182d3b04a6e6a63b70 (patch) (unidiff) | |
tree | a9847909ef7878ccb39c69cfec16568bc3632ea6 /korganizer | |
parent | b81bdd12cadbae5a3ab5a7f1f689bb4ae45cf315 (diff) | |
download | kdepimpi-70e025b560e0060804610c182d3b04a6e6a63b70.zip kdepimpi-70e025b560e0060804610c182d3b04a6e6a63b70.tar.gz kdepimpi-70e025b560e0060804610c182d3b04a6e6a63b70.tar.bz2 |
fixxxx
-rw-r--r-- | korganizer/koagenda.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index fc213d8..b99625c 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -435,60 +435,110 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
435 | } | 435 | } |
436 | if ( object == mAllAgendaPopup ) { | 436 | if ( object == mAllAgendaPopup ) { |
437 | //qDebug(" mAllAgendaPopup "); | 437 | //qDebug(" mAllAgendaPopup "); |
438 | if ( me->type() == QEvent::MouseButtonRelease ) { | 438 | if ( me->type() == QEvent::MouseButtonRelease ) { |
439 | mAllAgendaPopup->removeEventFilter( this ); | 439 | mAllAgendaPopup->removeEventFilter( this ); |
440 | int dX = me->globalPos().x() - mPopupPos.x();; | 440 | int dX = me->globalPos().x() - mPopupPos.x();; |
441 | if ( dX < 0 ) | 441 | if ( dX < 0 ) |
442 | dX = -dX; | 442 | dX = -dX; |
443 | int dY = me->globalPos().y() - mPopupPos.y(); | 443 | int dY = me->globalPos().y() - mPopupPos.y(); |
444 | if ( dY < 0 ) | 444 | if ( dY < 0 ) |
445 | dY = -dY; | 445 | dY = -dY; |
446 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 446 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
447 | mAllAgendaPopup->hide(); | 447 | mAllAgendaPopup->hide(); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | return true; | 450 | return true; |
451 | } | 451 | } |
452 | QPoint viewportPos; | 452 | QPoint viewportPos; |
453 | if (object != viewport()) { | 453 | if (object != viewport()) { |
454 | blockmoveDist = blockmoveDist*2; | 454 | blockmoveDist = blockmoveDist*2; |
455 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 455 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
456 | } else { | 456 | } else { |
457 | viewportPos = me->pos(); | 457 | viewportPos = me->pos(); |
458 | } | 458 | } |
459 | 459 | bool objIsNotViewport = (object != viewport()); | |
460 | switch (me->type()) { | 460 | switch (me->type()) { |
461 | case QEvent::MouseButtonPress: | 461 | case QEvent::MouseButtonPress: |
462 | if (me->button() == LeftButton) { | 462 | if (me->button() == LeftButton) { |
463 | mPopupTimer->start( 600 ); | 463 | mPopupTimer->start( 600 ); |
464 | mLeftMouseDown = true; | 464 | mLeftMouseDown = true; |
465 | } | 465 | } |
466 | blockMoving = true; | 466 | blockMoving = true; |
467 | startX = viewportPos.x(); | 467 | startX = viewportPos.x(); |
468 | startY = viewportPos.y(); | 468 | startY = viewportPos.y(); |
469 | mPopupPos = me->globalPos(); | 469 | mPopupPos = me->globalPos(); |
470 | if (object != viewport()) { | 470 | if ( objIsNotViewport ) { |
471 | KOAgendaItem * tempItem = (KOAgendaItem *)object; | ||
472 | if (mAllDayMode) { | ||
473 | if ( tempItem->height() > 10 ) { | ||
474 | int minV = tempItem->height()/4; | ||
475 | if ( minV > (blockmoveDist/2)-2 ) | ||
476 | minV = (blockmoveDist/2)-2; | ||
477 | bool border = false; | ||
478 | int diff = tempItem->y() - viewportPos.y(); | ||
479 | if ( diff < 0 ) | ||
480 | diff *= -1; | ||
481 | if ( diff < minV ) { | ||
482 | border = true; | ||
483 | objIsNotViewport = false; | ||
484 | } | ||
485 | if ( ! border ) { | ||
486 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); | ||
487 | if ( diff < 0 ) | ||
488 | diff *= -1; | ||
489 | if ( diff < minV ) { | ||
490 | border = true; | ||
491 | objIsNotViewport = false; | ||
492 | } | ||
493 | } | ||
494 | } | ||
495 | } else { // not allday | ||
496 | if ( tempItem->width() > 10 ) { | ||
497 | int minH = tempItem->width()/4; | ||
498 | if ( minH > (blockmoveDist/2)-2 ) | ||
499 | minH = (blockmoveDist/2)-2; | ||
500 | bool border = false; | ||
501 | int diff = tempItem->x() - viewportPos.x(); | ||
502 | if ( diff < 0 ) | ||
503 | diff *= -1; | ||
504 | if ( diff < minH ) { | ||
505 | border = true; | ||
506 | objIsNotViewport = false; | ||
507 | } | ||
508 | if ( ! border ) { | ||
509 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); | ||
510 | if ( diff < 0 ) | ||
511 | diff *= -1; | ||
512 | if ( diff < minH ) { | ||
513 | border = true; | ||
514 | objIsNotViewport = false; | ||
515 | } | ||
516 | } | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | if ( objIsNotViewport ) { | ||
471 | mPopupItem = (KOAgendaItem *)object; | 521 | mPopupItem = (KOAgendaItem *)object; |
472 | mPopupKind = 1; | 522 | mPopupKind = 1; |
473 | if (me->button() == RightButton) { | 523 | if (me->button() == RightButton) { |
474 | mPopupKind = 3; | 524 | mPopupKind = 3; |
475 | popupMenu(); | 525 | popupMenu(); |
476 | } else if (me->button() == LeftButton) { | 526 | } else if (me->button() == LeftButton) { |
477 | mActionItem = (KOAgendaItem *)object; | 527 | mActionItem = (KOAgendaItem *)object; |
478 | if (mActionItem) { | 528 | if (mActionItem) { |
479 | emit signalClearSelection(); | 529 | emit signalClearSelection(); |
480 | slotClearSelection(); | 530 | slotClearSelection(); |
481 | selectItem(mActionItem); | 531 | selectItem(mActionItem); |
482 | Incidence *incidence = mActionItem->incidence(); | 532 | Incidence *incidence = mActionItem->incidence(); |
483 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 533 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
484 | mActionItem = 0; | 534 | mActionItem = 0; |
485 | } else { | 535 | } else { |
486 | startItemAction(viewportPos); | 536 | startItemAction(viewportPos); |
487 | } | 537 | } |
488 | } | 538 | } |
489 | } | 539 | } |
490 | } else { // ---------- viewport() | 540 | } else { // ---------- viewport() |
491 | mPopupItem = 0; | 541 | mPopupItem = 0; |
492 | mPopupKind = 2; | 542 | mPopupKind = 2; |
493 | selectItem(0); | 543 | selectItem(0); |
494 | mActionItem = 0; | 544 | mActionItem = 0; |