summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-10 14:36:13 (UTC)
committer zautrix <zautrix>2005-03-10 14:36:13 (UTC)
commit34f5a1b758adb98c466ae8e45c9d980d62dfc544 (patch) (side-by-side diff)
tree1ba10eac4df592da4b284bae029a864e40314d18
parentb96161e4dd7fc19eea87257c2455b85420dad35a (diff)
downloadkdepimpi-34f5a1b758adb98c466ae8e45c9d980d62dfc544.zip
kdepimpi-34f5a1b758adb98c466ae8e45c9d980d62dfc544.tar.gz
kdepimpi-34f5a1b758adb98c466ae8e45c9d980d62dfc544.tar.bz2
htmal tag fix
Diffstat (more/less context) (show 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
@@ -241,26 +241,26 @@ void KOEventViewer::appendEvent(Event *event, int mode )
{
mMailSubject = "";
mCurrentIncidence = event;
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
topLevelWidget()->setCaption(i18n("Event Viewer"));
if ( mode == 0 ) {
- addTag("h2",event->summary());
+ addTag("h2",deTag(event->summary()));
}
else {
if ( mColorMode == 1 ) {
mText +="<font color=\"#00A000\">";
}
if ( mColorMode == 2 ) {
mText +="<font color=\"#C00000\">";
}
// 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 )
mText += "</font>";
}
mMailSubject += i18n( "Meeting " )+ event->summary();
@@ -270,13 +270,13 @@ void KOEventViewer::appendEvent(Event *event, int mode )
mText.append("<br>");
mText += "</font>";
mMailSubject += i18n("(cancelled)");
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
- mText.append(event->location()+"<br>");
+ mText.append(deTag(event->location())+"<br>");
mMailSubject += i18n(" at ") + event->location();
}
if (event->doesFloat()) {
if (event->isMultiDay()) {
mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
.arg(event->dtStartDateStr(shortDate))
@@ -341,13 +341,13 @@ void KOEventViewer::appendEvent(Event *event, int mode )
mText.append(event->secrecyStr()+"<br>");
if ( KOPrefs::instance()->mEVshowDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
formatCategories(event);
formatReadOnly(event);
formatAttendees(event);
@@ -371,24 +371,24 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
{
mMailSubject = "";
mCurrentIncidence = event;
topLevelWidget()->setCaption(i18n("Todo Viewer"));
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
if (mode == 0 )
- addTag("h2",event->summary());
+ addTag("h2",deTag(event->summary()));
else {
if ( mColorMode == 1 ) {
mText +="<font color=\"#00A000\">";
}
if ( mColorMode == 2 ) {
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 )
mText += "</font>";
}
mMailSubject += i18n( "Todo " )+ event->summary();
@@ -409,13 +409,13 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
mText += "</font>";
mMailSubject += i18n("(cancelled)");
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
- mText.append(event->location()+"<br>");
+ mText.append(deTag(event->location())+"<br>");
mMailSubject += i18n(" at ") + event->location();
}
if (event->recurrence()->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
@@ -431,33 +431,33 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
}
addTag("b",i18n("Access: "));
mText.append(event->secrecyStr()+"<br>");
if ( KOPrefs::instance()->mEVshowDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
formatCategories(event);
mText.append(i18n("<p><b>Priority:</b> %2</p>")
.arg(QString::number(event->priority())));
formatReadOnly(event);
formatAttendees(event);
if ( event->relatedTo() ) {
addTag("b",i18n("Parent todo:<br>"));
- mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
+ mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
}
QPtrList<Incidence> Relations = event->relations();
Incidence *to;
if ( Relations.first() )
addTag("b",i18n("Sub todos:<br>"));
for (to=Relations.first();to;to=Relations.next()) {
- mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
+ mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
}
if ( KOPrefs::instance()->mEVshowCreated ) {
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
@@ -620,13 +620,13 @@ void KOEventViewer::appendJournal(Journal *jour, int mode )
}
}
topLevelWidget()->setCaption("Journal Viewer");
mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
if (!jour->description().isEmpty()) {
- addTag("p",jour->description());
+ addTag("p",deTag(jour->description()));
}
setText(mText);
}
void KOEventViewer::formatReadOnly(Incidence *event)
{
@@ -636,13 +636,12 @@ void KOEventViewer::formatReadOnly(Incidence *event)
}
void KOEventViewer::setSyncMode( bool b )
{
mSyncMode = b;
}
-
void KOEventViewer::setTodo(Todo *event, bool clearV )
{
if ( clearV )
clearEvents();
if ( mSyncMode ) {
if ( clearV )
@@ -690,12 +689,27 @@ void KOEventViewer::clearEvents(bool now)
void KOEventViewer::addText(QString text)
{
mText.append(text);
setText(mText);
}
+QString KOEventViewer::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;
+}
void KOEventViewer::keyPressEvent ( QKeyEvent * e )
{
switch ( e->key() ) {
case Qt::Key_Return:
case Qt::Key_Enter :
e->ignore();
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 2d4a08e..47cc5e9 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -62,12 +62,13 @@ class KOEventViewer : public QTextBrowser {
void formatReadOnly(Incidence *event);
void keyPressEvent ( QKeyEvent * e );
private:
QTextBrowser *mEventTextView;
bool mSyncMode;
+ QString deTag(QString text);
QString mText;
QString mMailSubject;
Incidence* mCurrentIncidence;
signals:
void launchaddressbook(QString uid);
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 1751ae3..57a9ede 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -48,26 +48,26 @@ KIncidenceFormatter::KIncidenceFormatter()
void KIncidenceFormatter::setEvent(Event *event)
{
int mode = 0;
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\">";
}
if ( mColorMode == 2 ) {
mText +="<font color=\"#C00000\">";
}
// 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 )
mText += "</font>";
}
if (event->cancelled ()) {
@@ -75,13 +75,13 @@ void KIncidenceFormatter::setEvent(Event *event)
addTag("i",i18n("This event has been cancelled!"));
mText.append("<br>");
mText += "</font>";
}
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()) {
mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
.arg(event->dtStartDateStr(shortDate))
.arg(event->dtEndDateStr(shortDate)));
@@ -141,13 +141,13 @@ void KIncidenceFormatter::setEvent(Event *event)
addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
// mText.append(event->secrecyStr()+"<br>");
formatCategories(event);
if ( mDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
formatReadOnly(event);
formatAttendees(event);
@@ -167,24 +167,24 @@ void KIncidenceFormatter::setEvent(Event *event)
void KIncidenceFormatter::setTodo(Todo *event )
{
int mode = 0;
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\">";
}
if ( mColorMode == 2 ) {
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 )
mText += "</font>";
}
if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
@@ -201,13 +201,13 @@ void KIncidenceFormatter::setTodo(Todo *event )
mText.append("<br>");
mText += "</font>";
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
- mText.append(event->location()+"<br>");
+ mText.append(deTag(event->location())+"<br>");
}
if (event->recurrence()->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
@@ -226,13 +226,13 @@ void KIncidenceFormatter::setTodo(Todo *event )
addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
formatCategories(event);
if ( mDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
- addTag("p",event->description());
+ addTag("p",deTag(event->description()));
}
}
formatReadOnly(event);
formatAttendees(event);
if ( mCreated ) {
addTag("p",i18n("<b>Created: ") +" </b>");
@@ -373,6 +373,21 @@ void KIncidenceFormatter::formatAttendees(Incidence *event)
void KIncidenceFormatter::formatReadOnly(Incidence *event)
{
if (event->isReadOnly()) {
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;
+}
diff --git a/libkcal/kincidenceformatter.h b/libkcal/kincidenceformatter.h
index 068e6d2..b5603e0 100644
--- a/libkcal/kincidenceformatter.h
+++ b/libkcal/kincidenceformatter.h
@@ -29,12 +29,13 @@ class KIncidenceFormatter : public QObject
void formatCategories(Incidence *event);
void formatAttendees(Incidence *event);
void formatReadOnly(Incidence *event);
private:
+ QString deTag(QString text);
bool mSyncMode;
bool mDetails, mCreated ,mModified;
QString mText;
Incidence* mCurrentIncidence;
static KIncidenceFormatter* mInstance;