-rw-r--r-- | korganizer/koagenda.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 2a2acb1..fc213d8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -708,97 +708,97 @@ void KOAgenda::performSelectAction(QPoint viewportPos) | |||
708 | 708 | ||
709 | mCurrentCellY = gy; | 709 | mCurrentCellY = gy; |
710 | } else { | 710 | } else { |
711 | } | 711 | } |
712 | } | 712 | } |
713 | } | 713 | } |
714 | 714 | ||
715 | void KOAgenda::endSelectAction( bool emitNewEvent ) | 715 | void KOAgenda::endSelectAction( bool emitNewEvent ) |
716 | { | 716 | { |
717 | mActionType = NOP; | 717 | mActionType = NOP; |
718 | mScrollUpTimer.stop(); | 718 | mScrollUpTimer.stop(); |
719 | mScrollDownTimer.stop(); | 719 | mScrollDownTimer.stop(); |
720 | 720 | ||
721 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 721 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
722 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { | 722 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { |
723 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 723 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
724 | } | 724 | } |
725 | } | 725 | } |
726 | 726 | ||
727 | void KOAgenda::startItemAction(QPoint viewportPos) | 727 | void KOAgenda::startItemAction(QPoint viewportPos) |
728 | { | 728 | { |
729 | int x,y; | 729 | int x,y; |
730 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 730 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
731 | int gx,gy; | 731 | int gx,gy; |
732 | contentsToGrid(x,y,gx,gy); | 732 | contentsToGrid(x,y,gx,gy); |
733 | 733 | ||
734 | mStartCellX = gx; | 734 | mStartCellX = gx; |
735 | mStartCellY = gy; | 735 | mStartCellY = gy; |
736 | mCurrentCellX = gx; | 736 | mCurrentCellX = gx; |
737 | mCurrentCellY = gy; | 737 | mCurrentCellY = gy; |
738 | 738 | ||
739 | if (mAllDayMode) { | 739 | if (mAllDayMode) { |
740 | int gridDistanceX = (x - gx * mGridSpacingX); | 740 | int gridDistanceX = (x - gx * mGridSpacingX); |
741 | if (gridDistanceX < mResizeBorderWidth && | 741 | if (gridDistanceX < mResizeBorderWidth && |
742 | mActionItem->cellX() == mCurrentCellX) { | 742 | mActionItem->cellX() == mCurrentCellX) { |
743 | mActionType = RESIZELEFT; | 743 | mActionType = RESIZELEFT; |
744 | setCursor(sizeHorCursor); | 744 | setCursor(sizeHorCursor); |
745 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 745 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
746 | mActionItem->cellXWidth() == mCurrentCellX) { | 746 | mActionItem->cellXWidth() == mCurrentCellX) { |
747 | mActionType = RESIZERIGHT; | 747 | mActionType = RESIZERIGHT; |
748 | setCursor(sizeHorCursor); | 748 | setCursor(sizeHorCursor); |
749 | } else { | 749 | } else { |
750 | mActionType = MOVE; | 750 | mActionType = MOVE; |
751 | mActionItem->startMove(); | 751 | mActionItem->startMove(); |
752 | setCursor(sizeAllCursor); | 752 | setCursor(sizeAllCursor); |
753 | } | 753 | } |
754 | } else { | 754 | } else { |
755 | int gridDistanceY = (y - gy * mGridSpacingY); | 755 | int gridDistanceY = (y - gy * mGridSpacingY); |
756 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); | 756 | bool allowResize = ( mActionItem->incidence()->typeID() != todoID ); |
757 | if (allowResize && gridDistanceY < mResizeBorderWidth && | 757 | if (allowResize && gridDistanceY < mResizeBorderWidth && |
758 | mActionItem->cellYTop() == mCurrentCellY && | 758 | mActionItem->cellYTop() == mCurrentCellY && |
759 | !mActionItem->firstMultiItem()) { | 759 | !mActionItem->firstMultiItem()) { |
760 | mActionType = RESIZETOP; | 760 | mActionType = RESIZETOP; |
761 | setCursor(sizeVerCursor); | 761 | setCursor(sizeVerCursor); |
762 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 762 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
763 | mActionItem->cellYBottom() == mCurrentCellY && | 763 | mActionItem->cellYBottom() == mCurrentCellY && |
764 | !mActionItem->lastMultiItem()) { | 764 | !mActionItem->lastMultiItem()) { |
765 | mActionType = RESIZEBOTTOM; | 765 | mActionType = RESIZEBOTTOM; |
766 | setCursor(sizeVerCursor); | 766 | setCursor(sizeVerCursor); |
767 | } else { | 767 | } else { |
768 | mActionType = MOVE; | 768 | mActionType = MOVE; |
769 | mActionItem->startMove(); | 769 | mActionItem->startMove(); |
770 | setCursor(sizeAllCursor); | 770 | setCursor(sizeAllCursor); |
771 | } | 771 | } |
772 | } | 772 | } |
773 | } | 773 | } |
774 | 774 | ||
775 | void KOAgenda::performItemAction(QPoint viewportPos) | 775 | void KOAgenda::performItemAction(QPoint viewportPos) |
776 | { | 776 | { |
777 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 777 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
778 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 778 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
779 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 779 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
780 | // point = clipper()->mapFromGlobal(point); | 780 | // point = clipper()->mapFromGlobal(point); |
781 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 781 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
782 | // kdDebug() << "visible height: " << visibleHeight() << endl; | 782 | // kdDebug() << "visible height: " << visibleHeight() << endl; |
783 | int x,y; | 783 | int x,y; |
784 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 784 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
785 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 785 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
786 | int gx,gy; | 786 | int gx,gy; |
787 | contentsToGrid(x,y,gx,gy); | 787 | contentsToGrid(x,y,gx,gy); |
788 | QPoint clipperPos = clipper()-> | 788 | QPoint clipperPos = clipper()-> |
789 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 789 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
790 | 790 | ||
791 | // Cursor left active agenda area. | 791 | // Cursor left active agenda area. |
792 | // This starts a drag. | 792 | // This starts a drag. |
793 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ | 793 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ |
794 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { | 794 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { |
795 | if ( mActionType == MOVE ) { | 795 | if ( mActionType == MOVE ) { |
796 | mScrollUpTimer.stop(); | 796 | mScrollUpTimer.stop(); |
797 | mScrollDownTimer.stop(); | 797 | mScrollDownTimer.stop(); |
798 | mActionItem->resetMove(); | 798 | mActionItem->resetMove(); |
799 | placeSubCells( mActionItem ); | 799 | placeSubCells( mActionItem ); |
800 | // emit startDragSignal( mActionItem->incidence() ); | 800 | // emit startDragSignal( mActionItem->incidence() ); |
801 | setCursor( arrowCursor ); | 801 | setCursor( arrowCursor ); |
802 | mActionItem = 0; | 802 | mActionItem = 0; |
803 | mActionType = NOP; | 803 | mActionType = NOP; |
804 | mItemMoved = 0; | 804 | mItemMoved = 0; |
@@ -867,97 +867,97 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
867 | } else if (mActionType == RESIZEBOTTOM) { | 867 | } else if (mActionType == RESIZEBOTTOM) { |
868 | if (mCurrentCellY >= mActionItem->cellYTop()) { | 868 | if (mCurrentCellY >= mActionItem->cellYTop()) { |
869 | mActionItem->expandBottom(gy - mCurrentCellY); | 869 | mActionItem->expandBottom(gy - mCurrentCellY); |
870 | mActionItem->resize(mActionItem->width(), | 870 | mActionItem->resize(mActionItem->width(), |
871 | mGridSpacingY * mActionItem->cellHeight()); | 871 | mGridSpacingY * mActionItem->cellHeight()); |
872 | } | 872 | } |
873 | } else if (mActionType == RESIZELEFT) { | 873 | } else if (mActionType == RESIZELEFT) { |
874 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 874 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
875 | mActionItem->expandLeft(gx - mCurrentCellX); | 875 | mActionItem->expandLeft(gx - mCurrentCellX); |
876 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 876 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
877 | mActionItem->height()); | 877 | mActionItem->height()); |
878 | int x,y; | 878 | int x,y; |
879 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 879 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
880 | moveChild(mActionItem,x,childY(mActionItem)); | 880 | moveChild(mActionItem,x,childY(mActionItem)); |
881 | } | 881 | } |
882 | } else if (mActionType == RESIZERIGHT) { | 882 | } else if (mActionType == RESIZERIGHT) { |
883 | if (mCurrentCellX >= mActionItem->cellX()) { | 883 | if (mCurrentCellX >= mActionItem->cellX()) { |
884 | mActionItem->expandRight(gx - mCurrentCellX); | 884 | mActionItem->expandRight(gx - mCurrentCellX); |
885 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 885 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
886 | mActionItem->height()); | 886 | mActionItem->height()); |
887 | } | 887 | } |
888 | } | 888 | } |
889 | mCurrentCellX = gx; | 889 | mCurrentCellX = gx; |
890 | mCurrentCellY = gy; | 890 | mCurrentCellY = gy; |
891 | } | 891 | } |
892 | } | 892 | } |
893 | 893 | ||
894 | void KOAgenda::endItemAction() | 894 | void KOAgenda::endItemAction() |
895 | { | 895 | { |
896 | 896 | ||
897 | if ( mItemMoved ) { | 897 | if ( mItemMoved ) { |
898 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 898 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
899 | if ( !placeItem ) { | 899 | if ( !placeItem ) { |
900 | placeItem = mActionItem; | 900 | placeItem = mActionItem; |
901 | } | 901 | } |
902 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 902 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { |
903 | Incidence* oldInc = placeItem->incidence(); | 903 | Incidence* oldInc = placeItem->incidence(); |
904 | placeItem->recreateIncidence(); | 904 | placeItem->recreateIncidence(); |
905 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 905 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
906 | } | 906 | } |
907 | int type = mActionType; | 907 | int type = mActionType; |
908 | if ( mAllDayMode ) | 908 | if ( mAllDayMode ) |
909 | type = -1; | 909 | type = -1; |
910 | KOAgendaItem *modifiedItem = placeItem; | 910 | KOAgendaItem *modifiedItem = placeItem; |
911 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 911 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
912 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 912 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
913 | KOAgendaItem *item; | 913 | KOAgendaItem *item; |
914 | 914 | ||
915 | if ( placeItem->incidence()->type() == "Todo" ) { | 915 | if ( placeItem->incidence()->typeID() == todoID ) { |
916 | mSelectedItem = 0; | 916 | mSelectedItem = 0; |
917 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 917 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
918 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 918 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
919 | emit itemModified( modifiedItem, mActionType ); | 919 | emit itemModified( modifiedItem, mActionType ); |
920 | } | 920 | } |
921 | else { | 921 | else { |
922 | 922 | ||
923 | 923 | ||
924 | globalFlagBlockAgendaItemPaint = 1; | 924 | globalFlagBlockAgendaItemPaint = 1; |
925 | for ( item=oldconflictItems.first(); item != 0; | 925 | for ( item=oldconflictItems.first(); item != 0; |
926 | item=oldconflictItems.next() ) { | 926 | item=oldconflictItems.next() ) { |
927 | placeSubCells(item); | 927 | placeSubCells(item); |
928 | } | 928 | } |
929 | while ( placeItem ) { | 929 | while ( placeItem ) { |
930 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 930 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
931 | oldconflictItems = placeItem->conflictItems(); | 931 | oldconflictItems = placeItem->conflictItems(); |
932 | for ( item=oldconflictItems.first(); item != 0; | 932 | for ( item=oldconflictItems.first(); item != 0; |
933 | item=oldconflictItems.next() ) { | 933 | item=oldconflictItems.next() ) { |
934 | placeSubCells(item); | 934 | placeSubCells(item); |
935 | } | 935 | } |
936 | placeSubCells( placeItem ); | 936 | placeSubCells( placeItem ); |
937 | placeItem = placeItem->nextMultiItem(); | 937 | placeItem = placeItem->nextMultiItem(); |
938 | } | 938 | } |
939 | globalFlagBlockAgendaItemPaint = 0; | 939 | globalFlagBlockAgendaItemPaint = 0; |
940 | for ( item=oldconflictItems.first(); item != 0; | 940 | for ( item=oldconflictItems.first(); item != 0; |
941 | item=oldconflictItems.next() ) { | 941 | item=oldconflictItems.next() ) { |
942 | globalFlagBlockAgendaItemUpdate = 0; | 942 | globalFlagBlockAgendaItemUpdate = 0; |
943 | item->repaintMe(); | 943 | item->repaintMe(); |
944 | globalFlagBlockAgendaItemUpdate = 1; | 944 | globalFlagBlockAgendaItemUpdate = 1; |
945 | item->repaint( false ); | 945 | item->repaint( false ); |
946 | } | 946 | } |
947 | placeItem = modifiedItem; | 947 | placeItem = modifiedItem; |
948 | 948 | ||
949 | while ( placeItem ) { | 949 | while ( placeItem ) { |
950 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 950 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
951 | globalFlagBlockAgendaItemUpdate = 0; | 951 | globalFlagBlockAgendaItemUpdate = 0; |
952 | placeItem->repaintMe(); | 952 | placeItem->repaintMe(); |
953 | globalFlagBlockAgendaItemUpdate = 1; | 953 | globalFlagBlockAgendaItemUpdate = 1; |
954 | placeItem->repaint(false); | 954 | placeItem->repaint(false); |
955 | placeItem = placeItem->nextMultiItem(); | 955 | placeItem = placeItem->nextMultiItem(); |
956 | } | 956 | } |
957 | emit itemModified( modifiedItem, mActionType ); | 957 | emit itemModified( modifiedItem, mActionType ); |
958 | 958 | ||
959 | 959 | ||
960 | placeItem = modifiedItem; | 960 | placeItem = modifiedItem; |
961 | while ( placeItem ) { | 961 | while ( placeItem ) { |
962 | oldconflictItems = placeItem->conflictItems(); | 962 | oldconflictItems = placeItem->conflictItems(); |
963 | for ( item=oldconflictItems.first(); item != 0; | 963 | for ( item=oldconflictItems.first(); item != 0; |