author | zautrix <zautrix> | 2005-01-12 09:37:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-12 09:37:08 (UTC) |
commit | f408fee4c6ca34ee9c4d997c0f29d1c8975fa545 (patch) (unidiff) | |
tree | e91b6af3a8eccc19afdf10b465a58fee5fc03a17 | |
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 | |||
@@ -107,38 +107,16 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | |||
107 | setCellXY(0,0,1); | 107 | setCellXY(0,0,1); |
108 | setCellXWidth(0); | 108 | setCellXWidth(0); |
109 | setSubCell(0); | 109 | setSubCell(0); |
110 | setSubCells(1); | 110 | setSubCells(1); |
111 | setMultiItem(0,0,0); | 111 | setMultiItem(0,0,0); |
112 | startMove(); | 112 | startMove(); |
113 | mSelected = true; | 113 | mSelected = true; |
114 | select(false); | 114 | select(false); |
115 | QString tipText = mIncidence->summary(); | ||
116 | // QToolTip::add(this,tipText); | ||
117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | ||
118 | if ( !mIncidence->doesFloat() ) | ||
119 | if ( mIncidence->type() == "Event" ) { | ||
120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | ||
121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | ||
122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | ||
123 | } | ||
124 | else { | ||
125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | ||
126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | ||
127 | } | ||
128 | } | ||
129 | else if ( mIncidence->type() == "Todo" ) { | ||
130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); | ||
131 | } | ||
132 | |||
133 | if (!mIncidence->location().isEmpty()) { | ||
134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | ||
135 | } | ||
136 | QToolTip::add(this,tipText,toolTipGroup(),""); | ||
137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 115 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
138 | mFontPixelSize = fontinf.height();; | 116 | mFontPixelSize = fontinf.height();; |
139 | hide(); | 117 | hide(); |
140 | xPaintCoord = -1; | 118 | xPaintCoord = -1; |
141 | yPaintCoord = -1; | 119 | yPaintCoord = -1; |
142 | } | 120 | } |
143 | 121 | ||
144 | 122 | ||
@@ -483,16 +461,17 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) | |||
483 | paintFrom = paintPixAllday(); | 461 | paintFrom = paintPixAllday(); |
484 | else | 462 | else |
485 | paintFrom = paintPix(); | 463 | paintFrom = paintPix(); |
486 | } | 464 | } |
487 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); | 465 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); |
488 | } | 466 | } |
489 | void KOAgendaItem::computeText() | 467 | void KOAgendaItem::computeText() |
490 | { | 468 | { |
469 | |||
491 | mDisplayedText = mIncidence->summary(); | 470 | mDisplayedText = mIncidence->summary(); |
492 | if ( (mIncidence->type() == "Todo") ) { | 471 | if ( (mIncidence->type() == "Todo") ) { |
493 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 472 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
494 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 473 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
495 | else if ( !(mIncidence->doesFloat())) | 474 | else if ( !(mIncidence->doesFloat())) |
496 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 475 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
497 | 476 | ||
498 | 477 | ||
@@ -511,16 +490,46 @@ void KOAgendaItem::computeText() | |||
511 | 490 | ||
512 | if ( !mIncidence->location().isEmpty() ) { | 491 | if ( !mIncidence->location().isEmpty() ) { |
513 | if ( mAllDay ) | 492 | if ( mAllDay ) |
514 | mDisplayedText += " ("; | 493 | mDisplayedText += " ("; |
515 | else | 494 | else |
516 | mDisplayedText += "\n("; | 495 | mDisplayedText += "\n("; |
517 | mDisplayedText += mIncidence->location() +")"; | 496 | mDisplayedText += mIncidence->location() +")"; |
518 | } | 497 | } |
498 | |||
499 | QString tipText = mIncidence->summary(); | ||
500 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | ||
501 | if ( !mIncidence->doesFloat() ) { | ||
502 | if ( mIncidence->type() == "Event" ) { | ||
503 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | ||
504 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | ||
505 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | ||
506 | } | ||
507 | else { | ||
508 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | ||
509 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | ||
510 | } | ||
511 | } | ||
512 | else if ( mIncidence->type() == "Todo" ) { | ||
513 | if (mIncidence->hasStartDate()) | ||
514 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); | ||
515 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | ||
516 | } | ||
517 | } else if ( mIncidence->type() == "Todo" ) { | ||
518 | if (mIncidence->hasStartDate()) | ||
519 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); | ||
520 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | ||
521 | } | ||
522 | |||
523 | if (!mIncidence->location().isEmpty()) { | ||
524 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | ||
525 | } | ||
526 | QToolTip::add(this,tipText,toolTipGroup(),""); | ||
527 | |||
519 | } | 528 | } |
520 | void KOAgendaItem::updateItem() | 529 | void KOAgendaItem::updateItem() |
521 | { | 530 | { |
522 | computeText(); | 531 | computeText(); |
523 | 532 | ||
524 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); | 533 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); |
525 | paintMe( mSelected ); | 534 | paintMe( mSelected ); |
526 | repaint( false); | 535 | repaint( false); |