Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 539d6ba..52aff36 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -563,198 +563,207 @@ void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) | |||
563 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 563 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
564 | p->setPen( QPen( cg.buttonText() ) ); | 564 | p->setPen( QPen( cg.buttonText() ) ); |
565 | } | 565 | } |
566 | 566 | ||
567 | QFont f = p->font(); | 567 | QFont f = p->font(); |
568 | QFontMetrics fm(f); | 568 | QFontMetrics fm(f); |
569 | 569 | ||
570 | int marg = 2; | 570 | int marg = 2; |
571 | int x = 0; | 571 | int x = 0; |
572 | int y = ( cr.height() - 14 ) / 2; | 572 | int y = ( cr.height() - 14 ) / 2; |
573 | 573 | ||
574 | QString nameText = act_contact.fileAs(); | 574 | QString nameText = act_contact.fileAs(); |
575 | 575 | ||
576 | switch( col ){ | 576 | switch( col ){ |
577 | case 0: | 577 | case 0: |
578 | p->drawText( x + marg,2 + fm.ascent(), nameText ); | 578 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
579 | break; | 579 | break; |
580 | case 1:{ | 580 | case 1:{ |
581 | 581 | ||
582 | ContactItem contactItem = findContactContact( act_contact, 0 ); | 582 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
583 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ | 583 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
584 | QString contactText = contactItem.value; | 584 | QString contactText = contactItem.value; |
585 | 585 | ||
586 | if ( !contactPic.isNull() ) | 586 | if ( !contactPic.isNull() ) |
587 | { | 587 | { |
588 | p->drawPixmap( x + marg, y, contactPic ); | 588 | p->drawPixmap( x + marg, y, contactPic ); |
589 | p->drawText( x + marg + contactPic.width() | 589 | p->drawText( x + marg + contactPic.width() |
590 | + 4,2 + fm.ascent(), contactText ); | 590 | + 4,2 + fm.ascent(), contactText ); |
591 | } | 591 | } |
592 | else | 592 | else |
593 | { | 593 | { |
594 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | 594 | p->drawText( x + marg,2 + fm.ascent(), contactText ); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | break; | 597 | break; |
598 | 598 | ||
599 | } | 599 | } |
600 | p->restore(); | 600 | p->restore(); |
601 | } | 601 | } |
602 | 602 | ||
603 | void AbTable::rowHeightChanged( int row ) | 603 | void AbTable::rowHeightChanged( int row ) |
604 | { | 604 | { |
605 | if ( enablePainting ) | 605 | if ( enablePainting ) |
606 | QTable::rowHeightChanged( row ); | 606 | QTable::rowHeightChanged( row ); |
607 | } | 607 | } |
608 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) | 608 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) |
609 | { | 609 | { |
610 | 610 | ||
611 | ContactItem item; | 611 | int iconsize = fontMetrics().height(); |
612 | QImage icon; | ||
612 | 613 | ||
614 | ContactItem item; | ||
613 | item.value = ""; | 615 | item.value = ""; |
614 | 616 | ||
615 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 617 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
616 | it != intFields.end(); ++it ) { | 618 | it != intFields.end(); ++it ) { |
619 | icon.reset(); | ||
620 | |||
617 | switch ( *it ) { | 621 | switch ( *it ) { |
618 | default: | 622 | default: |
619 | break; | 623 | break; |
620 | case Qtopia::Title: | 624 | case Qtopia::Title: |
621 | item.value = entry.title(); | 625 | item.value = entry.title(); |
622 | break; | 626 | break; |
623 | case Qtopia::Suffix: | 627 | case Qtopia::Suffix: |
624 | item.value = entry.suffix(); | 628 | item.value = entry.suffix(); |
625 | break; | 629 | break; |
626 | case Qtopia::FileAs: | 630 | case Qtopia::FileAs: |
627 | item.value = entry.fileAs(); | 631 | item.value = entry.fileAs(); |
628 | break; | 632 | break; |
629 | case Qtopia::DefaultEmail: | 633 | case Qtopia::DefaultEmail: |
630 | item.value = entry.defaultEmail(); | 634 | item.value = entry.defaultEmail(); |
631 | if ( !item.value.isEmpty() ) | 635 | if ( !item.value.isEmpty() ) |
632 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); | 636 | icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); |
633 | break; | 637 | break; |
634 | case Qtopia::Emails: | 638 | case Qtopia::Emails: |
635 | item.value = entry.emails(); | 639 | item.value = entry.emails(); |
636 | if ( !item.value.isEmpty() ) | 640 | if ( !item.value.isEmpty() ) |
637 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); | 641 | icon = Opie::Core::OResource::loadPixmap( "addressbook/email" ); |
638 | break; | 642 | break; |
639 | case Qtopia::HomeStreet: | 643 | case Qtopia::HomeStreet: |
640 | item.value = entry.homeStreet(); | 644 | item.value = entry.homeStreet(); |
641 | break; | 645 | break; |
642 | case Qtopia::HomeCity: | 646 | case Qtopia::HomeCity: |
643 | item.value = entry.homeCity(); | 647 | item.value = entry.homeCity(); |
644 | break; | 648 | break; |
645 | case Qtopia::HomeState: | 649 | case Qtopia::HomeState: |
646 | item.value = entry.homeState(); | 650 | item.value = entry.homeState(); |
647 | break; | 651 | break; |
648 | case Qtopia::HomeZip: | 652 | case Qtopia::HomeZip: |
649 | item.value = entry.homeZip(); | 653 | item.value = entry.homeZip(); |
650 | break; | 654 | break; |
651 | case Qtopia::HomeCountry: | 655 | case Qtopia::HomeCountry: |
652 | item.value = entry.homeCountry(); | 656 | item.value = entry.homeCountry(); |
653 | break; | 657 | break; |
654 | case Qtopia::HomePhone: | 658 | case Qtopia::HomePhone: |
655 | item.value = entry.homePhone(); | 659 | item.value = entry.homePhone(); |
656 | if ( !item.value.isEmpty() ) | 660 | if ( !item.value.isEmpty() ) |
657 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome" ); | 661 | icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome" ); |
658 | break; | 662 | break; |
659 | case Qtopia::HomeFax: | 663 | case Qtopia::HomeFax: |
660 | item.value = entry.homeFax(); | 664 | item.value = entry.homeFax(); |
661 | if ( !item.value.isEmpty() ) | 665 | if ( !item.value.isEmpty() ) |
662 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome" ); | 666 | icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome" ); |
663 | break; | 667 | break; |
664 | case Qtopia::HomeMobile: | 668 | case Qtopia::HomeMobile: |
665 | item.value = entry.homeMobile(); | 669 | item.value = entry.homeMobile(); |
666 | if ( !item.value.isEmpty() ) | 670 | if ( !item.value.isEmpty() ) |
667 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome" ); | 671 | icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome" ); |
668 | break; | 672 | break; |
669 | case Qtopia::HomeWebPage: | 673 | case Qtopia::HomeWebPage: |
670 | item.value = entry.homeWebpage(); | 674 | item.value = entry.homeWebpage(); |
671 | if ( !item.value.isEmpty() ) | 675 | if ( !item.value.isEmpty() ) |
672 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome" ); | 676 | icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome" ); |
673 | break; | 677 | break; |
674 | case Qtopia::Company: | 678 | case Qtopia::Company: |
675 | item.value = entry.company(); | 679 | item.value = entry.company(); |
676 | break; | 680 | break; |
677 | case Qtopia::BusinessCity: | 681 | case Qtopia::BusinessCity: |
678 | item.value = entry.businessCity(); | 682 | item.value = entry.businessCity(); |
679 | break; | 683 | break; |
680 | case Qtopia::BusinessStreet: | 684 | case Qtopia::BusinessStreet: |
681 | item.value = entry.businessStreet(); | 685 | item.value = entry.businessStreet(); |
682 | break; | 686 | break; |
683 | case Qtopia::BusinessZip: | 687 | case Qtopia::BusinessZip: |
684 | item.value = entry.businessZip(); | 688 | item.value = entry.businessZip(); |
685 | break; | 689 | break; |
686 | case Qtopia::BusinessCountry: | 690 | case Qtopia::BusinessCountry: |
687 | item.value = entry.businessCountry(); | 691 | item.value = entry.businessCountry(); |
688 | break; | 692 | break; |
689 | case Qtopia::BusinessWebPage: | 693 | case Qtopia::BusinessWebPage: |
690 | item.value = entry.businessWebpage(); | 694 | item.value = entry.businessWebpage(); |
691 | if ( !item.value.isEmpty() ) | 695 | if ( !item.value.isEmpty() ) |
692 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework" ); | 696 | icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework" ); |
693 | break; | 697 | break; |
694 | case Qtopia::JobTitle: | 698 | case Qtopia::JobTitle: |
695 | item.value = entry.jobTitle(); | 699 | item.value = entry.jobTitle(); |
696 | break; | 700 | break; |
697 | case Qtopia::Department: | 701 | case Qtopia::Department: |
698 | item.value = entry.department(); | 702 | item.value = entry.department(); |
699 | break; | 703 | break; |
700 | case Qtopia::Office: | 704 | case Qtopia::Office: |
701 | item.value = entry.office(); | 705 | item.value = entry.office(); |
702 | break; | 706 | break; |
703 | case Qtopia::BusinessPhone: | 707 | case Qtopia::BusinessPhone: |
704 | item.value = entry.businessPhone(); | 708 | item.value = entry.businessPhone(); |
705 | if ( !item.value.isEmpty() ) | 709 | if ( !item.value.isEmpty() ) |
706 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework" ); | 710 | icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework" ); |
707 | break; | 711 | break; |
708 | case Qtopia::BusinessFax: | 712 | case Qtopia::BusinessFax: |
709 | item.value = entry.businessFax(); | 713 | item.value = entry.businessFax(); |
710 | if ( !item.value.isEmpty() ) | 714 | if ( !item.value.isEmpty() ) |
711 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork" ); | 715 | icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork" ); |
712 | break; | 716 | break; |
713 | case Qtopia::BusinessMobile: | 717 | case Qtopia::BusinessMobile: |
714 | item.value = entry.businessMobile(); | 718 | item.value = entry.businessMobile(); |
715 | if ( !item.value.isEmpty() ) | 719 | if ( !item.value.isEmpty() ) |
716 | item.icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework" ); | 720 | icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework" ); |
717 | break; | 721 | break; |
718 | case Qtopia::BusinessPager: | 722 | case Qtopia::BusinessPager: |
719 | item.value = entry.businessPager(); | 723 | item.value = entry.businessPager(); |
720 | break; | 724 | break; |
721 | case Qtopia::Profession: | 725 | case Qtopia::Profession: |
722 | item.value = entry.profession(); | 726 | item.value = entry.profession(); |
723 | break; | 727 | break; |
724 | case Qtopia::Assistant: | 728 | case Qtopia::Assistant: |
725 | item.value = entry.assistant(); | 729 | item.value = entry.assistant(); |
726 | break; | 730 | break; |
727 | case Qtopia::Manager: | 731 | case Qtopia::Manager: |
728 | item.value = entry.manager(); | 732 | item.value = entry.manager(); |
729 | break; | 733 | break; |
730 | case Qtopia::Spouse: | 734 | case Qtopia::Spouse: |
731 | item.value = entry.spouse(); | 735 | item.value = entry.spouse(); |
732 | break; | 736 | break; |
733 | case Qtopia::Gender: | 737 | case Qtopia::Gender: |
734 | item.value = entry.gender(); | 738 | item.value = entry.gender(); |
735 | break; | 739 | break; |
736 | case Qtopia::Birthday: | 740 | case Qtopia::Birthday: |
737 | if ( ! entry.birthday().isNull() ){ | 741 | if ( ! entry.birthday().isNull() ){ |
738 | item.value = TimeString::numberDateString( entry.birthday() ); | 742 | item.value = TimeString::numberDateString( entry.birthday() ); |
739 | } | 743 | } |
740 | break; | 744 | break; |
741 | case Qtopia::Anniversary: | 745 | case Qtopia::Anniversary: |
742 | if ( ! entry.anniversary().isNull() ){ | 746 | if ( ! entry.anniversary().isNull() ){ |
743 | item.value = TimeString::numberDateString( entry.anniversary() ); | 747 | item.value = TimeString::numberDateString( entry.anniversary() ); |
744 | } | 748 | } |
745 | break; | 749 | break; |
746 | case Qtopia::Nickname: | 750 | case Qtopia::Nickname: |
747 | item.value = entry.nickname(); | 751 | item.value = entry.nickname(); |
748 | break; | 752 | break; |
749 | case Qtopia::Children: | 753 | case Qtopia::Children: |
750 | item.value = entry.children(); | 754 | item.value = entry.children(); |
751 | break; | 755 | break; |
752 | case Qtopia::Notes: | 756 | case Qtopia::Notes: |
753 | item.value = entry.notes(); | 757 | item.value = entry.notes(); |
754 | break; | 758 | break; |
755 | } | 759 | } |
760 | |||
761 | if ( !icon.isNull() ) { | ||
762 | item.icon = icon.smoothScale( iconsize, iconsize ); | ||
763 | } | ||
764 | |||
756 | if ( !item.value.isEmpty() ) | 765 | if ( !item.value.isEmpty() ) |
757 | break; | 766 | break; |
758 | } | 767 | } |
759 | return item; | 768 | return item; |
760 | } | 769 | } |