summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index faddac4..ce73168 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -431,121 +431,129 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
431 mNewItemPopup->hide(); 431 mNewItemPopup->hide();
432 } 432 }
433 } 433 }
434 return true; 434 return true;
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 bool objIsNotViewport = (object != viewport()); 459 bool objIsNotViewport = (object != viewport());
460 bool leftButt = false; 460 bool leftButt = false;
461#ifdef DESKTOP_VERSION 461#ifdef DESKTOP_VERSION
462 leftButt = (me->button() == LeftButton); 462 leftButt = (me->button() == LeftButton);
463#endif 463#endif
464 switch (me->type()) { 464 switch (me->type()) {
465 case QEvent::MouseButtonPress: 465 case QEvent::MouseButtonPress:
466 if (me->button() == LeftButton) { 466 if (me->button() == LeftButton) {
467 mPopupTimer->start( 600 ); 467 mPopupTimer->start( 600 );
468 mLeftMouseDown = true; 468 mLeftMouseDown = true;
469 } 469 }
470 blockMoving = true; 470 blockMoving = true;
471 startX = viewportPos.x(); 471 startX = viewportPos.x();
472 startY = viewportPos.y(); 472 startY = viewportPos.y();
473 mPopupPos = me->globalPos(); 473 mPopupPos = me->globalPos();
474 if ( objIsNotViewport && !leftButt ) { 474 if ( objIsNotViewport && !leftButt ) {
475 KOAgendaItem * tempItem = (KOAgendaItem *)object; 475 KOAgendaItem * tempItem = (KOAgendaItem *)object;
476 if (mAllDayMode) { 476 if (mAllDayMode) {
477 if ( tempItem->height() > 10 ) { 477 if ( tempItem->height() > 10 ) {
478 int minV = tempItem->height()/4; 478 int minV = tempItem->height()/4;
479 if ( minV > (blockmoveDist/2)-2 ) 479 if ( minV > (blockmoveDist/2)-2 ) {
480 minV = (blockmoveDist/2)-2; 480 if ( minV > blockmoveDist )
481 minV = blockmoveDist;
482 else
483 minV = (blockmoveDist/2);
484 }
481 bool border = false; 485 bool border = false;
482 int diff = tempItem->y() - viewportPos.y(); 486 int diff = tempItem->y() - viewportPos.y();
483 if ( diff < 0 ) 487 if ( diff < 0 )
484 diff *= -1; 488 diff *= -1;
485 if ( diff < minV ) { 489 if ( diff < minV ) {
486 border = true; 490 border = true;
487 objIsNotViewport = false; 491 objIsNotViewport = false;
488 } 492 }
489 if ( ! border ) { 493 if ( ! border ) {
490 diff = tempItem->y() + tempItem->height()- viewportPos.y(); 494 diff = tempItem->y() + tempItem->height()- viewportPos.y();
491 if ( diff < 0 ) 495 if ( diff < 0 )
492 diff *= -1; 496 diff *= -1;
493 if ( diff < minV ) { 497 if ( diff < minV ) {
494 border = true; 498 border = true;
495 objIsNotViewport = false; 499 objIsNotViewport = false;
496 } 500 }
497 } 501 }
498 } 502 }
499 } else { // not allday 503 } else { // not allday
500 if ( tempItem->width() > 10 ) { 504 if ( tempItem->width() > 10 ) {
501 int minH = tempItem->width()/4; 505 int minH = tempItem->width()/4;
502 if ( minH > (blockmoveDist/2)-2 ) 506 if ( minH > (blockmoveDist/2)-2 ) {
503 minH = (blockmoveDist/2)-2; 507 if ( minH > blockmoveDist )
508 minH = blockmoveDist;
509 else
510 minH = (blockmoveDist/2);
511 }
504 bool border = false; 512 bool border = false;
505 int diff = tempItem->x() - viewportPos.x(); 513 int diff = tempItem->x() - viewportPos.x();
506 if ( diff < 0 ) 514 if ( diff < 0 )
507 diff *= -1; 515 diff *= -1;
508 if ( diff < minH ) { 516 if ( diff < minH ) {
509 border = true; 517 border = true;
510 objIsNotViewport = false; 518 objIsNotViewport = false;
511 } 519 }
512 if ( ! border ) { 520 if ( ! border ) {
513 diff = tempItem->x() + tempItem->width() - viewportPos.x(); 521 diff = tempItem->x() + tempItem->width() - viewportPos.x();
514 if ( diff < 0 ) 522 if ( diff < 0 )
515 diff *= -1; 523 diff *= -1;
516 if ( diff < minH ) { 524 if ( diff < minH ) {
517 border = true; 525 border = true;
518 objIsNotViewport = false; 526 objIsNotViewport = false;
519 } 527 }
520 } 528 }
521 } 529 }
522 } 530 }
523 } 531 }
524 if ( objIsNotViewport ) { 532 if ( objIsNotViewport ) {
525 mPopupItem = (KOAgendaItem *)object; 533 mPopupItem = (KOAgendaItem *)object;
526 mPopupKind = 1; 534 mPopupKind = 1;
527 if (me->button() == RightButton) { 535 if (me->button() == RightButton) {
528 mPopupKind = 3; 536 mPopupKind = 3;
529 popupMenu(); 537 popupMenu();
530 } else if (me->button() == LeftButton) { 538 } else if (me->button() == LeftButton) {
531 mActionItem = (KOAgendaItem *)object; 539 mActionItem = (KOAgendaItem *)object;
532 if (mActionItem) { 540 if (mActionItem) {
533 emit signalClearSelection(); 541 emit signalClearSelection();
534 slotClearSelection(); 542 slotClearSelection();
535 selectItem(mActionItem); 543 selectItem(mActionItem);
536 Incidence *incidence = mActionItem->incidence(); 544 Incidence *incidence = mActionItem->incidence();
537 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 545 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
538 mActionItem = 0; 546 mActionItem = 0;
539 } else { 547 } else {
540 startItemAction(viewportPos); 548 startItemAction(viewportPos);
541 } 549 }
542 } 550 }
543 } 551 }
544 } else { // ---------- viewport() 552 } else { // ---------- viewport()
545 mPopupItem = 0; 553 mPopupItem = 0;
546 mPopupKind = 2; 554 mPopupKind = 2;
547 selectItem(0); 555 selectItem(0);
548 mActionItem = 0; 556 mActionItem = 0;
549 if (me->button() == RightButton) { 557 if (me->button() == RightButton) {
550 int x,y; 558 int x,y;
551 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 559 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);