summaryrefslogtreecommitdiff
authoreilers <eilers>2002-10-08 14:25:09 (UTC)
committer eilers <eilers>2002-10-08 14:25:09 (UTC)
commit55c7fa47ac6784ae2bca5ff20e6130c5993e00f2 (patch) (unidiff)
tree584e31ba44186ad042589d44206f58f9db93191b
parent35858cdc60ab8ca959804e9994a7ce2cf8e99000 (diff)
downloadopie-55c7fa47ac6784ae2bca5ff20e6130c5993e00f2.zip
opie-55c7fa47ac6784ae2bca5ff20e6130c5993e00f2.tar.gz
opie-55c7fa47ac6784ae2bca5ff20e6130c5993e00f2.tar.bz2
contacteditor.cpp
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index fd7f009..5c1391b 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -652,1106 +652,1107 @@ void ContactEditor::init() {
652 cmbCountry->insertItem( tr ( "Uganda" ) ); 652 cmbCountry->insertItem( tr ( "Uganda" ) );
653 cmbCountry->insertItem( tr ( "Ukraine" ) ); 653 cmbCountry->insertItem( tr ( "Ukraine" ) );
654 cmbCountry->insertItem( tr ( "Uruguay" ) ); 654 cmbCountry->insertItem( tr ( "Uruguay" ) );
655 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 655 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
656 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 656 cmbCountry->insertItem( tr ( "Vanuatu" ) );
657 cmbCountry->insertItem( tr ( "Venezuela" ) ); 657 cmbCountry->insertItem( tr ( "Venezuela" ) );
658 cmbCountry->insertItem( tr ( "Viet Nam" ) ); 658 cmbCountry->insertItem( tr ( "Viet Nam" ) );
659 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 659 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
660 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 660 cmbCountry->insertItem( tr ( "Western Sahara" ) );
661 cmbCountry->insertItem( tr ( "Yemen" ) ); 661 cmbCountry->insertItem( tr ( "Yemen" ) );
662 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 662 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
663 cmbCountry->insertItem( tr ( "Zambia" ) ); 663 cmbCountry->insertItem( tr ( "Zambia" ) );
664 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 664 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
665 665
666 cmbCountry->setMaximumWidth( 135 ); 666 cmbCountry->setMaximumWidth( 135 );
667 667
668 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 668 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
669 669
670 cmbChooserField4 = new QComboBox( FALSE, container ); 670 cmbChooserField4 = new QComboBox( FALSE, container );
671 cmbChooserField4->setMaximumWidth( 90 ); 671 cmbChooserField4->setMaximumWidth( 90 );
672 gl->addWidget( cmbChooserField4, 6, 0 ); 672 gl->addWidget( cmbChooserField4, 6, 0 );
673 txtChooserField4 = new QLineEdit( container ); 673 txtChooserField4 = new QLineEdit( container );
674 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 674 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
675 675
676 QSpacerItem *space = new QSpacerItem(1,1, 676 QSpacerItem *space = new QSpacerItem(1,1,
677 QSizePolicy::Maximum, 677 QSizePolicy::Maximum,
678 QSizePolicy::MinimumExpanding ); 678 QSizePolicy::MinimumExpanding );
679 gl->addItem( space, 7, 0 ); 679 gl->addItem( space, 7, 0 );
680 680
681 tabMain->insertTab( tabViewport, tr( "Address" ) ); 681 tabMain->insertTab( tabViewport, tr( "Address" ) );
682 682
683 tabViewport = new QWidget ( tabMain ); 683 tabViewport = new QWidget ( tabMain );
684 684
685 vb = new QVBoxLayout( tabViewport ); 685 vb = new QVBoxLayout( tabViewport );
686 686
687 svDetails = new QScrollView( tabViewport ); 687 svDetails = new QScrollView( tabViewport );
688 vb->addWidget( svDetails, 0, 0 ); 688 vb->addWidget( svDetails, 0, 0 );
689 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 689 svDetails->setResizePolicy( QScrollView::AutoOneFit );
690 svDetails->setFrameStyle( QFrame::NoFrame ); 690 svDetails->setFrameStyle( QFrame::NoFrame );
691 691
692 container = new QWidget( svDetails->viewport() ); 692 container = new QWidget( svDetails->viewport() );
693 svDetails->addChild( container ); 693 svDetails->addChild( container );
694 694
695 gl = new QGridLayout( container, 1, 2, 2, 4 ); 695 gl = new QGridLayout( container, 1, 2, 2, 4 );
696 696
697 QStringList::ConstIterator it = slDynamicEntries.begin(); 697 QStringList::ConstIterator it = slDynamicEntries.begin();
698 for (i = 0; it != slDynamicEntries.end(); i++, ++it) { 698 for (i = 0; it != slDynamicEntries.end(); i++, ++it) {
699 l = new QLabel( *it, container ); 699 l = new QLabel( *it, container );
700 listName.append( l ); 700 listName.append( l );
701 gl->addWidget( l, i, 0 ); 701 gl->addWidget( l, i, 0 );
702 QLineEdit *e = new QLineEdit( container ); 702 QLineEdit *e = new QLineEdit( container );
703 listValue.append( e ); 703 listValue.append( e );
704 gl->addWidget( e, i, 1); 704 gl->addWidget( e, i, 1);
705 } 705 }
706 706
707 l = new QLabel( tr("Gender"), container ); 707 l = new QLabel( tr("Gender"), container );
708 gl->addWidget( l, slDynamicEntries.count(), 0 ); 708 gl->addWidget( l, slDynamicEntries.count(), 0 );
709 cmbGender = new QComboBox( container ); 709 cmbGender = new QComboBox( container );
710 cmbGender->insertItem( "", 0 ); 710 cmbGender->insertItem( "", 0 );
711 cmbGender->insertItem( tr("Male"), 1); 711 cmbGender->insertItem( tr("Male"), 1);
712 cmbGender->insertItem( tr("Female"), 2); 712 cmbGender->insertItem( tr("Female"), 2);
713 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); 713 gl->addWidget( cmbGender, slDynamicEntries.count(), 1 );
714 714
715 tabMain->insertTab( tabViewport, tr( "Details" ) ); 715 tabMain->insertTab( tabViewport, tr( "Details" ) );
716 716
717 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 717 dlgNote = new QDialog( this, "Note Dialog", TRUE );
718 dlgNote->setCaption( tr("Enter Note") ); 718 dlgNote->setCaption( tr("Enter Note") );
719 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 719 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
720 txtNote = new QMultiLineEdit( dlgNote ); 720 txtNote = new QMultiLineEdit( dlgNote );
721 vbNote->addWidget( txtNote ); 721 vbNote->addWidget( txtNote );
722 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 722 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
723 723
724 dlgName = new QDialog( this, "Name Dialog", TRUE ); 724 dlgName = new QDialog( this, "Name Dialog", TRUE );
725 dlgName->setCaption( tr("Edit Name") ); 725 dlgName->setCaption( tr("Edit Name") );
726 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 726 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
727 727
728 l = new QLabel( tr("First Name"), dlgName ); 728 l = new QLabel( tr("First Name"), dlgName );
729 gl->addWidget( l, 0, 0 ); 729 gl->addWidget( l, 0, 0 );
730 txtFirstName = new QLineEdit( dlgName ); 730 txtFirstName = new QLineEdit( dlgName );
731 gl->addWidget( txtFirstName, 0, 1 ); 731 gl->addWidget( txtFirstName, 0, 1 );
732 732
733 l = new QLabel( tr("Middle Name"), dlgName ); 733 l = new QLabel( tr("Middle Name"), dlgName );
734 gl->addWidget( l, 1, 0 ); 734 gl->addWidget( l, 1, 0 );
735 txtMiddleName = new QLineEdit( dlgName ); 735 txtMiddleName = new QLineEdit( dlgName );
736 gl->addWidget( txtMiddleName, 1, 1 ); 736 gl->addWidget( txtMiddleName, 1, 1 );
737 737
738 l = new QLabel( tr("Last Name"), dlgName ); 738 l = new QLabel( tr("Last Name"), dlgName );
739 gl->addWidget( l, 2, 0 ); 739 gl->addWidget( l, 2, 0 );
740 txtLastName = new QLineEdit( dlgName ); 740 txtLastName = new QLineEdit( dlgName );
741 gl->addWidget( txtLastName, 2, 1 ); 741 gl->addWidget( txtLastName, 2, 1 );
742 742
743 l = new QLabel( tr("Suffix"), dlgName ); 743 l = new QLabel( tr("Suffix"), dlgName );
744 gl->addWidget( l, 3, 0 ); 744 gl->addWidget( l, 3, 0 );
745 txtSuffix = new QLineEdit( dlgName ); 745 txtSuffix = new QLineEdit( dlgName );
746 gl->addWidget( txtSuffix, 3, 1 ); 746 gl->addWidget( txtSuffix, 3, 1 );
747 space = new QSpacerItem(1,1, 747 space = new QSpacerItem(1,1,
748 QSizePolicy::Maximum, 748 QSizePolicy::Maximum,
749 QSizePolicy::MinimumExpanding ); 749 QSizePolicy::MinimumExpanding );
750 gl->addItem( space, 4, 0 ); 750 gl->addItem( space, 4, 0 );
751 751
752 cmbChooserField1->insertStringList( slChooserNames ); 752 cmbChooserField1->insertStringList( slChooserNames );
753 cmbChooserField2->insertStringList( slChooserNames ); 753 cmbChooserField2->insertStringList( slChooserNames );
754 cmbChooserField3->insertStringList( slChooserNames ); 754 cmbChooserField3->insertStringList( slChooserNames );
755 cmbChooserField4->insertStringList( slChooserNames ); 755 cmbChooserField4->insertStringList( slChooserNames );
756 756
757 cmbChooserField1->setCurrentItem( 0 ); 757 cmbChooserField1->setCurrentItem( 0 );
758 cmbChooserField2->setCurrentItem( 1 ); 758 cmbChooserField2->setCurrentItem( 1 );
759 cmbChooserField3->setCurrentItem( 2 ); 759 cmbChooserField3->setCurrentItem( 2 );
760 760
761 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 761 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
762 762
763 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 763 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
764 764
765 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 765 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
766 this, SLOT(slotChooser1Change(const QString &)) ); 766 this, SLOT(slotChooser1Change(const QString &)) );
767 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 767 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
768 this, SLOT(slotChooser2Change(const QString &)) ); 768 this, SLOT(slotChooser2Change(const QString &)) );
769 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 769 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
770 this, SLOT(slotChooser3Change(const QString &)) ); 770 this, SLOT(slotChooser3Change(const QString &)) );
771 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 771 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
772 this, SLOT(slotChooser4Change(const QString &)) ); 772 this, SLOT(slotChooser4Change(const QString &)) );
773 connect( txtAddress, SIGNAL(textChanged(const QString &)), 773 connect( txtAddress, SIGNAL(textChanged(const QString &)),
774 this, SLOT(slotAddressChange(const QString &)) ); 774 this, SLOT(slotAddressChange(const QString &)) );
775 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 775 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
776 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 776 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
777 connect( txtCity, SIGNAL(textChanged(const QString &)), 777 connect( txtCity, SIGNAL(textChanged(const QString &)),
778 this, SLOT(slotCityChange(const QString &)) ); 778 this, SLOT(slotCityChange(const QString &)) );
779 connect( txtState, SIGNAL(textChanged(const QString &)), 779 connect( txtState, SIGNAL(textChanged(const QString &)),
780 this, SLOT(slotStateChange(const QString &)) ); 780 this, SLOT(slotStateChange(const QString &)) );
781 connect( txtZip, SIGNAL(textChanged(const QString &)), 781 connect( txtZip, SIGNAL(textChanged(const QString &)),
782 this, SLOT(slotZipChange(const QString &)) ); 782 this, SLOT(slotZipChange(const QString &)) );
783 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 783 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
784 this, SLOT(slotCountryChange(const QString &)) ); 784 this, SLOT(slotCountryChange(const QString &)) );
785 connect( cmbCountry, SIGNAL(activated(const QString &)), 785 connect( cmbCountry, SIGNAL(activated(const QString &)),
786 this, SLOT(slotCountryChange(const QString &)) ); 786 this, SLOT(slotCountryChange(const QString &)) );
787 connect( cmbChooserField1, SIGNAL(activated(int)), 787 connect( cmbChooserField1, SIGNAL(activated(int)),
788 this, SLOT(slotCmbChooser1Change(int)) ); 788 this, SLOT(slotCmbChooser1Change(int)) );
789 connect( cmbChooserField2, SIGNAL(activated(int)), 789 connect( cmbChooserField2, SIGNAL(activated(int)),
790 this, SLOT(slotCmbChooser2Change(int)) ); 790 this, SLOT(slotCmbChooser2Change(int)) );
791 connect( cmbChooserField3, SIGNAL(activated(int)), 791 connect( cmbChooserField3, SIGNAL(activated(int)),
792 this, SLOT(slotCmbChooser3Change(int)) ); 792 this, SLOT(slotCmbChooser3Change(int)) );
793 connect( cmbChooserField4, SIGNAL(activated(int)), 793 connect( cmbChooserField4, SIGNAL(activated(int)),
794 this, SLOT(slotCmbChooser4Change(int)) ); 794 this, SLOT(slotCmbChooser4Change(int)) );
795 connect( cmbAddress, SIGNAL(activated(int)), 795 connect( cmbAddress, SIGNAL(activated(int)),
796 this, SLOT(slotAddressTypeChange(int)) ); 796 this, SLOT(slotAddressTypeChange(int)) );
797 797
798 new QPEDialogListener(this); 798 new QPEDialogListener(this);
799} 799}
800 800
801void ContactEditor::initMap() 801void ContactEditor::initMap()
802{ 802{
803 /* 803 /*
804 // since the fields and the XML fields exist, create a map 804 // since the fields and the XML fields exist, create a map
805 // between them... 805 // between them...
806 Config cfg1( "AddressBook" ); 806 Config cfg1( "AddressBook" );
807 Config cfg2( "AddressBook" ); 807 Config cfg2( "AddressBook" );
808 QString strCfg1, 808 QString strCfg1,
809 strCfg2; 809 strCfg2;
810 int i; 810 int i;
811 811
812 // This stuff better exist... 812 // This stuff better exist...
813 cfg1.setGroup( "AddressFields" ); 813 cfg1.setGroup( "AddressFields" );
814o cfg2.setGroup( "XMLFields" ); 814o cfg2.setGroup( "XMLFields" );
815 i = 0; 815 i = 0;
816 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); 816 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null );
817 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 817 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
818 QString::null ); 818 QString::null );
819 while ( !strCfg1.isNull() && !strCfg2.isNull() ) { 819 while ( !strCfg1.isNull() && !strCfg2.isNull() ) {
820 mapField.insert( strCfg1, strCfg2 ); 820 mapField.insert( strCfg1, strCfg2 );
821 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), 821 strCfg1 = cfg1.readEntry( "Field" + QString::number(i),
822 QString::null ); 822 QString::null );
823 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 823 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
824 QString::null ); 824 QString::null );
825 } 825 }
826 */ 826 */
827} 827}
828 828
829void ContactEditor::slotChooser1Change( const QString &textChanged ) { 829void ContactEditor::slotChooser1Change( const QString &textChanged ) {
830 830
831 int index = cmbChooserField1->currentItem(); 831 int index = cmbChooserField1->currentItem();
832 832
833 slChooserValues[index] = textChanged; 833 slChooserValues[index] = textChanged;
834 834
835} 835}
836 836
837void ContactEditor::slotChooser2Change( const QString &textChanged ) { 837void ContactEditor::slotChooser2Change( const QString &textChanged ) {
838 838
839 int index = cmbChooserField2->currentItem(); 839 int index = cmbChooserField2->currentItem();
840 840
841 slChooserValues[index] = textChanged; 841 slChooserValues[index] = textChanged;
842 842
843} 843}
844 844
845void ContactEditor::slotChooser3Change( const QString &textChanged ) { 845void ContactEditor::slotChooser3Change( const QString &textChanged ) {
846 846
847 int index = cmbChooserField3->currentItem(); 847 int index = cmbChooserField3->currentItem();
848 848
849 slChooserValues[index] = textChanged; 849 slChooserValues[index] = textChanged;
850 850
851} 851}
852 852
853void ContactEditor::slotChooser4Change( const QString &textChanged ) { 853void ContactEditor::slotChooser4Change( const QString &textChanged ) {
854 854
855 int index = cmbChooserField4->currentItem(); 855 int index = cmbChooserField4->currentItem();
856 856
857 slChooserValues[index] = textChanged; 857 slChooserValues[index] = textChanged;
858 858
859} 859}
860 860
861void ContactEditor::slotAddressChange( const QString &textChanged ) { 861void ContactEditor::slotAddressChange( const QString &textChanged ) {
862 862
863 if ( cmbAddress->currentItem() == 0 ) { 863 if ( cmbAddress->currentItem() == 0 ) {
864 slBusinessAddress[0] = textChanged; 864 slBusinessAddress[0] = textChanged;
865 } else { 865 } else {
866 slHomeAddress[0] = textChanged; 866 slHomeAddress[0] = textChanged;
867 } 867 }
868} 868}
869 869
870void ContactEditor::slotAddress2Change( const QString &textChanged ) { 870void ContactEditor::slotAddress2Change( const QString &textChanged ) {
871 871
872 if ( cmbAddress->currentItem() == 0 ) { 872 if ( cmbAddress->currentItem() == 0 ) {
873 slBusinessAddress[1] = textChanged; 873 slBusinessAddress[1] = textChanged;
874 } else { 874 } else {
875 slHomeAddress[1] = textChanged; 875 slHomeAddress[1] = textChanged;
876 } 876 }
877} 877}
878 878
879void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 879void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
880 880
881 if ( cmbAddress->currentItem() == 0 ) { 881 if ( cmbAddress->currentItem() == 0 ) {
882 slBusinessAddress[2] = textChanged; 882 slBusinessAddress[2] = textChanged;
883 } else { 883 } else {
884 slHomeAddress[2] = textChanged; 884 slHomeAddress[2] = textChanged;
885 } 885 }
886} 886}
887 887
888void ContactEditor::slotCityChange( const QString &textChanged ) { 888void ContactEditor::slotCityChange( const QString &textChanged ) {
889 889
890 if ( cmbAddress->currentItem() == 0 ) { 890 if ( cmbAddress->currentItem() == 0 ) {
891 slBusinessAddress[3] = textChanged; 891 slBusinessAddress[3] = textChanged;
892 } else { 892 } else {
893 slHomeAddress[3] = textChanged; 893 slHomeAddress[3] = textChanged;
894 } 894 }
895} 895}
896 896
897void ContactEditor::slotStateChange( const QString &textChanged ) { 897void ContactEditor::slotStateChange( const QString &textChanged ) {
898 898
899 899
900 if ( cmbAddress->currentItem() == 0 ) { 900 if ( cmbAddress->currentItem() == 0 ) {
901 slBusinessAddress[4] = textChanged; 901 slBusinessAddress[4] = textChanged;
902 } else { 902 } else {
903 slHomeAddress[4] = textChanged; 903 slHomeAddress[4] = textChanged;
904 } 904 }
905} 905}
906 906
907void ContactEditor::slotZipChange( const QString &textChanged ) { 907void ContactEditor::slotZipChange( const QString &textChanged ) {
908 908
909 if ( cmbAddress->currentItem() == 0 ) { 909 if ( cmbAddress->currentItem() == 0 ) {
910 slBusinessAddress[5] = textChanged; 910 slBusinessAddress[5] = textChanged;
911 } else { 911 } else {
912 slHomeAddress[5] = textChanged; 912 slHomeAddress[5] = textChanged;
913 } 913 }
914} 914}
915 915
916void ContactEditor::slotCountryChange( const QString &textChanged ) { 916void ContactEditor::slotCountryChange( const QString &textChanged ) {
917 917
918 if ( cmbAddress->currentItem() == 0 ) { 918 if ( cmbAddress->currentItem() == 0 ) {
919 slBusinessAddress[6] = textChanged; 919 slBusinessAddress[6] = textChanged;
920 } else { 920 } else {
921 slHomeAddress[6] = textChanged; 921 slHomeAddress[6] = textChanged;
922 } 922 }
923} 923}
924 924
925void ContactEditor::slotCmbChooser1Change( int index ) { 925void ContactEditor::slotCmbChooser1Change( int index ) {
926 926
927 txtChooserField1->setText( slChooserValues[index] ); 927 txtChooserField1->setText( slChooserValues[index] );
928 txtChooserField1->setFocus(); 928 txtChooserField1->setFocus();
929} 929}
930 930
931void ContactEditor::slotCmbChooser2Change( int index ) { 931void ContactEditor::slotCmbChooser2Change( int index ) {
932 932
933 txtChooserField2->setText( slChooserValues[index] ); 933 txtChooserField2->setText( slChooserValues[index] );
934 txtChooserField2->setFocus(); 934 txtChooserField2->setFocus();
935} 935}
936 936
937void ContactEditor::slotCmbChooser3Change( int index ) { 937void ContactEditor::slotCmbChooser3Change( int index ) {
938 938
939 txtChooserField3->setText( slChooserValues[index] ); 939 txtChooserField3->setText( slChooserValues[index] );
940 txtChooserField3->setFocus(); 940 txtChooserField3->setFocus();
941 941
942} 942}
943 943
944void ContactEditor::slotCmbChooser4Change( int index ) { 944void ContactEditor::slotCmbChooser4Change( int index ) {
945 945
946 txtChooserField4->setText( slChooserValues[index] ); 946 txtChooserField4->setText( slChooserValues[index] );
947 txtChooserField4->setFocus(); 947 txtChooserField4->setFocus();
948 948
949} 949}
950 950
951void ContactEditor::slotAddressTypeChange( int index ) { 951void ContactEditor::slotAddressTypeChange( int index ) {
952 952
953 if ( index == 0 ) { 953 if ( index == 0 ) {
954 954
955 txtAddress->setText( slBusinessAddress[0] ); 955 txtAddress->setText( slBusinessAddress[0] );
956 //txtAddress2->setText( (*slBusinessAddress)[1] ); 956 //txtAddress2->setText( (*slBusinessAddress)[1] );
957 //txtPOBox->setText( (*slBusinessAddress)[2] ); 957 //txtPOBox->setText( (*slBusinessAddress)[2] );
958 txtCity->setText( slBusinessAddress[3] ); 958 txtCity->setText( slBusinessAddress[3] );
959 txtState->setText( slBusinessAddress[4] ); 959 txtState->setText( slBusinessAddress[4] );
960 txtZip->setText( slBusinessAddress[5] ); 960 txtZip->setText( slBusinessAddress[5] );
961 QLineEdit *txtTmp = cmbCountry->lineEdit(); 961 QLineEdit *txtTmp = cmbCountry->lineEdit();
962 txtTmp->setText( slBusinessAddress[6] ); 962 txtTmp->setText( slBusinessAddress[6] );
963 963
964 } else { 964 } else {
965 965
966 txtAddress->setText( slHomeAddress[0] ); 966 txtAddress->setText( slHomeAddress[0] );
967 //txtAddress2->setText( (*slHomeAddress)[1] ); 967 //txtAddress2->setText( (*slHomeAddress)[1] );
968 //txtPOBox->setText( (*slHomeAddress)[2] ); 968 //txtPOBox->setText( (*slHomeAddress)[2] );
969 txtCity->setText( slHomeAddress[3] ); 969 txtCity->setText( slHomeAddress[3] );
970 txtState->setText( slHomeAddress[4] ); 970 txtState->setText( slHomeAddress[4] );
971 txtZip->setText( slHomeAddress[5] ); 971 txtZip->setText( slHomeAddress[5] );
972 QLineEdit *txtTmp = cmbCountry->lineEdit(); 972 QLineEdit *txtTmp = cmbCountry->lineEdit();
973 txtTmp->setText( slHomeAddress[6] ); 973 txtTmp->setText( slHomeAddress[6] );
974 974
975 } 975 }
976 976
977} 977}
978 978
979void ContactEditor::slotFullNameChange( const QString &textChanged ) { 979void ContactEditor::slotFullNameChange( const QString &textChanged ) {
980 980
981 int index = cmbFileAs->currentItem(); 981 int index = cmbFileAs->currentItem();
982 982
983 cmbFileAs->clear(); 983 cmbFileAs->clear();
984 984
985 cmbFileAs->insertItem( parseName( textChanged, 0 ) ); 985 cmbFileAs->insertItem( parseName( textChanged, 0 ) );
986 cmbFileAs->insertItem( parseName( textChanged, 1 ) ); 986 cmbFileAs->insertItem( parseName( textChanged, 1 ) );
987 cmbFileAs->insertItem( parseName( textChanged, 2 ) ); 987 cmbFileAs->insertItem( parseName( textChanged, 2 ) );
988 cmbFileAs->insertItem( parseName( textChanged, 3 ) ); 988 cmbFileAs->insertItem( parseName( textChanged, 3 ) );
989 989
990 cmbFileAs->setCurrentItem( index ); 990 cmbFileAs->setCurrentItem( index );
991 991
992 useFullName = TRUE; 992 useFullName = TRUE;
993 993
994} 994}
995 995
996void ContactEditor::loadFields() { 996void ContactEditor::loadFields() {
997 997
998 QStringList::ConstIterator it; 998 QStringList::ConstIterator it;
999 QListIterator<QLabel> lit( listName ); 999 QListIterator<QLabel> lit( listName );
1000 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { 1000 for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) {
1001 (*lit)->setText( *it ); 1001 (*lit)->setText( *it );
1002 } 1002 }
1003} 1003}
1004 1004
1005void ContactEditor::accept() { 1005void ContactEditor::accept() {
1006 1006
1007 if ( isEmpty() ) { 1007 if ( isEmpty() ) {
1008 cleanupFields(); 1008 cleanupFields();
1009 reject(); 1009 reject();
1010 } else { 1010 } else {
1011 saveEntry(); 1011 saveEntry();
1012 cleanupFields(); 1012 cleanupFields();
1013 QDialog::accept(); 1013 QDialog::accept();
1014 } 1014 }
1015 1015
1016} 1016}
1017 1017
1018void ContactEditor::slotNote() { 1018void ContactEditor::slotNote() {
1019 1019
1020 dlgNote->showMaximized(); 1020 dlgNote->showMaximized();
1021 if ( !dlgNote->exec() ) { 1021 if ( !dlgNote->exec() ) {
1022 txtNote->setText( ent.notes() ); 1022 txtNote->setText( ent.notes() );
1023 } 1023 }
1024} 1024}
1025 1025
1026void ContactEditor::slotName() { 1026void ContactEditor::slotName() {
1027 1027
1028 QString tmpName; 1028 QString tmpName;
1029 if (useFullName == TRUE) { 1029 if (useFullName == TRUE) {
1030 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); 1030 txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
1031 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); 1031 txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
1032 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1032 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1033 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1033 txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1034 } 1034 }
1035 dlgName->showMaximized(); 1035 dlgName->showMaximized();
1036 if ( dlgName->exec() ) { 1036 if ( dlgName->exec() ) {
1037 1037
1038 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 1038 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
1039 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 1039 txtFullName->setText( tmpName.simplifyWhiteSpace() );
1040 slotFullNameChange( txtFullName->text() ); 1040 slotFullNameChange( txtFullName->text() );
1041 useFullName = FALSE; 1041 useFullName = FALSE;
1042 } 1042 }
1043 1043
1044} 1044}
1045 1045
1046void ContactEditor::setNameFocus() { 1046void ContactEditor::setNameFocus() {
1047 1047
1048 txtFullName->setFocus(); 1048 txtFullName->setFocus();
1049 1049
1050} 1050}
1051 1051
1052bool ContactEditor::isEmpty() { 1052bool ContactEditor::isEmpty() {
1053 // Test and see if the record should be saved. 1053 // Test and see if the record should be saved.
1054 // More strict than the original qtopia, needs name or fileas to save 1054 // More strict than the original qtopia, needs name or fileas to save
1055 1055
1056 QString t = txtFullName->text(); 1056 QString t = txtFullName->text();
1057 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1057 if ( !t.isEmpty() && containsAlphaNum( t ) )
1058 return false; 1058 return false;
1059 1059
1060 t = cmbFileAs->currentText(); 1060 t = cmbFileAs->currentText();
1061 if ( !t.isEmpty() && containsAlphaNum( t ) ) 1061 if ( !t.isEmpty() && containsAlphaNum( t ) )
1062 return false; 1062 return false;
1063 1063
1064 return true; 1064 return true;
1065 1065
1066} 1066}
1067 1067
1068QString ContactEditor::parseName( const QString fullName, int type ) { 1068QString ContactEditor::parseName( const QString fullName, int type ) {
1069 1069
1070 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1070 QString simplifiedName( fullName.simplifyWhiteSpace() );
1071 QString strFirstName; 1071 QString strFirstName;
1072 QString strMiddleName; 1072 QString strMiddleName;
1073 QString strLastName; 1073 QString strLastName;
1074 QString strSuffix; 1074 QString strSuffix;
1075 QString strTitle; 1075 QString strTitle;
1076 int commapos; 1076 int commapos;
1077 int spCount; 1077 int spCount;
1078 int spPos; 1078 int spPos;
1079 int spPos2; 1079 int spPos2;
1080 1080
1081 1081
1082 commapos = simplifiedName.find( ',', 0, TRUE); 1082 commapos = simplifiedName.find( ',', 0, TRUE);
1083 spCount = simplifiedName.contains( ' ', TRUE ); 1083 spCount = simplifiedName.contains( ' ', TRUE );
1084 1084
1085 if ( commapos == -1 ) { 1085 if ( commapos == -1 ) {
1086 1086
1087 switch (spCount) { 1087 switch (spCount) {
1088 case 0: 1088 case 0:
1089 //return simplifiedName; 1089 //return simplifiedName;
1090 if (txtLastName->text() != "") { 1090 if (txtLastName->text() != "") {
1091 strLastName = simplifiedName; 1091 strLastName = simplifiedName;
1092 break; 1092 break;
1093 } 1093 }
1094 if (txtMiddleName->text() != "") { 1094 if (txtMiddleName->text() != "") {
1095 strMiddleName = simplifiedName; 1095 strMiddleName = simplifiedName;
1096 break; 1096 break;
1097 } 1097 }
1098 if (txtSuffix->text() != "") { 1098 if (txtSuffix->text() != "") {
1099 strSuffix = simplifiedName; 1099 strSuffix = simplifiedName;
1100 break; 1100 break;
1101 } 1101 }
1102 strFirstName = simplifiedName; 1102 strFirstName = simplifiedName;
1103 break; 1103 break;
1104 1104
1105 case 1: 1105 case 1:
1106 spPos = simplifiedName.find( ' ', 0, TRUE ); 1106 spPos = simplifiedName.find( ' ', 0, TRUE );
1107 strFirstName = simplifiedName.left( spPos ); 1107 strFirstName = simplifiedName.left( spPos );
1108 strLastName = simplifiedName.mid( spPos + 1 ); 1108 strLastName = simplifiedName.mid( spPos + 1 );
1109 break; 1109 break;
1110 1110
1111 case 2: 1111 case 2:
1112 spPos = simplifiedName.find( ' ', 0, TRUE ); 1112 spPos = simplifiedName.find( ' ', 0, TRUE );
1113 strFirstName = simplifiedName.left( spPos ); 1113 strFirstName = simplifiedName.left( spPos );
1114 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1114 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1115 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1115 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1116 strLastName = simplifiedName.mid( spPos2 + 1 ); 1116 strLastName = simplifiedName.mid( spPos2 + 1 );
1117 break; 1117 break;
1118 1118
1119 case 3: 1119 case 3:
1120 spPos = simplifiedName.find( ' ', 0, TRUE ); 1120 spPos = simplifiedName.find( ' ', 0, TRUE );
1121 strFirstName = simplifiedName.left( spPos ); 1121 strFirstName = simplifiedName.left( spPos );
1122 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1122 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1123 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1123 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1124 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1124 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1125 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1125 strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1126 strSuffix = simplifiedName.mid( spPos + 1 ); 1126 strSuffix = simplifiedName.mid( spPos + 1 );
1127 break; 1127 break;
1128 1128
1129 case 4: 1129 case 4:
1130 spPos = simplifiedName.find( ' ', 0, TRUE ); 1130 spPos = simplifiedName.find( ' ', 0, TRUE );
1131 strTitle = simplifiedName.left( spPos ); 1131 strTitle = simplifiedName.left( spPos );
1132 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1132 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1133 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1133 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1134 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1134 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1135 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1135 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1136 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1136 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1137 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1137 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1138 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1138 strSuffix = simplifiedName.mid( spPos2 + 1 );
1139 break; 1139 break;
1140 1140
1141 default: 1141 default:
1142 spPos = simplifiedName.find( ' ', 0, TRUE ); 1142 spPos = simplifiedName.find( ' ', 0, TRUE );
1143 strTitle = simplifiedName.left( spPos ); 1143 strTitle = simplifiedName.left( spPos );
1144 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1144 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1145 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1145 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1146 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1146 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1147 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1147 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1148 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1148 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1149 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1149 strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1150 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1150 strSuffix = simplifiedName.mid( spPos2 + 1 );
1151 break; 1151 break;
1152 } 1152 }
1153 } else { 1153 } else {
1154 simplifiedName.replace( commapos, 1, " " ); 1154 simplifiedName.replace( commapos, 1, " " );
1155 simplifiedName = simplifiedName.simplifyWhiteSpace(); 1155 simplifiedName = simplifiedName.simplifyWhiteSpace();
1156 1156
1157 switch (spCount) { 1157 switch (spCount) {
1158 case 0: 1158 case 0:
1159 //return simplifiedName; 1159 //return simplifiedName;
1160 if (txtLastName->text() != "") { 1160 if (txtLastName->text() != "") {
1161 strLastName = simplifiedName; 1161 strLastName = simplifiedName;
1162 break; 1162 break;
1163 } 1163 }
1164 if (txtMiddleName->text() != "") { 1164 if (txtMiddleName->text() != "") {
1165 strMiddleName = simplifiedName; 1165 strMiddleName = simplifiedName;
1166 break; 1166 break;
1167 } 1167 }
1168 if (txtSuffix->text() != "") { 1168 if (txtSuffix->text() != "") {
1169 strSuffix = simplifiedName; 1169 strSuffix = simplifiedName;
1170 break; 1170 break;
1171 } 1171 }
1172 strFirstName = simplifiedName; 1172 strFirstName = simplifiedName;
1173 break; 1173 break;
1174 1174
1175 case 1: 1175 case 1:
1176 spPos = simplifiedName.find( ' ', 0, TRUE ); 1176 spPos = simplifiedName.find( ' ', 0, TRUE );
1177 strLastName = simplifiedName.left( spPos ); 1177 strLastName = simplifiedName.left( spPos );
1178 strFirstName = simplifiedName.mid( spPos + 1 ); 1178 strFirstName = simplifiedName.mid( spPos + 1 );
1179 break; 1179 break;
1180 1180
1181 case 2: 1181 case 2:
1182 spPos = simplifiedName.find( ' ', 0, TRUE ); 1182 spPos = simplifiedName.find( ' ', 0, TRUE );
1183 strLastName = simplifiedName.left( spPos ); 1183 strLastName = simplifiedName.left( spPos );
1184 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1184 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1185 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1185 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1186 strMiddleName = simplifiedName.mid( spPos2 + 1 ); 1186 strMiddleName = simplifiedName.mid( spPos2 + 1 );
1187 break; 1187 break;
1188 1188
1189 case 3: 1189 case 3:
1190 spPos = simplifiedName.find( ' ', 0, TRUE ); 1190 spPos = simplifiedName.find( ' ', 0, TRUE );
1191 strLastName = simplifiedName.left( spPos ); 1191 strLastName = simplifiedName.left( spPos );
1192 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1192 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1193 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1193 strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1194 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1194 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1195 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1195 strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1196 strSuffix = simplifiedName.mid( spPos + 1 ); 1196 strSuffix = simplifiedName.mid( spPos + 1 );
1197 break; 1197 break;
1198 1198
1199 case 4: 1199 case 4:
1200 spPos = simplifiedName.find( ' ', 0, TRUE ); 1200 spPos = simplifiedName.find( ' ', 0, TRUE );
1201 strLastName = simplifiedName.left( spPos ); 1201 strLastName = simplifiedName.left( spPos );
1202 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1202 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1203 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1203 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1204 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1204 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1205 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); 1205 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
1206 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1206 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1207 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1207 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1208 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1208 strSuffix = simplifiedName.mid( spPos2 + 1 );
1209 break; 1209 break;
1210 1210
1211 default: 1211 default:
1212 spPos = simplifiedName.find( ' ', 0, TRUE ); 1212 spPos = simplifiedName.find( ' ', 0, TRUE );
1213 strLastName = simplifiedName.left( spPos ); 1213 strLastName = simplifiedName.left( spPos );
1214 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1214 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1215 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1215 strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1216 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); 1216 spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
1217 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); 1217 strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
1218 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); 1218 spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
1219 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); 1219 strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
1220 strSuffix = simplifiedName.mid( spPos2 + 1 ); 1220 strSuffix = simplifiedName.mid( spPos2 + 1 );
1221 break; 1221 break;
1222 } 1222 }
1223 } 1223 }
1224 switch (type) { 1224 switch (type) {
1225 case NAME_FL: 1225 case NAME_FL:
1226 return strFirstName + " " + strLastName; 1226 return strFirstName + " " + strLastName;
1227 1227
1228 case NAME_LF: 1228 case NAME_LF:
1229 return strLastName + ", " + strFirstName; 1229 return strLastName + ", " + strFirstName;
1230 1230
1231 case NAME_LFM: 1231 case NAME_LFM:
1232 return strLastName + ", " + strFirstName + " " + strMiddleName; 1232 return strLastName + ", " + strFirstName + " " + strMiddleName;
1233 1233
1234 case NAME_FMLS: 1234 case NAME_FMLS:
1235 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1235 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
1236 1236
1237 case NAME_F: 1237 case NAME_F:
1238 return strFirstName; 1238 return strFirstName;
1239 1239
1240 case NAME_M: 1240 case NAME_M:
1241 return strMiddleName; 1241 return strMiddleName;
1242 1242
1243 case NAME_L: 1243 case NAME_L:
1244 return strLastName; 1244 return strLastName;
1245 1245
1246 case NAME_S: 1246 case NAME_S:
1247 return strSuffix; 1247 return strSuffix;
1248 1248
1249 } 1249 }
1250 return QString::null; 1250 return QString::null;
1251} 1251}
1252 1252
1253void ContactEditor::cleanupFields() { 1253void ContactEditor::cleanupFields() {
1254 1254
1255 QStringList::Iterator it = slChooserValues.begin(); 1255 QStringList::Iterator it = slChooserValues.begin();
1256 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { 1256 for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
1257 (*it) = ""; 1257 (*it) = "";
1258 } 1258 }
1259 1259
1260 for ( int i = 0; i < 7; i++ ) { 1260 for ( int i = 0; i < 7; i++ ) {
1261 slHomeAddress[i] = ""; 1261 slHomeAddress[i] = "";
1262 slBusinessAddress[i] = ""; 1262 slBusinessAddress[i] = "";
1263 } 1263 }
1264 1264
1265 QStringList::ConstIterator cit; 1265 QStringList::ConstIterator cit;
1266 QListIterator<QLineEdit> itLE( listValue ); 1266 QListIterator<QLineEdit> itLE( listValue );
1267 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { 1267 for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) {
1268 (*itLE)->setText( "" ); 1268 (*itLE)->setText( "" );
1269 } 1269 }
1270 1270
1271 txtFirstName->setText(""); 1271 txtFirstName->setText("");
1272 txtMiddleName->setText(""); 1272 txtMiddleName->setText("");
1273 txtLastName->setText(""); 1273 txtLastName->setText("");
1274 txtSuffix->setText(""); 1274 txtSuffix->setText("");
1275 txtNote->setText(""); 1275 txtNote->setText("");
1276 txtFullName->setText(""); 1276 txtFullName->setText("");
1277 txtJobTitle->setText(""); 1277 txtJobTitle->setText("");
1278 txtOrganization->setText(""); 1278 txtOrganization->setText("");
1279 txtChooserField1->setText(""); 1279 txtChooserField1->setText("");
1280 txtChooserField2->setText(""); 1280 txtChooserField2->setText("");
1281 txtChooserField3->setText(""); 1281 txtChooserField3->setText("");
1282 txtAddress->setText(""); 1282 txtAddress->setText("");
1283 //txtAddress2->setText(""); 1283 //txtAddress2->setText("");
1284 txtCity->setText(""); 1284 txtCity->setText("");
1285 //txtPOBox->setText(""); 1285 //txtPOBox->setText("");
1286 txtState->setText(""); 1286 txtState->setText("");
1287 txtZip->setText(""); 1287 txtZip->setText("");
1288 QLineEdit *txtTmp = cmbCountry->lineEdit(); 1288 QLineEdit *txtTmp = cmbCountry->lineEdit();
1289 txtTmp->setText(""); 1289 txtTmp->setText("");
1290 txtTmp = cmbFileAs->lineEdit(); 1290 txtTmp = cmbFileAs->lineEdit();
1291 txtTmp->setText(""); 1291 txtTmp->setText("");
1292 1292
1293} 1293}
1294 1294
1295void ContactEditor::setEntry( const OContact &entry ) { 1295void ContactEditor::setEntry( const OContact &entry ) {
1296 1296
1297 cleanupFields(); 1297 cleanupFields();
1298 1298
1299 1299
1300 ent = entry; 1300 ent = entry;
1301 1301
1302 useFullName = FALSE; 1302 useFullName = FALSE;
1303 txtFirstName->setText( ent.firstName() ); 1303 txtFirstName->setText( ent.firstName() );
1304 txtMiddleName->setText( ent.middleName() ); 1304 txtMiddleName->setText( ent.middleName() );
1305 txtLastName->setText( ent.lastName() ); 1305 txtLastName->setText( ent.lastName() );
1306 txtSuffix->setText( ent.suffix() ); 1306 txtSuffix->setText( ent.suffix() );
1307 1307
1308 QString *tmpString = new QString; 1308 QString *tmpString = new QString;
1309 *tmpString = ent.firstName() + " " + ent.middleName() + 1309 *tmpString = ent.firstName() + " " + ent.middleName() +
1310 + " " + ent.lastName() + " " + ent.suffix(); 1310 + " " + ent.lastName() + " " + ent.suffix();
1311 1311
1312 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 1312 txtFullName->setText( tmpString->simplifyWhiteSpace() );
1313 1313
1314 cmbFileAs->setEditText( ent.fileAs() ); 1314 cmbFileAs->setEditText( ent.fileAs() );
1315 1315
1316 if (hasTitle) 1316 if (hasTitle)
1317 txtJobTitle->setText( ent.jobTitle() ); 1317 txtJobTitle->setText( ent.jobTitle() );
1318 1318
1319 if (hasCompany) 1319 if (hasCompany)
1320 txtOrganization->setText( ent.company() ); 1320 txtOrganization->setText( ent.company() );
1321 1321
1322 if (hasNotes) 1322 if (hasNotes)
1323 txtNote->setText( ent.notes() ); 1323 txtNote->setText( ent.notes() );
1324 1324
1325 if (hasStreet) { 1325 if (hasStreet) {
1326 slHomeAddress[0] = ent.homeStreet(); 1326 slHomeAddress[0] = ent.homeStreet();
1327 slBusinessAddress[0] = ent.businessStreet(); 1327 slBusinessAddress[0] = ent.businessStreet();
1328 } 1328 }
1329/* 1329/*
1330 if (hasStreet2) { 1330 if (hasStreet2) {
1331 (*slHomeAddress)[1] = ent.homeStreet2(); 1331 (*slHomeAddress)[1] = ent.homeStreet2();
1332 (*slBusinessAddress)[1] = ent.businessStreet2(); 1332 (*slBusinessAddress)[1] = ent.businessStreet2();
1333 } 1333 }
1334 1334
1335 if (hasPOBox) { 1335 if (hasPOBox) {
1336 (*slHomeAddress)[2] = ent.homePOBox(); 1336 (*slHomeAddress)[2] = ent.homePOBox();
1337 (*slBusinessAddress)[2] = ent.businessPOBox(); 1337 (*slBusinessAddress)[2] = ent.businessPOBox();
1338 } 1338 }
1339*/ 1339*/
1340 if (hasCity) { 1340 if (hasCity) {
1341 slHomeAddress[3] = ent.homeCity(); 1341 slHomeAddress[3] = ent.homeCity();
1342 slBusinessAddress[3] = ent.businessCity(); 1342 slBusinessAddress[3] = ent.businessCity();
1343 } 1343 }
1344 1344
1345 if (hasState) { 1345 if (hasState) {
1346 slHomeAddress[4] = ent.homeState(); 1346 slHomeAddress[4] = ent.homeState();
1347 slBusinessAddress[4] = ent.businessState(); 1347 slBusinessAddress[4] = ent.businessState();
1348 } 1348 }
1349 1349
1350 if (hasZip) { 1350 if (hasZip) {
1351 slHomeAddress[5] = ent.homeZip(); 1351 slHomeAddress[5] = ent.homeZip();
1352 slBusinessAddress[5] = ent.businessZip(); 1352 slBusinessAddress[5] = ent.businessZip();
1353 } 1353 }
1354 1354
1355 if (hasCountry) { 1355 if (hasCountry) {
1356 slHomeAddress[6] = ent.homeCountry(); 1356 slHomeAddress[6] = ent.homeCountry();
1357 slBusinessAddress[6] = ent.businessCountry(); 1357 slBusinessAddress[6] = ent.businessCountry();
1358 } 1358 }
1359 1359
1360 QStringList::ConstIterator it; 1360 QStringList::ConstIterator it;
1361 QListIterator<QLineEdit> itLE( listValue ); 1361 QListIterator<QLineEdit> itLE( listValue );
1362 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1362 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1363 if ( *it == tr("Department") ) 1363 if ( *it == tr("Department") )
1364 (*itLE)->setText( ent.department() ); 1364 (*itLE)->setText( ent.department() );
1365 1365
1366 if ( *it == tr("Company" )) 1366 if ( *it == tr("Company" ))
1367 (*itLE)->setText( ent.company() ); 1367 (*itLE)->setText( ent.company() );
1368 1368
1369 if ( *it == tr("Office" )) 1369 if ( *it == tr("Office" ))
1370 (*itLE)->setText( ent.office() ); 1370 (*itLE)->setText( ent.office() );
1371 1371
1372 if ( *it == tr("Profession" )) 1372 if ( *it == tr("Profession" ))
1373 (*itLE)->setText( ent.profession() ); 1373 (*itLE)->setText( ent.profession() );
1374 1374
1375 if ( *it == tr("Assistant" )) 1375 if ( *it == tr("Assistant" ))
1376 (*itLE)->setText( ent.assistant() ); 1376 (*itLE)->setText( ent.assistant() );
1377 1377
1378 if ( *it == tr("Manager" )) 1378 if ( *it == tr("Manager" ))
1379 (*itLE)->setText( ent.manager() ); 1379 (*itLE)->setText( ent.manager() );
1380 1380
1381 if ( *it == tr("Spouse" )) 1381 if ( *it == tr("Spouse" ))
1382 (*itLE)->setText( ent.spouse() ); 1382 (*itLE)->setText( ent.spouse() );
1383 1383
1384 if ( *it == tr("Birthday" )) 1384 if ( *it == tr("Birthday" ))
1385 (*itLE)->setText( ent.birthday() ); 1385 (*itLE)->setText( ent.birthday() );
1386 1386
1387 if ( *it == tr("Anniversary" )) 1387 if ( *it == tr("Anniversary" ))
1388 (*itLE)->setText( ent.anniversary() ); 1388 (*itLE)->setText( ent.anniversary() );
1389 1389
1390 if ( *it == tr("Nickname" )) 1390 if ( *it == tr("Nickname" ))
1391 (*itLE)->setText( ent.nickname() ); 1391 (*itLE)->setText( ent.nickname() );
1392 1392
1393 if ( *it == tr("Children" )) 1393 if ( *it == tr("Children" ))
1394 (*itLE)->setText( ent.children() ); 1394 (*itLE)->setText( ent.children() );
1395 1395
1396 } 1396 }
1397 1397
1398 QStringList::Iterator itV; 1398 QStringList::Iterator itV;
1399 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1399 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1400 1400
1401 if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) 1401 if ( *it == tr("Business Phone") || *it == tr("Work Phone" ))
1402 *itV = ent.businessPhone(); 1402 *itV = ent.businessPhone();
1403/* 1403/*
1404 if ( *it == "Business 2 Phone" ) 1404 if ( *it == "Business 2 Phone" )
1405 *itV = ent.business2Phone(); 1405 *itV = ent.business2Phone();
1406*/ 1406*/
1407 if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) 1407 if ( *it == tr("Business Fax") || *it == tr("Work Fax" ))
1408 *itV = ent.businessFax(); 1408 *itV = ent.businessFax();
1409 1409
1410 if ( *it == tr("Business Mobile") || *it == tr("work Mobile" )) 1410 if ( *it == tr("Business Mobile") || *it == tr("work Mobile" ))
1411 *itV = ent.businessMobile(); 1411 *itV = ent.businessMobile();
1412/* 1412/*
1413 if ( *it == "Company Phone" ) 1413 if ( *it == "Company Phone" )
1414 *itV = ent.companyPhone(); 1414 *itV = ent.companyPhone();
1415*/ 1415*/
1416 if ( *it == tr("Default Email" )) 1416 if ( *it == tr("Default Email" ))
1417 *itV = ent.defaultEmail(); 1417 *itV = ent.defaultEmail();
1418 1418
1419 if ( *it == tr("Emails" )) 1419 if ( *it == tr("Emails" ))
1420 *itV = ent.emailList().join(";"); 1420 *itV = ent.emailList().join(","); // :SX
1421 1421
1422 if ( *it == tr("Home Phone" )) 1422 if ( *it == tr("Home Phone" ))
1423 *itV = ent.homePhone(); 1423 *itV = ent.homePhone();
1424/* 1424/*
1425 if ( *it == "Home 2 Phone" ) 1425 if ( *it == "Home 2 Phone" )
1426 *itV = ent.home2Phone(); 1426 *itV = ent.home2Phone();
1427*/ 1427*/
1428 if ( *it == tr("Home Fax" )) 1428 if ( *it == tr("Home Fax" ))
1429 *itV = ent.homeFax(); 1429 *itV = ent.homeFax();
1430 1430
1431 if ( *it == tr("Home Mobile" )) 1431 if ( *it == tr("Home Mobile" ))
1432 *itV = ent.homeMobile(); 1432 *itV = ent.homeMobile();
1433/* 1433/*
1434 if ( *it == "Car Phone" ) 1434 if ( *it == "Car Phone" )
1435 *itV = ent.carPhone(); 1435 *itV = ent.carPhone();
1436 1436
1437 if ( *it == "ISDN Phone" ) 1437 if ( *it == "ISDN Phone" )
1438 *itV = ent.ISDNPhone(); 1438 *itV = ent.ISDNPhone();
1439 1439
1440 if ( *it == "Other Phone" ) 1440 if ( *it == "Other Phone" )
1441 *itV = ent.otherPhone(); 1441 *itV = ent.otherPhone();
1442*/ 1442*/
1443 if ( *it == tr("Business Pager") || *it == tr("Work Pager" )) 1443 if ( *it == tr("Business Pager") || *it == tr("Work Pager" ))
1444 *itV = ent.businessPager(); 1444 *itV = ent.businessPager();
1445/* 1445/*
1446 if ( *it == "Home Pager") 1446 if ( *it == "Home Pager")
1447 *itV = ent.homePager(); 1447 *itV = ent.homePager();
1448 1448
1449 if ( *it == "AIM IM" ) 1449 if ( *it == "AIM IM" )
1450 *itV = ent.AIMIM(); 1450 *itV = ent.AIMIM();
1451 1451
1452 if ( *it == "ICQ IM" ) 1452 if ( *it == "ICQ IM" )
1453 *itV = ent.ICQIM(); 1453 *itV = ent.ICQIM();
1454 1454
1455 if ( *it == "Jabber IM" ) 1455 if ( *it == "Jabber IM" )
1456 *itV = ent.jabberIM(); 1456 *itV = ent.jabberIM();
1457 1457
1458 if ( *it == "MSN IM" ) 1458 if ( *it == "MSN IM" )
1459 *itV = ent.MSNIM(); 1459 *itV = ent.MSNIM();
1460 1460
1461 if ( *it == "Yahoo IM" ) 1461 if ( *it == "Yahoo IM" )
1462 *itV = ent.yahooIM(); 1462 *itV = ent.yahooIM();
1463*/ 1463*/
1464 if ( *it == tr("Home Web Page") ) 1464 if ( *it == tr("Home Web Page") )
1465 *itV = ent.homeWebpage(); 1465 *itV = ent.homeWebpage();
1466 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") ) 1466 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") )
1467 *itV = ent.businessWebpage(); 1467 *itV = ent.businessWebpage();
1468 1468
1469 1469
1470 } 1470 }
1471 1471
1472 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1472 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1473 1473
1474 QString gender = ent.gender(); 1474 QString gender = ent.gender();
1475 cmbGender->setCurrentItem( gender.toInt() ); 1475 cmbGender->setCurrentItem( gender.toInt() );
1476 1476
1477 txtNote->setText( ent.notes() ); 1477 txtNote->setText( ent.notes() );
1478 1478
1479 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1479 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1480 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1480 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1481 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1481 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1482 1482
1483 slotAddressTypeChange( cmbAddress->currentItem() ); 1483 slotAddressTypeChange( cmbAddress->currentItem() );
1484 1484
1485} 1485}
1486 1486
1487void ContactEditor::saveEntry() { 1487void ContactEditor::saveEntry() {
1488 1488
1489 if ( useFullName == TRUE ) { 1489 if ( useFullName == TRUE ) {
1490 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1490 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1491 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1491 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1492 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1492 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1493 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1493 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1494 1494
1495 useFullName = FALSE; 1495 useFullName = FALSE;
1496 } 1496 }
1497 1497
1498 /*if ( ent.firstName() != txtFirstName->text() || 1498 /*if ( ent.firstName() != txtFirstName->text() ||
1499 ent.lastName != txtLastName->text() || 1499 ent.lastName != txtLastName->text() ||
1500 ent.middleName != txtMiddleName->text() ) { 1500 ent.middleName != txtMiddleName->text() ) {
1501 */ 1501 */
1502 ent.setFirstName( txtFirstName->text() ); 1502 ent.setFirstName( txtFirstName->text() );
1503 ent.setLastName( txtLastName->text() ); 1503 ent.setLastName( txtLastName->text() );
1504 ent.setMiddleName( txtMiddleName->text() ); 1504 ent.setMiddleName( txtMiddleName->text() );
1505 ent.setSuffix( txtSuffix->text() ); 1505 ent.setSuffix( txtSuffix->text() );
1506 1506
1507 //} 1507 //}
1508 1508
1509 ent.setFileAs( cmbFileAs->currentText() ); 1509 ent.setFileAs( cmbFileAs->currentText() );
1510 1510
1511 ent.setCategories( cmbCat->currentCategories() ); 1511 ent.setCategories( cmbCat->currentCategories() );
1512 1512
1513 if (hasTitle) 1513 if (hasTitle)
1514 ent.setJobTitle( txtJobTitle->text() ); 1514 ent.setJobTitle( txtJobTitle->text() );
1515 1515
1516 if (hasCompany) 1516 if (hasCompany)
1517 ent.setCompany( txtOrganization->text() ); 1517 ent.setCompany( txtOrganization->text() );
1518 1518
1519 if (hasNotes) 1519 if (hasNotes)
1520 ent.setNotes( txtNote->text() ); 1520 ent.setNotes( txtNote->text() );
1521 1521
1522 if (hasStreet) { 1522 if (hasStreet) {
1523 ent.setHomeStreet( slHomeAddress[0] ); 1523 ent.setHomeStreet( slHomeAddress[0] );
1524 ent.setBusinessStreet( slBusinessAddress[0] ); 1524 ent.setBusinessStreet( slBusinessAddress[0] );
1525 } 1525 }
1526/* 1526/*
1527 if (hasStreet2) { 1527 if (hasStreet2) {
1528 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1528 ent.setHomeStreet2( (*slHomeAddress)[1] );
1529 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1529 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1530 } 1530 }
1531 1531
1532 if (hasPOBox) { 1532 if (hasPOBox) {
1533 ent.setHomePOBox( (*slHomeAddress)[2] ); 1533 ent.setHomePOBox( (*slHomeAddress)[2] );
1534 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1534 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1535 } 1535 }
1536*/ 1536*/
1537 if (hasCity) { 1537 if (hasCity) {
1538 ent.setHomeCity( slHomeAddress[3] ); 1538 ent.setHomeCity( slHomeAddress[3] );
1539 ent.setBusinessCity( slBusinessAddress[3] ); 1539 ent.setBusinessCity( slBusinessAddress[3] );
1540 } 1540 }
1541 1541
1542 if (hasState) { 1542 if (hasState) {
1543 ent.setHomeState( slHomeAddress[4] ); 1543 ent.setHomeState( slHomeAddress[4] );
1544 ent.setBusinessState( slBusinessAddress[4] ); 1544 ent.setBusinessState( slBusinessAddress[4] );
1545 } 1545 }
1546 1546
1547 if (hasZip) { 1547 if (hasZip) {
1548 ent.setHomeZip( slHomeAddress[5] ); 1548 ent.setHomeZip( slHomeAddress[5] );
1549 ent.setBusinessZip( slBusinessAddress[5] ); 1549 ent.setBusinessZip( slBusinessAddress[5] );
1550 } 1550 }
1551 1551
1552 if (hasCountry) { 1552 if (hasCountry) {
1553 ent.setHomeCountry( slHomeAddress[6] ); 1553 ent.setHomeCountry( slHomeAddress[6] );
1554 ent.setBusinessCountry( slBusinessAddress[6] ); 1554 ent.setBusinessCountry( slBusinessAddress[6] );
1555 } 1555 }
1556 1556
1557 QStringList::ConstIterator it; 1557 QStringList::ConstIterator it;
1558 QListIterator<QLineEdit> itLE( listValue ); 1558 QListIterator<QLineEdit> itLE( listValue );
1559 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1559 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1560 if ( *it == tr("Department" )) 1560 if ( *it == tr("Department" ))
1561 ent.setDepartment( (*itLE)->text() ); 1561 ent.setDepartment( (*itLE)->text() );
1562 1562
1563 if ( *it == tr("Company" )) 1563 if ( *it == tr("Company" ))
1564 ent.setCompany( (*itLE)->text() ); 1564 ent.setCompany( (*itLE)->text() );
1565 1565
1566 if ( *it == tr("Office" )) 1566 if ( *it == tr("Office" ))
1567 ent.setOffice( (*itLE)->text() ); 1567 ent.setOffice( (*itLE)->text() );
1568 1568
1569 if ( *it == tr("Profession" )) 1569 if ( *it == tr("Profession" ))
1570 ent.setProfession( (*itLE)->text() ); 1570 ent.setProfession( (*itLE)->text() );
1571 1571
1572 if ( *it == tr("Assistant" )) 1572 if ( *it == tr("Assistant" ))
1573 ent.setAssistant( (*itLE)->text() ); 1573 ent.setAssistant( (*itLE)->text() );
1574 1574
1575 if ( *it == tr("Manager" )) 1575 if ( *it == tr("Manager" ))
1576 ent.setManager( (*itLE)->text() ); 1576 ent.setManager( (*itLE)->text() );
1577 1577
1578 if ( *it == tr("Spouse" )) 1578 if ( *it == tr("Spouse" ))
1579 ent.setSpouse( (*itLE)->text() ); 1579 ent.setSpouse( (*itLE)->text() );
1580 1580
1581 if ( *it == tr("Birthday" )) 1581 if ( *it == tr("Birthday" ))
1582 ent.setBirthday( (*itLE)->text() ); 1582 ent.setBirthday( (*itLE)->text() );
1583 1583
1584 if ( *it == tr("Anniversary" )) 1584 if ( *it == tr("Anniversary" ))
1585 ent.setAnniversary( (*itLE)->text() ); 1585 ent.setAnniversary( (*itLE)->text() );
1586 1586
1587 if ( *it == tr("Nickname" )) 1587 if ( *it == tr("Nickname" ))
1588 ent.setNickname( (*itLE)->text() ); 1588 ent.setNickname( (*itLE)->text() );
1589 1589
1590 if ( *it == tr("Children" )) 1590 if ( *it == tr("Children" ))
1591 ent.setChildren( (*itLE)->text() ); 1591 ent.setChildren( (*itLE)->text() );
1592 1592
1593 } 1593 }
1594 1594
1595 QStringList::ConstIterator itV; 1595 QStringList::ConstIterator itV;
1596 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1596 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1597 1597
1598 if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) 1598 if ( *it == tr("Business Phone") || *it == tr("Work Phone" ))
1599 ent.setBusinessPhone( *itV ); 1599 ent.setBusinessPhone( *itV );
1600/* 1600/*
1601 if ( *it == tr("Business 2 Phone" ) 1601 if ( *it == tr("Business 2 Phone" )
1602 ent.setBusiness2Phone( *itV ); 1602 ent.setBusiness2Phone( *itV );
1603*/ 1603*/
1604 if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) 1604 if ( *it == tr("Business Fax") || *it == tr("Work Fax" ))
1605 ent.setBusinessFax( *itV ); 1605 ent.setBusinessFax( *itV );
1606 1606
1607 if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" )) 1607 if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" ))
1608 ent.setBusinessMobile( *itV ); 1608 ent.setBusinessMobile( *itV );
1609/* 1609/*
1610 if ( *it == "Company Phone" ) 1610 if ( *it == "Company Phone" )
1611 ent.setCompanyPhone( *itV ); 1611 ent.setCompanyPhone( *itV );
1612*/ 1612*/
1613 //if ( *it == "Default Email" ) 1613 //if ( *it == "Default Email" )
1614 //ent.setDefaultEmail( *itV ); 1614 //ent.setDefaultEmail( *itV );
1615 1615
1616 if ( *it == tr("Emails" )) { 1616 if ( *it == tr("Emails" )) {
1617 QString allemail; 1617 QString allemail;
1618 QString defaultmail; 1618 QString defaultmail;
1619 parseEmailFrom( *itV, defaultmail, allemail ); 1619 parseEmailFrom( *itV, defaultmail, allemail );
1620 ent.clearEmails();
1620 ent.setDefaultEmail( defaultmail ); 1621 ent.setDefaultEmail( defaultmail );
1621 ent.insertEmails( *itV ); 1622 ent.insertEmails( *itV );
1622 } 1623 }
1623 1624
1624 if ( *it == tr("Home Phone" )) 1625 if ( *it == tr("Home Phone" ))
1625 ent.setHomePhone( *itV ); 1626 ent.setHomePhone( *itV );
1626/* 1627/*
1627 if ( *it == "Home 2 Phone" ) 1628 if ( *it == "Home 2 Phone" )
1628 ent.setHome2Phone( *itV ); 1629 ent.setHome2Phone( *itV );
1629*/ 1630*/
1630 if ( *it == tr("Home Fax" )) 1631 if ( *it == tr("Home Fax" ))
1631 ent.setHomeFax( *itV ); 1632 ent.setHomeFax( *itV );
1632 1633
1633 if ( *it == tr("Home Mobile" )) 1634 if ( *it == tr("Home Mobile" ))
1634 ent.setHomeMobile( *itV ); 1635 ent.setHomeMobile( *itV );
1635/* 1636/*
1636 if ( *it == "Car Phone" ) 1637 if ( *it == "Car Phone" )
1637 ent.setCarPhone( *itV ); 1638 ent.setCarPhone( *itV );
1638 1639
1639 if ( *it == "ISDN Phone" ) 1640 if ( *it == "ISDN Phone" )
1640 ent.setISDNPhone( *itV ); 1641 ent.setISDNPhone( *itV );
1641 1642
1642 if ( *it == "Other Phone" ) 1643 if ( *it == "Other Phone" )
1643 ent.setOtherPhone( *itV ); 1644 ent.setOtherPhone( *itV );
1644*/ 1645*/
1645 if ( *it == tr("Business Pager") || *it == tr("Work Pager") ) 1646 if ( *it == tr("Business Pager") || *it == tr("Work Pager") )
1646 ent.setBusinessPager( *itV ); 1647 ent.setBusinessPager( *itV );
1647/* 1648/*
1648 if ( *it == "Home Pager" ) 1649 if ( *it == "Home Pager" )
1649 ent.setHomePager( *itV ); 1650 ent.setHomePager( *itV );
1650 1651
1651 if ( *it == "AIM IM" ) 1652 if ( *it == "AIM IM" )
1652 ent.setAIMIM( *itV ); 1653 ent.setAIMIM( *itV );
1653 1654
1654 if ( *it == "ICQ IM" ) 1655 if ( *it == "ICQ IM" )
1655 ent.setICQIM( *itV ); 1656 ent.setICQIM( *itV );
1656 1657
1657 if ( *it == "Jabber IM" ) 1658 if ( *it == "Jabber IM" )
1658 ent.setJabberIM( *itV ); 1659 ent.setJabberIM( *itV );
1659 1660
1660 if ( *it == "MSN IM" ) 1661 if ( *it == "MSN IM" )
1661 ent.setMSNIM( *itV ); 1662 ent.setMSNIM( *itV );
1662 1663
1663 if ( *it == "Yahoo IM" ) 1664 if ( *it == "Yahoo IM" )
1664 ent.setYahooIM( *itV ); 1665 ent.setYahooIM( *itV );
1665*/ 1666*/
1666 if ( *it == tr("Home Web Page") ) 1667 if ( *it == tr("Home Web Page") )
1667 ent.setHomeWebpage( *itV ); 1668 ent.setHomeWebpage( *itV );
1668 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" )) 1669 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" ))
1669 ent.setBusinessWebpage( *itV ); 1670 ent.setBusinessWebpage( *itV );
1670 1671
1671 1672
1672 } 1673 }
1673 1674
1674 int gender = cmbGender->currentItem(); 1675 int gender = cmbGender->currentItem();
1675 ent.setGender( QString::number( gender ) ); 1676 ent.setGender( QString::number( gender ) );
1676 1677
1677 QString str = txtNote->text(); 1678 QString str = txtNote->text();
1678 if ( !str.isNull() ) 1679 if ( !str.isNull() )
1679 ent.setNotes( str ); 1680 ent.setNotes( str );
1680 1681
1681} 1682}
1682 1683
1683void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1684void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1684 QString &strAll ) 1685 QString &strAll )
1685{ 1686{
1686 int where, 1687 int where,
1687 start; 1688 start;
1688 if ( txt.isEmpty() ) 1689 if ( txt.isEmpty() )
1689 return; 1690 return;
1690 // find the first 1691 // find the first
1691 where = txt.find( ',' ); 1692 where = txt.find( ',' );
1692 if ( where < 0 ) { 1693 if ( where < 0 ) {
1693 strDefaultEmail = txt; 1694 strDefaultEmail = txt;
1694 strAll = txt; 1695 strAll = txt;
1695 } else { 1696 } else {
1696 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1697 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1697 strAll = strDefaultEmail; 1698 strAll = strDefaultEmail;
1698 while ( where > -1 ) { 1699 while ( where > -1 ) {
1699 strAll.append(" "); 1700 strAll.append(" ");
1700 start = where; 1701 start = where;
1701 where = txt.find( ',', where + 1 ); 1702 where = txt.find( ',', where + 1 );
1702 if ( where > - 1 ) 1703 if ( where > - 1 )
1703 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1704 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1704 else // grab until the end... 1705 else // grab until the end...
1705 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1706 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1706 } 1707 }
1707 } 1708 }
1708} 1709}
1709 1710
1710void parseEmailTo( const QString &strDefaultEmail, 1711void parseEmailTo( const QString &strDefaultEmail,
1711 const QString &strOtherEmail, QString &strBack ) 1712 const QString &strOtherEmail, QString &strBack )
1712{ 1713{
1713 // create a comma dilimeted set of emails... 1714 // create a comma dilimeted set of emails...
1714 // use the power of short circuiting... 1715 // use the power of short circuiting...
1715 bool foundDefault = false; 1716 bool foundDefault = false;
1716 QString strTmp; 1717 QString strTmp;
1717 int start = 0; 1718 int start = 0;
1718 int where; 1719 int where;
1719 // start at the beginng. 1720 // start at the beginng.
1720 strBack = strDefaultEmail; 1721 strBack = strDefaultEmail;
1721 where = 0; 1722 where = 0;
1722 while ( where > -1 ) { 1723 while ( where > -1 ) {
1723 start = where; 1724 start = where;
1724 where = strOtherEmail.find( ' ', where + 1 ); 1725 where = strOtherEmail.find( ' ', where + 1 );
1725 if ( where > 0 ) { 1726 if ( where > 0 ) {
1726 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1727 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1727 } else 1728 } else
1728 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1729 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1729 if ( foundDefault || strTmp != strDefaultEmail ) { 1730 if ( foundDefault || strTmp != strDefaultEmail ) {
1730 strBack.append( ", " ); 1731 strBack.append( ", " );
1731 strBack.append( strTmp ); 1732 strBack.append( strTmp );
1732 } else 1733 } else
1733 foundDefault = true; 1734 foundDefault = true;
1734 } 1735 }
1735} 1736}
1736 1737
1737 1738
1738static inline bool containsAlphaNum( const QString &str ) 1739static inline bool containsAlphaNum( const QString &str )
1739{ 1740{
1740 int i, 1741 int i,
1741 count = str.length(); 1742 count = str.length();
1742 for ( i = 0; i < count; i++ ) 1743 for ( i = 0; i < count; i++ )
1743 if ( !str[i].isSpace() ) 1744 if ( !str[i].isSpace() )
1744 return TRUE; 1745 return TRUE;
1745 return FALSE; 1746 return FALSE;
1746} 1747}
1747 1748
1748static inline bool constainsWhiteSpace( const QString &str ) 1749static inline bool constainsWhiteSpace( const QString &str )
1749{ 1750{
1750 int i, 1751 int i,
1751 count = str.length(); 1752 count = str.length();
1752 for (i = 0; i < count; i++ ) 1753 for (i = 0; i < count; i++ )
1753 if ( str[i].isSpace() ) 1754 if ( str[i].isSpace() )
1754 return TRUE; 1755 return TRUE;
1755 return FALSE; 1756 return FALSE;
1756} 1757}
1757 1758