-rw-r--r-- | korganizer/komonthview.cpp | 40 | ||||
-rw-r--r-- | korganizer/komonthview.h | 11 |
2 files changed, 45 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 08232e2..9344567 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -53,9 +53,11 @@ #include "komonthview.h" #define PIXMAP_SIZE 5 - +#ifdef DESKTOP_VERSION + QToolTipGroup *MonthViewCell::mToolTipGroup = 0; +#endif class KNOWhatsThis :public QWhatsThis { public: KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; @@ -83,9 +85,9 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 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()); } void KNoScrollListBox::keyPressEvent(QKeyEvent *e) @@ -294,9 +296,16 @@ MonthViewCell::MonthViewCell( KOMonthView *parent) SLOT( cellClicked( QListBoxItem * ) ) ); 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 ) { // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; @@ -391,13 +400,18 @@ void MonthViewCell::updateCell() } else { 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 ); Event *event; @@ -427,14 +441,18 @@ void MonthViewCell::updateCell() prefix ="<-" ; } } 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(); } } MonthViewItem *item = new MonthViewItem( event, mDate, text ); @@ -482,10 +500,13 @@ void MonthViewCell::updateCell() if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) insert = false; } - if ( insert ) + if ( insert ) { mItemList->insertItem( item ); + tipText += "\n"; + } else + tipText = ""; } // insert due todos QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); @@ -526,9 +547,15 @@ void MonthViewCell::updateCell() pal = mStandardPalette ; } item->setPalette( pal ); mItemList->insertItem( item ); + tipText += text+"\n"; } +#ifdef DESKTOP_VERSION + if (tipText != "") + QToolTip::add(this,tipText,toolTipGroup(),""); +#endif + //setMyPalette(); setMyPalette(); resizeEvent( 0 ); // if ( isVisible()) @@ -813,8 +840,11 @@ void KOMonthView::updateConfig() //resizeEvent( 0 ); for (uint i = 0; i < mCells.count(); ++i) { mCells[i]->updateConfig(); } +#ifdef DESKTOP_VERSION + MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); +#endif } void KOMonthView::updateDayLabels() { diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 5124057..4c1567c 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -35,8 +35,12 @@ #include <libkcal/event.h> #include "koeventview.h" +#ifdef DESKTOP_VERSION +class QToolTipGroup; +#endif + class KOWeekButton : public QPushButton { Q_OBJECT public: @@ -139,8 +143,11 @@ class MonthViewCell : public QWidget void deselect(); void select(); +#ifdef DESKTOP_VERSION + static QToolTipGroup *toolTipGroup(); +#endif signals: void defaultAction( Incidence * ); void newEventSignal( QDateTime ); void showDaySignal( QDate ); @@ -166,9 +173,11 @@ class MonthViewCell : public QWidget //QLabel *mLabel; QPushButton *mLabel; QListBox *mItemList; - +#ifdef DESKTOP_VERSION + static QToolTipGroup *mToolTipGroup; +#endif QSize mLabelSize; QSize mLabelBigSize; QPalette mHolidayPalette; QPalette mStandardPalette; |