From 18780cc2342097b343ee2fa50c649f425ddaed34 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 22 Aug 2005 16:28:08 +0000 Subject: fix for the lonng agenda float fix --- (limited to 'korganizer') diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 796d633..d9d1283 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1836,12 +1836,12 @@ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,i 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); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 7a685d8..81681df 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -582,7 +582,8 @@ void KOAgendaItem::computeText() if ( mIncidence->doesRecur() ) { mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; } else { - mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast(mIncidence))->dtEnd().date(), true) ; + int dur = 1+ (static_cast(mIncidence))->dtStart().date().daysTo( (static_cast(mIncidence))->dtEnd().date() ); + mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast(mIncidence))->dtEnd().date(), true) + " ("+QString::number( dur )+i18n(" days") +")" ; } } } @@ -658,7 +659,7 @@ int KOAgendaItem::cellHeight() } // 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 ) { @@ -669,10 +670,11 @@ int KOAgendaItem::resizeMe( int grid, int wid, int hei ) //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; } /* diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index 97acd4c..37d89a6 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h @@ -109,7 +109,7 @@ class KOAgendaItem : public QWidget 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); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1cf03a0..d8a2134 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1235,7 +1235,6 @@ void KOAgendaView::fillAgenda() } else { mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); } - } else { if (beginX <= 0 && curCol == 0) { mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); -- cgit v0.9.0.2