-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 @@ #include "komonthview.h" #define PIXMAP_SIZE 5 - +#ifdef DESKTOP_VERSION + QToolTipGroup *MonthViewCell::mToolTipGroup = 0; +#endif class KNOWhatsThis :public QWhatsThis { public: @@ -84,7 +86,7 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p) { QListBoxItem* item = itemAt ( p ); if ( ! item ) { - return i18n("Click in the cell or\non the date label\nto add an event!"); + return i18n("Click in the cell\nto add an event!"); } return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); } @@ -295,6 +297,13 @@ MonthViewCell::MonthViewCell( KOMonthView *parent) connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), SLOT( selection( QListBoxItem * ) ) ); } +#ifdef DESKTOP_VERSION +QToolTipGroup *MonthViewCell::toolTipGroup() +{ + if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); + return mToolTipGroup; +} +#endif void MonthViewCell::setDate( const QDate &date ) { @@ -392,11 +401,16 @@ void MonthViewCell::updateCell() mItemList->setLineWidth( 1 ); } mItemList->clear(); +#ifdef DESKTOP_VERSION + QToolTip::remove(this); +#endif + QString tipText(""); //qApp->processEvents(); if ( !mHolidayString.isEmpty() ) { MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); item->setPalette( mHolidayPalette ); mItemList->insertItem( item ); + tipText += mHolidayString+"\n"; } //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); @@ -428,12 +442,16 @@ void MonthViewCell::updateCell() } } text = prefix + event->summary(); + tipText += text; } else { - if (event->doesFloat()) + if (event->doesFloat()) { text = event->summary(); + tipText += text; + } else { text = KGlobal::locale()->formatTime(event->dtStart().time()); text += " " + event->summary(); + tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); } } @@ -483,8 +501,11 @@ void MonthViewCell::updateCell() insert = false; } - if ( insert ) + if ( insert ) { mItemList->insertItem( item ); + tipText += "\n"; + } else + tipText = ""; } // insert due todos @@ -527,7 +548,13 @@ void MonthViewCell::updateCell() } item->setPalette( pal ); mItemList->insertItem( item ); + tipText += text+"\n"; } +#ifdef DESKTOP_VERSION + if (tipText != "") + QToolTip::add(this,tipText,toolTipGroup(),""); +#endif + //setMyPalette(); setMyPalette(); resizeEvent( 0 ); @@ -814,6 +841,9 @@ void KOMonthView::updateConfig() for (uint i = 0; i < mCells.count(); ++i) { mCells[i]->updateConfig(); } +#ifdef DESKTOP_VERSION + MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); +#endif } void KOMonthView::updateDayLabels() |