summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp57
-rw-r--r--korganizer/kodaymatrix.h1
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
@@ -187,49 +187,82 @@ QString KODayMatrix::getWhatsThisText( QPoint p )
187 } 187 }
188 text = time + event->summary(); 188 text = time + event->summary();
189 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
190 } else { 190 } else {
191 if (event->doesFloat()) { 191 if (event->doesFloat()) {
192 text = event->summary(); 192 text = event->summary();
193 mToolTipText += text; 193 mToolTipText += text;
194 } 194 }
195 else { 195 else {
196 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
197 text += " " + event->summary(); 197 text += " " + event->summary();
198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
199 } 199 }
200 } 200 }
201 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
202 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
203#if QT_VERSION >= 0x030000
204 mToolTipText.replace( '<' , "&lt;" );
205 mToolTipText.replace( '>' , "&gt;" );
206#else
207 if ( mToolTipText.find ('<') >= 0 ) {
208 mToolTipText.replace( QRegExp("<") , "&lt;" );
209 }
210 if ( mToolTipText.find ('>') >= 0 ) {
211 mToolTipText.replace( QRegExp(">") , "&gt;" );
212 }
213#endif
214 //qDebug("TTT: %s ", mToolTipText.latin1()); 203 //qDebug("TTT: %s ", mToolTipText.latin1());
215 mToolTip.append( mToolTipText ); 204 mToolTip.append( deTag( mToolTipText ) );
205 }
206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
207 QPtrList<Todo> todolist = mCalendar->todos(mDate);
208 Todo *todo;
209 for(todo=todolist.first();todo != 0;todo=todolist.next()) {
210 QString mToolTipText;
211 if ( !todo->doesFloat() )
212 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
213 mToolTipText += todo->summary();
214 if ( !todo->location().isEmpty() )
215 mToolTipText += " (" + todo->location() + ")";
216 mToolTipText = deTag( mToolTipText);
217 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
218 mToolTip.append( mToolTipText );
219 }
216 } 220 }
217 mToolTip.sort(); 221 mToolTip.sort();
222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
223 Journal *j = mCalendar->journal( mDate );
224 if ( j ) {
225 QString mToolTipText = j->description().left(100);
226 if ( j->description().length() > 100 )
227 mToolTipText += " ...";
228 mToolTipText = deTag( mToolTipText);
229 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
230 mToolTip.append( mToolTipText );
231 }
232 }
218 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 233 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
219} 234}
235
236
237QString KODayMatrix::deTag( QString mToolTipText )
238{
239
240#if QT_VERSION >= 0x030000
241 mToolTipText.replace( '<' , "&lt;" );
242 mToolTipText.replace( '>' , "&gt;" );
243#else
244 if ( mToolTipText.find ('<') >= 0 ) {
245 mToolTipText.replace( QRegExp("<") , "&lt;" );
246 }
247 if ( mToolTipText.find ('>') >= 0 ) {
248 mToolTipText.replace( QRegExp(">") , "&gt;" );
249 }
250#endif
251 return mToolTipText;
252}
220void KODayMatrix::setCalendar( Calendar *cal ) 253void KODayMatrix::setCalendar( Calendar *cal )
221{ 254{
222 mCalendar = cal; 255 mCalendar = cal;
223 256
224 setAcceptDrops( mCalendar ); 257 setAcceptDrops( mCalendar );
225 258
226 updateEvents(); 259 updateEvents();
227} 260}
228 261
229QColor KODayMatrix::getShadedColor(QColor color) 262QColor KODayMatrix::getShadedColor(QColor color)
230{ 263{
231 QColor shaded; 264 QColor shaded;
232 int h=0; 265 int h=0;
233 int s=0; 266 int s=0;
234 int v=0; 267 int v=0;
235 color.hsv(&h,&s,&v); 268 color.hsv(&h,&s,&v);
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index a3216d6..b96e08f 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -194,32 +194,33 @@ public slots:
194signals: 194signals:
195 195
196 /** emitted if the user selects a block of days with the mouse by dragging a rectangle 196 /** emitted if the user selects a block of days with the mouse by dragging a rectangle
197 * inside the matrix 197 * inside the matrix
198 * 198 *
199 * @param daylist list of days that have been selected by the user 199 * @param daylist list of days that have been selected by the user
200 */ 200 */
201 void selected( const KCal::DateList &daylist ); 201 void selected( const KCal::DateList &daylist );
202 202
203 /** emitted if the user has dropped an event inside the matrix 203 /** emitted if the user has dropped an event inside the matrix
204 * 204 *
205 * @param event the dropped calendar event 205 * @param event the dropped calendar event
206 */ 206 */
207 void eventDropped(Event *event); 207 void eventDropped(Event *event);
208 208
209protected: 209protected:
210 QString deTag( QString mToolTipText );
210 211
211 void paintEvent(QPaintEvent *ev); 212 void paintEvent(QPaintEvent *ev);
212 213
213 void mousePressEvent (QMouseEvent* e); 214 void mousePressEvent (QMouseEvent* e);
214 215
215 void mouseReleaseEvent (QMouseEvent* e); 216 void mouseReleaseEvent (QMouseEvent* e);
216 217
217 void mouseMoveEvent (QMouseEvent* e); 218 void mouseMoveEvent (QMouseEvent* e);
218 219
219 void dragEnterEvent(QDragEnterEvent *); 220 void dragEnterEvent(QDragEnterEvent *);
220 221
221 void dragMoveEvent(QDragMoveEvent *); 222 void dragMoveEvent(QDragMoveEvent *);
222 223
223 void dragLeaveEvent(QDragLeaveEvent *); 224 void dragLeaveEvent(QDragLeaveEvent *);
224 225
225 void dropEvent(QDropEvent *); 226 void dropEvent(QDropEvent *);