summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp35
-rw-r--r--libkcal/kincidenceformatter.h1
2 files changed, 26 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
@@ -52,5 +52,5 @@ void KIncidenceFormatter::setEvent(Event *event)
bool shortDate = true;
if ( mode == 0 ) {
- addTag("h3",event->summary());
+ addTag("h3",deTag(event->summary()));
}
else {
@@ -63,7 +63,7 @@ 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 ) );
@@ -79,5 +79,5 @@ 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()) {
@@ -145,5 +145,5 @@ void KIncidenceFormatter::setEvent(Event *event)
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
@@ -171,5 +171,5 @@ void KIncidenceFormatter::setTodo(Todo *event )
bool shortDate = true;
if (mode == 0 )
- addTag("h3",event->summary());
+ addTag("h3",deTag(event->summary()));
else {
if ( mColorMode == 1 ) {
@@ -180,7 +180,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
}
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 ) );
@@ -205,5 +205,5 @@ void KIncidenceFormatter::setTodo(Todo *event )
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
- mText.append(event->location()+"<br>");
+ mText.append(deTag(event->location())+"<br>");
}
@@ -230,5 +230,5 @@ void KIncidenceFormatter::setTodo(Todo *event )
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
@@ -377,2 +377,17 @@ void KIncidenceFormatter::formatReadOnly(Incidence *event)
}
}
+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;
+}
diff --git a/libkcal/kincidenceformatter.h b/libkcal/kincidenceformatter.h
index 068e6d2..b5603e0 100644
--- a/libkcal/kincidenceformatter.h
+++ b/libkcal/kincidenceformatter.h
@@ -33,4 +33,5 @@ class KIncidenceFormatter : public QObject
private:
+ QString deTag(QString text);
bool mSyncMode;
bool mDetails, mCreated ,mModified;