-rw-r--r-- | korganizer/koagendaitem.cpp | 24 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 9fe1be4..abb29f7 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -335,38 +335,41 @@ bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | |||
335 | } | 335 | } |
336 | void KOAgendaItem::repaintMe( ) | 336 | void KOAgendaItem::repaintMe( ) |
337 | { | 337 | { |
338 | paintMe ( mSelected ); | 338 | paintMe ( mSelected ); |
339 | } | 339 | } |
340 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 340 | 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 ) |
367 | paint = &pa; | 370 | paint = &pa; |
368 | bool horLayout = ( w < h ); | 371 | bool horLayout = ( w < h ); |
369 | int maxhei = mFontPixelSize+4; | 372 | int maxhei = mFontPixelSize+4; |
370 | if ( horLayout ) | 373 | if ( horLayout ) |
371 | maxhei += AGENDA_ICON_SIZE -4; | 374 | maxhei += AGENDA_ICON_SIZE -4; |
372 | bool small = ( h < maxhei ); | 375 | bool small = ( h < maxhei ); |
@@ -461,92 +464,85 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
461 | if ( ! small ) { | 464 | if ( ! small ) { |
462 | QFontMetrics fm ( paint->font() ); | 465 | QFontMetrics fm ( paint->font() ); |
463 | 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); |
464 | } | 467 | } |
465 | 468 | ||
466 | } | 469 | } |
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 ) { |
480 | int w = QApplication::desktop()->width(); | 482 | int w = QApplication::desktop()->width(); |
481 | int h = QApplication::desktop()->height(); | 483 | int h = QApplication::desktop()->height(); |
482 | mPaintPix = new QPixmap(w,h); | 484 | mPaintPix = new QPixmap(w,h); |
483 | } | 485 | } |
484 | return mPaintPix ; | 486 | return mPaintPix ; |
485 | } | 487 | } |
486 | QPixmap * KOAgendaItem::paintPixAllday() | 488 | QPixmap * KOAgendaItem::paintPixAllday() |
487 | { | 489 | { |
488 | static QPixmap* mPaintPixA = 0; | 490 | static QPixmap* mPaintPixA = 0; |
489 | if ( ! mPaintPixA ) { | 491 | if ( ! mPaintPixA ) { |
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 ) |
512 | return; | 505 | return; |
513 | int yy; | 506 | int yy; |
514 | if ( mAllDay ) | 507 | if ( mAllDay ) |
515 | yy = y(); | 508 | yy = y(); |
516 | else | 509 | else |
517 | yy = mCellYTop * ( height() / cellHeight() ); | 510 | yy = mCellYTop * ( height() / cellHeight() ); |
518 | int xx = x(); | 511 | int xx = x(); |
519 | 512 | ||
520 | if ( xPaintCoord != xx || yPaintCoord != yy || | 513 | if ( xPaintCoord != xx || yPaintCoord != yy || |
521 | wPaintCoord != width() || hPaintCoord != height()) { | 514 | wPaintCoord != width() || hPaintCoord != height()) { |
522 | xPaintCoord= xx; | 515 | xPaintCoord= xx; |
523 | yPaintCoord = yy; | 516 | yPaintCoord = yy; |
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 | } |
547 | xx += rx; | 543 | xx += rx; |
548 | 544 | ||
549 | if ( xx < 0 ) { | 545 | if ( xx < 0 ) { |
550 | rw = rw + xx; | 546 | rw = rw + xx; |
551 | rx -= xx; | 547 | rx -= xx; |
552 | xx = 0; | 548 | xx = 0; |
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index dc2316a..7103abe 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h | |||
@@ -94,25 +94,24 @@ class KOAgendaItem : public QWidget | |||
94 | 94 | ||
95 | virtual bool eventFilter ( QObject *, QEvent * ); | 95 | virtual bool eventFilter ( QObject *, QEvent * ); |
96 | 96 | ||
97 | static QToolTipGroup *toolTipGroup(); | 97 | static QToolTipGroup *toolTipGroup(); |
98 | 98 | ||
99 | QPtrList<KOAgendaItem> conflictItems(); | 99 | QPtrList<KOAgendaItem> conflictItems(); |
100 | void setConflictItems(QPtrList<KOAgendaItem>); | 100 | void setConflictItems(QPtrList<KOAgendaItem>); |
101 | void addConflictItem(KOAgendaItem *ci); | 101 | void addConflictItem(KOAgendaItem *ci); |
102 | void paintMe( bool, QPainter* painter = 0 ); | 102 | void paintMe( bool, QPainter* painter = 0 ); |
103 | void repaintMe(); | 103 | void repaintMe(); |
104 | static void resizePixmap( int, int ); | 104 | static void resizePixmap( int, int ); |
105 | static QPixmap * paintPix(); | 105 | static QPixmap * paintPix(); |
106 | static QPixmap * paintPixSel(); | ||
107 | static QPixmap * paintPixAllday(); | 106 | static QPixmap * paintPixAllday(); |
108 | void updateItem(); | 107 | void updateItem(); |
109 | void computeText(); | 108 | void computeText(); |
110 | void recreateIncidence(); | 109 | void recreateIncidence(); |
111 | bool checkLayout(); | 110 | bool checkLayout(); |
112 | void initColor (); | 111 | void initColor (); |
113 | public slots: | 112 | public slots: |
114 | bool updateIcons( QPainter *, bool ); | 113 | bool updateIcons( QPainter *, bool ); |
115 | void select(bool=true); | 114 | void select(bool=true); |
116 | 115 | ||
117 | protected: | 116 | protected: |
118 | void dragEnterEvent(QDragEnterEvent *e); | 117 | void dragEnterEvent(QDragEnterEvent *e); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 5a63b35..f811fba 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -594,25 +594,25 @@ void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | |||
594 | 594 | ||
595 | } | 595 | } |
596 | void KOAgendaView::categoryChanged(Incidence * inc) | 596 | void KOAgendaView::categoryChanged(Incidence * inc) |
597 | { | 597 | { |
598 | mAgenda->categoryChanged( inc ); | 598 | mAgenda->categoryChanged( inc ); |
599 | mAllDayAgenda->categoryChanged( inc ); | 599 | mAllDayAgenda->categoryChanged( inc ); |
600 | } | 600 | } |
601 | KOAgendaView::~KOAgendaView() | 601 | KOAgendaView::~KOAgendaView() |
602 | { | 602 | { |
603 | delete mAllAgendaPopup; | 603 | delete mAllAgendaPopup; |
604 | //delete mAllDayAgendaPopup; | 604 | //delete mAllDayAgendaPopup; |
605 | delete KOAgendaItem::paintPix(); | 605 | delete KOAgendaItem::paintPix(); |
606 | delete KOAgendaItem::paintPixSel(); | 606 | delete KOAgendaItem::paintPixAllday(); |
607 | } | 607 | } |
608 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 608 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
609 | { | 609 | { |
610 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 610 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
611 | bool uc = false; | 611 | bool uc = false; |
612 | int ow = e->oldSize().width(); | 612 | int ow = e->oldSize().width(); |
613 | int oh = e->oldSize().height(); | 613 | int oh = e->oldSize().height(); |
614 | int w = e->size().width(); | 614 | int w = e->size().width(); |
615 | int h = e->size().height(); | 615 | int h = e->size().height(); |
616 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 616 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
617 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 617 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
618 | uc = true; | 618 | uc = true; |