-rw-r--r-- | korganizer/koagenda.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 8 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 1 |
4 files changed, 8 insertions, 7 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 796d633..d9d1283 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1833,18 +1833,18 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int */ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) { if (!mAllDayMode) { return 0; } - + //qDebug("insertallday %s -- %d - %d ",qd.toString().latin1(), XBegin, XEnd ); KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); agendaItem->setCellXY(XBegin,0,0); agendaItem->setCellXWidth(XEnd); - agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); + agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY, true ); //addChild(agendaItem,XBegin*mGridSpacingX,0); mItems.append(agendaItem); placeSubCells(agendaItem); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 7a685d8..81681df 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -579,13 +579,14 @@ void KOAgendaItem::computeText() if ( mAllDay ) { if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { if ( mIncidence->doesRecur() ) { mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; } else { - mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; + int dur = 1+ (static_cast<Event*>(mIncidence))->dtStart().date().daysTo( (static_cast<Event*>(mIncidence))->dtEnd().date() ); + mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) + " ("+QString::number( dur )+i18n(" days") +")" ; } } } } if ( !mIncidence->location().isEmpty() ) { @@ -655,27 +656,28 @@ int KOAgendaItem::cellHeight() mCellYTop = 0; } return ret; } // it may be that allday agenda items have a needed width > 32000 // this code is to fix this problem -int KOAgendaItem::resizeMe( int grid, int wid, int hei ) +int KOAgendaItem::resizeMe( int grid, int wid, int hei, bool invalidWidth ) { int diff = 0; if ( mCellX < -3 && mAllDay ) { diff = (mCellX + 3) * -grid; //qDebug("%s: cellX %d diff %d wid %d grid %d ", mDisplayedText.latin1(), mCellX, diff, wid, grid); if ( diff >= wid ) { // qDebug("KOAgendaItem::resizeMe: diff >= wid: diff %d wid %d ", diff, wid); //diff = 0; } } - if ( wid == width() || diff >= wid ) + if ( (!invalidWidth && wid == width() ) || diff >= wid ) resize( wid, hei ); else resize( wid - diff, hei ); + //qDebug("wid %d x %d ", width(), x()); return diff; } /* Return height of item in units of agenda cells */ int KOAgendaItem::cellWidth() diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index 97acd4c..37d89a6 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h @@ -106,13 +106,13 @@ class KOAgendaItem : public QWidget void updateItem(); void computeText(); void recreateIncidence(); bool checkLayout(); void initColor (); bool isAllDay() { return mAllDay; } - int resizeMe( int grid, int wid, int hei ); + int resizeMe( int grid, int wid, int hei, bool invalidHei = false ); public slots: bool updateIcons( QPainter *, bool ); void select(bool=true); void repaintItem(); protected: diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1cf03a0..d8a2134 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1232,13 +1232,12 @@ void KOAgendaView::fillAgenda() } } } } else { mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); } - } else { if (beginX <= 0 && curCol == 0) { mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); } else if (beginX == curCol) { mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); } |