From 586dea6e61c766da49ba6cb55dd71851c0fafad3 Mon Sep 17 00:00:00 2001 From: drw Date: Sun, 18 May 2003 23:20:25 +0000 Subject: Updates to ocontact, oevent & otodo's toRichText() implementations --- (limited to 'libopie/pim/oevent.cpp') diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp index 83b191f..e4f5d92 100644 --- a/libopie/pim/oevent.cpp +++ b/libopie/pim/oevent.cpp @@ -235,22 +235,54 @@ bool OEvent::match( const QRegExp& re )const { return false; } QString OEvent::toRichText()const { - QString text; + QString text, value; + + // description + text += "

"; if ( !description().isEmpty() ) { - text += "" + QObject::tr( "Description:") + "
"; - text += Qtopia::escapeString(description() ). - replace(QRegExp( "[\n]"), "
" ) + "
"; + text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); + } + text += "




"; + + // location + if ( !(value = location()).isEmpty() ) { + text += "" + QObject::tr( "Location:" ) + " "; + text += Qtopia::escapeString(value) + "
"; + } + + // all day event + if ( isAllDay() ) { + text += "" + QObject::tr( "This is an all day event" ) + "
"; } - if ( startDateTime().isValid() ) { - text += "" + QObject::tr( "Start:") + " "; - text += Qtopia::escapeString(startDateTime().toString() ). - replace(QRegExp( "[\n]"), "
" ) + "
"; + // multiple day event + else if ( isMultipleDay () ) { + text += "" + QObject::tr( "This is a multiple day event" ) + "
"; + } + // start & end times + else { + // start time + if ( startDateTime().isValid() ) { + text += "" + QObject::tr( "Start:") + " "; + text += Qtopia::escapeString(startDateTime().toString() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } + + // end time + if ( endDateTime().isValid() ) { + text += "" + QObject::tr( "End:") + " "; + text += Qtopia::escapeString(endDateTime().toString() ). + replace(QRegExp( "[\n]"), "
" ) + "
"; + } } - if ( endDateTime().isValid() ) { - text += "" + QObject::tr( "End:") + " "; - text += Qtopia::escapeString(endDateTime().toString() ). - replace(QRegExp( "[\n]"), "
" ) + "
"; + + // categories + if ( categoryNames("Calendar").count() ){ + text += "" + QObject::tr( "Category:") + " "; + text += categoryNames("Calendar").join(", "); + text += "
"; } + + //notes if ( !note().isEmpty() ) { text += "" + QObject::tr( "Note:") + "
"; text += note(); -- cgit v0.9.0.2