summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp54
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
@@ -447,36 +447,86 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
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();