summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagendaitem.cpp8
-rw-r--r--korganizer/koagendaitem.h2
-rw-r--r--korganizer/koagendaview.cpp1
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
@@ -1831,22 +1831,22 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int
/*
Insert all-day KOAgendaItem into agenda.
*/
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);
//agendaItem->show();
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 7a685d8..81681df 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -577,17 +577,18 @@ void KOAgendaItem::computeText()
if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
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() ) {
if ( mAllDay )
mDisplayedText += " (";
@@ -653,31 +654,32 @@ int KOAgendaItem::cellHeight()
ret = 1;
mCellYBottom = 0;
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()
{
return mCellXWidth - mCellX + 1;
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 97acd4c..37d89a6 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -104,17 +104,17 @@ class KOAgendaItem : public QWidget
static QPixmap * paintPix();
static QPixmap * paintPixAllday();
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:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1cf03a0..d8a2134 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1230,17 +1230,16 @@ void KOAgendaView::fillAgenda()
mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
}
}
}
}
} 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);
}
}
} else if (event->isMultiDay()) {