author | zautrix <zautrix> | 2005-03-10 14:36:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-10 14:36:13 (UTC) |
commit | 34f5a1b758adb98c466ae8e45c9d980d62dfc544 (patch) (unidiff) | |
tree | 1ba10eac4df592da4b284bae029a864e40314d18 | |
parent | b96161e4dd7fc19eea87257c2455b85420dad35a (diff) | |
download | kdepimpi-34f5a1b758adb98c466ae8e45c9d980d62dfc544.zip kdepimpi-34f5a1b758adb98c466ae8e45c9d980d62dfc544.tar.gz kdepimpi-34f5a1b758adb98c466ae8e45c9d980d62dfc544.tar.bz2 |
htmal tag fix
-rw-r--r-- | korganizer/koeventviewer.cpp | 42 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 35 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.h | 1 |
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 | |||
@@ -239,46 +239,46 @@ void KOEventViewer::setColorMode( int m ) | |||
239 | } | 239 | } |
240 | void KOEventViewer::appendEvent(Event *event, int mode ) | 240 | void KOEventViewer::appendEvent(Event *event, int mode ) |
241 | { | 241 | { |
242 | mMailSubject = ""; | 242 | mMailSubject = ""; |
243 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
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 ) { |
251 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
252 | } | 252 | } |
253 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
254 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
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 ) |
264 | mText += "</font>"; | 264 | mText += "</font>"; |
265 | } | 265 | } |
266 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
267 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
268 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
269 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
270 | mText.append("<br>"); | 270 | mText.append("<br>"); |
271 | mText += "</font>"; | 271 | mText += "</font>"; |
272 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
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()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
@@ -339,17 +339,17 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
339 | 339 | ||
340 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
341 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
342 | 342 | ||
343 | 343 | ||
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); |
351 | 351 | ||
352 | formatReadOnly(event); | 352 | formatReadOnly(event); |
353 | formatAttendees(event); | 353 | formatAttendees(event); |
354 | 354 | ||
355 | if ( KOPrefs::instance()->mEVshowCreated ) { | 355 | if ( KOPrefs::instance()->mEVshowCreated ) { |
@@ -369,28 +369,28 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
369 | 369 | ||
370 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 370 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
371 | { | 371 | { |
372 | mMailSubject = ""; | 372 | mMailSubject = ""; |
373 | mCurrentIncidence = event; | 373 | mCurrentIncidence = event; |
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\">"; |
381 | } | 381 | } |
382 | if ( mColorMode == 2 ) { | 382 | if ( mColorMode == 2 ) { |
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 ) |
392 | mText += "</font>"; | 392 | mText += "</font>"; |
393 | } | 393 | } |
394 | mMailSubject += i18n( "Todo " )+ event->summary(); | 394 | mMailSubject += i18n( "Todo " )+ event->summary(); |
395 | 395 | ||
396 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 396 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
@@ -407,17 +407,17 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
407 | addTag("i",i18n("This todo has been cancelled!")); | 407 | addTag("i",i18n("This todo has been cancelled!")); |
408 | mText.append("<br>"); | 408 | mText.append("<br>"); |
409 | mText += "</font>"; | 409 | mText += "</font>"; |
410 | mMailSubject += i18n("(cancelled)"); | 410 | mMailSubject += i18n("(cancelled)"); |
411 | } | 411 | } |
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 | ||
419 | if (event->recurrence()->doesRecur()) { | 419 | if (event->recurrence()->doesRecur()) { |
420 | 420 | ||
421 | QString recurText = event->recurrence()->recurrenceText(); | 421 | QString recurText = event->recurrence()->recurrenceText(); |
422 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 422 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
423 | 423 | ||
@@ -429,37 +429,37 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
429 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 429 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
430 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 430 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
431 | } | 431 | } |
432 | addTag("b",i18n("Access: ")); | 432 | addTag("b",i18n("Access: ")); |
433 | mText.append(event->secrecyStr()+"<br>"); | 433 | mText.append(event->secrecyStr()+"<br>"); |
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 | ||
441 | formatCategories(event); | 441 | formatCategories(event); |
442 | 442 | ||
443 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 443 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
444 | .arg(QString::number(event->priority()))); | 444 | .arg(QString::number(event->priority()))); |
445 | 445 | ||
446 | formatReadOnly(event); | 446 | formatReadOnly(event); |
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 ) { |
461 | addTag("p",i18n("<b>Created: ") +" </b>"); | 461 | addTag("p",i18n("<b>Created: ") +" </b>"); |
462 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 462 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
463 | 463 | ||
464 | } | 464 | } |
465 | if ( KOPrefs::instance()->mEVshowChanged ) { | 465 | if ( KOPrefs::instance()->mEVshowChanged ) { |
@@ -618,33 +618,32 @@ void KOEventViewer::appendJournal(Journal *jour, int mode ) | |||
618 | } else { | 618 | } else { |
619 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 619 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | topLevelWidget()->setCaption("Journal Viewer"); | 622 | topLevelWidget()->setCaption("Journal Viewer"); |
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 | } |
630 | 630 | ||
631 | void KOEventViewer::formatReadOnly(Incidence *event) | 631 | void KOEventViewer::formatReadOnly(Incidence *event) |
632 | { | 632 | { |
633 | if (event->isReadOnly()) { | 633 | if (event->isReadOnly()) { |
634 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 634 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
635 | } | 635 | } |
636 | } | 636 | } |
637 | void KOEventViewer::setSyncMode( bool b ) | 637 | void KOEventViewer::setSyncMode( bool b ) |
638 | { | 638 | { |
639 | mSyncMode = b; | 639 | mSyncMode = b; |
640 | } | 640 | } |
641 | 641 | ||
642 | |||
643 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 642 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
644 | { | 643 | { |
645 | if ( clearV ) | 644 | if ( clearV ) |
646 | clearEvents(); | 645 | clearEvents(); |
647 | if ( mSyncMode ) { | 646 | if ( mSyncMode ) { |
648 | if ( clearV ) | 647 | if ( clearV ) |
649 | appendTodo(event,1 ); | 648 | appendTodo(event,1 ); |
650 | else | 649 | else |
@@ -688,16 +687,31 @@ void KOEventViewer::clearEvents(bool now) | |||
688 | if (now) setText(mText); | 687 | if (now) setText(mText); |
689 | } | 688 | } |
690 | 689 | ||
691 | void KOEventViewer::addText(QString text) | 690 | void KOEventViewer::addText(QString text) |
692 | { | 691 | { |
693 | mText.append(text); | 692 | mText.append(text); |
694 | setText(mText); | 693 | setText(mText); |
695 | } | 694 | } |
695 | QString KOEventViewer::deTag(QString text) | ||
696 | { | ||
697 | #if QT_VERSION >= 0x030000 | ||
698 | text.replace( '<' , "<" ); | ||
699 | text.replace( '>' , ">" ); | ||
700 | #else | ||
701 | if ( text.find ('<') > 0 ) { | ||
702 | text.replace( QRegExp("<") , "<" ); | ||
703 | } | ||
704 | if ( text.find ('>') > 0 ) { | ||
705 | text.replace( QRegExp(">") , ">" ); | ||
706 | } | ||
707 | #endif | ||
708 | return text; | ||
709 | } | ||
696 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) | 710 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) |
697 | { | 711 | { |
698 | switch ( e->key() ) { | 712 | switch ( e->key() ) { |
699 | case Qt::Key_Return: | 713 | case Qt::Key_Return: |
700 | case Qt::Key_Enter : | 714 | case Qt::Key_Enter : |
701 | e->ignore(); | 715 | e->ignore(); |
702 | break; | 716 | break; |
703 | default: | 717 | default: |
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index 2d4a08e..47cc5e9 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h | |||
@@ -60,16 +60,17 @@ class KOEventViewer : public QTextBrowser { | |||
60 | void formatCategories(Incidence *event); | 60 | void formatCategories(Incidence *event); |
61 | void formatAttendees(Incidence *event); | 61 | void formatAttendees(Incidence *event); |
62 | void formatReadOnly(Incidence *event); | 62 | void formatReadOnly(Incidence *event); |
63 | void keyPressEvent ( QKeyEvent * e ); | 63 | void keyPressEvent ( QKeyEvent * e ); |
64 | 64 | ||
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; |
71 | Incidence* mCurrentIncidence; | 72 | Incidence* mCurrentIncidence; |
72 | signals: | 73 | signals: |
73 | void launchaddressbook(QString uid); | 74 | void launchaddressbook(QString uid); |
74 | }; | 75 | }; |
75 | 76 | ||
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 1751ae3..57a9ede 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -46,44 +46,44 @@ KIncidenceFormatter::KIncidenceFormatter() | |||
46 | mColorMode = 0; | 46 | mColorMode = 0; |
47 | } | 47 | } |
48 | void KIncidenceFormatter::setEvent(Event *event) | 48 | void KIncidenceFormatter::setEvent(Event *event) |
49 | { | 49 | { |
50 | int mode = 0; | 50 | int mode = 0; |
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 ) { |
58 | mText +="<font color=\"#00A000\">"; | 58 | mText +="<font color=\"#00A000\">"; |
59 | } | 59 | } |
60 | if ( mColorMode == 2 ) { | 60 | if ( mColorMode == 2 ) { |
61 | mText +="<font color=\"#C00000\">"; | 61 | mText +="<font color=\"#C00000\">"; |
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 ) |
71 | mText += "</font>"; | 71 | mText += "</font>"; |
72 | } | 72 | } |
73 | if (event->cancelled ()) { | 73 | if (event->cancelled ()) { |
74 | mText +="<font color=\"#B00000\">"; | 74 | mText +="<font color=\"#B00000\">"; |
75 | addTag("i",i18n("This event has been cancelled!")); | 75 | addTag("i",i18n("This event has been cancelled!")); |
76 | mText.append("<br>"); | 76 | mText.append("<br>"); |
77 | mText += "</font>"; | 77 | mText += "</font>"; |
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()) { |
85 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 85 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
86 | .arg(event->dtStartDateStr(shortDate)) | 86 | .arg(event->dtStartDateStr(shortDate)) |
87 | .arg(event->dtEndDateStr(shortDate))); | 87 | .arg(event->dtEndDateStr(shortDate))); |
88 | } else { | 88 | } else { |
89 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 89 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
@@ -139,17 +139,17 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 141 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
142 | // mText.append(event->secrecyStr()+"<br>"); | 142 | // mText.append(event->secrecyStr()+"<br>"); |
143 | formatCategories(event); | 143 | formatCategories(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 | ||
151 | formatReadOnly(event); | 151 | formatReadOnly(event); |
152 | formatAttendees(event); | 152 | formatAttendees(event); |
153 | 153 | ||
154 | if ( mCreated ) { | 154 | if ( mCreated ) { |
155 | addTag("p",i18n("<b>Created: ") +" </b>"); | 155 | addTag("p",i18n("<b>Created: ") +" </b>"); |
@@ -165,28 +165,28 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | void KIncidenceFormatter::setTodo(Todo *event ) | 167 | void KIncidenceFormatter::setTodo(Todo *event ) |
168 | { | 168 | { |
169 | int mode = 0; | 169 | int mode = 0; |
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\">"; |
177 | } | 177 | } |
178 | if ( mColorMode == 2 ) { | 178 | if ( mColorMode == 2 ) { |
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 ) |
188 | mText += "</font>"; | 188 | mText += "</font>"; |
189 | } | 189 | } |
190 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 190 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
191 | mText +="<font color=\"#B00000\">"; | 191 | mText +="<font color=\"#B00000\">"; |
192 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); | 192 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); |
@@ -199,17 +199,17 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
199 | mText +="<font color=\"#B00000\">"; | 199 | mText +="<font color=\"#B00000\">"; |
200 | addTag("i",i18n("This todo has been cancelled!")); | 200 | addTag("i",i18n("This todo has been cancelled!")); |
201 | mText.append("<br>"); | 201 | mText.append("<br>"); |
202 | mText += "</font>"; | 202 | mText += "</font>"; |
203 | } | 203 | } |
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()) { |
211 | 211 | ||
212 | QString recurText = event->recurrence()->recurrenceText(); | 212 | QString recurText = event->recurrence()->recurrenceText(); |
213 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 213 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
214 | } | 214 | } |
215 | 215 | ||
@@ -224,17 +224,17 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
224 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 224 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
225 | .arg(QString::number(event->priority()))); | 225 | .arg(QString::number(event->priority()))); |
226 | 226 | ||
227 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 227 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
228 | formatCategories(event); | 228 | formatCategories(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); |
236 | formatAttendees(event); | 236 | formatAttendees(event); |
237 | if ( mCreated ) { | 237 | if ( mCreated ) { |
238 | addTag("p",i18n("<b>Created: ") +" </b>"); | 238 | addTag("p",i18n("<b>Created: ") +" </b>"); |
239 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 239 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
240 | 240 | ||
@@ -371,8 +371,23 @@ void KIncidenceFormatter::formatAttendees(Incidence *event) | |||
371 | } | 371 | } |
372 | 372 | ||
373 | void KIncidenceFormatter::formatReadOnly(Incidence *event) | 373 | void KIncidenceFormatter::formatReadOnly(Incidence *event) |
374 | { | 374 | { |
375 | if (event->isReadOnly()) { | 375 | if (event->isReadOnly()) { |
376 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 376 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | QString KIncidenceFormatter::deTag(QString text) | ||
380 | { | ||
381 | #if QT_VERSION >= 0x030000 | ||
382 | text.replace( '<' , "<" ); | ||
383 | text.replace( '>' , ">" ); | ||
384 | #else | ||
385 | if ( text.find ('<') > 0 ) { | ||
386 | text.replace( QRegExp("<") , "<" ); | ||
387 | } | ||
388 | if ( text.find ('>') > 0 ) { | ||
389 | text.replace( QRegExp(">") , ">" ); | ||
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 | |||
@@ -27,16 +27,17 @@ class KIncidenceFormatter : public QObject | |||
27 | int mColorMode; | 27 | int mColorMode; |
28 | void addTag(const QString & tag,const QString & text); | 28 | void addTag(const QString & tag,const QString & text); |
29 | 29 | ||
30 | void formatCategories(Incidence *event); | 30 | void formatCategories(Incidence *event); |
31 | void formatAttendees(Incidence *event); | 31 | void formatAttendees(Incidence *event); |
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 | ||
38 | QString mText; | 39 | QString mText; |
39 | Incidence* mCurrentIncidence; | 40 | Incidence* mCurrentIncidence; |
40 | static KIncidenceFormatter* mInstance; | 41 | static KIncidenceFormatter* mInstance; |
41 | }; | 42 | }; |
42 | 43 | ||