Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 02b54da..607e549 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -215,501 +215,509 @@ void KOEventViewer::setSource(const QString& n) | |||
215 | /* | 215 | /* |
216 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 216 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
217 | We start it without its main interface | 217 | We start it without its main interface |
218 | */ | 218 | */ |
219 | KIconLoader* iconLoader = new KIconLoader(); | 219 | KIconLoader* iconLoader = new KIconLoader(); |
220 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 220 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
221 | ActionManager::setStartedKAddressBook(true); | 221 | ActionManager::setStartedKAddressBook(true); |
222 | tmpStr = "kaddressbook --editor-only --uid "; | 222 | tmpStr = "kaddressbook --editor-only --uid "; |
223 | tmpStr += KProcess::quote(n.mid(6)); | 223 | tmpStr += KProcess::quote(n.mid(6)); |
224 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 224 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
225 | return; | 225 | return; |
226 | } | 226 | } |
227 | } else { | 227 | } else { |
228 | //QTextBrowser::setSource(n); | 228 | //QTextBrowser::setSource(n); |
229 | } | 229 | } |
230 | #endif | 230 | #endif |
231 | } | 231 | } |
232 | void KOEventViewer::mailToAttendees( bool all ) | 232 | void KOEventViewer::mailToAttendees( bool all ) |
233 | { | 233 | { |
234 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 234 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
235 | if (attendees.count() == 0) return; | 235 | if (attendees.count() == 0) return; |
236 | QStringList nameList; | 236 | QStringList nameList; |
237 | QStringList emailList; | 237 | QStringList emailList; |
238 | QStringList uidList; | 238 | QStringList uidList; |
239 | Attendee* a; | 239 | Attendee* a; |
240 | for(a=attendees.first();a;a=attendees.next()) { | 240 | for(a=attendees.first();a;a=attendees.next()) { |
241 | if ( !all && !a->RSVP() ) continue; | 241 | if ( !all && !a->RSVP() ) continue; |
242 | if (!a->email().isEmpty()) { | 242 | if (!a->email().isEmpty()) { |
243 | #ifndef DESKTOP_VERSION | 243 | #ifndef DESKTOP_VERSION |
244 | nameList.append (a->realName() ); | 244 | nameList.append (a->realName() ); |
245 | emailList.append (a->email() ); | 245 | emailList.append (a->email() ); |
246 | uidList.append (a->uid() ); | 246 | uidList.append (a->uid() ); |
247 | #else | 247 | #else |
248 | emailList.append(a->realName() +" <" + a->email() +">"); | 248 | emailList.append(a->realName() +" <" + a->email() +">"); |
249 | #endif | 249 | #endif |
250 | } | 250 | } |
251 | } | 251 | } |
252 | #ifndef DESKTOP_VERSION | 252 | #ifndef DESKTOP_VERSION |
253 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 253 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
254 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 254 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
255 | 255 | ||
256 | #else | 256 | #else |
257 | ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject ); | 257 | ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject ); |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | } | 260 | } |
261 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 261 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
262 | { | 262 | { |
263 | int number=text.contains("\n"); | 263 | int number=text.contains("\n"); |
264 | QString str = "<" + tag + ">"; | 264 | QString str = "<" + tag + ">"; |
265 | QString tmpText=text; | 265 | QString tmpText=text; |
266 | QString tmpStr=str; | 266 | QString tmpStr=str; |
267 | if(number !=-1) | 267 | if(number !=-1) |
268 | { | 268 | { |
269 | if (number > 0) { | 269 | if (number > 0) { |
270 | int pos=0; | 270 | int pos=0; |
271 | QString tmp; | 271 | QString tmp; |
272 | for(int i=0;i<=number;i++) { | 272 | for(int i=0;i<=number;i++) { |
273 | pos=tmpText.find("\n"); | 273 | pos=tmpText.find("\n"); |
274 | tmp=tmpText.left(pos); | 274 | tmp=tmpText.left(pos); |
275 | tmpText=tmpText.right(tmpText.length()-pos-1); | 275 | tmpText=tmpText.right(tmpText.length()-pos-1); |
276 | tmpStr+=tmp+"<br>"; | 276 | tmpStr+=tmp+"<br>"; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | else tmpStr += tmpText; | 279 | else tmpStr += tmpText; |
280 | tmpStr+="</" + tag + ">"; | 280 | tmpStr+="</" + tag + ">"; |
281 | mText.append(tmpStr); | 281 | mText.append(tmpStr); |
282 | } | 282 | } |
283 | else | 283 | else |
284 | { | 284 | { |
285 | str += text + "</" + tag + ">"; | 285 | str += text + "</" + tag + ">"; |
286 | mText.append(str); | 286 | mText.append(str); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | void KOEventViewer::setColorMode( int m ) | 290 | void KOEventViewer::setColorMode( int m ) |
291 | { | 291 | { |
292 | mColorMode = m; | 292 | mColorMode = m; |
293 | } | 293 | } |
294 | void KOEventViewer::appendEvent(Event *event, int mode ) | 294 | void KOEventViewer::appendEvent(Event *event, int mode ) |
295 | { | 295 | { |
296 | mMailSubject = ""; | 296 | mMailSubject = ""; |
297 | mCurrentIncidence = event; | 297 | mCurrentIncidence = event; |
298 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 298 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
299 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | 299 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); |
300 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 300 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
301 | if ( mode == 0 ) { | 301 | if ( mode == 0 ) { |
302 | addTag("h2",deTag(event->summary())); | 302 | addTag("h2",deTag(event->summary())); |
303 | formatReadOnly(event); | 303 | formatReadOnly(event); |
304 | } | 304 | } |
305 | else { | 305 | else { |
306 | if ( mColorMode == 1 ) { | 306 | if ( mColorMode == 1 ) { |
307 | mText +="<font color=\"#00A000\">"; | 307 | mText +="<font color=\"#00A000\">"; |
308 | } | 308 | } |
309 | if ( mColorMode == 2 ) { | 309 | if ( mColorMode == 2 ) { |
310 | mText +="<font color=\"#C00000\">"; | 310 | mText +="<font color=\"#C00000\">"; |
311 | } | 311 | } |
312 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 312 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
313 | if ( mode == 1 ) { | 313 | if ( mode == 1 ) { |
314 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 314 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
315 | } else { | 315 | } else { |
316 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 316 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
317 | } | 317 | } |
318 | formatReadOnly(event); | 318 | formatReadOnly(event); |
319 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 319 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
320 | if ( mColorMode ) | 320 | if ( mColorMode ) |
321 | mText += "</font>"; | 321 | mText += "</font>"; |
322 | } | 322 | } |
323 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 323 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
324 | if (event->cancelled ()) { | 324 | if (event->cancelled ()) { |
325 | mText +="<font color=\"#B00000\">"; | 325 | mText +="<font color=\"#B00000\">"; |
326 | addTag("i",i18n("This event has been cancelled!")); | 326 | addTag("i",i18n("This event has been cancelled!")); |
327 | mText.append("<br>"); | 327 | mText.append("<br>"); |
328 | mText += "</font>"; | 328 | mText += "</font>"; |
329 | mMailSubject += i18n("(cancelled)"); | 329 | mMailSubject += i18n("(cancelled)"); |
330 | } | 330 | } |
331 | 331 | ||
332 | if (event->doesFloat()) { | 332 | if (event->doesFloat()) { |
333 | if (event->isMultiDay()) { | 333 | if (event->isMultiDay()) { |
334 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 334 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
335 | .arg(event->dtStartDateStr(shortDate)) | 335 | .arg(event->dtStartDateStr(shortDate)) |
336 | .arg(event->dtEndDateStr(shortDate))); | 336 | .arg(event->dtEndDateStr(shortDate))); |
337 | mText.append(i18n("<p><b>Duration:</b> %1 days</p>") | 337 | mText.append(i18n("<p><b>Duration:</b> %1 days</p>") |
338 | .arg(event->dtStart().daysTo(event->dtEnd())+1)); | 338 | .arg(event->dtStart().daysTo(event->dtEnd())+1)); |
339 | } else { | 339 | } else { |
340 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 340 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
341 | } | 341 | } |
342 | } else { | 342 | } else { |
343 | if (event->isMultiDay()) { | 343 | if (event->isMultiDay()) { |
344 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 344 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
345 | .arg(event->dtStartStr( shortDate))); | 345 | .arg(event->dtStartStr( shortDate))); |
346 | mText.append(i18n("<p><b>To:</b> %1</p>") | 346 | mText.append(i18n("<p><b>To:</b> %1</p>") |
347 | .arg(event->dtEndStr(shortDate))); | 347 | .arg(event->dtEndStr(shortDate))); |
348 | } else { | 348 | } else { |
349 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 349 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
350 | .arg(event->dtStartTimeStr()) | 350 | .arg(event->dtStartTimeStr()) |
351 | .arg(event->dtEndTimeStr())); | 351 | .arg(event->dtEndTimeStr())); |
352 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 352 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
353 | .arg(event->dtStartDateStr( shortDate ))); | 353 | .arg(event->dtStartDateStr( shortDate ))); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | if (!event->location().isEmpty()) { | 356 | if (!event->location().isEmpty()) { |
357 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 357 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
358 | mMailSubject += i18n(" at ") + event->location(); | 358 | mMailSubject += i18n(" at ") + event->location(); |
359 | } | 359 | } |
360 | if (event->doesRecur()) { | 360 | if (event->doesRecur()) { |
361 | 361 | ||
362 | QString recurText = event->recurrenceText(); | 362 | QString recurText = event->recurrenceText(); |
363 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 363 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
364 | bool ok; | 364 | bool ok; |
365 | QDate start = QDate::currentDate(); | 365 | QDate start = QDate::currentDate(); |
366 | QDateTime next; | 366 | QDateTime next; |
367 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 367 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
368 | if ( ok ) { | 368 | if ( ok ) { |
369 | if ( wideScreen ){ | 369 | if ( wideScreen ){ |
370 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); | 370 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); |
371 | } else { | 371 | } else { |
372 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 372 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
373 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 373 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
374 | } | 374 | } |
375 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 375 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
376 | 376 | ||
377 | } else { | 377 | } else { |
378 | bool last; | 378 | bool last; |
379 | QDate nextd; | 379 | QDate nextd; |
380 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 380 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
381 | if ( last ) { | 381 | if ( last ) { |
382 | if ( wideScreen ){ | 382 | if ( wideScreen ){ |
383 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); | 383 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); |
384 | } else{ | 384 | } else{ |
385 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 385 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
386 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 386 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | } | 389 | } |
390 | } else { | 390 | } else { |
391 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 391 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
392 | 392 | ||
393 | } | 393 | } |
394 | 394 | ||
395 | 395 | ||
396 | if (event->isAlarmEnabled()) { | 396 | if (event->isAlarmEnabled()) { |
397 | Alarm *alarm =event->alarms().first() ; | 397 | Alarm *alarm =event->alarms().first() ; |
398 | QDateTime t = alarm->time(); | 398 | QDateTime t = alarm->time(); |
399 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 399 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
400 | if(wideScreen ){ | 400 | if(wideScreen ){ |
401 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); | 401 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
402 | }else{ | 402 | }else{ |
403 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 403 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
404 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 404 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
405 | } | 405 | } |
406 | //addTag("p",s); | 406 | //addTag("p",s); |
407 | if ( !(event->alarmEnabled() ) ) { | ||
408 | addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>"); | ||
409 | |||
410 | } | ||
407 | } | 411 | } |
408 | 412 | ||
409 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 413 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
410 | 414 | ||
411 | formatCategories(event); | 415 | formatCategories(event); |
412 | 416 | ||
413 | formatAttendees(event); | 417 | formatAttendees(event); |
414 | 418 | ||
415 | if ( KOPrefs::instance()->mEVshowCreated ) { | 419 | if ( KOPrefs::instance()->mEVshowCreated ) { |
416 | if(wideScreen ){ | 420 | if(wideScreen ){ |
417 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 421 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
418 | }else{ | 422 | }else{ |
419 | addTag("p",i18n("<b>Created: ") +" </b>"); | 423 | addTag("p",i18n("<b>Created: ") +" </b>"); |
420 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 424 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
421 | } | 425 | } |
422 | 426 | ||
423 | 427 | ||
424 | } | 428 | } |
425 | if ( KOPrefs::instance()->mEVshowChanged ) { | 429 | if ( KOPrefs::instance()->mEVshowChanged ) { |
426 | if(wideScreen ){ | 430 | if(wideScreen ){ |
427 | addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 431 | addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
428 | }else{ | 432 | }else{ |
429 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 433 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
430 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 434 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
431 | } | 435 | } |
432 | 436 | ||
433 | } | 437 | } |
434 | if ( KOPrefs::instance()->mEVshowDetails ) { | 438 | if ( KOPrefs::instance()->mEVshowDetails ) { |
435 | if (!event->description().isEmpty()) { | 439 | if (!event->description().isEmpty()) { |
436 | addTag("p",i18n("<b>Details: </b>")); | 440 | addTag("p",i18n("<b>Details: </b>")); |
437 | addTag("p",deTag(event->description())); | 441 | addTag("p",deTag(event->description())); |
438 | } | 442 | } |
439 | } | 443 | } |
440 | setText(mText); | 444 | setText(mText); |
441 | //QWhatsThis::add(this,mText); | 445 | //QWhatsThis::add(this,mText); |
442 | 446 | ||
443 | } | 447 | } |
444 | 448 | ||
445 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 449 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
446 | { | 450 | { |
447 | mMailSubject = ""; | 451 | mMailSubject = ""; |
448 | mCurrentIncidence = event; | 452 | mCurrentIncidence = event; |
449 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 453 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
450 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 454 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
451 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | 455 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); |
452 | if (mode == 0 ) { | 456 | if (mode == 0 ) { |
453 | addTag("h2",deTag(event->summary())); | 457 | addTag("h2",deTag(event->summary())); |
454 | formatReadOnly(event); | 458 | formatReadOnly(event); |
455 | } | 459 | } |
456 | else { | 460 | else { |
457 | if ( mColorMode == 1 ) { | 461 | if ( mColorMode == 1 ) { |
458 | mText +="<font color=\"#00A000\">"; | 462 | mText +="<font color=\"#00A000\">"; |
459 | } | 463 | } |
460 | if ( mColorMode == 2 ) { | 464 | if ( mColorMode == 2 ) { |
461 | mText +="<font color=\"#B00000\">"; | 465 | mText +="<font color=\"#B00000\">"; |
462 | } | 466 | } |
463 | if ( mode == 1 ) { | 467 | if ( mode == 1 ) { |
464 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 468 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
465 | } else { | 469 | } else { |
466 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 470 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
467 | } | 471 | } |
468 | formatReadOnly(event); | 472 | formatReadOnly(event); |
469 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 473 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
470 | if ( mColorMode ) | 474 | if ( mColorMode ) |
471 | mText += "</font>"; | 475 | mText += "</font>"; |
472 | } | 476 | } |
473 | mMailSubject += i18n( "Todo " )+ event->summary(); | 477 | mMailSubject += i18n( "Todo " )+ event->summary(); |
474 | 478 | ||
475 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 479 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
476 | mText +="<font color=\"#B00000\">"; | 480 | mText +="<font color=\"#B00000\">"; |
477 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 481 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
478 | mText += "</font>"; | 482 | mText += "</font>"; |
479 | } else { | 483 | } else { |
480 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 484 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
481 | .arg(event->percentComplete())); | 485 | .arg(event->percentComplete())); |
482 | } | 486 | } |
483 | 487 | ||
484 | if (event->cancelled ()) { | 488 | if (event->cancelled ()) { |
485 | mText +="<font color=\"#B00000\">"; | 489 | mText +="<font color=\"#B00000\">"; |
486 | addTag("i",i18n("This todo has been cancelled!")); | 490 | addTag("i",i18n("This todo has been cancelled!")); |
487 | mText.append("<br>"); | 491 | mText.append("<br>"); |
488 | mText += "</font>"; | 492 | mText += "</font>"; |
489 | mMailSubject += i18n("(cancelled)"); | 493 | mMailSubject += i18n("(cancelled)"); |
490 | } | 494 | } |
491 | 495 | ||
492 | 496 | ||
493 | 497 | ||
494 | if (event->doesRecur()) { | 498 | if (event->doesRecur()) { |
495 | 499 | ||
496 | QString recurText = event->recurrence()->recurrenceText(); | 500 | QString recurText = event->recurrence()->recurrenceText(); |
497 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 501 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
498 | 502 | ||
499 | } | 503 | } |
500 | if (event->hasStartDate()) { | 504 | if (event->hasStartDate()) { |
501 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 505 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
502 | } | 506 | } |
503 | if (event->hasDueDate()) { | 507 | if (event->hasDueDate()) { |
504 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 508 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
505 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 509 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
506 | } | 510 | } |
507 | if (!event->location().isEmpty()) { | 511 | if (!event->location().isEmpty()) { |
508 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 512 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
509 | mMailSubject += i18n(" at ") + event->location(); | 513 | mMailSubject += i18n(" at ") + event->location(); |
510 | } | 514 | } |
511 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 515 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
512 | .arg(QString::number(event->priority()))); | 516 | .arg(QString::number(event->priority()))); |
513 | 517 | ||
514 | if (event->isAlarmEnabled()) { | 518 | if (event->isAlarmEnabled()) { |
515 | Alarm *alarm =event->alarms().first() ; | 519 | Alarm *alarm =event->alarms().first() ; |
516 | QDateTime t = alarm->time(); | 520 | QDateTime t = alarm->time(); |
517 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 521 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
518 | if ( wideScreen ) { | 522 | if ( wideScreen ) { |
519 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); | 523 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
520 | } else { | 524 | } else { |
521 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 525 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
522 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 526 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
523 | } | 527 | } |
528 | if ( !(event->alarmEnabled() ) ) { | ||
529 | addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>"); | ||
530 | |||
531 | } | ||
524 | } | 532 | } |
525 | 533 | ||
526 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 534 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
527 | 535 | ||
528 | formatCategories(event); | 536 | formatCategories(event); |
529 | 537 | ||
530 | formatAttendees(event); | 538 | formatAttendees(event); |
531 | 539 | ||
532 | if ( KOPrefs::instance()->mEVshowCreated ) { | 540 | if ( KOPrefs::instance()->mEVshowCreated ) { |
533 | if(wideScreen ){ | 541 | if(wideScreen ){ |
534 | 542 | ||
535 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 543 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
536 | 544 | ||
537 | } else { | 545 | } else { |
538 | addTag("p",i18n("<b>Created: ") +" </b>"); | 546 | addTag("p",i18n("<b>Created: ") +" </b>"); |
539 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 547 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
540 | } | 548 | } |
541 | } | 549 | } |
542 | if ( KOPrefs::instance()->mEVshowChanged ) { | 550 | if ( KOPrefs::instance()->mEVshowChanged ) { |
543 | if(wideScreen ){ | 551 | if(wideScreen ){ |
544 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 552 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
545 | 553 | ||
546 | } else { | 554 | } else { |
547 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 555 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
548 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 556 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
549 | } | 557 | } |
550 | } | 558 | } |
551 | if ( event->relatedTo() ) { | 559 | if ( event->relatedTo() ) { |
552 | addTag("b",i18n("Parent todo:<br>")); | 560 | addTag("b",i18n("Parent todo:<br>")); |
553 | 561 | ||
554 | QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); | 562 | QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); |
555 | 563 | ||
556 | mText += t_name; | 564 | mText += t_name; |
557 | mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; | 565 | mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; |
558 | mText += deTag(event->relatedTo()->summary()); | 566 | mText += deTag(event->relatedTo()->summary()); |
559 | mText += "</a><br>"; | 567 | mText += "</a><br>"; |
560 | 568 | ||
561 | // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); | 569 | // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); |
562 | } | 570 | } |
563 | QPtrList<Incidence> Relations = event->relations(); | 571 | QPtrList<Incidence> Relations = event->relations(); |
564 | Incidence *to; | 572 | Incidence *to; |
565 | if ( Relations.first() ) | 573 | if ( Relations.first() ) |
566 | addTag("b",i18n("Sub todos:<br>")); | 574 | addTag("b",i18n("Sub todos:<br>")); |
567 | for (to=Relations.first();to;to=Relations.next()) { | 575 | for (to=Relations.first();to;to=Relations.next()) { |
568 | QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); | 576 | QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); |
569 | mText += t_name; | 577 | mText += t_name; |
570 | mText += "<a href=\"todo_uid:" + to->uid() + "\">"; | 578 | mText += "<a href=\"todo_uid:" + to->uid() + "\">"; |
571 | mText += deTag(to->summary()); | 579 | mText += deTag(to->summary()); |
572 | mText += "</a><br>"; | 580 | mText += "</a><br>"; |
573 | 581 | ||
574 | } | 582 | } |
575 | 583 | ||
576 | if ( KOPrefs::instance()->mEVshowDetails ) { | 584 | if ( KOPrefs::instance()->mEVshowDetails ) { |
577 | if (!event->description().isEmpty()) { | 585 | if (!event->description().isEmpty()) { |
578 | addTag("p",i18n("<b>Details: </b>")); | 586 | addTag("p",i18n("<b>Details: </b>")); |
579 | addTag("p",deTag(event->description())); | 587 | addTag("p",deTag(event->description())); |
580 | } | 588 | } |
581 | } | 589 | } |
582 | setText(mText); | 590 | setText(mText); |
583 | } | 591 | } |
584 | 592 | ||
585 | void KOEventViewer::formatCategories(Incidence *event) | 593 | void KOEventViewer::formatCategories(Incidence *event) |
586 | { | 594 | { |
587 | if (!event->categoriesStr().isEmpty()) { | 595 | if (!event->categoriesStr().isEmpty()) { |
588 | if (event->categories().count() == 1) { | 596 | if (event->categories().count() == 1) { |
589 | addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); | 597 | addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); |
590 | } else { | 598 | } else { |
591 | addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; | 599 | addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; |
592 | } | 600 | } |
593 | } | 601 | } |
594 | } | 602 | } |
595 | void KOEventViewer::formatAttendees(Incidence *event) | 603 | void KOEventViewer::formatAttendees(Incidence *event) |
596 | { | 604 | { |
597 | QPtrList<Attendee> attendees = event->attendees(); | 605 | QPtrList<Attendee> attendees = event->attendees(); |
598 | if (attendees.count()) { | 606 | if (attendees.count()) { |
599 | 607 | ||
600 | 608 | ||
601 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 609 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
602 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 610 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
603 | addTag("h3",i18n("Organizer")); | 611 | addTag("h3",i18n("Organizer")); |
604 | mText.append("<ul><li>"); | 612 | mText.append("<ul><li>"); |
605 | #ifndef KORG_NOKABC | 613 | #ifndef KORG_NOKABC |
606 | 614 | ||
607 | #ifdef DESKTOP_VERSION | 615 | #ifdef DESKTOP_VERSION |
608 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 616 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
609 | KABC::Addressee::List addressList; | 617 | KABC::Addressee::List addressList; |
610 | addressList = add_book->findByEmail(event->organizer()); | 618 | addressList = add_book->findByEmail(event->organizer()); |
611 | KABC::Addressee o = addressList.first(); | 619 | KABC::Addressee o = addressList.first(); |
612 | if (!o.isEmpty() && addressList.size()<2) { | 620 | if (!o.isEmpty() && addressList.size()<2) { |
613 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 621 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
614 | mText += o.formattedName(); | 622 | mText += o.formattedName(); |
615 | mText += "</a>\n"; | 623 | mText += "</a>\n"; |
616 | } else { | 624 | } else { |
617 | mText.append(event->organizer()); | 625 | mText.append(event->organizer()); |
618 | } | 626 | } |
619 | #else //DESKTOP_VERSION | 627 | #else //DESKTOP_VERSION |
620 | mText += "<a href=\"uid:organizer\">"; | 628 | mText += "<a href=\"uid:organizer\">"; |
621 | mText += event->organizer(); | 629 | mText += event->organizer(); |
622 | mText += "</a>\n"; | 630 | mText += "</a>\n"; |
623 | #endif //DESKTOP_VERSION | 631 | #endif //DESKTOP_VERSION |
624 | 632 | ||
625 | 633 | ||
626 | #else | 634 | #else |
627 | mText.append(event->organizer()); | 635 | mText.append(event->organizer()); |
628 | #endif | 636 | #endif |
629 | 637 | ||
630 | if (iconPath) { | 638 | if (iconPath) { |
631 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 639 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
632 | mText += "<IMG src=\"" + iconPath + "\">"; | 640 | mText += "<IMG src=\"" + iconPath + "\">"; |
633 | mText += "</a>\n"; | 641 | mText += "</a>\n"; |
634 | } | 642 | } |
635 | mText.append("</li></ul>"); | 643 | mText.append("</li></ul>"); |
636 | 644 | ||
637 | addTag("h3",i18n("Attendees")); | 645 | addTag("h3",i18n("Attendees")); |
638 | Attendee *a; | 646 | Attendee *a; |
639 | mText.append("<ul>"); | 647 | mText.append("<ul>"); |
640 | int a_count = 0; | 648 | int a_count = 0; |
641 | int a_count_nr = 0; | 649 | int a_count_nr = 0; |
642 | 650 | ||
643 | for(a=attendees.first();a;a=attendees.next()) { | 651 | for(a=attendees.first();a;a=attendees.next()) { |
644 | #ifndef KORG_NOKABC | 652 | #ifndef KORG_NOKABC |
645 | #ifdef DESKTOP_VERSION | 653 | #ifdef DESKTOP_VERSION |
646 | if (a->name().isEmpty()) { | 654 | if (a->name().isEmpty()) { |
647 | addressList = add_book->findByEmail(a->email()); | 655 | addressList = add_book->findByEmail(a->email()); |
648 | KABC::Addressee o = addressList.first(); | 656 | KABC::Addressee o = addressList.first(); |
649 | if (!o.isEmpty() && addressList.size()<2) { | 657 | if (!o.isEmpty() && addressList.size()<2) { |
650 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 658 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
651 | mText += o.formattedName(); | 659 | mText += o.formattedName(); |
652 | mText += "</a>\n"; | 660 | mText += "</a>\n"; |
653 | } else { | 661 | } else { |
654 | mText += "<li>"; | 662 | mText += "<li>"; |
655 | mText.append(a->email()); | 663 | mText.append(a->email()); |
656 | mText += "\n"; | 664 | mText += "\n"; |
657 | } | 665 | } |
658 | } else { | 666 | } else { |
659 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 667 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
660 | if (!a->name().isEmpty()) mText += a->name(); | 668 | if (!a->name().isEmpty()) mText += a->name(); |
661 | else mText += a->email(); | 669 | else mText += a->email(); |
662 | mText += "</a>\n"; | 670 | mText += "</a>\n"; |
663 | } | 671 | } |
664 | #else //DESKTOP_VERSION | 672 | #else //DESKTOP_VERSION |
665 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 673 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
666 | if (!a->name().isEmpty()) mText += a->name(); | 674 | if (!a->name().isEmpty()) mText += a->name(); |
667 | else mText += a->email(); | 675 | else mText += a->email(); |
668 | mText += "</a>\n"; | 676 | mText += "</a>\n"; |
669 | #endif //DESKTOP_VERSION | 677 | #endif //DESKTOP_VERSION |
670 | #else | 678 | #else |
671 | //qDebug("nokabc "); | 679 | //qDebug("nokabc "); |
672 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 680 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
673 | if (!a->name().isEmpty()) mText += a->name(); | 681 | if (!a->name().isEmpty()) mText += a->name(); |
674 | else mText += a->email(); | 682 | else mText += a->email(); |
675 | mText += "</a>\n"; | 683 | mText += "</a>\n"; |
676 | #endif | 684 | #endif |
677 | 685 | ||
678 | 686 | ||
679 | if (!a->email().isEmpty()) { | 687 | if (!a->email().isEmpty()) { |
680 | if (iconPath) { | 688 | if (iconPath) { |
681 | mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 689 | mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
682 | if ( a->RSVP() ) { | 690 | if ( a->RSVP() ) { |
683 | ++a_count_nr; | 691 | ++a_count_nr; |
684 | mText += "<IMG src=\"" + iconPath + "\">"; | 692 | mText += "<IMG src=\"" + iconPath + "\">"; |
685 | } | 693 | } |
686 | else { | 694 | else { |
687 | ++a_count; | 695 | ++a_count; |
688 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 696 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
689 | } | 697 | } |
690 | mText += "</a>\n"; | 698 | mText += "</a>\n"; |
691 | } | 699 | } |
692 | } | 700 | } |
693 | if (a->status() != Attendee::NeedsAction ) | 701 | if (a->status() != Attendee::NeedsAction ) |
694 | mText +="[" + a->statusStr() + "] "; | 702 | mText +="[" + a->statusStr() + "] "; |
695 | if (a->role() == Attendee::Chair ) | 703 | if (a->role() == Attendee::Chair ) |
696 | mText +="(" + a->roleStr().left(1) + ".)"; | 704 | mText +="(" + a->roleStr().left(1) + ".)"; |
697 | } | 705 | } |
698 | mText.append("</li></ul>"); | 706 | mText.append("</li></ul>"); |
699 | if ( (a_count+a_count_nr) > 1 ) { | 707 | if ( (a_count+a_count_nr) > 1 ) { |
700 | mText += "<a href=\"mailto:ALL\">"; | 708 | mText += "<a href=\"mailto:ALL\">"; |
701 | mText += i18n( "Mail to all" ); | 709 | mText += i18n( "Mail to all" ); |
702 | mText += "</a> ( "; | 710 | mText += "</a> ( "; |
703 | mText += "<IMG src=\"" + iconPath + "\">"; | 711 | mText += "<IMG src=\"" + iconPath + "\">"; |
704 | mText += i18n( " and " ); | 712 | mText += i18n( " and " ); |
705 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 713 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
706 | mText += "<br>\n"; | 714 | mText += "<br>\n"; |
707 | 715 | ||
708 | 716 | ||
709 | } | 717 | } |
710 | if ( a_count_nr > 1 ) { | 718 | if ( a_count_nr > 1 ) { |
711 | mText += "<a href=\"mailto:RSVP\">"; | 719 | mText += "<a href=\"mailto:RSVP\">"; |
712 | mText += i18n( "Mail to selected" ); | 720 | mText += i18n( "Mail to selected" ); |
713 | mText += "</a> ( "; | 721 | mText += "</a> ( "; |
714 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 722 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
715 | mText += "<br>\n"; | 723 | mText += "<br>\n"; |