-rw-r--r-- | korganizer/kodaymatrix.cpp | 57 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 1 |
2 files changed, 46 insertions, 12 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 53ebdb2..4366265 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -191,41 +191,74 @@ QString KODayMatrix::getWhatsThisText( QPoint p ) if (event->doesFloat()) { text = event->summary(); mToolTipText += text; } else { text = KGlobal::locale()->formatTime(event->dtStart().time()); text += " " + event->summary(); mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); } } if ( !event->location().isEmpty() ) mToolTipText += " (" + event->location() + ")"; -#if QT_VERSION >= 0x030000 - mToolTipText.replace( '<' , "<" ); - mToolTipText.replace( '>' , ">" ); -#else - if ( mToolTipText.find ('<') >= 0 ) { - mToolTipText.replace( QRegExp("<") , "<" ); - } - if ( mToolTipText.find ('>') >= 0 ) { - mToolTipText.replace( QRegExp(">") , ">" ); - } -#endif //qDebug("TTT: %s ", mToolTipText.latin1()); - mToolTip.append( mToolTipText ); + mToolTip.append( deTag( mToolTipText ) ); + } + if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { + QPtrList<Todo> todolist = mCalendar->todos(mDate); + Todo *todo; + for(todo=todolist.first();todo != 0;todo=todolist.next()) { + QString mToolTipText; + if ( !todo->doesFloat() ) + mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" "; + mToolTipText += todo->summary(); + if ( !todo->location().isEmpty() ) + mToolTipText += " (" + todo->location() + ")"; + mToolTipText = deTag( mToolTipText); + mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; + mToolTip.append( mToolTipText ); + } } mToolTip.sort(); + if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { + Journal *j = mCalendar->journal( mDate ); + if ( j ) { + QString mToolTipText = j->description().left(100); + if ( j->description().length() > 100 ) + mToolTipText += " ..."; + mToolTipText = deTag( mToolTipText); + mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; + mToolTip.append( mToolTipText ); + } + } return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); } + + +QString KODayMatrix::deTag( QString mToolTipText ) +{ + +#if QT_VERSION >= 0x030000 + mToolTipText.replace( '<' , "<" ); + mToolTipText.replace( '>' , ">" ); +#else + if ( mToolTipText.find ('<') >= 0 ) { + mToolTipText.replace( QRegExp("<") , "<" ); + } + if ( mToolTipText.find ('>') >= 0 ) { + mToolTipText.replace( QRegExp(">") , ">" ); + } +#endif + return mToolTipText; +} void KODayMatrix::setCalendar( Calendar *cal ) { mCalendar = cal; setAcceptDrops( mCalendar ); updateEvents(); } QColor KODayMatrix::getShadedColor(QColor color) { QColor shaded; diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index a3216d6..b96e08f 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h @@ -198,24 +198,25 @@ signals: * * @param daylist list of days that have been selected by the user */ void selected( const KCal::DateList &daylist ); /** emitted if the user has dropped an event inside the matrix * * @param event the dropped calendar event */ void eventDropped(Event *event); protected: + QString deTag( QString mToolTipText ); void paintEvent(QPaintEvent *ev); void mousePressEvent (QMouseEvent* e); void mouseReleaseEvent (QMouseEvent* e); void mouseMoveEvent (QMouseEvent* e); void dragEnterEvent(QDragEnterEvent *); void dragMoveEvent(QDragMoveEvent *); |