author | zautrix <zautrix> | 2005-03-10 14:36:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-10 14:36:13 (UTC) |
commit | 34f5a1b758adb98c466ae8e45c9d980d62dfc544 (patch) (side-by-side diff) | |
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 @@ -243,9 +243,9 @@ void KOEventViewer::appendEvent(Event *event, int mode ) 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\">"; @@ -254,11 +254,11 @@ void KOEventViewer::appendEvent(Event *event, int mode ) 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>"; @@ -272,9 +272,9 @@ void KOEventViewer::appendEvent(Event *event, int mode ) 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()) { @@ -343,9 +343,9 @@ void KOEventViewer::appendEvent(Event *event, int mode ) 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); @@ -373,20 +373,20 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) 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>"; @@ -411,9 +411,9 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) } 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()) { @@ -433,9 +433,9 @@ void KOEventViewer::appendTodo(Todo *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); @@ -446,16 +446,16 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) 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>"); @@ -622,9 +622,9 @@ 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); } @@ -638,9 +638,8 @@ void KOEventViewer::setSyncMode( bool b ) { mSyncMode = b; } - void KOEventViewer::setTodo(Todo *event, bool clearV ) { if ( clearV ) clearEvents(); @@ -692,8 +691,23 @@ 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() ) { case Qt::Key_Return: diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index 2d4a08e..47cc5e9 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h @@ -64,8 +64,9 @@ class KOEventViewer : public QTextBrowser { private: QTextBrowser *mEventTextView; bool mSyncMode; + QString deTag(QString text); QString mText; QString mMailSubject; Incidence* mCurrentIncidence; diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 1751ae3..57a9ede 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -50,9 +50,9 @@ 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\">"; @@ -61,11 +61,11 @@ void KIncidenceFormatter::setEvent(Event *event) 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>"; @@ -77,9 +77,9 @@ void KIncidenceFormatter::setEvent(Event *event) 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>") @@ -143,9 +143,9 @@ void KIncidenceFormatter::setEvent(Event *event) 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); @@ -169,20 +169,20 @@ 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>"; @@ -203,9 +203,9 @@ 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()) { @@ -228,9 +228,9 @@ void KIncidenceFormatter::setTodo(Todo *event ) 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); @@ -375,4 +375,19 @@ 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( '<' , "<" ); + 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 @@ -31,8 +31,9 @@ class KIncidenceFormatter : public QObject void formatAttendees(Incidence *event); void formatReadOnly(Incidence *event); private: + QString deTag(QString text); bool mSyncMode; bool mDetails, mCreated ,mModified; QString mText; |