-rw-r--r-- | korganizer/koeventviewer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 417d89c..44da058 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -504,192 +504,204 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
504 | mText += "</a>\n"; | 504 | mText += "</a>\n"; |
505 | } else { | 505 | } else { |
506 | mText.append(event->organizer()); | 506 | mText.append(event->organizer()); |
507 | } | 507 | } |
508 | #else //DESKTOP_VERSION | 508 | #else //DESKTOP_VERSION |
509 | mText += "<a href=\"uid:organizer\">"; | 509 | mText += "<a href=\"uid:organizer\">"; |
510 | mText += event->organizer(); | 510 | mText += event->organizer(); |
511 | mText += "</a>\n"; | 511 | mText += "</a>\n"; |
512 | #endif //DESKTOP_VERSION | 512 | #endif //DESKTOP_VERSION |
513 | 513 | ||
514 | 514 | ||
515 | #else | 515 | #else |
516 | mText.append(event->organizer()); | 516 | mText.append(event->organizer()); |
517 | #endif | 517 | #endif |
518 | 518 | ||
519 | if (iconPath) { | 519 | if (iconPath) { |
520 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 520 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
521 | mText += "<IMG src=\"" + iconPath + "\">"; | 521 | mText += "<IMG src=\"" + iconPath + "\">"; |
522 | mText += "</a>\n"; | 522 | mText += "</a>\n"; |
523 | } | 523 | } |
524 | mText.append("</li></ul>"); | 524 | mText.append("</li></ul>"); |
525 | 525 | ||
526 | addTag("h3",i18n("Attendees")); | 526 | addTag("h3",i18n("Attendees")); |
527 | Attendee *a; | 527 | Attendee *a; |
528 | mText.append("<ul>"); | 528 | mText.append("<ul>"); |
529 | int a_count = 0; | 529 | int a_count = 0; |
530 | int a_count_nr = 0; | 530 | int a_count_nr = 0; |
531 | 531 | ||
532 | for(a=attendees.first();a;a=attendees.next()) { | 532 | for(a=attendees.first();a;a=attendees.next()) { |
533 | #ifndef KORG_NOKABC | 533 | #ifndef KORG_NOKABC |
534 | #ifdef DESKTOP_VERSION | 534 | #ifdef DESKTOP_VERSION |
535 | if (a->name().isEmpty()) { | 535 | if (a->name().isEmpty()) { |
536 | addressList = add_book->findByEmail(a->email()); | 536 | addressList = add_book->findByEmail(a->email()); |
537 | KABC::Addressee o = addressList.first(); | 537 | KABC::Addressee o = addressList.first(); |
538 | if (!o.isEmpty() && addressList.size()<2) { | 538 | if (!o.isEmpty() && addressList.size()<2) { |
539 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 539 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
540 | mText += o.formattedName(); | 540 | mText += o.formattedName(); |
541 | mText += "</a>\n"; | 541 | mText += "</a>\n"; |
542 | } else { | 542 | } else { |
543 | mText += "<li>"; | 543 | mText += "<li>"; |
544 | mText.append(a->email()); | 544 | mText.append(a->email()); |
545 | mText += "\n"; | 545 | mText += "\n"; |
546 | } | 546 | } |
547 | } else { | 547 | } else { |
548 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 548 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
549 | if (!a->name().isEmpty()) mText += a->name(); | 549 | if (!a->name().isEmpty()) mText += a->name(); |
550 | else mText += a->email(); | 550 | else mText += a->email(); |
551 | mText += "</a>\n"; | 551 | mText += "</a>\n"; |
552 | } | 552 | } |
553 | #else //DESKTOP_VERSION | 553 | #else //DESKTOP_VERSION |
554 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 554 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
555 | if (!a->name().isEmpty()) mText += a->name(); | 555 | if (!a->name().isEmpty()) mText += a->name(); |
556 | else mText += a->email(); | 556 | else mText += a->email(); |
557 | mText += "</a>\n"; | 557 | mText += "</a>\n"; |
558 | #endif //DESKTOP_VERSION | 558 | #endif //DESKTOP_VERSION |
559 | #else | 559 | #else |
560 | //qDebug("nokabc "); | 560 | //qDebug("nokabc "); |
561 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 561 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
562 | if (!a->name().isEmpty()) mText += a->name(); | 562 | if (!a->name().isEmpty()) mText += a->name(); |
563 | else mText += a->email(); | 563 | else mText += a->email(); |
564 | mText += "</a>\n"; | 564 | mText += "</a>\n"; |
565 | #endif | 565 | #endif |
566 | 566 | ||
567 | 567 | ||
568 | if (!a->email().isEmpty()) { | 568 | if (!a->email().isEmpty()) { |
569 | if (iconPath) { | 569 | if (iconPath) { |
570 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 570 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
571 | if ( a->RSVP() ) { | 571 | if ( a->RSVP() ) { |
572 | ++a_count_nr; | 572 | ++a_count_nr; |
573 | mText += "<IMG src=\"" + iconPath + "\">"; | 573 | mText += "<IMG src=\"" + iconPath + "\">"; |
574 | } | 574 | } |
575 | else { | 575 | else { |
576 | ++a_count; | 576 | ++a_count; |
577 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 577 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
578 | } | 578 | } |
579 | mText += "</a>\n"; | 579 | mText += "</a>\n"; |
580 | } | 580 | } |
581 | } | 581 | } |
582 | if (a->status() != Attendee::NeedsAction ) | 582 | if (a->status() != Attendee::NeedsAction ) |
583 | mText +="[" + a->statusStr() + "] "; | 583 | mText +="[" + a->statusStr() + "] "; |
584 | if (a->role() == Attendee::Chair ) | 584 | if (a->role() == Attendee::Chair ) |
585 | mText +="(" + a->roleStr().left(1) + ".)"; | 585 | mText +="(" + a->roleStr().left(1) + ".)"; |
586 | } | 586 | } |
587 | mText.append("</li></ul>"); | 587 | mText.append("</li></ul>"); |
588 | if ( (a_count+a_count_nr) > 1 ) { | 588 | if ( (a_count+a_count_nr) > 1 ) { |
589 | mText += "<a href=\"mailto:ALL\">"; | 589 | mText += "<a href=\"mailto:ALL\">"; |
590 | mText += i18n( "Mail to all" ); | 590 | mText += i18n( "Mail to all" ); |
591 | mText += "</a> ( "; | 591 | mText += "</a> ( "; |
592 | mText += "<IMG src=\"" + iconPath + "\">"; | 592 | mText += "<IMG src=\"" + iconPath + "\">"; |
593 | mText += i18n( " and " ); | 593 | mText += i18n( " and " ); |
594 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 594 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
595 | mText += "<br>\n"; | 595 | mText += "<br>\n"; |
596 | 596 | ||
597 | 597 | ||
598 | } | 598 | } |
599 | if ( a_count_nr > 1 ) { | 599 | if ( a_count_nr > 1 ) { |
600 | mText += "<a href=\"mailto:RSVP\">"; | 600 | mText += "<a href=\"mailto:RSVP\">"; |
601 | mText += i18n( "Mail to selected" ); | 601 | mText += i18n( "Mail to selected" ); |
602 | mText += "</a> ( "; | 602 | mText += "</a> ( "; |
603 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 603 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
604 | mText += "<br>\n"; | 604 | mText += "<br>\n"; |
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | } | 608 | } |
609 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 609 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
610 | { | 610 | { |
611 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 611 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
612 | if (mode == 0 ) { | 612 | if (mode == 0 ) { |
613 | addTag("h2",i18n("Journal from: ")); | 613 | addTag("h2",i18n("Journal from: ")); |
614 | } | 614 | } |
615 | else { | 615 | else { |
616 | if ( mode == 1 ) { | 616 | if ( mode == 1 ) { |
617 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 617 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
618 | } else { | 618 | } else { |
619 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 619 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | topLevelWidget()->setCaption("Journal Viewer"); | 622 | topLevelWidget()->setCaption("Journal Viewer"); |
623 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 623 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
624 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 624 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
625 | if (!jour->description().isEmpty()) { | 625 | if (!jour->description().isEmpty()) { |
626 | addTag("p",jour->description()); | 626 | addTag("p",jour->description()); |
627 | } | 627 | } |
628 | setText(mText); | 628 | setText(mText); |
629 | } | 629 | } |
630 | 630 | ||
631 | void KOEventViewer::formatReadOnly(Incidence *event) | 631 | void KOEventViewer::formatReadOnly(Incidence *event) |
632 | { | 632 | { |
633 | if (event->isReadOnly()) { | 633 | if (event->isReadOnly()) { |
634 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 634 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
635 | } | 635 | } |
636 | } | 636 | } |
637 | void KOEventViewer::setSyncMode( bool b ) | 637 | void KOEventViewer::setSyncMode( bool b ) |
638 | { | 638 | { |
639 | mSyncMode = b; | 639 | mSyncMode = b; |
640 | } | 640 | } |
641 | 641 | ||
642 | 642 | ||
643 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 643 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
644 | { | 644 | { |
645 | if ( clearV ) | 645 | if ( clearV ) |
646 | clearEvents(); | 646 | clearEvents(); |
647 | if ( mSyncMode ) { | 647 | if ( mSyncMode ) { |
648 | if ( clearV ) | 648 | if ( clearV ) |
649 | appendTodo(event,1 ); | 649 | appendTodo(event,1 ); |
650 | else | 650 | else |
651 | appendTodo(event,2); | 651 | appendTodo(event,2); |
652 | } else | 652 | } else |
653 | appendTodo(event); | 653 | appendTodo(event); |
654 | } | 654 | } |
655 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 655 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
656 | { | 656 | { |
657 | if ( clearV ) | 657 | if ( clearV ) |
658 | clearEvents(); | 658 | clearEvents(); |
659 | if ( mSyncMode ) { | 659 | if ( mSyncMode ) { |
660 | if ( clearV ) | 660 | if ( clearV ) |
661 | appendJournal(event, 1); | 661 | appendJournal(event, 1); |
662 | else | 662 | else |
663 | appendJournal(event, 2); | 663 | appendJournal(event, 2); |
664 | } else | 664 | } else |
665 | appendJournal(event); | 665 | appendJournal(event); |
666 | } | 666 | } |
667 | 667 | ||
668 | void KOEventViewer::setEvent(Event *event) | 668 | void KOEventViewer::setEvent(Event *event) |
669 | { | 669 | { |
670 | clearEvents(); | 670 | clearEvents(); |
671 | if ( mSyncMode ) | 671 | if ( mSyncMode ) |
672 | appendEvent(event, 1); | 672 | appendEvent(event, 1); |
673 | else | 673 | else |
674 | appendEvent(event); | 674 | appendEvent(event); |
675 | } | 675 | } |
676 | 676 | ||
677 | void KOEventViewer::addEvent(Event *event) | 677 | void KOEventViewer::addEvent(Event *event) |
678 | { | 678 | { |
679 | if ( mSyncMode ) | 679 | if ( mSyncMode ) |
680 | appendEvent(event, 2); | 680 | appendEvent(event, 2); |
681 | else | 681 | else |
682 | appendEvent(event); | 682 | appendEvent(event); |
683 | } | 683 | } |
684 | 684 | ||
685 | void KOEventViewer::clearEvents(bool now) | 685 | void KOEventViewer::clearEvents(bool now) |
686 | { | 686 | { |
687 | mText = ""; | 687 | mText = ""; |
688 | if (now) setText(mText); | 688 | if (now) setText(mText); |
689 | } | 689 | } |
690 | 690 | ||
691 | void KOEventViewer::addText(QString text) | 691 | void KOEventViewer::addText(QString text) |
692 | { | 692 | { |
693 | mText.append(text); | 693 | mText.append(text); |
694 | setText(mText); | 694 | setText(mText); |
695 | } | 695 | } |
696 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) | ||
697 | { | ||
698 | switch ( e->key() ) { | ||
699 | case Qt::Key_Return: | ||
700 | case Qt::Key_Enter : | ||
701 | e->ignore(); | ||
702 | break; | ||
703 | default: | ||
704 | QTextBrowser::keyPressEvent ( e ); | ||
705 | break; | ||
706 | } | ||
707 | } | ||