summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index f855b03..8675ff6 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -447,103 +447,112 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
447 align = ( AlignHCenter|WordBreak|AlignTop); 447 align = ( AlignHCenter|WordBreak|AlignTop);
448#else 448#else
449 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 449 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
450#endif 450#endif
451 451
452 } 452 }
453 } 453 }
454 QRect dr; 454 QRect dr;
455 if ( w + x > parentWidget()->width() ) 455 if ( w + x > parentWidget()->width() )
456 w = parentWidget()->width()-x; 456 w = parentWidget()->width()-x;
457 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 457 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
458 //qDebug("%d %d %d %d ", x, yy, w, h ); 458 //qDebug("%d %d %d %d ", x, yy, w, h );
459 if ( mIncidence->cancelled() ){ 459 if ( mIncidence->cancelled() ){
460 460
461 461
462 small = ( height() < 20 ); 462 small = ( height() < 20 );
463 463
464 if ( ! small ) { 464 if ( ! small ) {
465 QFontMetrics fm ( paint->font() ); 465 QFontMetrics fm ( paint->font() );
466 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 466 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
467 } 467 }
468 468
469 } 469 }
470 pa.end(); 470 pa.end();
471 471
472} 472}
473 473
474QPixmap * KOAgendaItem::paintPix() 474QPixmap * KOAgendaItem::paintPix()
475{ 475{
476 static QPixmap* mPaintPix = 0; 476 static QPixmap* mPaintPix = 0;
477 if ( ! mPaintPix ) { 477 if ( ! mPaintPix ) {
478 int w = QApplication::desktop()->width(); 478 int w = QApplication::desktop()->width();
479 int h = QApplication::desktop()->height(); 479 int h = QApplication::desktop()->height();
480 mPaintPix = new QPixmap(w,h); 480 mPaintPix = new QPixmap(w,h);
481 } 481 }
482 return mPaintPix ; 482 return mPaintPix ;
483} 483}
484QPixmap * KOAgendaItem::paintPixAllday() 484QPixmap * KOAgendaItem::paintPixAllday()
485{ 485{
486 static QPixmap* mPaintPixA = 0; 486 static QPixmap* mPaintPixA = 0;
487 if ( ! mPaintPixA ) { 487 if ( ! mPaintPixA ) {
488 int w = QApplication::desktop()->width(); 488 int w = QApplication::desktop()->width();
489 int h = QApplication::desktop()->height()/5; 489 int h = QApplication::desktop()->height()/5;
490 mPaintPixA = new QPixmap(w,h); 490 mPaintPixA = new QPixmap(w,h);
491 } 491 }
492 return mPaintPixA ; 492 return mPaintPixA ;
493} 493}
494 494
495void KOAgendaItem::repaintItem()
496{
497 globalFlagBlockAgendaItemPaint = 0;
498 globalFlagBlockAgenda = 0;
499 //qDebug("AAA ");
500 repaint( false );
501 //qDebug("BBB ");
502}
495void KOAgendaItem::paintEvent ( QPaintEvent *e ) 503void KOAgendaItem::paintEvent ( QPaintEvent *e )
496{ 504{
497 505 qDebug("CCC ");
498 if ( globalFlagBlockAgendaItemPaint ) 506 if ( globalFlagBlockAgendaItemPaint )
499 return; 507 return;
500 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 508 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
501 return; 509 return;
510 qDebug("DDD ");
502 int yy; 511 int yy;
503 if ( mAllDay ) 512 if ( mAllDay )
504 yy = y(); 513 yy = y();
505 else 514 else
506 yy = mCellYTop * ( height() / cellHeight() ); 515 yy = mCellYTop * ( height() / cellHeight() );
507 int xx = x(); 516 int xx = x();
508 517
509 if ( xPaintCoord != xx || yPaintCoord != yy || 518 if ( xPaintCoord != xx || yPaintCoord != yy ||
510 wPaintCoord != width() || hPaintCoord != height()) { 519 wPaintCoord != width() || hPaintCoord != height()) {
511 xPaintCoord= xx; 520 xPaintCoord= xx;
512 yPaintCoord = yy; 521 yPaintCoord = yy;
513 wPaintCoord = width(); 522 wPaintCoord = width();
514 hPaintCoord = height(); 523 hPaintCoord = height();
515 globalFlagBlockAgendaItemUpdate = 0; 524 globalFlagBlockAgendaItemUpdate = 0;
516 paintMe( mSelected ); 525 paintMe( mSelected );
517 //qDebug("calling paintMe "); 526 //qDebug("calling paintMe ");
518 globalFlagBlockAgendaItemUpdate = 1; 527 globalFlagBlockAgendaItemUpdate = 1;
519 if ( mSelected ) 528 if ( mSelected )
520 return; 529 return;
521 } 530 }
522 int rx, ry, rw, rh; 531 int rx, ry, rw, rh;
523 rx = e->rect().x(); 532 rx = e->rect().x();
524 ry = e->rect().y(); 533 ry = e->rect().y();
525 rw = e->rect().width(); 534 rw = e->rect().width();
526 rh = e->rect().height(); 535 rh = e->rect().height();
527 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 536 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
528 537
529 QPixmap* paintFrom ; 538 QPixmap* paintFrom ;
530 if ( mSelected ) { 539 if ( mSelected ) {
531 paintMe( mSelected ); 540 paintMe( mSelected );
532 return; 541 return;
533 } else { 542 } else {
534 if ( mAllDay ) 543 if ( mAllDay )
535 paintFrom = paintPixAllday(); 544 paintFrom = paintPixAllday();
536 else 545 else
537 paintFrom = paintPix(); 546 paintFrom = paintPix();
538 } 547 }
539 xx += rx; 548 xx += rx;
540 549
541 if ( xx < 0 ) { 550 if ( xx < 0 ) {
542 rw = rw + xx; 551 rw = rw + xx;
543 rx -= xx; 552 rx -= xx;
544 xx = 0; 553 xx = 0;
545 if ( rw <= 1 ) { 554 if ( rw <= 1 ) {
546 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 555 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
547 return; 556 return;
548 } 557 }
549 } 558 }