summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
authorzautrix <zautrix>2005-07-27 22:26:08 (UTC)
committer zautrix <zautrix>2005-07-27 22:26:08 (UTC)
commit0e38cffd7ba745f237c659e1c48080fcb25b126c (patch) (unidiff)
tree6069600e18bae5300c6ce427735457dbfed93141 /korganizer/koagenda.cpp
parent136f9082862e7a56abb3a201e96f5e7386c4f1b9 (diff)
downloadkdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.zip
kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.gz
kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.bz2
rec changes
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0dd5ef5..c738f7e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -534,97 +534,97 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
534 if ( diff < minV ) { 534 if ( diff < minV ) {
535 border = true; 535 border = true;
536 objIsNotViewport = false; 536 objIsNotViewport = false;
537 } 537 }
538 } 538 }
539 } 539 }
540 } else { // not allday 540 } else { // not allday
541 if ( tempItem->width() > 10 ) { 541 if ( tempItem->width() > 10 ) {
542 int minH = tempItem->width()/4; 542 int minH = tempItem->width()/4;
543 if ( minH > (blockmoveDist/2)-2 ) { 543 if ( minH > (blockmoveDist/2)-2 ) {
544 if ( minH > blockmoveDist ) 544 if ( minH > blockmoveDist )
545 minH = blockmoveDist; 545 minH = blockmoveDist;
546 else 546 else
547 minH = (blockmoveDist/2); 547 minH = (blockmoveDist/2);
548 } 548 }
549 bool border = false; 549 bool border = false;
550 int diff = tempItem->x() - viewportPos.x(); 550 int diff = tempItem->x() - viewportPos.x();
551 if ( diff < 0 ) 551 if ( diff < 0 )
552 diff *= -1; 552 diff *= -1;
553 if ( diff < minH ) { 553 if ( diff < minH ) {
554 border = true; 554 border = true;
555 objIsNotViewport = false; 555 objIsNotViewport = false;
556 } 556 }
557 if ( ! border ) { 557 if ( ! border ) {
558 diff = tempItem->x() + tempItem->width() - viewportPos.x(); 558 diff = tempItem->x() + tempItem->width() - viewportPos.x();
559 if ( diff < 0 ) 559 if ( diff < 0 )
560 diff *= -1; 560 diff *= -1;
561 if ( diff < minH ) { 561 if ( diff < minH ) {
562 border = true; 562 border = true;
563 objIsNotViewport = false; 563 objIsNotViewport = false;
564 } 564 }
565 } 565 }
566 } 566 }
567 } 567 }
568 } 568 }
569 if ( objIsNotViewport ) { 569 if ( objIsNotViewport ) {
570 mPopupItem = (KOAgendaItem *)object; 570 mPopupItem = (KOAgendaItem *)object;
571 mPopupKind = 1; 571 mPopupKind = 1;
572 if (me->button() == RightButton) { 572 if (me->button() == RightButton) {
573 mPopupKind = 3; 573 mPopupKind = 3;
574 popupMenu(); 574 popupMenu();
575 } else if (me->button() == LeftButton) { 575 } else if (me->button() == LeftButton) {
576 mActionItem = (KOAgendaItem *)object; 576 mActionItem = (KOAgendaItem *)object;
577 if (mActionItem) { 577 if (mActionItem) {
578 emit signalClearSelection(); 578 emit signalClearSelection();
579 slotClearSelection(); 579 slotClearSelection();
580 selectItem(mActionItem); 580 selectItem(mActionItem);
581 Incidence *incidence = mActionItem->incidence(); 581 Incidence *incidence = mActionItem->incidence();
582 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 582 if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) {
583 mActionItem = 0; 583 mActionItem = 0;
584 } else { 584 } else {
585 startItemAction(viewportPos); 585 startItemAction(viewportPos);
586 } 586 }
587 } 587 }
588 } 588 }
589 } else { // ---------- viewport() 589 } else { // ---------- viewport()
590 mPopupItem = 0; 590 mPopupItem = 0;
591 mPopupKind = 2; 591 mPopupKind = 2;
592 selectItem(0); 592 selectItem(0);
593 mActionItem = 0; 593 mActionItem = 0;
594 if (me->button() == RightButton) { 594 if (me->button() == RightButton) {
595 int x,y; 595 int x,y;
596 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 596 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
597 int gx,gy; 597 int gx,gy;
598 contentsToGrid(x,y,gx,gy); 598 contentsToGrid(x,y,gx,gy);
599 mCurrentCellX = gx; 599 mCurrentCellX = gx;
600 mCurrentCellY = gy; 600 mCurrentCellY = gy;
601 mStartCellX = gx; 601 mStartCellX = gx;
602 mStartCellY = gy; 602 mStartCellY = gy;
603 mPopupKind = 4; 603 mPopupKind = 4;
604 popupMenu(); 604 popupMenu();
605 } else if (me->button() == LeftButton) { 605 } else if (me->button() == LeftButton) {
606 setCursor(arrowCursor); 606 setCursor(arrowCursor);
607 startSelectAction(viewportPos); 607 startSelectAction(viewportPos);
608 } 608 }
609 } 609 }
610 break; 610 break;
611 611
612 case QEvent::MouseButtonRelease: 612 case QEvent::MouseButtonRelease:
613 if (me->button() == LeftButton ) { 613 if (me->button() == LeftButton ) {
614 mPopupTimer->stop(); 614 mPopupTimer->stop();
615 } 615 }
616 if (object != viewport()) { 616 if (object != viewport()) {
617 if (me->button() == LeftButton && mLeftMouseDown) { 617 if (me->button() == LeftButton && mLeftMouseDown) {
618 if (mActionItem) { 618 if (mActionItem) {
619 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 619 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
620 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 620 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
621 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 621 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
622 mScrollUpTimer.stop(); 622 mScrollUpTimer.stop();
623 mScrollDownTimer.stop(); 623 mScrollDownTimer.stop();
624 mActionItem->resetMove(); 624 mActionItem->resetMove();
625 placeSubCells( mActionItem ); 625 placeSubCells( mActionItem );
626 // emit startDragSignal( mActionItem->incidence() ); 626 // emit startDragSignal( mActionItem->incidence() );
627 setCursor( arrowCursor ); 627 setCursor( arrowCursor );
628 mActionItem = 0; 628 mActionItem = 0;
629 mActionType = NOP; 629 mActionType = NOP;
630 mItemMoved = 0; 630 mItemMoved = 0;
@@ -954,97 +954,97 @@ void KOAgenda::performItemAction(QPoint viewportPos)
954 moveChild(moveItem,x,y); 954 moveChild(moveItem,x,y);
955 moveItem = moveItem->nextMultiItem(); 955 moveItem = moveItem->nextMultiItem();
956 } 956 }
957 } else if (mActionType == RESIZETOP) { 957 } else if (mActionType == RESIZETOP) {
958 if (mCurrentCellY <= mActionItem->cellYBottom()) { 958 if (mCurrentCellY <= mActionItem->cellYBottom()) {
959 mActionItem->expandTop(gy - mCurrentCellY); 959 mActionItem->expandTop(gy - mCurrentCellY);
960 mActionItem->resize(mActionItem->width(), 960 mActionItem->resize(mActionItem->width(),
961 mGridSpacingY * mActionItem->cellHeight()); 961 mGridSpacingY * mActionItem->cellHeight());
962 int x,y; 962 int x,y;
963 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); 963 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
964 //moveChild(mActionItem,childX(mActionItem),y); 964 //moveChild(mActionItem,childX(mActionItem),y);
965 QScrollView::moveChild( mActionItem,childX(mActionItem),y ); 965 QScrollView::moveChild( mActionItem,childX(mActionItem),y );
966 } 966 }
967 } else if (mActionType == RESIZEBOTTOM) { 967 } else if (mActionType == RESIZEBOTTOM) {
968 if (mCurrentCellY >= mActionItem->cellYTop()) { 968 if (mCurrentCellY >= mActionItem->cellYTop()) {
969 mActionItem->expandBottom(gy - mCurrentCellY); 969 mActionItem->expandBottom(gy - mCurrentCellY);
970 mActionItem->resize(mActionItem->width(), 970 mActionItem->resize(mActionItem->width(),
971 mGridSpacingY * mActionItem->cellHeight()); 971 mGridSpacingY * mActionItem->cellHeight());
972 } 972 }
973 } else if (mActionType == RESIZELEFT) { 973 } else if (mActionType == RESIZELEFT) {
974 if (mCurrentCellX <= mActionItem->cellXWidth()) { 974 if (mCurrentCellX <= mActionItem->cellXWidth()) {
975 mActionItem->expandLeft(gx - mCurrentCellX); 975 mActionItem->expandLeft(gx - mCurrentCellX);
976 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 976 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
977 mActionItem->height()); 977 mActionItem->height());
978 int x,y; 978 int x,y;
979 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); 979 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
980 moveChild(mActionItem,x,childY(mActionItem)); 980 moveChild(mActionItem,x,childY(mActionItem));
981 } 981 }
982 } else if (mActionType == RESIZERIGHT) { 982 } else if (mActionType == RESIZERIGHT) {
983 if (mCurrentCellX >= mActionItem->cellX()) { 983 if (mCurrentCellX >= mActionItem->cellX()) {
984 mActionItem->expandRight(gx - mCurrentCellX); 984 mActionItem->expandRight(gx - mCurrentCellX);
985 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 985 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
986 mActionItem->height()); 986 mActionItem->height());
987 } 987 }
988 } 988 }
989 mCurrentCellX = gx; 989 mCurrentCellX = gx;
990 mCurrentCellY = gy; 990 mCurrentCellY = gy;
991 } 991 }
992} 992}
993 993
994void KOAgenda::endItemAction() 994void KOAgenda::endItemAction()
995{ 995{
996 996
997 if ( mItemMoved ) { 997 if ( mItemMoved ) {
998 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 998 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
999 if ( !placeItem ) { 999 if ( !placeItem ) {
1000 placeItem = mActionItem; 1000 placeItem = mActionItem;
1001 } 1001 }
1002 if ( placeItem->incidence()->recurrence()->doesRecur() ) { 1002 if ( placeItem->incidence()->doesRecur() ) {
1003 Incidence* oldInc = placeItem->incidence(); 1003 Incidence* oldInc = placeItem->incidence();
1004 placeItem->recreateIncidence(); 1004 placeItem->recreateIncidence();
1005 emit addToCalSignal(placeItem->incidence(), oldInc ); 1005 emit addToCalSignal(placeItem->incidence(), oldInc );
1006 } 1006 }
1007 int type = mActionType; 1007 int type = mActionType;
1008 if ( mAllDayMode ) 1008 if ( mAllDayMode )
1009 type = -1; 1009 type = -1;
1010 KOAgendaItem *modifiedItem = placeItem; 1010 KOAgendaItem *modifiedItem = placeItem;
1011 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); 1011 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
1012 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 1012 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
1013 KOAgendaItem *item; 1013 KOAgendaItem *item;
1014 1014
1015 if ( placeItem->incidence()->typeID() == todoID ) { 1015 if ( placeItem->incidence()->typeID() == todoID ) {
1016 mSelectedItem = 0; 1016 mSelectedItem = 0;
1017 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); 1017 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
1018 modifiedItem->mLastMoveXPos = mCurrentCellX; 1018 modifiedItem->mLastMoveXPos = mCurrentCellX;
1019 emit itemModified( modifiedItem, mActionType ); 1019 emit itemModified( modifiedItem, mActionType );
1020 } 1020 }
1021 else { 1021 else {
1022 1022
1023 1023
1024 globalFlagBlockAgendaItemPaint = 1; 1024 globalFlagBlockAgendaItemPaint = 1;
1025 for ( item=oldconflictItems.first(); item != 0; 1025 for ( item=oldconflictItems.first(); item != 0;
1026 item=oldconflictItems.next() ) { 1026 item=oldconflictItems.next() ) {
1027 placeSubCells(item); 1027 placeSubCells(item);
1028 } 1028 }
1029 while ( placeItem ) { 1029 while ( placeItem ) {
1030 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 1030 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
1031 oldconflictItems = placeItem->conflictItems(); 1031 oldconflictItems = placeItem->conflictItems();
1032 for ( item=oldconflictItems.first(); item != 0; 1032 for ( item=oldconflictItems.first(); item != 0;
1033 item=oldconflictItems.next() ) { 1033 item=oldconflictItems.next() ) {
1034 placeSubCells(item); 1034 placeSubCells(item);
1035 } 1035 }
1036 placeSubCells( placeItem ); 1036 placeSubCells( placeItem );
1037 placeItem = placeItem->nextMultiItem(); 1037 placeItem = placeItem->nextMultiItem();
1038 } 1038 }
1039 globalFlagBlockAgendaItemPaint = 0; 1039 globalFlagBlockAgendaItemPaint = 0;
1040 for ( item=oldconflictItems.first(); item != 0; 1040 for ( item=oldconflictItems.first(); item != 0;
1041 item=oldconflictItems.next() ) { 1041 item=oldconflictItems.next() ) {
1042 globalFlagBlockAgendaItemUpdate = 0; 1042 globalFlagBlockAgendaItemUpdate = 0;
1043 item->repaintMe(); 1043 item->repaintMe();
1044 globalFlagBlockAgendaItemUpdate = 1; 1044 globalFlagBlockAgendaItemUpdate = 1;
1045 item->repaint( false ); 1045 item->repaint( false );
1046 } 1046 }
1047 placeItem = modifiedItem; 1047 placeItem = modifiedItem;
1048 1048
1049 while ( placeItem ) { 1049 while ( placeItem ) {
1050 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 1050 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());