summaryrefslogtreecommitdiffabout
path: root/libkcal/kincidenceformatter.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/kincidenceformatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp35
1 files changed, 25 insertions, 10 deletions
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)
mCurrentIncidence = event;
bool shortDate = true;
if ( mode == 0 ) {
- addTag("h3",event->summary());
+ addTag("h3",deTag(event->summary()));
}
else {
if ( mColorMode == 1 ) {
@@ -62,9 +62,9 @@ void KIncidenceFormatter::setEvent(Event *event)
}
// mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
if ( mode == 1 ) {
- addTag("h2",i18n( "Local: " ) +event->summary());
+ addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
} else {
- addTag("h2",i18n( "Remote: " ) +event->summary());
+ addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
}
addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
if ( mColorMode )
@@ -78,7 +78,7 @@ void KIncidenceFormatter::setEvent(Event *event)
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
- mText.append(event->location()+"<br>");
+ mText.append(deTag(event->location())+"<br>");
}
if (event->doesFloat()) {
if (event->isMultiDay()) {
@@ -144,7 +144,7 @@ void KIncidenceFormatter::setEvent(Event *event)
if ( mDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
@@ -170,7 +170,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
mCurrentIncidence = event;
bool shortDate = true;
if (mode == 0 )
- addTag("h3",event->summary());
+ addTag("h3",deTag(event->summary()));
else {
if ( mColorMode == 1 ) {
mText +="<font color=\"#00A000\">";
@@ -179,9 +179,9 @@ void KIncidenceFormatter::setTodo(Todo *event )
mText +="<font color=\"#B00000\">";
}
if ( mode == 1 ) {
- addTag("h2",i18n( "Local: " ) +event->summary());
+ addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
} else {
- addTag("h2",i18n( "Remote: " ) +event->summary());
+ addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
}
addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
if ( mColorMode )
@@ -204,7 +204,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
- mText.append(event->location()+"<br>");
+ mText.append(deTag(event->location())+"<br>");
}
if (event->recurrence()->doesRecur()) {
@@ -229,7 +229,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
if ( mDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
formatReadOnly(event);
@@ -376,3 +376,18 @@ void KIncidenceFormatter::formatReadOnly(Incidence *event)
addTag("p","<em>(" + i18n("read-only") + ")</em>");
}
}
+QString KIncidenceFormatter::deTag(QString text)
+{
+#if QT_VERSION >= 0x030000
+ text.replace( '<' , "&lt;" );
+ text.replace( '>' , "&gt;" );
+#else
+ if ( text.find ('<') > 0 ) {
+ text.replace( QRegExp("<") , "&lt;" );
+ }
+ if ( text.find ('>') > 0 ) {
+ text.replace( QRegExp(">") , "&gt;" );
+ }
+#endif
+ return text;
+}