-rw-r--r-- | korganizer/koagenda.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index acdf5a0..b290020 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1003,193 +1003,194 @@ void KOAgenda::endItemAction() Incidence* oldInc = placeItem->incidence(); placeItem->recreateIncidence(); emit addToCalSignal(placeItem->incidence(), oldInc ); } int type = mActionType; if ( mAllDayMode ) type = -1; KOAgendaItem *modifiedItem = placeItem; //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); KOAgendaItem *item; if ( placeItem->incidence()->typeID() == todoID ) { mSelectedItem = 0; //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); modifiedItem->mLastMoveXPos = mCurrentCellX; emit itemModified( modifiedItem, mActionType ); } else { globalFlagBlockAgendaItemPaint = 1; for ( item=oldconflictItems.first(); item != 0; item=oldconflictItems.next() ) { placeSubCells(item); } while ( placeItem ) { //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); oldconflictItems = placeItem->conflictItems(); for ( item=oldconflictItems.first(); item != 0; item=oldconflictItems.next() ) { placeSubCells(item); } placeSubCells( placeItem ); placeItem = placeItem->nextMultiItem(); } globalFlagBlockAgendaItemPaint = 0; for ( item=oldconflictItems.first(); item != 0; item=oldconflictItems.next() ) { globalFlagBlockAgendaItemUpdate = 0; item->repaintMe(); globalFlagBlockAgendaItemUpdate = 1; item->repaint( false ); } placeItem = modifiedItem; while ( placeItem ) { //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); globalFlagBlockAgendaItemUpdate = 0; placeItem->repaintMe(); globalFlagBlockAgendaItemUpdate = 1; placeItem->repaint(false); placeItem = placeItem->nextMultiItem(); } emit itemModified( modifiedItem, mActionType ); placeItem = modifiedItem; while ( placeItem ) { oldconflictItems = placeItem->conflictItems(); for ( item=oldconflictItems.first(); item != 0; item=oldconflictItems.next() ) { placeSubCells(item); } placeSubCells( placeItem ); placeItem = placeItem->nextMultiItem(); } placeItem = modifiedItem; while ( placeItem ) { oldconflictItems = placeItem->conflictItems(); for ( item=oldconflictItems.first(); item != 0; item=oldconflictItems.next() ) { globalFlagBlockAgendaItemUpdate = 0; item->repaintMe(); globalFlagBlockAgendaItemUpdate = 1; item->repaint(false); } placeItem = placeItem->nextMultiItem(); } /* oldconflictItems = modifiedItem->conflictItems(); for ( item=oldconflictItems.first(); item != 0; item=oldconflictItems.next() ) { globalFlagBlockAgendaItemUpdate = 0; item->paintMe(false); globalFlagBlockAgendaItemUpdate = 1; item->repaint(false); } */ } } - + if ( mActionItem ) + emit incidenceSelected( mActionItem->incidence() ); mScrollUpTimer.stop(); mScrollDownTimer.stop(); setCursor( arrowCursor ); mActionItem = 0; mActionType = NOP; mItemMoved = 0; } void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) { // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; // QPoint point = viewport()->mapToGlobal(viewportPos); // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; // point = clipper()->mapFromGlobal(point); // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; int x,y; viewportToContents(viewportPos.x(),viewportPos.y(),x,y); // kdDebug() << "contents: " << x << "," << y << "\n" << endl; int gx,gy; contentsToGrid(x,y,gx,gy); // Change cursor to resize cursor if appropriate if (mAllDayMode) { int gridDistanceX = (x - gx * mGridSpacingX); if (gridDistanceX < mResizeBorderWidth && moveItem->cellX() == gx) { setCursor(sizeHorCursor); } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && moveItem->cellXWidth() == gx) { setCursor(sizeHorCursor); } else { setCursor(arrowCursor); } } else { int gridDistanceY = (y - gy * mGridSpacingY); if (gridDistanceY < mResizeBorderWidth && moveItem->cellYTop() == gy && !moveItem->firstMultiItem()) { setCursor(sizeVerCursor); } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && moveItem->cellYBottom() == gy && !moveItem->lastMultiItem()) { setCursor(sizeVerCursor); } else { setCursor(arrowCursor); } } } /* Place item in cell and take care that multiple items using the same cell do not overlap. This method is not yet optimal. It doesn´t use the maximum space it can get in all cases. At the moment the method has a bug: When an item is placed only the sub cell widths of the items are changed, which are within the Y region the item to place spans. When the sub cell width change of one of this items affects a cell, where other items are, which do not overlap in Y with the item to place, the display gets corrupted, although the corruption looks quite nice. */ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) { QPtrList<KOAgendaItem> conflictItems; int maxSubCells = 0; QIntDict<KOAgendaItem> subCellDict(7); KOAgendaItem *item; for ( item=mItems.first(); item != 0; item=mItems.next() ) { if (item != placeItem) { if (placeItem->cellX() <= item->cellXWidth() && placeItem->cellXWidth() >= item->cellX()) { if ((placeItem->cellYTop() <= item->cellYBottom()) && (placeItem->cellYBottom() >= item->cellYTop())) { conflictItems.append(item); if (item->subCells() > maxSubCells) maxSubCells = item->subCells(); subCellDict.insert(item->subCell(),item); } } } } if (conflictItems.count() > 0) { // Look for unused sub cell and insert item int i; for(i=0;i<maxSubCells;++i) { if (!subCellDict.find(i)) { placeItem->setSubCell(i); break; } } if (i == maxSubCells) { placeItem->setSubCell(maxSubCells); |