-rw-r--r-- | korganizer/koagendaitem.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 9fe1be4..abb29f7 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -341,26 +341,29 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
341 | { | 341 | { |
342 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 342 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
343 | return; | 343 | return; |
344 | QPainter pa; | 344 | QPainter pa; |
345 | 345 | ||
346 | if ( mSelected ) { | 346 | if ( mSelected ) { |
347 | pa.begin( paintPixSel() ); | 347 | pa.begin( this ); |
348 | } else { | 348 | } else { |
349 | if ( mAllDay ) | 349 | if ( mAllDay ) |
350 | pa.begin( paintPixAllday() ); | 350 | pa.begin( paintPixAllday() ); |
351 | else | 351 | else |
352 | pa.begin( paintPix() ); | 352 | pa.begin( paintPix() ); |
353 | } | 353 | } |
354 | int x, yy, w, h; | 354 | int x, yy, w, h; |
355 | float nfh = 7.0; | 355 | float nfh = 7.0; |
356 | x = pos().x(); w = width(); h = height (); | 356 | x = pos().x(); w = width(); h = height (); |
357 | if ( mAllDay ) | 357 | if ( mAllDay ) |
358 | yy = y(); | 358 | yy = y(); |
359 | else | 359 | else |
360 | yy = mCellYTop * ( height() / cellHeight() ); | 360 | yy = mCellYTop * ( height() / cellHeight() ); |
361 | if ( mSelected ) { | ||
362 | pa.translate( -x, -yy ); | ||
363 | } | ||
361 | xPaintCoord= x; | 364 | xPaintCoord= x; |
362 | yPaintCoord = yy; | 365 | yPaintCoord = yy; |
363 | wPaintCoord = width(); | 366 | wPaintCoord = width(); |
364 | hPaintCoord = height(); | 367 | hPaintCoord = height(); |
365 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 368 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
366 | if ( paint == 0 ) | 369 | if ( paint == 0 ) |
@@ -467,13 +470,12 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
467 | pa.end(); | 470 | pa.end(); |
468 | 471 | ||
469 | } | 472 | } |
470 | void KOAgendaItem::resizePixmap( int w , int h ) | 473 | void KOAgendaItem::resizePixmap( int w , int h ) |
471 | { | 474 | { |
472 | paintPix()->resize( w, h ); | 475 | paintPix()->resize( w, h ); |
473 | paintPixSel()->resize( w, h ); | ||
474 | 476 | ||
475 | } | 477 | } |
476 | QPixmap * KOAgendaItem::paintPix() | 478 | QPixmap * KOAgendaItem::paintPix() |
477 | { | 479 | { |
478 | static QPixmap* mPaintPix = 0; | 480 | static QPixmap* mPaintPix = 0; |
479 | if ( ! mPaintPix ) { | 481 | if ( ! mPaintPix ) { |
@@ -490,22 +492,13 @@ QPixmap * KOAgendaItem::paintPixAllday() | |||
490 | int w = QApplication::desktop()->width(); | 492 | int w = QApplication::desktop()->width(); |
491 | int h = QApplication::desktop()->height()/3; | 493 | int h = QApplication::desktop()->height()/3; |
492 | mPaintPixA = new QPixmap(w,h); | 494 | mPaintPixA = new QPixmap(w,h); |
493 | } | 495 | } |
494 | return mPaintPixA ; | 496 | return mPaintPixA ; |
495 | } | 497 | } |
496 | QPixmap * KOAgendaItem::paintPixSel() | 498 | |
497 | { | ||
498 | static QPixmap* mPaintPixSel = 0; | ||
499 | if ( ! mPaintPixSel ) { | ||
500 | int w = QApplication::desktop()->width(); | ||
501 | int h = QApplication::desktop()->height(); | ||
502 | mPaintPixSel = new QPixmap(w,h); | ||
503 | } | ||
504 | return mPaintPixSel ; | ||
505 | } | ||
506 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 499 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
507 | { | 500 | { |
508 | 501 | ||
509 | if ( globalFlagBlockAgendaItemPaint ) | 502 | if ( globalFlagBlockAgendaItemPaint ) |
510 | return; | 503 | return; |
511 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 504 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
@@ -524,23 +517,26 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) | |||
524 | wPaintCoord = width(); | 517 | wPaintCoord = width(); |
525 | hPaintCoord = height(); | 518 | hPaintCoord = height(); |
526 | globalFlagBlockAgendaItemUpdate = 0; | 519 | globalFlagBlockAgendaItemUpdate = 0; |
527 | paintMe( mSelected ); | 520 | paintMe( mSelected ); |
528 | //qDebug("calling paintMe "); | 521 | //qDebug("calling paintMe "); |
529 | globalFlagBlockAgendaItemUpdate = 1; | 522 | globalFlagBlockAgendaItemUpdate = 1; |
523 | if ( mSelected ) | ||
524 | return; | ||
530 | } | 525 | } |
531 | int rx, ry, rw, rh; | 526 | int rx, ry, rw, rh; |
532 | rx = e->rect().x(); | 527 | rx = e->rect().x(); |
533 | ry = e->rect().y(); | 528 | ry = e->rect().y(); |
534 | rw = e->rect().width(); | 529 | rw = e->rect().width(); |
535 | rh = e->rect().height(); | 530 | rh = e->rect().height(); |
536 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 531 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
537 | 532 | ||
538 | QPixmap* paintFrom ; | 533 | QPixmap* paintFrom ; |
539 | if ( mSelected ) { | 534 | if ( mSelected ) { |
540 | paintFrom = paintPixSel(); | 535 | paintMe( mSelected ); |
536 | return; | ||
541 | } else { | 537 | } else { |
542 | if ( mAllDay ) | 538 | if ( mAllDay ) |
543 | paintFrom = paintPixAllday(); | 539 | paintFrom = paintPixAllday(); |
544 | else | 540 | else |
545 | paintFrom = paintPix(); | 541 | paintFrom = paintPix(); |
546 | } | 542 | } |