author | zautrix <zautrix> | 2005-04-17 12:17:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 12:17:07 (UTC) |
commit | 2d81c75c4ffb8f144ae58e90e68496500d07a19e (patch) (unidiff) | |
tree | 1b27958fdc2948c1235579029188b1de78d7b820 /korganizer/koagenda.cpp | |
parent | f64384edcc1e3b3f7511480866b0900aa1ebdda6 (diff) | |
download | kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.zip kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.tar.gz kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.tar.bz2 |
fixx
-rw-r--r-- | korganizer/koagenda.cpp | 236 |
1 files changed, 21 insertions, 215 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 114ed75..355f4bb 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -453,57 +453,50 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
453 | if (object != viewport()) { | 453 | if (object != viewport()) { |
454 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 454 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
455 | } else { | 455 | } else { |
456 | viewportPos = me->pos(); | 456 | viewportPos = me->pos(); |
457 | } | 457 | } |
458 | 458 | ||
459 | switch (me->type()) { | 459 | switch (me->type()) { |
460 | case QEvent::MouseButtonPress: | 460 | case QEvent::MouseButtonPress: |
461 | if (me->button() == LeftButton) { | 461 | if (me->button() == LeftButton) { |
462 | mPopupTimer->start( 600 ); | 462 | mPopupTimer->start( 600 ); |
463 | mLeftMouseDown = true; | 463 | mLeftMouseDown = true; |
464 | } | 464 | } |
465 | blockMoving = true; | 465 | blockMoving = true; |
466 | startX = viewportPos.x(); | 466 | startX = viewportPos.x(); |
467 | startY = viewportPos.y(); | 467 | startY = viewportPos.y(); |
468 | mPopupPos = me->globalPos(); | 468 | mPopupPos = me->globalPos(); |
469 | if (object != viewport()) { | 469 | if (object != viewport()) { |
470 | mPopupItem = (KOAgendaItem *)object; | 470 | mPopupItem = (KOAgendaItem *)object; |
471 | mPopupKind = 1; | 471 | mPopupKind = 1; |
472 | if (me->button() == RightButton) { | 472 | if (me->button() == RightButton) { |
473 | popupMenu(); | 473 | popupMenu(); |
474 | } else if (me->button() == LeftButton) { | 474 | } else if (me->button() == LeftButton) { |
475 | mActionItem = (KOAgendaItem *)object; | 475 | mActionItem = (KOAgendaItem *)object; |
476 | if (mActionItem) { | 476 | if (mActionItem) { |
477 | if ( mSelectionHeight > 0 ) { | 477 | emit signalClearSelection(); |
478 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 478 | slotClearSelection(); |
479 | int selectionYTop = mSelectionYTop; | ||
480 | int gridSpacingX = mGridSpacingX; | ||
481 | int selectionHeight = mSelectionHeight; | ||
482 | clearSelection(); | ||
483 | repaintContents( selectionCellX, selectionYTop, | ||
484 | gridSpacingX, selectionHeight,false ); | ||
485 | } | ||
486 | selectItem(mActionItem); | 479 | selectItem(mActionItem); |
487 | Incidence *incidence = mActionItem->incidence(); | 480 | Incidence *incidence = mActionItem->incidence(); |
488 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 481 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
489 | mActionItem = 0; | 482 | mActionItem = 0; |
490 | } else { | 483 | } else { |
491 | startItemAction(viewportPos); | 484 | startItemAction(viewportPos); |
492 | } | 485 | } |
493 | } | 486 | } |
494 | } | 487 | } |
495 | } else { // ---------- viewport() | 488 | } else { // ---------- viewport() |
496 | mPopupItem = 0; | 489 | mPopupItem = 0; |
497 | mPopupKind = 2; | 490 | mPopupKind = 2; |
498 | selectItem(0); | 491 | selectItem(0); |
499 | mActionItem = 0; | 492 | mActionItem = 0; |
500 | if (me->button() == RightButton) { | 493 | if (me->button() == RightButton) { |
501 | int x,y; | 494 | int x,y; |
502 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 495 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
503 | int gx,gy; | 496 | int gx,gy; |
504 | contentsToGrid(x,y,gx,gy); | 497 | contentsToGrid(x,y,gx,gy); |
505 | mCurrentCellX = gx; | 498 | mCurrentCellX = gx; |
506 | mCurrentCellY = gy; | 499 | mCurrentCellY = gy; |
507 | mStartCellX = gx; | 500 | mStartCellX = gx; |
508 | mStartCellY = gy; | 501 | mStartCellY = gy; |
509 | popupMenu(); | 502 | popupMenu(); |
@@ -589,339 +582,162 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
589 | 582 | ||
590 | case QEvent::MouseButtonDblClick: | 583 | case QEvent::MouseButtonDblClick: |
591 | mPopupTimer->stop(); | 584 | mPopupTimer->stop(); |
592 | if (object == viewport()) { | 585 | if (object == viewport()) { |
593 | selectItem(0); | 586 | selectItem(0); |
594 | int x,y; | 587 | int x,y; |
595 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 588 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
596 | int gx,gy; | 589 | int gx,gy; |
597 | contentsToGrid(x,y,gx,gy); | 590 | contentsToGrid(x,y,gx,gy); |
598 | emit newEventSignal(gx,gy); | 591 | emit newEventSignal(gx,gy); |
599 | } else { | 592 | } else { |
600 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 593 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
601 | selectItem(doubleClickedItem); | 594 | selectItem(doubleClickedItem); |
602 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 595 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
603 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 596 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
604 | else | 597 | else |
605 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 598 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
606 | } | 599 | } |
607 | break; | 600 | break; |
608 | 601 | ||
609 | default: | 602 | default: |
610 | break; | 603 | break; |
611 | } | 604 | } |
612 | return true; | 605 | return true; |
613 | #if 0 | ||
614 | //qDebug("KOAgenda::eventFilter_mous "); | ||
615 | QPoint viewportPos; | ||
616 | if (object != viewport()) { | ||
617 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | ||
618 | } else { | ||
619 | viewportPos = me->pos(); | ||
620 | } | ||
621 | static int startX = 0; | ||
622 | static int startY = 0; | ||
623 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | ||
624 | static bool blockMoving = true; | ||
625 | static bool leftMouseDown = false; | ||
626 | bool rightButtonPressed = false; | ||
627 | switch (me->type()) { | ||
628 | case QEvent::MouseButtonPress: | ||
629 | if (me->button() == LeftButton) { | ||
630 | leftMouseDown = true; | ||
631 | } | ||
632 | else if (me->button() == RightButton) { | ||
633 | leftMouseDown = false; | ||
634 | } | ||
635 | blockMoving = true; | ||
636 | startX = viewportPos.x(); | ||
637 | startY = viewportPos.y(); | ||
638 | if (object != viewport()) { // item clicked ************** | ||
639 | if (me->button() == RightButton) { | ||
640 | leftMouseDown = false; | ||
641 | mClickedItem = (KOAgendaItem *)object; | ||
642 | if (mActionItem ) { | ||
643 | endItemAction(); | ||
644 | } | ||
645 | if (mClickedItem) { | ||
646 | selectItem(mClickedItem); | ||
647 | emit showIncidencePopupSignal(mClickedItem->incidence()); | ||
648 | } | ||
649 | return true; | ||
650 | } else if (me->button() == LeftButton) { | ||
651 | mActionItem = (KOAgendaItem *)object; | ||
652 | if (mActionItem) { | ||
653 | if ( mSelectionHeight > 0 ) { | ||
654 | int selectionCellX = mSelectionCellX * mGridSpacingX; | ||
655 | int selectionYTop = mSelectionYTop; | ||
656 | int gridSpacingX = mGridSpacingX; | ||
657 | int selectionHeight = mSelectionHeight; | ||
658 | clearSelection(); | ||
659 | repaintContents( selectionCellX, selectionYTop, | ||
660 | gridSpacingX, selectionHeight,false ); | ||
661 | } | ||
662 | selectItem(mActionItem); | ||
663 | Incidence *incidence = mActionItem->incidence(); | ||
664 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | ||
665 | mActionItem = 0; | ||
666 | } else { | ||
667 | startItemAction(viewportPos); | ||
668 | } | ||
669 | } | ||
670 | } | ||
671 | } else { // ---------- viewport() | ||
672 | selectItem(0); | ||
673 | mActionItem = 0; | ||
674 | if (me->button() == LeftButton ) { | ||
675 | setCursor(arrowCursor); | ||
676 | startSelectAction(viewportPos); | ||
677 | } else if (me->button() == RightButton ) { | ||
678 | setCursor(arrowCursor); | ||
679 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action | ||
680 | endSelectAction( false ); // do not emit new event signal | ||
681 | leftMouseDown = false; // no more leftMouse computation | ||
682 | } | ||
683 | int x,y; | ||
684 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
685 | int gx,gy; | ||
686 | contentsToGrid(x,y,gx,gy); | ||
687 | mCurrentCellX = gx; | ||
688 | mCurrentCellY = gy; | ||
689 | mStartCellX = gx; | ||
690 | mStartCellY = gy; | ||
691 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | ||
692 | } | ||
693 | } | ||
694 | break; | ||
695 | |||
696 | case QEvent::MouseButtonRelease: | ||
697 | 606 | ||
698 | if (object != viewport()) { | ||
699 | if (me->button() == LeftButton && leftMouseDown) { | ||
700 | if (mActionItem) { | ||
701 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | ||
702 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | ||
703 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | ||
704 | mScrollUpTimer.stop(); | ||
705 | mScrollDownTimer.stop(); | ||
706 | mActionItem->resetMove(); | ||
707 | placeSubCells( mActionItem ); | ||
708 | // emit startDragSignal( mActionItem->incidence() ); | ||
709 | setCursor( arrowCursor ); | ||
710 | mActionItem = 0; | ||
711 | mActionType = NOP; | ||
712 | mItemMoved = 0; | ||
713 | leftMouseDown = false; | ||
714 | return true; | ||
715 | } | ||
716 | endItemAction(); | ||
717 | } | ||
718 | } | ||
719 | |||
720 | } else { // ---------- viewport() | ||
721 | if (me->button() == LeftButton && leftMouseDown ) { //left click | ||
722 | endSelectAction( true ); // emit new event signal | ||
723 | } | ||
724 | } | ||
725 | if (me->button() == LeftButton) | ||
726 | leftMouseDown = false; | ||
727 | |||
728 | break; | ||
729 | |||
730 | case QEvent::MouseMove: | ||
731 | if ( !leftMouseDown ) | ||
732 | return true; | ||
733 | if ( blockMoving ) { | ||
734 | int dX, dY; | ||
735 | dX = startX - viewportPos.x(); | ||
736 | if ( dX < 0 ) | ||
737 | dX = -dX; | ||
738 | dY = viewportPos.y() - startY; | ||
739 | if ( dY < 0 ) | ||
740 | dY = -dY; | ||
741 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | ||
742 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | ||
743 | blockMoving = false; | ||
744 | } | ||
745 | } | ||
746 | if (object != viewport()) { | ||
747 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | ||
748 | if (!moveItem->incidence()->isReadOnly() ) { | ||
749 | if (!mActionItem) | ||
750 | setNoActionCursor(moveItem,viewportPos); | ||
751 | else { | ||
752 | if ( !blockMoving ) | ||
753 | performItemAction(viewportPos); | ||
754 | } | ||
755 | } | ||
756 | } else { // ---------- viewport() | ||
757 | if ( mActionType == SELECT ) { | ||
758 | performSelectAction( viewportPos ); | ||
759 | } | ||
760 | } | ||
761 | break; | ||
762 | |||
763 | case QEvent::MouseButtonDblClick: | ||
764 | blockMoving = false; | ||
765 | leftMouseDown = false; | ||
766 | if (object == viewport()) { | ||
767 | selectItem(0); | ||
768 | int x,y; | ||
769 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
770 | int gx,gy; | ||
771 | contentsToGrid(x,y,gx,gy); | ||
772 | emit newEventSignal(gx,gy); | ||
773 | } else { | ||
774 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | ||
775 | selectItem(doubleClickedItem); | ||
776 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | ||
777 | emit editIncidenceSignal(doubleClickedItem->incidence()); | ||
778 | else | ||
779 | emit showIncidenceSignal(doubleClickedItem->incidence()); | ||
780 | } | ||
781 | break; | ||
782 | |||
783 | default: | ||
784 | break; | ||
785 | } | ||
786 | return true; | ||
787 | #endif | ||
788 | } | 607 | } |
789 | 608 | ||
790 | void KOAgenda::newItem( int item ) | 609 | void KOAgenda::newItem( int item ) |
791 | { | 610 | { |
792 | if ( item == 1 ) { //new event | 611 | if ( item == 1 ) { //new event |
793 | newEventSignal(mStartCellX ,mStartCellY ); | 612 | newEventSignal(mStartCellX ,mStartCellY ); |
794 | } else | 613 | } else |
795 | if ( item == 2 ) { //new event | 614 | if ( item == 2 ) { //new event |
796 | newTodoSignal(mStartCellX ,mStartCellY ); | 615 | newTodoSignal(mStartCellX ,mStartCellY ); |
797 | } else | 616 | } else |
798 | { | 617 | { |
799 | emit showDateView( item, mStartCellX ); | 618 | emit showDateView( item, mStartCellX ); |
800 | // 3Day view | 619 | // 3Day view |
801 | // 4Week view | 620 | // 4Week view |
802 | // 5Month view | 621 | // 5Month view |
803 | // 6Journal view | 622 | // 6Journal view |
804 | } | 623 | } |
805 | } | 624 | } |
625 | void KOAgenda::slotClearSelection() | ||
626 | { | ||
627 | if (mSelectionHeight) { | ||
628 | int selectionX = mSelectionCellX * mGridSpacingX; | ||
629 | int top = mSelectionYTop - 2 *mGridSpacingY; | ||
630 | int hei = mSelectionHeight + 4 *mGridSpacingY; | ||
631 | clearSelection(); | ||
632 | repaintContents( selectionX, top, | ||
633 | mGridSpacingX, hei ,false ); | ||
634 | } | ||
635 | |||
636 | } | ||
806 | void KOAgenda::startSelectAction(QPoint viewportPos) | 637 | void KOAgenda::startSelectAction(QPoint viewportPos) |
807 | { | 638 | { |
808 | //emit newStartSelectSignal(); | 639 | |
640 | emit signalClearSelection(); | ||
641 | slotClearSelection(); | ||
809 | 642 | ||
810 | mActionType = SELECT; | 643 | mActionType = SELECT; |
811 | 644 | ||
812 | int x,y; | 645 | int x,y; |
813 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 646 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
814 | int gx,gy; | 647 | int gx,gy; |
815 | contentsToGrid(x,y,gx,gy); | 648 | contentsToGrid(x,y,gx,gy); |
816 | 649 | ||
817 | mStartCellX = gx; | 650 | mStartCellX = gx; |
818 | mStartCellY = gy; | 651 | mStartCellY = gy; |
819 | mCurrentCellX = gx; | 652 | mCurrentCellX = gx; |
820 | mCurrentCellY = gy; | 653 | mCurrentCellY = gy; |
821 | 654 | ||
822 | // Store coordinates of old selection | ||
823 | int selectionX = mSelectionCellX * mGridSpacingX; | ||
824 | int selectionYTop = mSelectionYTop; | ||
825 | int selectionHeight = mSelectionHeight; | ||
826 | |||
827 | // Store new selection | 655 | // Store new selection |
828 | mSelectionCellX = gx; | 656 | mSelectionCellX = gx; |
829 | mSelectionYTop = gy * mGridSpacingY; | 657 | mSelectionYTop = gy * mGridSpacingY; |
830 | mSelectionHeight = mGridSpacingY; | 658 | mSelectionHeight = mGridSpacingY; |
831 | 659 | ||
832 | // Clear old selection | ||
833 | repaintContents( selectionX, selectionYTop, | ||
834 | mGridSpacingX, selectionHeight,false ); | ||
835 | |||
836 | // Paint new selection | 660 | // Paint new selection |
837 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, | 661 | repaintContents( mSelectionCellX * mGridSpacingX+1, mSelectionYTop, |
838 | // mGridSpacingX, mSelectionHeight ); | 662 | mGridSpacingX-1, mSelectionHeight ); |
839 | } | 663 | } |
840 | 664 | ||
841 | void KOAgenda::performSelectAction(QPoint viewportPos) | 665 | void KOAgenda::performSelectAction(QPoint viewportPos) |
842 | { | 666 | { |
843 | int x,y; | 667 | int x,y; |
844 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 668 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
845 | int gx,gy; | 669 | int gx,gy; |
846 | contentsToGrid(x,y,gx,gy); | 670 | contentsToGrid(x,y,gx,gy); |
847 | 671 | ||
848 | QPoint clipperPos = clipper()-> | 672 | QPoint clipperPos = clipper()-> |
849 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 673 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
850 | 674 | ||
851 | // Scroll if cursor was moved to upper or lower end of agenda. | 675 | // Scroll if cursor was moved to upper or lower end of agenda. |
852 | if (clipperPos.y() < mScrollBorderWidth) { | 676 | if (clipperPos.y() < mScrollBorderWidth) { |
853 | mScrollUpTimer.start(mScrollDelay); | 677 | mScrollUpTimer.start(mScrollDelay); |
854 | } else if (visibleHeight() - clipperPos.y() < | 678 | } else if (visibleHeight() - clipperPos.y() < |
855 | mScrollBorderWidth) { | 679 | mScrollBorderWidth) { |
856 | mScrollDownTimer.start(mScrollDelay); | 680 | mScrollDownTimer.start(mScrollDelay); |
857 | } else { | 681 | } else { |
858 | mScrollUpTimer.stop(); | 682 | mScrollUpTimer.stop(); |
859 | mScrollDownTimer.stop(); | 683 | mScrollDownTimer.stop(); |
860 | } | 684 | } |
861 | 685 | ||
862 | if ( gy > mCurrentCellY ) { | 686 | if ( gy > mCurrentCellY ) { |
863 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 687 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
864 | 688 | ||
865 | #if 0 | 689 | |
866 | // FIXME: Repaint only the newly selected region | ||
867 | repaintContents( mSelectionCellX * mGridSpacingX, | ||
868 | mCurrentCellY + mGridSpacingY, | ||
869 | mGridSpacingX, | ||
870 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); | ||
871 | #else | ||
872 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 690 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
873 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 691 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
874 | mGridSpacingX, mSelectionYTop, | 692 | mGridSpacingX, mSelectionYTop, |
875 | mGridSpacingX, mSelectionHeight , false); | 693 | mGridSpacingX, mSelectionHeight , false); |
876 | #endif | ||
877 | 694 | ||
878 | mCurrentCellY = gy; | 695 | mCurrentCellY = gy; |
879 | } else if ( gy < mCurrentCellY ) { | 696 | } else if ( gy < mCurrentCellY ) { |
880 | if ( gy >= mStartCellY ) { | 697 | if ( gy >= mStartCellY ) { |
881 | int selectionHeight = mSelectionHeight; | 698 | int selectionHeight = mSelectionHeight; |
882 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 699 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
883 | 700 | ||
884 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 701 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
885 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 702 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
886 | mGridSpacingX, mSelectionYTop, | 703 | mGridSpacingX, mSelectionYTop, |
887 | mGridSpacingX, selectionHeight,false ); | 704 | mGridSpacingX, selectionHeight,false ); |
888 | 705 | ||
889 | mCurrentCellY = gy; | 706 | mCurrentCellY = gy; |
890 | } else { | 707 | } else { |
891 | } | 708 | } |
892 | } | 709 | } |
893 | } | 710 | } |
894 | 711 | ||
895 | void KOAgenda::endSelectAction( bool emitNewEvent ) | 712 | void KOAgenda::endSelectAction( bool emitNewEvent ) |
896 | { | 713 | { |
897 | mActionType = NOP; | 714 | mActionType = NOP; |
898 | mScrollUpTimer.stop(); | 715 | mScrollUpTimer.stop(); |
899 | mScrollDownTimer.stop(); | 716 | mScrollDownTimer.stop(); |
900 | 717 | ||
901 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 718 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
902 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { | 719 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { |
903 | qDebug("ew event signal "); | ||
904 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 720 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
905 | } | 721 | } |
906 | } | 722 | } |
907 | 723 | ||
908 | void KOAgenda::startItemAction(QPoint viewportPos) | 724 | void KOAgenda::startItemAction(QPoint viewportPos) |
909 | { | 725 | { |
910 | int x,y; | 726 | int x,y; |
911 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 727 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
912 | int gx,gy; | 728 | int gx,gy; |
913 | contentsToGrid(x,y,gx,gy); | 729 | contentsToGrid(x,y,gx,gy); |
914 | 730 | ||
915 | mStartCellX = gx; | 731 | mStartCellX = gx; |
916 | mStartCellY = gy; | 732 | mStartCellY = gy; |
917 | mCurrentCellX = gx; | 733 | mCurrentCellX = gx; |
918 | mCurrentCellY = gy; | 734 | mCurrentCellY = gy; |
919 | 735 | ||
920 | if (mAllDayMode) { | 736 | if (mAllDayMode) { |
921 | int gridDistanceX = (x - gx * mGridSpacingX); | 737 | int gridDistanceX = (x - gx * mGridSpacingX); |
922 | if (gridDistanceX < mResizeBorderWidth && | 738 | if (gridDistanceX < mResizeBorderWidth && |
923 | mActionItem->cellX() == mCurrentCellX) { | 739 | mActionItem->cellX() == mCurrentCellX) { |
924 | mActionType = RESIZELEFT; | 740 | mActionType = RESIZELEFT; |
925 | setCursor(sizeHorCursor); | 741 | setCursor(sizeHorCursor); |
926 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 742 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
927 | mActionItem->cellXWidth() == mCurrentCellX) { | 743 | mActionItem->cellXWidth() == mCurrentCellX) { |
@@ -1079,59 +895,49 @@ void KOAgenda::endItemAction() | |||
1079 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 895 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
1080 | if ( !placeItem ) { | 896 | if ( !placeItem ) { |
1081 | placeItem = mActionItem; | 897 | placeItem = mActionItem; |
1082 | } | 898 | } |
1083 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 899 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { |
1084 | Incidence* oldInc = placeItem->incidence(); | 900 | Incidence* oldInc = placeItem->incidence(); |
1085 | placeItem->recreateIncidence(); | 901 | placeItem->recreateIncidence(); |
1086 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 902 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
1087 | } | 903 | } |
1088 | int type = mActionType; | 904 | int type = mActionType; |
1089 | if ( mAllDayMode ) | 905 | if ( mAllDayMode ) |
1090 | type = -1; | 906 | type = -1; |
1091 | KOAgendaItem *modifiedItem = placeItem; | 907 | KOAgendaItem *modifiedItem = placeItem; |
1092 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 908 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
1093 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 909 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
1094 | KOAgendaItem *item; | 910 | KOAgendaItem *item; |
1095 | 911 | ||
1096 | if ( placeItem->incidence()->type() == "Todo" ) { | 912 | if ( placeItem->incidence()->type() == "Todo" ) { |
1097 | mSelectedItem = 0; | 913 | mSelectedItem = 0; |
1098 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 914 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
1099 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 915 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
1100 | emit itemModified( modifiedItem, mActionType ); | 916 | emit itemModified( modifiedItem, mActionType ); |
1101 | } | 917 | } |
1102 | else { | 918 | else { |
1103 | #if 0 | 919 | |
1104 | for ( item=oldconflictItems.first(); item != 0; | ||
1105 | item=oldconflictItems.next() ) { | ||
1106 | placeSubCells(item); | ||
1107 | } | ||
1108 | while ( placeItem ) { | ||
1109 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | ||
1110 | placeSubCells( placeItem ); | ||
1111 | placeItem = placeItem->nextMultiItem(); | ||
1112 | } | ||
1113 | #endif | ||
1114 | 920 | ||
1115 | globalFlagBlockAgendaItemPaint = 1; | 921 | globalFlagBlockAgendaItemPaint = 1; |
1116 | for ( item=oldconflictItems.first(); item != 0; | 922 | for ( item=oldconflictItems.first(); item != 0; |
1117 | item=oldconflictItems.next() ) { | 923 | item=oldconflictItems.next() ) { |
1118 | placeSubCells(item); | 924 | placeSubCells(item); |
1119 | } | 925 | } |
1120 | while ( placeItem ) { | 926 | while ( placeItem ) { |
1121 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 927 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1122 | oldconflictItems = placeItem->conflictItems(); | 928 | oldconflictItems = placeItem->conflictItems(); |
1123 | for ( item=oldconflictItems.first(); item != 0; | 929 | for ( item=oldconflictItems.first(); item != 0; |
1124 | item=oldconflictItems.next() ) { | 930 | item=oldconflictItems.next() ) { |
1125 | placeSubCells(item); | 931 | placeSubCells(item); |
1126 | } | 932 | } |
1127 | placeSubCells( placeItem ); | 933 | placeSubCells( placeItem ); |
1128 | placeItem = placeItem->nextMultiItem(); | 934 | placeItem = placeItem->nextMultiItem(); |
1129 | } | 935 | } |
1130 | globalFlagBlockAgendaItemPaint = 0; | 936 | globalFlagBlockAgendaItemPaint = 0; |
1131 | for ( item=oldconflictItems.first(); item != 0; | 937 | for ( item=oldconflictItems.first(); item != 0; |
1132 | item=oldconflictItems.next() ) { | 938 | item=oldconflictItems.next() ) { |
1133 | globalFlagBlockAgendaItemUpdate = 0; | 939 | globalFlagBlockAgendaItemUpdate = 0; |
1134 | item->repaintMe(); | 940 | item->repaintMe(); |
1135 | globalFlagBlockAgendaItemUpdate = 1; | 941 | globalFlagBlockAgendaItemUpdate = 1; |
1136 | item->repaint( false ); | 942 | item->repaint( false ); |
1137 | } | 943 | } |