author | zautrix <zautrix> | 2005-06-14 18:15:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-14 18:15:28 (UTC) |
commit | d9df54411b01cabaf51fcae62b91f227f7eff5f5 (patch) (side-by-side diff) | |
tree | 1b996ed8635d9cb7ecc03d735b46f03048fb4d95 /korganizer | |
parent | 05f27a0fe3d9d5455439f0efd683321d8c247482 (diff) | |
download | kdepimpi-d9df54411b01cabaf51fcae62b91f227f7eff5f5.zip kdepimpi-d9df54411b01cabaf51fcae62b91f227f7eff5f5.tar.gz kdepimpi-d9df54411b01cabaf51fcae62b91f227f7eff5f5.tar.bz2 |
fix
-rw-r--r-- | korganizer/koagendaitem.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index c7bc6eb..1be0aca 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -281,193 +281,194 @@ void KOAgendaItem::select(bool selected) } } globalFlagBlockAgendaItemUpdate = 0; paintMe( selected ); globalFlagBlockAgendaItemUpdate = 1; repaint( false ); } /* The eventFilter has to filter the mouse events of the agenda item childs. The events are fed into the event handling method of KOAgendaItem. This allows the KOAgenda to handle the KOAgendaItems by using an eventFilter. */ bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) { if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick || e->type() == QEvent::MouseButtonRelease || e->type() == QEvent::MouseMove) { QMouseEvent *me = (QMouseEvent *)e; QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> mapToGlobal(me->pos())); QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); return event(&returnEvent); } else { return false; } } void KOAgendaItem::repaintMe( ) { paintMe ( mSelected ); } void KOAgendaItem::paintMe( bool selected, QPainter* paint ) { if ( globalFlagBlockAgendaItemUpdate && ! selected) return; QPainter pa; if ( mSelected ) { pa.begin( paintPixSel() ); } else { if ( mAllDay ) pa.begin( paintPixAllday() ); else pa.begin( paintPix() ); } int x, yy, w, h; float nfh = 7.0; x = pos().x(); w = width(); h = height (); if ( mAllDay ) yy = y(); else yy = mCellYTop * ( height() / cellHeight() ); xPaintCoord= x; yPaintCoord = yy; wPaintCoord = width(); hPaintCoord = height(); //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); if ( paint == 0 ) paint = &pa; bool horLayout = ( w < h ); int maxhei = mFontPixelSize+4; if ( horLayout ) maxhei += AGENDA_ICON_SIZE -4; bool small = ( h < maxhei ); if ( ! small ) paint->setFont(KOPrefs::instance()->mAgendaViewFont); else { QFont f = KOPrefs::instance()->mAgendaViewFont; f.setBold( false ); int fh = f.pointSize(); nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; if ( nfh < 6 ) nfh = 6; f.setPointSize( nfh ); paint->setFont(f); } paint->fillRect ( x, yy, w, h, mBackgroundColor ); static const QPixmap completedPxmp = SmallIcon("greenhook16"); static const QPixmap overduePxmp = SmallIcon("redcross16"); if ( mIncidence->typeID() == todoID ) { Todo* tempTodo = static_cast<Todo*>(mIncidence); int xx = pos().x()+(width()-completedPxmp.width()-3 ); int yyy = yy+3; if ( tempTodo->isCompleted() ) paint->drawPixmap ( xx, yyy, completedPxmp ); else { paint->drawPixmap ( xx, yyy, overduePxmp ); } } bool addIcon = false; if ( ! small || w > 3 * h || h > 3* w ) addIcon = updateIcons( paint, horLayout ); - qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); + //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); + qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); if ( ! small ) { x += 3; yy += 3;w -= 6; h-= 5; } else { x += 2; yy += 1;w -= 4; h-= 4; if ( nfh < 6.01 ) { yy -= 2; h += 4; } else if ( nfh < h -2 ) ++yy; } int align; #ifndef DESKTOP_VERSION align = ( AlignLeft|WordBreak|AlignTop); #else align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); #endif if ( addIcon ) { if ( ! horLayout ) { x += AGENDA_ICON_SIZE+3; w -= (AGENDA_ICON_SIZE+3); } else { yy+= AGENDA_ICON_SIZE+2; h -=(AGENDA_ICON_SIZE+3); } } int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); if ( colsum < 250 ) paint->setPen ( white); if ( x < 0 ) { w = w+x-3; x = 3; if ( w > parentWidget()->width() ){ w = parentWidget()->width() - 6; #ifndef DESKTOP_VERSION align = ( AlignHCenter|WordBreak|AlignTop); #else align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); #endif } } QRect dr; if ( w + x > parentWidget()->width() ) w = parentWidget()->width()-x; paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); //qDebug("%d %d %d %d ", x, yy, w, h ); if ( mIncidence->cancelled() ){ small = ( height() < 20 ); if ( ! small ) { QFontMetrics fm ( paint->font() ); paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); } } pa.end(); } void KOAgendaItem::resizePixmap( int w , int h ) { paintPix()->resize( w, h ); paintPixSel()->resize( w, h ); } QPixmap * KOAgendaItem::paintPix() { static QPixmap* mPaintPix = 0; if ( ! mPaintPix ) { int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height(); mPaintPix = new QPixmap(w,h); } return mPaintPix ; } QPixmap * KOAgendaItem::paintPixAllday() { static QPixmap* mPaintPixA = 0; if ( ! mPaintPixA ) { int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height()/3; mPaintPixA = new QPixmap(w,h); } return mPaintPixA ; } QPixmap * KOAgendaItem::paintPixSel() { static QPixmap* mPaintPixSel = 0; if ( ! mPaintPixSel ) { int w = QApplication::desktop()->width(); int h = QApplication::desktop()->height(); |