From 34f5a1b758adb98c466ae8e45c9d980d62dfc544 Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 10 Mar 2005 14:36:13 +0000 Subject: htmal tag fix --- 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 ) 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 ) { @@ -255,9 +255,9 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } // mText +="" + i18n("O-due!") + ""; 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 ) @@ -273,7 +273,7 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } if (!event->location().isEmpty()) { addTag("b",i18n("Location: ")); - mText.append(event->location()+"
"); + mText.append(deTag(event->location())+"
"); mMailSubject += i18n(" at ") + event->location(); } if (event->doesFloat()) { @@ -344,7 +344,7 @@ void KOEventViewer::appendEvent(Event *event, int mode ) if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("Details: ")); - addTag("p",event->description()); + addTag("p",deTag(event->description())); } } formatCategories(event); @@ -374,7 +374,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) 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 +=""; @@ -383,9 +383,9 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText +=""; } 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 ) @@ -412,7 +412,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) if (!event->location().isEmpty()) { addTag("b",i18n("Location: ")); - mText.append(event->location()+"
"); + mText.append(deTag(event->location())+"
"); mMailSubject += i18n(" at ") + event->location(); } @@ -434,7 +434,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("Details: ")); - addTag("p",event->description()); + addTag("p",deTag(event->description())); } } @@ -447,14 +447,14 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) formatAttendees(event); if ( event->relatedTo() ) { addTag("b",i18n("Parent todo:
")); - mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%]
"); + mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%]
"); } QPtrList Relations = event->relations(); Incidence *to; if ( Relations.first() ) addTag("b",i18n("Sub todos:
")); for (to=Relations.first();to;to=Relations.next()) { - mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]
"); + mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]
"); } if ( KOPrefs::instance()->mEVshowCreated ) { @@ -623,7 +623,7 @@ void KOEventViewer::appendJournal(Journal *jour, int mode ) mText.append(i18n("

%1

").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); } @@ -639,7 +639,6 @@ void KOEventViewer::setSyncMode( bool b ) mSyncMode = b; } - void KOEventViewer::setTodo(Todo *event, bool clearV ) { if ( clearV ) @@ -693,6 +692,21 @@ void KOEventViewer::addText(QString text) mText.append(text); setText(mText); } +QString KOEventViewer::deTag(QString text) +{ +#if QT_VERSION >= 0x030000 + text.replace( '<' , "<" ); + text.replace( '>' , ">" ); +#else + if ( text.find ('<') > 0 ) { + text.replace( QRegExp("<") , "<" ); + } + if ( text.find ('>') > 0 ) { + text.replace( QRegExp(">") , ">" ); + } +#endif + return text; +} void KOEventViewer::keyPressEvent ( QKeyEvent * e ) { 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 { private: QTextBrowser *mEventTextView; bool mSyncMode; + QString deTag(QString text); QString mText; 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) 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 +="" + i18n("O-due!") + ""; 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()+"
"); + mText.append(deTag(event->location())+"
"); } if (event->doesFloat()) { if (event->isMultiDay()) { @@ -144,7 +144,7 @@ void KIncidenceFormatter::setEvent(Event *event) if ( mDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("Details: ")); - 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 +=""; @@ -179,9 +179,9 @@ void KIncidenceFormatter::setTodo(Todo *event ) mText +=""; } 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()+"
"); + mText.append(deTag(event->location())+"
"); } if (event->recurrence()->doesRecur()) { @@ -229,7 +229,7 @@ void KIncidenceFormatter::setTodo(Todo *event ) if ( mDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("Details: ")); - addTag("p",event->description()); + addTag("p",deTag(event->description())); } } formatReadOnly(event); @@ -376,3 +376,18 @@ void KIncidenceFormatter::formatReadOnly(Incidence *event) addTag("p","(" + i18n("read-only") + ")"); } } +QString KIncidenceFormatter::deTag(QString text) +{ +#if QT_VERSION >= 0x030000 + text.replace( '<' , "<" ); + text.replace( '>' , ">" ); +#else + if ( text.find ('<') > 0 ) { + text.replace( QRegExp("<") , "<" ); + } + if ( text.find ('>') > 0 ) { + text.replace( QRegExp(">") , ">" ); + } +#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 @@ -32,6 +32,7 @@ class KIncidenceFormatter : public QObject void formatReadOnly(Incidence *event); private: + QString deTag(QString text); bool mSyncMode; bool mDetails, mCreated ,mModified; -- cgit v0.9.0.2