-rw-r--r-- | korganizer/komonthview.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 08232e2..9344567 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -54,7 +54,9 @@ | |||
54 | #include "komonthview.h" | 54 | #include "komonthview.h" |
55 | 55 | ||
56 | #define PIXMAP_SIZE 5 | 56 | #define PIXMAP_SIZE 5 |
57 | 57 | #ifdef DESKTOP_VERSION | |
58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | ||
59 | #endif | ||
58 | class KNOWhatsThis :public QWhatsThis | 60 | class KNOWhatsThis :public QWhatsThis |
59 | { | 61 | { |
60 | public: | 62 | public: |
@@ -84,7 +86,7 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p) | |||
84 | { | 86 | { |
85 | QListBoxItem* item = itemAt ( p ); | 87 | QListBoxItem* item = itemAt ( p ); |
86 | if ( ! item ) { | 88 | if ( ! item ) { |
87 | return i18n("Click in the cell or\non the date label\nto add an event!"); | 89 | return i18n("Click in the cell\nto add an event!"); |
88 | } | 90 | } |
89 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 91 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
90 | } | 92 | } |
@@ -295,6 +297,13 @@ MonthViewCell::MonthViewCell( KOMonthView *parent) | |||
295 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 297 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
296 | SLOT( selection( QListBoxItem * ) ) ); | 298 | SLOT( selection( QListBoxItem * ) ) ); |
297 | } | 299 | } |
300 | #ifdef DESKTOP_VERSION | ||
301 | QToolTipGroup *MonthViewCell::toolTipGroup() | ||
302 | { | ||
303 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | ||
304 | return mToolTipGroup; | ||
305 | } | ||
306 | #endif | ||
298 | 307 | ||
299 | void MonthViewCell::setDate( const QDate &date ) | 308 | void MonthViewCell::setDate( const QDate &date ) |
300 | { | 309 | { |
@@ -392,11 +401,16 @@ void MonthViewCell::updateCell() | |||
392 | mItemList->setLineWidth( 1 ); | 401 | mItemList->setLineWidth( 1 ); |
393 | } | 402 | } |
394 | mItemList->clear(); | 403 | mItemList->clear(); |
404 | #ifdef DESKTOP_VERSION | ||
405 | QToolTip::remove(this); | ||
406 | #endif | ||
407 | QString tipText(""); | ||
395 | //qApp->processEvents(); | 408 | //qApp->processEvents(); |
396 | if ( !mHolidayString.isEmpty() ) { | 409 | if ( !mHolidayString.isEmpty() ) { |
397 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 410 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
398 | item->setPalette( mHolidayPalette ); | 411 | item->setPalette( mHolidayPalette ); |
399 | mItemList->insertItem( item ); | 412 | mItemList->insertItem( item ); |
413 | tipText += mHolidayString+"\n"; | ||
400 | } | 414 | } |
401 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 415 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
402 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 416 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
@@ -428,12 +442,16 @@ void MonthViewCell::updateCell() | |||
428 | } | 442 | } |
429 | } | 443 | } |
430 | text = prefix + event->summary(); | 444 | text = prefix + event->summary(); |
445 | tipText += text; | ||
431 | } else { | 446 | } else { |
432 | if (event->doesFloat()) | 447 | if (event->doesFloat()) { |
433 | text = event->summary(); | 448 | text = event->summary(); |
449 | tipText += text; | ||
450 | } | ||
434 | else { | 451 | else { |
435 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 452 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
436 | text += " " + event->summary(); | 453 | text += " " + event->summary(); |
454 | tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | ||
437 | } | 455 | } |
438 | } | 456 | } |
439 | 457 | ||
@@ -483,8 +501,11 @@ void MonthViewCell::updateCell() | |||
483 | insert = false; | 501 | insert = false; |
484 | 502 | ||
485 | } | 503 | } |
486 | if ( insert ) | 504 | if ( insert ) { |
487 | mItemList->insertItem( item ); | 505 | mItemList->insertItem( item ); |
506 | tipText += "\n"; | ||
507 | } else | ||
508 | tipText = ""; | ||
488 | } | 509 | } |
489 | 510 | ||
490 | // insert due todos | 511 | // insert due todos |
@@ -527,7 +548,13 @@ void MonthViewCell::updateCell() | |||
527 | } | 548 | } |
528 | item->setPalette( pal ); | 549 | item->setPalette( pal ); |
529 | mItemList->insertItem( item ); | 550 | mItemList->insertItem( item ); |
551 | tipText += text+"\n"; | ||
530 | } | 552 | } |
553 | #ifdef DESKTOP_VERSION | ||
554 | if (tipText != "") | ||
555 | QToolTip::add(this,tipText,toolTipGroup(),""); | ||
556 | #endif | ||
557 | |||
531 | //setMyPalette(); | 558 | //setMyPalette(); |
532 | setMyPalette(); | 559 | setMyPalette(); |
533 | resizeEvent( 0 ); | 560 | resizeEvent( 0 ); |
@@ -814,6 +841,9 @@ void KOMonthView::updateConfig() | |||
814 | for (uint i = 0; i < mCells.count(); ++i) { | 841 | for (uint i = 0; i < mCells.count(); ++i) { |
815 | mCells[i]->updateConfig(); | 842 | mCells[i]->updateConfig(); |
816 | } | 843 | } |
844 | #ifdef DESKTOP_VERSION | ||
845 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | ||
846 | #endif | ||
817 | } | 847 | } |
818 | 848 | ||
819 | void KOMonthView::updateDayLabels() | 849 | void KOMonthView::updateDayLabels() |