summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp42
-rw-r--r--korganizer/koeventviewer.h1
-rw-r--r--libkcal/kincidenceformatter.cpp35
-rw-r--r--libkcal/kincidenceformatter.h1
4 files changed, 55 insertions, 24 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 44da058..135ca73 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -244,7 +244,7 @@ void KOEventViewer::appendEvent(Event *event, int mode )
244 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 244 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
245 topLevelWidget()->setCaption(i18n("Event Viewer")); 245 topLevelWidget()->setCaption(i18n("Event Viewer"));
246 if ( mode == 0 ) { 246 if ( mode == 0 ) {
247 addTag("h2",event->summary()); 247 addTag("h2",deTag(event->summary()));
248 } 248 }
249 else { 249 else {
250 if ( mColorMode == 1 ) { 250 if ( mColorMode == 1 ) {
@@ -255,9 +255,9 @@ void KOEventViewer::appendEvent(Event *event, int mode )
255 } 255 }
256 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 256 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
257 if ( mode == 1 ) { 257 if ( mode == 1 ) {
258 addTag("h2",i18n( "Local: " ) +event->summary()); 258 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
259 } else { 259 } else {
260 addTag("h2",i18n( "Remote: " ) +event->summary()); 260 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
261 } 261 }
262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
263 if ( mColorMode ) 263 if ( mColorMode )
@@ -273,7 +273,7 @@ void KOEventViewer::appendEvent(Event *event, int mode )
273 } 273 }
274 if (!event->location().isEmpty()) { 274 if (!event->location().isEmpty()) {
275 addTag("b",i18n("Location: ")); 275 addTag("b",i18n("Location: "));
276 mText.append(event->location()+"<br>"); 276 mText.append(deTag(event->location())+"<br>");
277 mMailSubject += i18n(" at ") + event->location(); 277 mMailSubject += i18n(" at ") + event->location();
278 } 278 }
279 if (event->doesFloat()) { 279 if (event->doesFloat()) {
@@ -344,7 +344,7 @@ void KOEventViewer::appendEvent(Event *event, int mode )
344 if ( KOPrefs::instance()->mEVshowDetails ) { 344 if ( KOPrefs::instance()->mEVshowDetails ) {
345 if (!event->description().isEmpty()) { 345 if (!event->description().isEmpty()) {
346 addTag("p",i18n("<b>Details: </b>")); 346 addTag("p",i18n("<b>Details: </b>"));
347 addTag("p",event->description()); 347 addTag("p",deTag(event->description()));
348 } 348 }
349 } 349 }
350 formatCategories(event); 350 formatCategories(event);
@@ -374,7 +374,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
374 topLevelWidget()->setCaption(i18n("Todo Viewer")); 374 topLevelWidget()->setCaption(i18n("Todo Viewer"));
375 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 375 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
376 if (mode == 0 ) 376 if (mode == 0 )
377 addTag("h2",event->summary()); 377 addTag("h2",deTag(event->summary()));
378 else { 378 else {
379 if ( mColorMode == 1 ) { 379 if ( mColorMode == 1 ) {
380 mText +="<font color=\"#00A000\">"; 380 mText +="<font color=\"#00A000\">";
@@ -383,9 +383,9 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
383 mText +="<font color=\"#B00000\">"; 383 mText +="<font color=\"#B00000\">";
384 } 384 }
385 if ( mode == 1 ) { 385 if ( mode == 1 ) {
386 addTag("h2",i18n( "Local: " ) +event->summary()); 386 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
387 } else { 387 } else {
388 addTag("h2",i18n( "Remote: " ) +event->summary()); 388 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
389 } 389 }
390 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 390 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
391 if ( mColorMode ) 391 if ( mColorMode )
@@ -412,7 +412,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
412 412
413 if (!event->location().isEmpty()) { 413 if (!event->location().isEmpty()) {
414 addTag("b",i18n("Location: ")); 414 addTag("b",i18n("Location: "));
415 mText.append(event->location()+"<br>"); 415 mText.append(deTag(event->location())+"<br>");
416 mMailSubject += i18n(" at ") + event->location(); 416 mMailSubject += i18n(" at ") + event->location();
417 } 417 }
418 418
@@ -434,7 +434,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
434 if ( KOPrefs::instance()->mEVshowDetails ) { 434 if ( KOPrefs::instance()->mEVshowDetails ) {
435 if (!event->description().isEmpty()) { 435 if (!event->description().isEmpty()) {
436 addTag("p",i18n("<b>Details: </b>")); 436 addTag("p",i18n("<b>Details: </b>"));
437 addTag("p",event->description()); 437 addTag("p",deTag(event->description()));
438 } 438 }
439 } 439 }
440 440
@@ -447,14 +447,14 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
447 formatAttendees(event); 447 formatAttendees(event);
448 if ( event->relatedTo() ) { 448 if ( event->relatedTo() ) {
449 addTag("b",i18n("Parent todo:<br>")); 449 addTag("b",i18n("Parent todo:<br>"));
450 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 450 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
451 } 451 }
452 QPtrList<Incidence> Relations = event->relations(); 452 QPtrList<Incidence> Relations = event->relations();
453 Incidence *to; 453 Incidence *to;
454 if ( Relations.first() ) 454 if ( Relations.first() )
455 addTag("b",i18n("Sub todos:<br>")); 455 addTag("b",i18n("Sub todos:<br>"));
456 for (to=Relations.first();to;to=Relations.next()) { 456 for (to=Relations.first();to;to=Relations.next()) {
457 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 457 mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
458 458
459 } 459 }
460 if ( KOPrefs::instance()->mEVshowCreated ) { 460 if ( KOPrefs::instance()->mEVshowCreated ) {
@@ -623,7 +623,7 @@ void KOEventViewer::appendJournal(Journal *jour, int mode )
623 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 623 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
624 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 624 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
625 if (!jour->description().isEmpty()) { 625 if (!jour->description().isEmpty()) {
626 addTag("p",jour->description()); 626 addTag("p",deTag(jour->description()));
627 } 627 }
628 setText(mText); 628 setText(mText);
629} 629}
@@ -639,7 +639,6 @@ void KOEventViewer::setSyncMode( bool b )
639 mSyncMode = b; 639 mSyncMode = b;
640} 640}
641 641
642
643void KOEventViewer::setTodo(Todo *event, bool clearV ) 642void KOEventViewer::setTodo(Todo *event, bool clearV )
644{ 643{
645 if ( clearV ) 644 if ( clearV )
@@ -693,6 +692,21 @@ void KOEventViewer::addText(QString text)
693 mText.append(text); 692 mText.append(text);
694 setText(mText); 693 setText(mText);
695} 694}
695QString KOEventViewer::deTag(QString text)
696{
697#if QT_VERSION >= 0x030000
698 text.replace( '<' , "&lt;" );
699 text.replace( '>' , "&gt;" );
700#else
701 if ( text.find ('<') > 0 ) {
702 text.replace( QRegExp("<") , "&lt;" );
703 }
704 if ( text.find ('>') > 0 ) {
705 text.replace( QRegExp(">") , "&gt;" );
706 }
707#endif
708 return text;
709}
696void KOEventViewer::keyPressEvent ( QKeyEvent * e ) 710void KOEventViewer::keyPressEvent ( QKeyEvent * e )
697{ 711{
698 switch ( e->key() ) { 712 switch ( e->key() ) {
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 2d4a08e..47cc5e9 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -65,6 +65,7 @@ class KOEventViewer : public QTextBrowser {
65 private: 65 private:
66 QTextBrowser *mEventTextView; 66 QTextBrowser *mEventTextView;
67 bool mSyncMode; 67 bool mSyncMode;
68 QString deTag(QString text);
68 69
69 QString mText; 70 QString mText;
70 QString mMailSubject; 71 QString mMailSubject;
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 1751ae3..57a9ede 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -51,7 +51,7 @@ void KIncidenceFormatter::setEvent(Event *event)
51 mCurrentIncidence = event; 51 mCurrentIncidence = event;
52 bool shortDate = true; 52 bool shortDate = true;
53 if ( mode == 0 ) { 53 if ( mode == 0 ) {
54 addTag("h3",event->summary()); 54 addTag("h3",deTag(event->summary()));
55 } 55 }
56 else { 56 else {
57 if ( mColorMode == 1 ) { 57 if ( mColorMode == 1 ) {
@@ -62,9 +62,9 @@ void KIncidenceFormatter::setEvent(Event *event)
62 } 62 }
63 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 63 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
64 if ( mode == 1 ) { 64 if ( mode == 1 ) {
65 addTag("h2",i18n( "Local: " ) +event->summary()); 65 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
66 } else { 66 } else {
67 addTag("h2",i18n( "Remote: " ) +event->summary()); 67 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
68 } 68 }
69 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 69 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
70 if ( mColorMode ) 70 if ( mColorMode )
@@ -78,7 +78,7 @@ void KIncidenceFormatter::setEvent(Event *event)
78 } 78 }
79 if (!event->location().isEmpty()) { 79 if (!event->location().isEmpty()) {
80 addTag("b",i18n("Location: ")); 80 addTag("b",i18n("Location: "));
81 mText.append(event->location()+"<br>"); 81 mText.append(deTag(event->location())+"<br>");
82 } 82 }
83 if (event->doesFloat()) { 83 if (event->doesFloat()) {
84 if (event->isMultiDay()) { 84 if (event->isMultiDay()) {
@@ -144,7 +144,7 @@ void KIncidenceFormatter::setEvent(Event *event)
144 if ( mDetails ) { 144 if ( mDetails ) {
145 if (!event->description().isEmpty()) { 145 if (!event->description().isEmpty()) {
146 addTag("p",i18n("<b>Details: </b>")); 146 addTag("p",i18n("<b>Details: </b>"));
147 addTag("p",event->description()); 147 addTag("p",deTag(event->description()));
148 } 148 }
149 } 149 }
150 150
@@ -170,7 +170,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
170 mCurrentIncidence = event; 170 mCurrentIncidence = event;
171 bool shortDate = true; 171 bool shortDate = true;
172 if (mode == 0 ) 172 if (mode == 0 )
173 addTag("h3",event->summary()); 173 addTag("h3",deTag(event->summary()));
174 else { 174 else {
175 if ( mColorMode == 1 ) { 175 if ( mColorMode == 1 ) {
176 mText +="<font color=\"#00A000\">"; 176 mText +="<font color=\"#00A000\">";
@@ -179,9 +179,9 @@ void KIncidenceFormatter::setTodo(Todo *event )
179 mText +="<font color=\"#B00000\">"; 179 mText +="<font color=\"#B00000\">";
180 } 180 }
181 if ( mode == 1 ) { 181 if ( mode == 1 ) {
182 addTag("h2",i18n( "Local: " ) +event->summary()); 182 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
183 } else { 183 } else {
184 addTag("h2",i18n( "Remote: " ) +event->summary()); 184 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
185 } 185 }
186 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 186 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
187 if ( mColorMode ) 187 if ( mColorMode )
@@ -204,7 +204,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
204 204
205 if (!event->location().isEmpty()) { 205 if (!event->location().isEmpty()) {
206 addTag("b",i18n("Location: ")); 206 addTag("b",i18n("Location: "));
207 mText.append(event->location()+"<br>"); 207 mText.append(deTag(event->location())+"<br>");
208 } 208 }
209 209
210 if (event->recurrence()->doesRecur()) { 210 if (event->recurrence()->doesRecur()) {
@@ -229,7 +229,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
229 if ( mDetails ) { 229 if ( mDetails ) {
230 if (!event->description().isEmpty()) { 230 if (!event->description().isEmpty()) {
231 addTag("p",i18n("<b>Details: </b>")); 231 addTag("p",i18n("<b>Details: </b>"));
232 addTag("p",event->description()); 232 addTag("p",deTag(event->description()));
233 } 233 }
234 } 234 }
235 formatReadOnly(event); 235 formatReadOnly(event);
@@ -376,3 +376,18 @@ void KIncidenceFormatter::formatReadOnly(Incidence *event)
376 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 376 addTag("p","<em>(" + i18n("read-only") + ")</em>");
377 } 377 }
378} 378}
379QString KIncidenceFormatter::deTag(QString text)
380{
381#if QT_VERSION >= 0x030000
382 text.replace( '<' , "&lt;" );
383 text.replace( '>' , "&gt;" );
384#else
385 if ( text.find ('<') > 0 ) {
386 text.replace( QRegExp("<") , "&lt;" );
387 }
388 if ( text.find ('>') > 0 ) {
389 text.replace( QRegExp(">") , "&gt;" );
390 }
391#endif
392 return text;
393}
diff --git a/libkcal/kincidenceformatter.h b/libkcal/kincidenceformatter.h
index 068e6d2..b5603e0 100644
--- a/libkcal/kincidenceformatter.h
+++ b/libkcal/kincidenceformatter.h
@@ -32,6 +32,7 @@ class KIncidenceFormatter : public QObject
32 void formatReadOnly(Incidence *event); 32 void formatReadOnly(Incidence *event);
33 33
34 private: 34 private:
35 QString deTag(QString text);
35 bool mSyncMode; 36 bool mSyncMode;
36 bool mDetails, mCreated ,mModified; 37 bool mDetails, mCreated ,mModified;
37 38