summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-23 11:47:33 (UTC)
committer zautrix <zautrix>2005-03-23 11:47:33 (UTC)
commit913291ec9784520cc6ff9769081c03bd74a5ab07 (patch) (side-by-side diff)
treeabc324e407ea03c312511f83d735b6039d9b36bb
parentc99ce87456abd342befc7820d3e1376f9560183a (diff)
downloadkdepimpi-913291ec9784520cc6ff9769081c03bd74a5ab07.zip
kdepimpi-913291ec9784520cc6ff9769081c03bd74a5ab07.tar.gz
kdepimpi-913291ec9784520cc6ff9769081c03bd74a5ab07.tar.bz2
koa item resize crash fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 5ee433a..7e6fa48 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -461,24 +461,25 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
{
if ( globalFlagBlockAgendaItemPaint )
return;
if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
return;
int yy;
if ( mAllDay )
yy = y();
else
yy = mCellYTop * ( height() / cellHeight() );
int xx = x();
+
if ( xPaintCoord != xx || yPaintCoord != yy ||
wPaintCoord != width() || hPaintCoord != height()) {
xPaintCoord= xx;
yPaintCoord = yy;
wPaintCoord = width();
hPaintCoord = height();
globalFlagBlockAgendaItemUpdate = 0;
paintMe( mSelected );
//qDebug("calling paintMe ");
globalFlagBlockAgendaItemUpdate = 1;
}
int rx, ry, rw, rh;
@@ -488,25 +489,44 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
rh = e->rect().height();
//qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
QPixmap* paintFrom ;
if ( mSelected ) {
paintFrom = paintPixSel();
} else {
if ( mAllDay )
paintFrom = paintPixAllday();
else
paintFrom = paintPix();
}
- bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP);
+ xx += rx;
+
+ if ( xx < 0 ) {
+ rw = rw + xx;
+ rx -= xx;
+ xx = 0;
+ if ( rw < 0 ) {
+ qDebug("KOAgendaItem::Width1 < 0. Returning ");
+ return;
+ }
+ }
+ if ( paintFrom->width() < xx+rw ) {
+ rw = paintFrom->width() - xx;
+ if ( rw < 0 ) {
+ qDebug("KOAgendaItem::Width2 < 0. Returning ");
+ return;
+ }
+ }
+ //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
+ bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
}
void KOAgendaItem::computeText()
{
mDisplayedText = mIncidence->summary();
if ( (mIncidence->type() == "Todo") ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
else if ( !(mIncidence->doesFloat()))
mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
}