-rw-r--r-- | korganizer/koeventviewer.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index d87938a..417d89c 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -363,193 +363,203 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
363 | 363 | ||
364 | } | 364 | } |
365 | setText(mText); | 365 | setText(mText); |
366 | //QWhatsThis::add(this,mText); | 366 | //QWhatsThis::add(this,mText); |
367 | 367 | ||
368 | } | 368 | } |
369 | 369 | ||
370 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 370 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
371 | { | 371 | { |
372 | mMailSubject = ""; | 372 | mMailSubject = ""; |
373 | mCurrentIncidence = event; | 373 | mCurrentIncidence = event; |
374 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 374 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
375 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 375 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
376 | if (mode == 0 ) | 376 | if (mode == 0 ) |
377 | addTag("h2",event->summary()); | 377 | addTag("h2",event->summary()); |
378 | else { | 378 | else { |
379 | if ( mColorMode == 1 ) { | 379 | if ( mColorMode == 1 ) { |
380 | mText +="<font color=\"#00A000\">"; | 380 | mText +="<font color=\"#00A000\">"; |
381 | } | 381 | } |
382 | if ( mColorMode == 2 ) { | 382 | if ( mColorMode == 2 ) { |
383 | mText +="<font color=\"#B00000\">"; | 383 | mText +="<font color=\"#B00000\">"; |
384 | } | 384 | } |
385 | if ( mode == 1 ) { | 385 | if ( mode == 1 ) { |
386 | addTag("h2",i18n( "Local: " ) +event->summary()); | 386 | addTag("h2",i18n( "Local: " ) +event->summary()); |
387 | } else { | 387 | } else { |
388 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 388 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
389 | } | 389 | } |
390 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 390 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
391 | if ( mColorMode ) | 391 | if ( mColorMode ) |
392 | mText += "</font>"; | 392 | mText += "</font>"; |
393 | } | 393 | } |
394 | mMailSubject += i18n( "Todo " )+ event->summary(); | 394 | mMailSubject += i18n( "Todo " )+ event->summary(); |
395 | 395 | ||
396 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 396 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
397 | mText +="<font color=\"#B00000\">"; | 397 | mText +="<font color=\"#B00000\">"; |
398 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 398 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
399 | mText += "</font>"; | 399 | mText += "</font>"; |
400 | } else { | 400 | } else { |
401 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 401 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
402 | .arg(event->percentComplete())); | 402 | .arg(event->percentComplete())); |
403 | } | 403 | } |
404 | 404 | ||
405 | if (event->cancelled ()) { | 405 | if (event->cancelled ()) { |
406 | mText +="<font color=\"#B00000\">"; | 406 | mText +="<font color=\"#B00000\">"; |
407 | addTag("i",i18n("This todo has been cancelled!")); | 407 | addTag("i",i18n("This todo has been cancelled!")); |
408 | mText.append("<br>"); | 408 | mText.append("<br>"); |
409 | mText += "</font>"; | 409 | mText += "</font>"; |
410 | mMailSubject += i18n("(cancelled)"); | 410 | mMailSubject += i18n("(cancelled)"); |
411 | } | 411 | } |
412 | 412 | ||
413 | if (!event->location().isEmpty()) { | 413 | if (!event->location().isEmpty()) { |
414 | addTag("b",i18n("Location: ")); | 414 | addTag("b",i18n("Location: ")); |
415 | mText.append(event->location()+"<br>"); | 415 | mText.append(event->location()+"<br>"); |
416 | mMailSubject += i18n(" at ") + event->location(); | 416 | mMailSubject += i18n(" at ") + event->location(); |
417 | } | 417 | } |
418 | 418 | ||
419 | if (event->recurrence()->doesRecur()) { | 419 | if (event->recurrence()->doesRecur()) { |
420 | 420 | ||
421 | QString recurText = event->recurrence()->recurrenceText(); | 421 | QString recurText = event->recurrence()->recurrenceText(); |
422 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 422 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
423 | 423 | ||
424 | } | 424 | } |
425 | if (event->hasStartDate()) { | 425 | if (event->hasStartDate()) { |
426 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 426 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
427 | } | 427 | } |
428 | if (event->hasDueDate()) { | 428 | if (event->hasDueDate()) { |
429 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 429 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
430 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 430 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
431 | } | 431 | } |
432 | addTag("b",i18n("Access: ")); | 432 | addTag("b",i18n("Access: ")); |
433 | mText.append(event->secrecyStr()+"<br>"); | 433 | mText.append(event->secrecyStr()+"<br>"); |
434 | if ( KOPrefs::instance()->mEVshowDetails ) { | 434 | if ( KOPrefs::instance()->mEVshowDetails ) { |
435 | if (!event->description().isEmpty()) { | 435 | if (!event->description().isEmpty()) { |
436 | addTag("p",i18n("<b>Details: </b>")); | 436 | addTag("p",i18n("<b>Details: </b>")); |
437 | addTag("p",event->description()); | 437 | addTag("p",event->description()); |
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | formatCategories(event); | 441 | formatCategories(event); |
442 | 442 | ||
443 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 443 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
444 | .arg(QString::number(event->priority()))); | 444 | .arg(QString::number(event->priority()))); |
445 | 445 | ||
446 | formatReadOnly(event); | 446 | formatReadOnly(event); |
447 | formatAttendees(event); | 447 | formatAttendees(event); |
448 | if ( event->relatedTo() ) { | 448 | if ( event->relatedTo() ) { |
449 | addTag("b",i18n("Parent todo:<br>")); | 449 | addTag("b",i18n("Parent todo:<br>")); |
450 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 450 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
451 | } | 451 | } |
452 | QPtrList<Incidence> Relations = event->relations(); | 452 | QPtrList<Incidence> Relations = event->relations(); |
453 | Incidence *to; | 453 | Incidence *to; |
454 | if ( Relations.first() ) | 454 | if ( Relations.first() ) |
455 | addTag("b",i18n("Sub todos:<br>")); | 455 | addTag("b",i18n("Sub todos:<br>")); |
456 | for (to=Relations.first();to;to=Relations.next()) { | 456 | for (to=Relations.first();to;to=Relations.next()) { |
457 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 457 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
458 | 458 | ||
459 | } | 459 | } |
460 | if ( KOPrefs::instance()->mEVshowCreated ) { | ||
461 | addTag("p",i18n("<b>Created: ") +" </b>"); | ||
462 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
463 | |||
464 | } | ||
465 | if ( KOPrefs::instance()->mEVshowChanged ) { | ||
466 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | ||
467 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
468 | |||
469 | } | ||
460 | setText(mText); | 470 | setText(mText); |
461 | } | 471 | } |
462 | 472 | ||
463 | void KOEventViewer::formatCategories(Incidence *event) | 473 | void KOEventViewer::formatCategories(Incidence *event) |
464 | { | 474 | { |
465 | if (!event->categoriesStr().isEmpty()) { | 475 | if (!event->categoriesStr().isEmpty()) { |
466 | if (event->categories().count() == 1) { | 476 | if (event->categories().count() == 1) { |
467 | addTag("h3",i18n("Category")); | 477 | addTag("h3",i18n("Category")); |
468 | } else { | 478 | } else { |
469 | addTag("h3",i18n("Categories")); | 479 | addTag("h3",i18n("Categories")); |
470 | } | 480 | } |
471 | addTag("p",event->categoriesStr()); | 481 | addTag("p",event->categoriesStr()); |
472 | } | 482 | } |
473 | } | 483 | } |
474 | void KOEventViewer::formatAttendees(Incidence *event) | 484 | void KOEventViewer::formatAttendees(Incidence *event) |
475 | { | 485 | { |
476 | QPtrList<Attendee> attendees = event->attendees(); | 486 | QPtrList<Attendee> attendees = event->attendees(); |
477 | if (attendees.count()) { | 487 | if (attendees.count()) { |
478 | 488 | ||
479 | 489 | ||
480 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 490 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
481 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 491 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
482 | addTag("h3",i18n("Organizer")); | 492 | addTag("h3",i18n("Organizer")); |
483 | mText.append("<ul><li>"); | 493 | mText.append("<ul><li>"); |
484 | #ifndef KORG_NOKABC | 494 | #ifndef KORG_NOKABC |
485 | 495 | ||
486 | #ifdef DESKTOP_VERSION | 496 | #ifdef DESKTOP_VERSION |
487 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 497 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
488 | KABC::Addressee::List addressList; | 498 | KABC::Addressee::List addressList; |
489 | addressList = add_book->findByEmail(event->organizer()); | 499 | addressList = add_book->findByEmail(event->organizer()); |
490 | KABC::Addressee o = addressList.first(); | 500 | KABC::Addressee o = addressList.first(); |
491 | if (!o.isEmpty() && addressList.size()<2) { | 501 | if (!o.isEmpty() && addressList.size()<2) { |
492 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 502 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
493 | mText += o.formattedName(); | 503 | mText += o.formattedName(); |
494 | mText += "</a>\n"; | 504 | mText += "</a>\n"; |
495 | } else { | 505 | } else { |
496 | mText.append(event->organizer()); | 506 | mText.append(event->organizer()); |
497 | } | 507 | } |
498 | #else //DESKTOP_VERSION | 508 | #else //DESKTOP_VERSION |
499 | mText += "<a href=\"uid:organizer\">"; | 509 | mText += "<a href=\"uid:organizer\">"; |
500 | mText += event->organizer(); | 510 | mText += event->organizer(); |
501 | mText += "</a>\n"; | 511 | mText += "</a>\n"; |
502 | #endif //DESKTOP_VERSION | 512 | #endif //DESKTOP_VERSION |
503 | 513 | ||
504 | 514 | ||
505 | #else | 515 | #else |
506 | mText.append(event->organizer()); | 516 | mText.append(event->organizer()); |
507 | #endif | 517 | #endif |
508 | 518 | ||
509 | if (iconPath) { | 519 | if (iconPath) { |
510 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 520 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
511 | mText += "<IMG src=\"" + iconPath + "\">"; | 521 | mText += "<IMG src=\"" + iconPath + "\">"; |
512 | mText += "</a>\n"; | 522 | mText += "</a>\n"; |
513 | } | 523 | } |
514 | mText.append("</li></ul>"); | 524 | mText.append("</li></ul>"); |
515 | 525 | ||
516 | addTag("h3",i18n("Attendees")); | 526 | addTag("h3",i18n("Attendees")); |
517 | Attendee *a; | 527 | Attendee *a; |
518 | mText.append("<ul>"); | 528 | mText.append("<ul>"); |
519 | int a_count = 0; | 529 | int a_count = 0; |
520 | int a_count_nr = 0; | 530 | int a_count_nr = 0; |
521 | 531 | ||
522 | for(a=attendees.first();a;a=attendees.next()) { | 532 | for(a=attendees.first();a;a=attendees.next()) { |
523 | #ifndef KORG_NOKABC | 533 | #ifndef KORG_NOKABC |
524 | #ifdef DESKTOP_VERSION | 534 | #ifdef DESKTOP_VERSION |
525 | if (a->name().isEmpty()) { | 535 | if (a->name().isEmpty()) { |
526 | addressList = add_book->findByEmail(a->email()); | 536 | addressList = add_book->findByEmail(a->email()); |
527 | KABC::Addressee o = addressList.first(); | 537 | KABC::Addressee o = addressList.first(); |
528 | if (!o.isEmpty() && addressList.size()<2) { | 538 | if (!o.isEmpty() && addressList.size()<2) { |
529 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 539 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
530 | mText += o.formattedName(); | 540 | mText += o.formattedName(); |
531 | mText += "</a>\n"; | 541 | mText += "</a>\n"; |
532 | } else { | 542 | } else { |
533 | mText += "<li>"; | 543 | mText += "<li>"; |
534 | mText.append(a->email()); | 544 | mText.append(a->email()); |
535 | mText += "\n"; | 545 | mText += "\n"; |
536 | } | 546 | } |
537 | } else { | 547 | } else { |
538 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 548 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
539 | if (!a->name().isEmpty()) mText += a->name(); | 549 | if (!a->name().isEmpty()) mText += a->name(); |
540 | else mText += a->email(); | 550 | else mText += a->email(); |
541 | mText += "</a>\n"; | 551 | mText += "</a>\n"; |
542 | } | 552 | } |
543 | #else //DESKTOP_VERSION | 553 | #else //DESKTOP_VERSION |
544 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 554 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
545 | if (!a->name().isEmpty()) mText += a->name(); | 555 | if (!a->name().isEmpty()) mText += a->name(); |
546 | else mText += a->email(); | 556 | else mText += a->email(); |
547 | mText += "</a>\n"; | 557 | mText += "</a>\n"; |
548 | #endif //DESKTOP_VERSION | 558 | #endif //DESKTOP_VERSION |
549 | #else | 559 | #else |
550 | //qDebug("nokabc "); | 560 | //qDebug("nokabc "); |
551 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 561 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
552 | if (!a->name().isEmpty()) mText += a->name(); | 562 | if (!a->name().isEmpty()) mText += a->name(); |
553 | else mText += a->email(); | 563 | else mText += a->email(); |
554 | mText += "</a>\n"; | 564 | mText += "</a>\n"; |
555 | #endif | 565 | #endif |