summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 99009a5..cdeeac5 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -404,25 +404,25 @@ void KOAgenda::popupMenu()
404 mNewItemPopup->popup( mPopupPos); 404 mNewItemPopup->popup( mPopupPos);
405 405
406 } 406 }
407 mLeftMouseDown = false; 407 mLeftMouseDown = false;
408 mPopupItem = 0; 408 mPopupItem = 0;
409 mPopupKind = 0; 409 mPopupKind = 0;
410} 410}
411 411
412bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 412bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
413{ 413{
414 static int startX = 0; 414 static int startX = 0;
415 static int startY = 0; 415 static int startY = 0;
416 static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); 416 int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 );
417 static bool blockMoving = true; 417 static bool blockMoving = true;
418 418
419 //qDebug("KOAgenda::eventFilter_mous "); 419 //qDebug("KOAgenda::eventFilter_mous ");
420 if ( object == mNewItemPopup ) { 420 if ( object == mNewItemPopup ) {
421 //qDebug("mNewItemPopup "); 421 //qDebug("mNewItemPopup ");
422 if ( me->type() == QEvent::MouseButtonRelease ) { 422 if ( me->type() == QEvent::MouseButtonRelease ) {
423 mNewItemPopup->removeEventFilter( this ); 423 mNewItemPopup->removeEventFilter( this );
424 int dX = me->globalPos().x() - mPopupPos.x();; 424 int dX = me->globalPos().x() - mPopupPos.x();;
425 if ( dX < 0 ) 425 if ( dX < 0 )
426 dX = -dX; 426 dX = -dX;
427 int dY = me->globalPos().y() - mPopupPos.y(); 427 int dY = me->globalPos().y() - mPopupPos.y();
428 if ( dY < 0 ) 428 if ( dY < 0 )
@@ -442,44 +442,45 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
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 viewportPos = ((QWidget *)object)->mapToParent(me->pos()); 455 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
455 } else { 456 } else {
456 viewportPos = me->pos(); 457 viewportPos = me->pos();
457 } 458 }
458 459
459 switch (me->type()) { 460 switch (me->type()) {
460 case QEvent::MouseButtonPress: 461 case QEvent::MouseButtonPress:
461 if (me->button() == LeftButton) { 462 if (me->button() == LeftButton) {
462 mPopupTimer->start( 600 ); 463 mPopupTimer->start( 600 );
463 mLeftMouseDown = true; 464 mLeftMouseDown = true;
464 } 465 }
465 blockMoving = true; 466 blockMoving = true;
466 startX = viewportPos.x(); 467 startX = viewportPos.x();
467 startY = viewportPos.y(); 468 startY = viewportPos.y();
468 mPopupPos = me->globalPos(); 469 mPopupPos = me->globalPos();
469 if (object != viewport()) { 470 if (object != viewport()) {
470 mPopupItem = (KOAgendaItem *)object; 471 mPopupItem = (KOAgendaItem *)object;
471 mPopupKind = 1; 472 mPopupKind = 1;
472 if (me->button() == RightButton) { 473 if (me->button() == RightButton) {
473 mPopupKind = 3; 474 mPopupKind = 3;
474 popupMenu(); 475 popupMenu();
475 } else if (me->button() == LeftButton) { 476 } else if (me->button() == LeftButton) {
476 mActionItem = (KOAgendaItem *)object; 477 mActionItem = (KOAgendaItem *)object;
477 if (mActionItem) { 478 if (mActionItem) {
478 emit signalClearSelection(); 479 emit signalClearSelection();
479 slotClearSelection(); 480 slotClearSelection();
480 selectItem(mActionItem); 481 selectItem(mActionItem);
481 Incidence *incidence = mActionItem->incidence(); 482 Incidence *incidence = mActionItem->incidence();
482 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 483 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
483 mActionItem = 0; 484 mActionItem = 0;
484 } else { 485 } else {
485 startItemAction(viewportPos); 486 startItemAction(viewportPos);
@@ -491,25 +492,25 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
491 mPopupKind = 2; 492 mPopupKind = 2;
492 selectItem(0); 493 selectItem(0);
493 mActionItem = 0; 494 mActionItem = 0;
494 if (me->button() == RightButton) { 495 if (me->button() == RightButton) {
495 int x,y; 496 int x,y;
496 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 497 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
497 int gx,gy; 498 int gx,gy;
498 contentsToGrid(x,y,gx,gy); 499 contentsToGrid(x,y,gx,gy);
499 mCurrentCellX = gx; 500 mCurrentCellX = gx;
500 mCurrentCellY = gy; 501 mCurrentCellY = gy;
501 mStartCellX = gx; 502 mStartCellX = gx;
502 mStartCellY = gy; 503 mStartCellY = gy;
503 mPopupKind = 4; 504 mPopupKind = 4;
504 popupMenu(); 505 popupMenu();
505 } else if (me->button() == LeftButton) { 506 } else if (me->button() == LeftButton) {
506 setCursor(arrowCursor); 507 setCursor(arrowCursor);
507 startSelectAction(viewportPos); 508 startSelectAction(viewportPos);
508 } 509 }
509 } 510 }
510 break; 511 break;
511 512
512 case QEvent::MouseButtonRelease: 513 case QEvent::MouseButtonRelease:
513 if (me->button() == LeftButton ) { 514 if (me->button() == LeftButton ) {
514 mPopupTimer->stop(); 515 mPopupTimer->stop();
515 } 516 }