-rw-r--r-- | libopie2/opiepim/oevent.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index e4f5d92..7bcf944 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/oevent.cpp | |||
@@ -215,94 +215,94 @@ 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, value; | 238 | QString text, value; |
239 | 239 | ||
240 | // description | 240 | // description |
241 | text += "<b><h3><img src=\"datebook/DateBook\">"; | 241 | text += "<b><h3><img src=\"datebook/DateBook\">"; |
242 | if ( !description().isEmpty() ) { | 242 | if ( !description().isEmpty() ) { |
243 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); | 243 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" ); |
244 | } | 244 | } |
245 | text += "</h3></b><br><hr><br>"; | 245 | text += "</h3></b><br><hr><br>"; |
246 | 246 | ||
247 | // location | 247 | // location |
248 | if ( !(value = location()).isEmpty() ) { | 248 | if ( !(value = location()).isEmpty() ) { |
249 | text += "<b>" + QObject::tr( "Location:" ) + "</b> "; | 249 | text += "<b>" + QObject::tr( "Location:" ) + "</b> "; |
250 | text += Qtopia::escapeString(value) + "<br>"; | 250 | text += Qtopia::escapeString(value) + "<br>"; |
251 | } | 251 | } |
252 | 252 | ||
253 | // all day event | 253 | // all day event |
254 | if ( isAllDay() ) { | 254 | if ( isAllDay() ) { |
255 | text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; | 255 | text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>"; |
256 | } | 256 | } |
257 | // multiple day event | 257 | // multiple day event |
258 | else if ( isMultipleDay () ) { | 258 | else if ( isMultipleDay () ) { |
259 | text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; | 259 | text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>"; |
260 | } | 260 | } |
261 | // start & end times | 261 | // start & end times |
262 | else { | 262 | else { |
263 | // start time | 263 | // start time |
264 | if ( startDateTime().isValid() ) { | 264 | if ( startDateTime().isValid() ) { |
265 | text += "<b>" + QObject::tr( "Start:") + "</b> "; | 265 | text += "<b>" + QObject::tr( "Start:") + "</b> "; |
266 | text += Qtopia::escapeString(startDateTime().toString() ). | 266 | text += Qtopia::escapeString(startDateTime().toString() ). |
267 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 267 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
268 | } | 268 | } |
269 | 269 | ||
270 | // end time | 270 | // end time |
271 | if ( endDateTime().isValid() ) { | 271 | if ( endDateTime().isValid() ) { |
272 | text += "<b>" + QObject::tr( "End:") + "</b> "; | 272 | text += "<b>" + QObject::tr( "End:") + "</b> "; |
273 | text += Qtopia::escapeString(endDateTime().toString() ). | 273 | text += Qtopia::escapeString(endDateTime().toString() ). |
274 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 274 | replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | // categories | 278 | // categories |
279 | if ( categoryNames("Calendar").count() ){ | 279 | if ( categoryNames("Calendar").count() ){ |
280 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 280 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
281 | text += categoryNames("Calendar").join(", "); | 281 | text += categoryNames("Calendar").join(", "); |
282 | text += "<br>"; | 282 | text += "<br>"; |
283 | } | 283 | } |
284 | 284 | ||
285 | //notes | 285 | //notes |
286 | if ( !note().isEmpty() ) { | 286 | if ( !note().isEmpty() ) { |
287 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; | 287 | text += "<b>" + QObject::tr( "Note:") + "</b><br>"; |
288 | text += note(); | 288 | text += note(); |
289 | // text += Qtopia::escapeString(note() ). | 289 | // text += Qtopia::escapeString(note() ). |
290 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 290 | // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
291 | } | 291 | } |
292 | return text; | 292 | return text; |
293 | } | 293 | } |
294 | QString OEvent::toShortText()const { | 294 | QString OEvent::toShortText()const { |
295 | QString text; | 295 | QString text; |
296 | text += QString::number( startDateTime().date().day() ); | 296 | text += QString::number( startDateTime().date().day() ); |
297 | text += "."; | 297 | text += "."; |
298 | text += QString::number( startDateTime().date().month() ); | 298 | text += QString::number( startDateTime().date().month() ); |
299 | text += "."; | 299 | text += "."; |
300 | text += QString::number( startDateTime().date().year() ); | 300 | text += QString::number( startDateTime().date().year() ); |
301 | text += " "; | 301 | text += " "; |
302 | text += QString::number( startDateTime().time().hour() ); | 302 | text += QString::number( startDateTime().time().hour() ); |
303 | text += ":"; | 303 | text += ":"; |
304 | text += QString::number( startDateTime().time().minute() ); | 304 | text += QString::number( startDateTime().time().minute() ); |
305 | text += " - "; | 305 | text += " - "; |
306 | text += description(); | 306 | text += description(); |
307 | return text; | 307 | return text; |
308 | } | 308 | } |
@@ -339,51 +339,48 @@ void OEvent::changeOrModify() { | |||
339 | d2->start = data->start; | 339 | d2->start = data->start; |
340 | d2->end = data->end; | 340 | d2->end = data->end; |
341 | d2->isAllDay = data->isAllDay; | 341 | d2->isAllDay = data->isAllDay; |
342 | d2->timezone = data->timezone; | 342 | d2->timezone = data->timezone; |
343 | d2->parent = data->parent; | 343 | d2->parent = data->parent; |
344 | 344 | ||
345 | if ( data->child ) { | 345 | if ( data->child ) { |
346 | d2->child = new QArray<int>( *data->child ); | 346 | d2->child = new QArray<int>( *data->child ); |
347 | d2->child->detach(); | 347 | d2->child->detach(); |
348 | } | 348 | } |
349 | 349 | ||
350 | data = d2; | 350 | data = d2; |
351 | } | 351 | } |
352 | } | 352 | } |
353 | void OEvent::deref() { | 353 | void OEvent::deref() { |
354 | if ( data->deref() ) { | 354 | if ( data->deref() ) { |
355 | delete data; | 355 | delete data; |
356 | data = 0; | 356 | data = 0; |
357 | } | 357 | } |
358 | } | 358 | } |
359 | // FIXME | 359 | // FIXME |
360 | QMap<int, QString> OEvent::toMap()const { | 360 | QMap<int, QString> OEvent::toMap()const { |
361 | return QMap<int, QString>(); | 361 | return QMap<int, QString>(); |
362 | } | 362 | } |
363 | QMap<QString, QString> OEvent::toExtraMap()const { | ||
364 | return QMap<QString, QString>(); | ||
365 | } | ||
366 | int OEvent::parent()const { | 363 | int OEvent::parent()const { |
367 | return data->parent; | 364 | return data->parent; |
368 | } | 365 | } |
369 | void OEvent::setParent( int uid ) { | 366 | void OEvent::setParent( int uid ) { |
370 | changeOrModify(); | 367 | changeOrModify(); |
371 | data->parent = uid; | 368 | data->parent = uid; |
372 | } | 369 | } |
373 | QArray<int> OEvent::children() const{ | 370 | QArray<int> OEvent::children() const{ |
374 | if (!data->child) return QArray<int>(); | 371 | if (!data->child) return QArray<int>(); |
375 | else | 372 | else |
376 | return data->child->copy(); | 373 | return data->child->copy(); |
377 | } | 374 | } |
378 | void OEvent::setChildren( const QArray<int>& arr ) { | 375 | void OEvent::setChildren( const QArray<int>& arr ) { |
379 | changeOrModify(); | 376 | changeOrModify(); |
380 | if (data->child) delete data->child; | 377 | if (data->child) delete data->child; |
381 | 378 | ||
382 | data->child = new QArray<int>( arr ); | 379 | data->child = new QArray<int>( arr ); |
383 | data->child->detach(); | 380 | data->child->detach(); |
384 | } | 381 | } |
385 | void OEvent::addChild( int uid ) { | 382 | void OEvent::addChild( int uid ) { |
386 | changeOrModify(); | 383 | changeOrModify(); |
387 | if (!data->child ) { | 384 | if (!data->child ) { |
388 | data->child = new QArray<int>(1); | 385 | data->child = new QArray<int>(1); |
389 | (*data->child)[0] = uid; | 386 | (*data->child)[0] = uid; |