-rw-r--r-- | korganizer/koagenda.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 5420822..2820ca2 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -503,96 +503,99 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
503 | mStartCellY = gy; | 503 | mStartCellY = gy; |
504 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | 504 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | else if (me->button() == LeftButton && leftMouseDown ) { //left click | 507 | else if (me->button() == LeftButton && leftMouseDown ) { //left click |
508 | endSelectAction( true ); // emit new event signal | 508 | endSelectAction( true ); // emit new event signal |
509 | } | 509 | } |
510 | } | 510 | } |
511 | if (me->button() == LeftButton) | 511 | if (me->button() == LeftButton) |
512 | leftMouseDown = false; | 512 | leftMouseDown = false; |
513 | else if (me->button() == RightButton) | 513 | else if (me->button() == RightButton) |
514 | rightMouseDown = false; | 514 | rightMouseDown = false; |
515 | break; | 515 | break; |
516 | 516 | ||
517 | case QEvent::MouseMove: | 517 | case QEvent::MouseMove: |
518 | if ( !rightMouseDown && !leftMouseDown ) | 518 | if ( !rightMouseDown && !leftMouseDown ) |
519 | return true; | 519 | return true; |
520 | if ( blockMoving ) { | 520 | if ( blockMoving ) { |
521 | int dX, dY; | 521 | int dX, dY; |
522 | dX = startX - viewportPos.x(); | 522 | dX = startX - viewportPos.x(); |
523 | if ( dX < 0 ) | 523 | if ( dX < 0 ) |
524 | dX = -dX; | 524 | dX = -dX; |
525 | dY = viewportPos.y() - startY; | 525 | dY = viewportPos.y() - startY; |
526 | if ( dY < 0 ) | 526 | if ( dY < 0 ) |
527 | dY = -dY; | 527 | dY = -dY; |
528 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 528 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
529 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 529 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
530 | blockMoving = false; | 530 | blockMoving = false; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | if (object != viewport()) { | 533 | if (object != viewport()) { |
534 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 534 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
535 | if (!moveItem->incidence()->isReadOnly() ) { | 535 | if (!moveItem->incidence()->isReadOnly() ) { |
536 | if (!mActionItem) | 536 | if (!mActionItem) |
537 | setNoActionCursor(moveItem,viewportPos); | 537 | setNoActionCursor(moveItem,viewportPos); |
538 | else { | 538 | else { |
539 | if ( !blockMoving ) | 539 | if ( !blockMoving ) |
540 | performItemAction(viewportPos); | 540 | performItemAction(viewportPos); |
541 | } | 541 | } |
542 | } | 542 | } |
543 | } else { // ---------- viewport() | 543 | } else { // ---------- viewport() |
544 | if ( mActionType == SELECT ) { | 544 | if ( mActionType == SELECT ) { |
545 | performSelectAction( viewportPos ); | 545 | performSelectAction( viewportPos ); |
546 | } | 546 | } |
547 | } | 547 | } |
548 | break; | 548 | break; |
549 | 549 | ||
550 | case QEvent::MouseButtonDblClick: | 550 | case QEvent::MouseButtonDblClick: |
551 | blockMoving = false; | ||
552 | leftMouseDown = false; | ||
553 | rightMouseDown = false; | ||
551 | if (object == viewport()) { | 554 | if (object == viewport()) { |
552 | selectItem(0); | 555 | selectItem(0); |
553 | int x,y; | 556 | int x,y; |
554 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 557 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
555 | int gx,gy; | 558 | int gx,gy; |
556 | contentsToGrid(x,y,gx,gy); | 559 | contentsToGrid(x,y,gx,gy); |
557 | emit newEventSignal(gx,gy); | 560 | emit newEventSignal(gx,gy); |
558 | } else { | 561 | } else { |
559 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 562 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
560 | selectItem(doubleClickedItem); | 563 | selectItem(doubleClickedItem); |
561 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 564 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
562 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 565 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
563 | else | 566 | else |
564 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 567 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
565 | } | 568 | } |
566 | break; | 569 | break; |
567 | 570 | ||
568 | default: | 571 | default: |
569 | break; | 572 | break; |
570 | } | 573 | } |
571 | return true; | 574 | return true; |
572 | } | 575 | } |
573 | 576 | ||
574 | void KOAgenda::newItem( int item ) | 577 | void KOAgenda::newItem( int item ) |
575 | { | 578 | { |
576 | if ( item == 1 ) { //new event | 579 | if ( item == 1 ) { //new event |
577 | newEventSignal(mStartCellX ,mStartCellY ); | 580 | newEventSignal(mStartCellX ,mStartCellY ); |
578 | } else | 581 | } else |
579 | if ( item == 2 ) { //new event | 582 | if ( item == 2 ) { //new event |
580 | newTodoSignal(mStartCellX ,mStartCellY ); | 583 | newTodoSignal(mStartCellX ,mStartCellY ); |
581 | } else | 584 | } else |
582 | { | 585 | { |
583 | QDate day = mSelectedDates[mStartCellX]; | 586 | QDate day = mSelectedDates[mStartCellX]; |
584 | emit showDateView( item, day ); | 587 | emit showDateView( item, day ); |
585 | // 3Day view | 588 | // 3Day view |
586 | // 4Week view | 589 | // 4Week view |
587 | // 5Month view | 590 | // 5Month view |
588 | // 6Journal view | 591 | // 6Journal view |
589 | } | 592 | } |
590 | } | 593 | } |
591 | void KOAgenda::startSelectAction(QPoint viewportPos) | 594 | void KOAgenda::startSelectAction(QPoint viewportPos) |
592 | { | 595 | { |
593 | //emit newStartSelectSignal(); | 596 | //emit newStartSelectSignal(); |
594 | 597 | ||
595 | mActionType = SELECT; | 598 | mActionType = SELECT; |
596 | 599 | ||
597 | int x,y; | 600 | int x,y; |
598 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 601 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |