author | zautrix <zautrix> | 2005-01-12 09:37:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-12 09:37:08 (UTC) |
commit | f408fee4c6ca34ee9c4d997c0f29d1c8975fa545 (patch) (side-by-side diff) | |
tree | e91b6af3a8eccc19afdf10b465a58fee5fc03a17 /korganizer | |
parent | b7753438e51d9b87da7d802ef1f5ac092e3266dd (diff) | |
download | kdepimpi-f408fee4c6ca34ee9c4d997c0f29d1c8975fa545.zip kdepimpi-f408fee4c6ca34ee9c4d997c0f29d1c8975fa545.tar.gz kdepimpi-f408fee4c6ca34ee9c4d997c0f29d1c8975fa545.tar.bz2 |
fix for tooltips in agenda view
-rw-r--r-- | korganizer/koagendaitem.cpp | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 62281d4..39355b4 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -103,46 +103,24 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) mBackgroundColor.dark(),mBackgroundColor.light(), mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; setBackgroundColor( mBackgroundColor ); setCellXY(0,0,1); setCellXWidth(0); setSubCell(0); setSubCells(1); setMultiItem(0,0,0); startMove(); mSelected = true; select(false); - QString tipText = mIncidence->summary(); - // QToolTip::add(this,tipText); - QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); - if ( !mIncidence->doesFloat() ) - if ( mIncidence->type() == "Event" ) { - if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { - tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); - tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); - } - else { - tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); - tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); - } - } - else if ( mIncidence->type() == "Todo" ) { - tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); - } - - if (!mIncidence->location().isEmpty()) { - tipText += "\n"+i18n("Location: ")+mIncidence->location(); - } - QToolTip::add(this,tipText,toolTipGroup(),""); QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); mFontPixelSize = fontinf.height();; hide(); xPaintCoord = -1; yPaintCoord = -1; } KOAgendaItem::~KOAgendaItem() { // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); @@ -479,24 +457,25 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) if ( mSelected ) { paintFrom = paintPixSel(); } else { if ( mAllDay ) paintFrom = paintPixAllday(); else paintFrom = paintPix(); } bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); } void KOAgendaItem::computeText() { + mDisplayedText = mIncidence->summary(); if ( (mIncidence->type() == "Todo") ) { 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())+")"; } else { if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; @@ -507,24 +486,54 @@ void KOAgendaItem::computeText() } } } if ( !mIncidence->location().isEmpty() ) { if ( mAllDay ) mDisplayedText += " ("; else mDisplayedText += "\n("; mDisplayedText += mIncidence->location() +")"; } + + QString tipText = mIncidence->summary(); + QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); + if ( !mIncidence->doesFloat() ) { + if ( mIncidence->type() == "Event" ) { + if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { + tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); + tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); + } + else { + tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); + tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); + } + } + else if ( mIncidence->type() == "Todo" ) { + if (mIncidence->hasStartDate()) + tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); + tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); + } + } else if ( mIncidence->type() == "Todo" ) { + if (mIncidence->hasStartDate()) + tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); + tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); + } + + if (!mIncidence->location().isEmpty()) { + tipText += "\n"+i18n("Location: ")+mIncidence->location(); + } + QToolTip::add(this,tipText,toolTipGroup(),""); + } void KOAgendaItem::updateItem() { computeText(); //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); paintMe( mSelected ); repaint( false); } void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) { |