-rw-r--r-- | libopie/pim/oevent.cpp | 56 |
1 files changed, 44 insertions, 12 deletions
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 | |||
@@ -222,48 +222,80 @@ bool OEvent::match( const QRegExp& re )const { | |||
222 | } | 222 | } |
223 | if ( re.match( data->location ) != -1 ){ | 223 | if ( re.match( data->location ) != -1 ){ |
224 | setLastHitField( Qtopia::Location ); | 224 | setLastHitField( Qtopia::Location ); |
225 | return true; | 225 | return true; |
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 | } |
244 | if ( startDateTime().isValid() ) { | 257 | // multiple day event |
245 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | 258 | else if ( isMultipleDay () ) { |
246 | text += Qtopia::escapeString(startDateTime().toString() ). | 259 | text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; |
247 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 260 | } |
261 | // start & end times | ||
262 | else { | ||
263 | // start time | ||
264 | if ( startDateTime().isValid() ) { | ||
265 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | ||
266 | text += Qtopia::escapeString(startDateTime().toString() ). | ||
267 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | ||
268 | } | ||
269 | |||
270 | // end time | ||
271 | if ( endDateTime().isValid() ) { | ||
272 | text += "<b>" + QObject::tr( "End:") + "</b> "; | ||
273 | text += Qtopia::escapeString(endDateTime().toString() ). | ||
274 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | ||
275 | } | ||
248 | } | 276 | } |
249 | if ( endDateTime().isValid() ) { | 277 | |
250 | text += "<b>" + QObject::tr( "End:") + "</b> "; | 278 | // categories |
251 | text += Qtopia::escapeString(endDateTime().toString() ). | 279 | if ( categoryNames("Calendar").count() ){ |
252 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 280 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
281 | text += categoryNames("Calendar").join(", "); | ||
282 | text += "<br>"; | ||
253 | } | 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 += "."; |
266 | text += QString::number( startDateTime().date().month() ); | 298 | text += QString::number( startDateTime().date().month() ); |
267 | text += "."; | 299 | text += "."; |
268 | text += QString::number( startDateTime().date().year() ); | 300 | text += QString::number( startDateTime().date().year() ); |
269 | text += " "; | 301 | text += " "; |