author | drw <drw> | 2003-05-18 23:20:25 (UTC) |
---|---|---|
committer | drw <drw> | 2003-05-18 23:20:25 (UTC) |
commit | 586dea6e61c766da49ba6cb55dd71851c0fafad3 (patch) (unidiff) | |
tree | 6122bd75b327c4a29157a66e273bae9632ac22a0 /libopie2/opiepim/oevent.cpp | |
parent | 34c5b88459bcf5e02deae6b04e8bc17ee0de74c0 (diff) | |
download | opie-586dea6e61c766da49ba6cb55dd71851c0fafad3.zip opie-586dea6e61c766da49ba6cb55dd71851c0fafad3.tar.gz opie-586dea6e61c766da49ba6cb55dd71851c0fafad3.tar.bz2 |
Updates to ocontact, oevent & otodo's toRichText() implementations
-rw-r--r-- | libopie2/opiepim/oevent.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index 83b191f..e4f5d92 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/oevent.cpp | |||
@@ -226,40 +226,72 @@ bool OEvent::match( const QRegExp& re )const { | |||
226 | } | 226 | } |
227 | if ( re.match( data->start.toString() ) != -1 ){ | 227 | if ( re.match( data->start.toString() ) != -1 ){ |
228 | setLastHitField( Qtopia::StartDateTime ); | 228 | setLastHitField( Qtopia::StartDateTime ); |
229 | return true; | 229 | return true; |
230 | } | 230 | } |
231 | if ( re.match( data->end.toString() ) != -1 ){ | 231 | if ( re.match( data->end.toString() ) != -1 ){ |
232 | setLastHitField( Qtopia::EndDateTime ); | 232 | setLastHitField( Qtopia::EndDateTime ); |
233 | return true; | 233 | return true; |
234 | } | 234 | } |
235 | return false; | 235 | return false; |
236 | } | 236 | } |
237 | QString OEvent::toRichText()const { | 237 | QString OEvent::toRichText()const { |
238 | QString text; | 238 | QString text, value; |
239 | |||
240 | // description | ||
241 | text += "<b><h3><img src=\"datebook/DateBook\">"; | ||
239 | if ( !description().isEmpty() ) { | 242 | if ( !description().isEmpty() ) { |
240 | text += "<b>" + QObject::tr( "Description:") + "</b><br>"; | 243 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); |
241 | text += Qtopia::escapeString(description() ). | 244 | } |
242 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 245 | text += "</h3></b><br><hr><br>"; |
246 | |||
247 | // location | ||
248 | if ( !(value = location()).isEmpty() ) { | ||
249 | text += "<b>" + QObject::tr( "Location:" ) + "</b> "; | ||
250 | text += Qtopia::escapeString(value) + "<br>"; | ||
251 | } | ||
252 | |||
253 | // all day event | ||
254 | if ( isAllDay() ) { | ||
255 | text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; | ||
243 | } | 256 | } |
257 | // multiple day event | ||
258 | else if ( isMultipleDay () ) { | ||
259 | text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; | ||
260 | } | ||
261 | // start & end times | ||
262 | else { | ||
263 | // start time | ||
244 | if ( startDateTime().isValid() ) { | 264 | if ( startDateTime().isValid() ) { |
245 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | 265 | text += "<b>" + QObject::tr( "Start:") + "</b> "; |
246 | text += Qtopia::escapeString(startDateTime().toString() ). | 266 | text += Qtopia::escapeString(startDateTime().toString() ). |
247 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 267 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
248 | } | 268 | } |
269 | |||
270 | // end time | ||
249 | if ( endDateTime().isValid() ) { | 271 | if ( endDateTime().isValid() ) { |
250 | text += "<b>" + QObject::tr( "End:") + "</b> "; | 272 | text += "<b>" + QObject::tr( "End:") + "</b> "; |
251 | text += Qtopia::escapeString(endDateTime().toString() ). | 273 | text += Qtopia::escapeString(endDateTime().toString() ). |
252 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 274 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
253 | } | 275 | } |
276 | } | ||
277 | |||
278 | // categories | ||
279 | if ( categoryNames("Calendar").count() ){ | ||
280 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | ||
281 | text += categoryNames("Calendar").join(", "); | ||
282 | text += "<br>"; | ||
283 | } | ||
284 | |||
285 | //notes | ||
254 | if ( !note().isEmpty() ) { | 286 | if ( !note().isEmpty() ) { |
255 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; | 287 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; |
256 | text += note(); | 288 | text += note(); |
257 | // text += Qtopia::escapeString(note() ). | 289 | // text += Qtopia::escapeString(note() ). |
258 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 290 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
259 | } | 291 | } |
260 | return text; | 292 | return text; |
261 | } | 293 | } |
262 | QString OEvent::toShortText()const { | 294 | QString OEvent::toShortText()const { |
263 | QString text; | 295 | QString text; |
264 | text += QString::number( startDateTime().date().day() ); | 296 | text += QString::number( startDateTime().date().day() ); |
265 | text += "."; | 297 | text += "."; |