-rw-r--r-- | korganizer/koagenda.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 195b1fa..ec81d44 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1152,65 +1152,88 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) //qDebug("KOAgenda::drawContents "); if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) ;//drawContentsToPainter(); QPaintDevice* pd = p->device(); p->end(); int vx, vy; int selectionX = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - mSelectionCellX) * mGridSpacingX : mSelectionCellX * mGridSpacingX; contentsToViewport ( cx, cy, vx,vy); // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); if ( mSelectionHeight > 0 ) { //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { contentsToViewport ( selectionX, mSelectionYTop, vx,vy); bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); } } //qDebug("btbl "); p->begin( pd ); //qDebug("end "); } void KOAgenda::finishUpdate() { KOAgendaItem *item; - globalFlagBlockAgendaItemPaint = 1; + globalFlagBlockAgendaItemPaint = 1; + // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems + for ( item=mItems.first(); item != 0; item=mItems.next() ) { + if ( !item->checkLayout() ) { + //qDebug(" conflictitem found "); + int newSubCellWidth; + if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); + else newSubCellWidth = mGridSpacingX / item->subCells(); + + if (mAllDayMode) { + item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); + } else { + item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); + } + int x,y; + gridToContents(item->cellX(),item->cellYTop(),x,y); + if (mAllDayMode) { + y += item->subCell() * newSubCellWidth; + } else { + x += item->subCell() * newSubCellWidth; + } + moveChild(item,x,y); + } + } for ( item=mItems.first(); item != 0; item=mItems.next() ) { if ( !item->isVisible() ) item->show(); } globalFlagBlockAgendaItemUpdate = 0; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaintMe( ); } globalFlagBlockAgendaItemUpdate = 1; qApp->processEvents(); globalFlagBlockAgendaItemPaint = 0; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaint( false ); } } /* Draw grid in the background of the agenda. */ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) { if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) return; if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) return; int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); if ( ch < 1 ) ch = 1; |