-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 | |||
@@ -214,64 +214,96 @@ QString OEvent::timeZone()const { | |||
214 | bool OEvent::match( const QRegExp& re )const { | 214 | bool OEvent::match( const QRegExp& re )const { |
215 | if ( re.match( data->description ) != -1 ){ | 215 | if ( re.match( data->description ) != -1 ){ |
216 | setLastHitField( Qtopia::DatebookDescription ); | 216 | setLastHitField( Qtopia::DatebookDescription ); |
217 | return true; | 217 | return true; |
218 | } | 218 | } |
219 | if ( re.match( data->note ) != -1 ){ | 219 | if ( re.match( data->note ) != -1 ){ |
220 | setLastHitField( Qtopia::Note ); | 220 | setLastHitField( Qtopia::Note ); |
221 | return true; | 221 | return true; |
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 | } |
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 += "."; |
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 += " "; |
270 | text += QString::number( startDateTime().time().hour() ); | 302 | text += QString::number( startDateTime().time().hour() ); |
271 | text += ":"; | 303 | text += ":"; |
272 | text += QString::number( startDateTime().time().minute() ); | 304 | text += QString::number( startDateTime().time().minute() ); |
273 | text += " - "; | 305 | text += " - "; |
274 | text += description(); | 306 | text += description(); |
275 | return text; | 307 | return text; |
276 | } | 308 | } |
277 | QString OEvent::type()const { | 309 | QString OEvent::type()const { |