summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp24
-rw-r--r--core/pim/addressbook/contacteditor.cpp176
2 files changed, 102 insertions, 98 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index cf2eddf..472b13e 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -623,408 +623,410 @@ void AddressbookWindow::editPersonal()
623 abView()->init(new_personal); 623 abView()->init(new_personal);
624 abView()->sync(); 624 abView()->sync();
625 } 625 }
626 abEditor->setCaption( tr("Edit Address") ); 626 abEditor->setCaption( tr("Edit Address") );
627} 627}
628 628
629void AddressbookWindow::slotPersonalView() 629void AddressbookWindow::slotPersonalView()
630{ 630{
631 if (!actionPersonal->isOn()) { 631 if (!actionPersonal->isOn()) {
632 // we just turned it off 632 // we just turned it off
633 setCaption( tr("Contacts") ); 633 setCaption( tr("Contacts") );
634 actionNew->setEnabled(TRUE); 634 actionNew->setEnabled(TRUE);
635 actionTrash->setEnabled(TRUE); 635 actionTrash->setEnabled(TRUE);
636#ifndef MAKE_FOR_SHARP_ROM 636#ifndef MAKE_FOR_SHARP_ROM
637 actionFind->setEnabled(TRUE); 637 actionFind->setEnabled(TRUE);
638#endif 638#endif
639 slotUpdateToolbar(); // maybe some of the above could be moved there 639 slotUpdateToolbar(); // maybe some of the above could be moved there
640 showList(); 640 showList();
641 return; 641 return;
642 } 642 }
643 643
644 // XXX need to disable some QActions. 644 // XXX need to disable some QActions.
645 actionNew->setEnabled(FALSE); 645 actionNew->setEnabled(FALSE);
646 actionTrash->setEnabled(FALSE); 646 actionTrash->setEnabled(FALSE);
647#ifndef MAKE_FOR_SHARP_ROM 647#ifndef MAKE_FOR_SHARP_ROM
648 actionFind->setEnabled(FALSE); 648 actionFind->setEnabled(FALSE);
649#endif 649#endif
650 actionMail->setEnabled(FALSE); 650 actionMail->setEnabled(FALSE);
651 651
652 setCaption( tr("Contacts - My Personal Details") ); 652 setCaption( tr("Contacts - My Personal Details") );
653 QString filename = addressbookPersonalVCardName(); 653 QString filename = addressbookPersonalVCardName();
654 OContact me; 654 OContact me;
655 if (QFile::exists(filename)) 655 if (QFile::exists(filename))
656 me = OContact::readVCard( filename )[0]; 656 me = OContact::readVCard( filename )[0];
657 657
658 abView()->init( me ); 658 abView()->init( me );
659 abView()->sync(); 659 abView()->sync();
660 listContainer->hide(); 660 listContainer->hide();
661 setCentralWidget( abView() ); 661 setCentralWidget( abView() );
662 mView->show(); 662 mView->show();
663 mView->setFocus(); 663 mView->setFocus();
664} 664}
665 665
666void AddressbookWindow::editEntry( EntryMode entryMode ) 666void AddressbookWindow::editEntry( EntryMode entryMode )
667{ 667{
668 OContact entry; 668 OContact entry;
669 if ( bAbEditFirstTime ) { 669 if ( bAbEditFirstTime ) {
670 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, 670 abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields,
671 this, "editor" ); 671 this, "editor" );
672 bAbEditFirstTime = FALSE; 672 bAbEditFirstTime = FALSE;
673 if ( entryMode == EditEntry ) 673 if ( entryMode == EditEntry )
674 abEditor->setEntry( abList->currentEntry() ); 674 abEditor->setEntry( abList->currentEntry() );
675 } 675 }
676 // other things may chane the caption. 676 // other things may chane the caption.
677 abEditor->setCaption( tr("Edit Address") ); 677 abEditor->setCaption( tr("Edit Address") );
678 678
679#if defined(Q_WS_QWS) || defined(_WS_QWS_) 679#if defined(Q_WS_QWS) || defined(_WS_QWS_)
680 abEditor->showMaximized(); 680 abEditor->showMaximized();
681#endif 681#endif
682 // fix the foxus... 682 // fix the foxus...
683 abEditor->setNameFocus(); 683 abEditor->setNameFocus();
684 if ( abEditor->exec() ) { 684 if ( abEditor->exec() ) {
685 setFocus(); 685 setFocus();
686 if ( entryMode == NewEntry ) { 686 if ( entryMode == NewEntry ) {
687 OContact insertEntry = abEditor->entry(); 687 OContact insertEntry = abEditor->entry();
688 insertEntry.assignUid(); 688 insertEntry.assignUid();
689 abList->addEntry( insertEntry ); 689 abList->addEntry( insertEntry );
690 } else { 690 } else {
691 OContact replaceEntry = abEditor->entry(); 691 OContact replaceEntry = abEditor->entry();
692 if ( !replaceEntry.isValidUid() ) 692 if ( !replaceEntry.isValidUid() )
693 replaceEntry.assignUid(); 693 replaceEntry.assignUid();
694 abList->replaceCurrentEntry( replaceEntry ); 694 abList->replaceCurrentEntry( replaceEntry );
695 } 695 }
696 } 696 }
697 populateCategories(); 697 populateCategories();
698 showList(); 698 showList();
699} 699}
700 700
701void AddressbookWindow::listIsEmpty( bool empty ) 701void AddressbookWindow::listIsEmpty( bool empty )
702{ 702{
703 if ( !empty ) { 703 if ( !empty ) {
704 deleteButton->setEnabled( TRUE ); 704 deleteButton->setEnabled( TRUE );
705 } 705 }
706} 706}
707 707
708void AddressbookWindow::reload() 708void AddressbookWindow::reload()
709{ 709{
710 syncing = FALSE; 710 syncing = FALSE;
711 abList->clear(); 711 abList->clear();
712 abList->load( addressbookXMLFilename() ); 712 abList->load( addressbookXMLFilename() );
713} 713}
714 714
715void AddressbookWindow::flush() 715void AddressbookWindow::flush()
716{ 716{
717 syncing = TRUE; 717 syncing = TRUE;
718 abList->save( addressbookXMLFilename() ); 718 abList->save( addressbookXMLFilename() );
719} 719}
720 720
721 721
722void AddressbookWindow::closeEvent( QCloseEvent *e ) 722void AddressbookWindow::closeEvent( QCloseEvent *e )
723{ 723{
724 if ( centralWidget() == mView ) { 724 if ( centralWidget() == mView ) {
725 if (actionPersonal->isOn()) { 725 if (actionPersonal->isOn()) {
726 // pretend we clicked it off 726 // pretend we clicked it off
727 actionPersonal->setOn(FALSE); 727 actionPersonal->setOn(FALSE);
728 slotPersonalView(); 728 slotPersonalView();
729 } else { 729 } else {
730 showList(); 730 showList();
731 } 731 }
732 e->ignore(); 732 e->ignore();
733 return; 733 return;
734 } 734 }
735 735
736 if(syncing) { 736 if(syncing) {
737 /* shouldn't we save, I hear you say? well its already been set 737 /* shouldn't we save, I hear you say? well its already been set
738 so that an edit can not occur during a sync, and we flushed 738 so that an edit can not occur during a sync, and we flushed
739 at the start of the sync, so there is no need to save 739 at the start of the sync, so there is no need to save
740 Saving however itself would cause problems. */ 740 Saving however itself would cause problems. */
741 e->accept(); 741 e->accept();
742 return; 742 return;
743 } 743 }
744 //################## shouldn't always save 744 //################## shouldn't always save
745 // True, but the database handles this automatically ! (se) 745 // True, but the database handles this automatically ! (se)
746 if ( save() ) 746 if ( save() )
747 e->accept(); 747 e->accept();
748 else 748 else
749 e->ignore(); 749 e->ignore();
750} 750}
751 751
752/* 752/*
753 Returns TRUE if it is OK to exit 753 Returns TRUE if it is OK to exit
754*/ 754*/
755 755
756bool AddressbookWindow::save() 756bool AddressbookWindow::save()
757{ 757{
758 QString str = addressbookXMLFilename(); 758 QString str = addressbookXMLFilename();
759 if ( str.isNull() ) { 759 if ( str.isNull() ) {
760 if ( QMessageBox::critical( 0, tr("Out of space"), 760 if ( QMessageBox::critical( 0, tr("Out of space"),
761 tr("Unable to save information.\n" 761 tr("Unable to save information.\n"
762 "Free up some space\n" 762 "Free up some space\n"
763 "and try again.\n" 763 "and try again.\n"
764 "\nQuit anyway?"), 764 "\nQuit anyway?"),
765 QMessageBox::Yes|QMessageBox::Escape, 765 QMessageBox::Yes|QMessageBox::Escape,
766 QMessageBox::No|QMessageBox::Default ) 766 QMessageBox::No|QMessageBox::Default )
767 != QMessageBox::No ) 767 != QMessageBox::No )
768 return TRUE; 768 return TRUE;
769 else 769 else
770 return FALSE; 770 return FALSE;
771 } else { 771 } else {
772 if ( !abList->save( str ) ) { 772 if ( !abList->save( str ) ) {
773 if ( QMessageBox::critical( 0, tr( "Out of space" ), 773 if ( QMessageBox::critical( 0, tr( "Out of space" ),
774 tr("Unable to save information.\n" 774 tr("Unable to save information.\n"
775 "Free up some space\n" 775 "Free up some space\n"
776 "and try again.\n" 776 "and try again.\n"
777 "\nQuit anyway?"), 777 "\nQuit anyway?"),
778 QMessageBox::Yes|QMessageBox::Escape, 778 QMessageBox::Yes|QMessageBox::Escape,
779 QMessageBox::No|QMessageBox::Default ) 779 QMessageBox::No|QMessageBox::Default )
780 != QMessageBox::No ) 780 != QMessageBox::No )
781 return TRUE; 781 return TRUE;
782 else 782 else
783 return FALSE; 783 return FALSE;
784 } 784 }
785 } 785 }
786 return TRUE; 786 return TRUE;
787} 787}
788 788
789void AddressbookWindow::slotSettings() 789void AddressbookWindow::slotSettings()
790{ 790{
791 AddressSettings frmSettings( this ); 791 AddressSettings frmSettings( this );
792#if defined(Q_WS_QWS) || defined(_WS_QWS_) 792#if defined(Q_WS_QWS) || defined(_WS_QWS_)
793 frmSettings.showMaximized(); 793 frmSettings.showMaximized();
794#endif 794#endif
795 795
796 if ( frmSettings.exec() ) { 796 if ( frmSettings.exec() ) {
797 allFields.clear(); 797 allFields.clear();
798 orderedFields.clear(); 798 orderedFields.clear();
799 slOrderedFields.clear(); 799 slOrderedFields.clear();
800 initFields(); 800 initFields();
801 if ( abEditor ) 801 if ( abEditor )
802 abEditor->loadFields(); 802 abEditor->loadFields();
803 abList->refresh(); 803 abList->refresh();
804 } 804 }
805} 805}
806 806
807 807
808void AddressbookWindow::initFields() 808void AddressbookWindow::initFields()
809{ 809{
810 // we really don't need the things from the configuration, anymore 810 // we really don't need the things from the configuration, anymore
811 // only thing that is important are the important categories. So, 811 // only thing that is important are the important categories. So,
812 // Call the contact functions that correspond to these old functions... 812 // Call the contact functions that correspond to these old functions...
813 813
814 QStringList xmlFields = OContact::fields(); 814 QStringList xmlFields = OContact::fields();
815 QStringList visibleFields = OContact::trfields(); 815 QStringList visibleFields = OContact::untrfields();
816 // QStringList trFields = OContact::trfields();
817
816 xmlFields.remove( "Title" ); 818 xmlFields.remove( "Title" );
817 visibleFields.remove( tr("Name Title") ); 819 visibleFields.remove( "Name Title" );
818 visibleFields.remove( tr("Notes") ); 820 visibleFields.remove( "Notes" );
819 821
820 int i, version; 822 int i, version;
821 Config cfg( "AddressBook" ); 823 Config cfg( "AddressBook" );
822 QString zn; 824 QString zn;
823 825
824 // ### Write a function to keep this from happening again... 826 // ### Write a function to keep this from happening again...
825 QStringList::ConstIterator it; 827 QStringList::ConstIterator it;
826 for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { 828 for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) {
827 allFields.append( i + 3 ); 829 allFields.append( i + 3 );
828 } 830 }
829 831
830 cfg.setGroup( "Version" ); 832 cfg.setGroup( "Version" );
831 version = cfg.readNumEntry( "version" ); 833 version = cfg.readNumEntry( "version" );
832 i = 0; 834 i = 0;
833 startFontSize = 1; 835 startFontSize = 1;
834 836
835 if ( version >= ADDRESSVERSION ) { 837 if ( version >= ADDRESSVERSION ) {
836 838
837 cfg.setGroup( "ImportantCategory" ); 839 cfg.setGroup( "ImportantCategory" );
838 840
839 zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); 841 zn = cfg.readEntry( "Category" + QString::number(i), QString::null );
840 while ( !zn.isNull() ) { 842 while ( !zn.isNull() ) {
841 if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) { 843 if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) {
842 slOrderedFields.clear(); 844 slOrderedFields.clear();
843 break; 845 break;
844 } 846 }
845 slOrderedFields.append( zn ); 847 slOrderedFields.append( zn );
846 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); 848 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null );
847 } 849 }
848 cfg.setGroup( "Font" ); 850 cfg.setGroup( "Font" );
849 startFontSize = cfg.readNumEntry( "fontSize", 1 ); 851 startFontSize = cfg.readNumEntry( "fontSize", 1 );
850 852
851 853
852 } else { 854 } else {
853 QString str; 855 QString str;
854 str = getenv("HOME"); 856 str = getenv("HOME");
855 str += "/Settings/AddressBook.conf"; 857 str += "/Settings/AddressBook.conf";
856 QFile::remove( str ); 858 QFile::remove( str );
857 } 859 }
858 if ( slOrderedFields.count() > 0 ) { 860 if ( slOrderedFields.count() > 0 ) {
859 for( QStringList::ConstIterator it = slOrderedFields.begin(); 861 for( QStringList::ConstIterator it = slOrderedFields.begin();
860 it != slOrderedFields.end(); ++it ) { 862 it != slOrderedFields.end(); ++it ) {
861 QValueList<int>::ConstIterator itVl; 863 QValueList<int>::ConstIterator itVl;
862 QStringList::ConstIterator itVis; 864 QStringList::ConstIterator itVis;
863 itVl = allFields.begin(); 865 itVl = allFields.begin();
864 for ( itVis = visibleFields.begin(); 866 for ( itVis = visibleFields.begin();
865 itVis != visibleFields.end() && itVl != allFields.end(); 867 itVis != visibleFields.end() && itVl != allFields.end();
866 ++itVis, ++itVl ) { 868 ++itVis, ++itVl ) {
867 if ( *it == *itVis && itVl != allFields.end() ) { 869 if ( *it == *itVis && itVl != allFields.end() ) {
868 orderedFields.append( *itVl ); 870 orderedFields.append( *itVl );
869 } 871 }
870 } 872 }
871 } 873 }
872 } else { 874 } else {
873 QValueList<int>::ConstIterator it; 875 QValueList<int>::ConstIterator it;
874 for ( it = allFields.begin(); it != allFields.end(); ++it ) 876 for ( it = allFields.begin(); it != allFields.end(); ++it )
875 orderedFields.append( *it ); 877 orderedFields.append( *it );
876 878
877 slOrderedFields = visibleFields; 879 slOrderedFields = visibleFields;
878 orderedFields.remove( Qtopia::AddressUid ); 880 orderedFields.remove( Qtopia::AddressUid );
879 orderedFields.remove( Qtopia::Title ); 881 orderedFields.remove( Qtopia::Title );
880 orderedFields.remove( Qtopia::Groups ); 882 orderedFields.remove( Qtopia::Groups );
881 orderedFields.remove( Qtopia::AddressCategory ); 883 orderedFields.remove( Qtopia::AddressCategory );
882 orderedFields.remove( Qtopia::FirstName ); 884 orderedFields.remove( Qtopia::FirstName );
883 orderedFields.remove( Qtopia::LastName ); 885 orderedFields.remove( Qtopia::LastName );
884 orderedFields.remove( Qtopia::DefaultEmail ); 886 orderedFields.remove( Qtopia::DefaultEmail );
885 orderedFields.remove( Qtopia::FileAs ); 887 orderedFields.remove( Qtopia::FileAs );
886 orderedFields.remove( Qtopia::Notes ); 888 orderedFields.remove( Qtopia::Notes );
887 orderedFields.remove( Qtopia::Gender ); 889 orderedFields.remove( Qtopia::Gender );
888 slOrderedFields.remove( tr("Name Title") ); 890 slOrderedFields.remove( "Name Title" );
889 slOrderedFields.remove( tr("First Name") ); 891 slOrderedFields.remove( "First Name" );
890 slOrderedFields.remove( tr("Last Name") ); 892 slOrderedFields.remove( "Last Name" );
891 slOrderedFields.remove( tr("File As") ); 893 slOrderedFields.remove( "File As" );
892 slOrderedFields.remove( tr("Default Email") ); 894 slOrderedFields.remove( "Default Email" );
893 slOrderedFields.remove( tr("Notes") ); 895 slOrderedFields.remove( "Notes" );
894 slOrderedFields.remove( tr("Gender") ); 896 slOrderedFields.remove( "Gender" );
895 897
896 } 898 }
897} 899}
898 900
899 901
900AbLabel *AddressbookWindow::abView() 902AbLabel *AddressbookWindow::abView()
901{ 903{
902 if ( !mView ) { 904 if ( !mView ) {
903 mView = new AbLabel( this, "viewer" ); 905 mView = new AbLabel( this, "viewer" );
904 mView->init( OContact() ); 906 mView->init( OContact() );
905 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 907 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
906 } 908 }
907 return mView; 909 return mView;
908} 910}
909 911
910void AddressbookWindow::slotFind() 912void AddressbookWindow::slotFind()
911{ 913{
912#ifndef MAKE_FOR_SHARP_ROM 914#ifndef MAKE_FOR_SHARP_ROM
913 if ( centralWidget() == abView() ) 915 if ( centralWidget() == abView() )
914 showList(); 916 showList();
915 917
916 FindDialog frmFind( "Contacts", this ); 918 FindDialog frmFind( "Contacts", this );
917 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 919 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int)));
918 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 920 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
919 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 921 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
920 922
921 frmFind.exec(); 923 frmFind.exec();
922 924
923 if ( abList->numSelections() ) 925 if ( abList->numSelections() )
924 abList->clearSelection(); 926 abList->clearSelection();
925 927
926 abList->clearFindRow(); 928 abList->clearFindRow();
927#endif 929#endif
928} 930}
929 931
930void AddressbookWindow::slotSetCategory( int c ) 932void AddressbookWindow::slotSetCategory( int c )
931{ 933{
932 934
933 QString cat, book; 935 QString cat, book;
934 936
935 if ( c <= 0 ) 937 if ( c <= 0 )
936 return; 938 return;
937 939
938 // Checkmark Book Menu Item Selected 940 // Checkmark Book Menu Item Selected
939 if ( c < 6 ) 941 if ( c < 6 )
940 for ( unsigned int i = 1; i < 6; i++ ) 942 for ( unsigned int i = 1; i < 6; i++ )
941 catMenu->setItemChecked( i, c == (int)i ); 943 catMenu->setItemChecked( i, c == (int)i );
942 944
943 // Checkmark Category Menu Item Selected 945 // Checkmark Category Menu Item Selected
944 else 946 else
945 for ( unsigned int i = 6; i < catMenu->count(); i++ ) 947 for ( unsigned int i = 6; i < catMenu->count(); i++ )
946 catMenu->setItemChecked( i, c == (int)i ); 948 catMenu->setItemChecked( i, c == (int)i );
947 949
948 for ( unsigned int i = 1; i < catMenu->count(); i++ ) { 950 for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
949 if (catMenu->isItemChecked( i )) { 951 if (catMenu->isItemChecked( i )) {
950 if ( i == 1 ) // default List view 952 if ( i == 1 ) // default List view
951 book = QString::null; 953 book = QString::null;
952 else if ( i == 2 ) 954 else if ( i == 2 )
953 book = "Phone"; 955 book = "Phone";
954 else if ( i == 3 ) 956 else if ( i == 3 )
955 book = "Company"; 957 book = "Company";
956 else if ( i == 4 ) 958 else if ( i == 4 )
957 book = "Email"; 959 book = "Email";
958 else if ( i == 5 ) 960 else if ( i == 5 )
959 book = "Cards"; 961 book = "Cards";
960 else if ( i == 6 ) // default All Categories 962 else if ( i == 6 ) // default All Categories
961 cat = QString::null; 963 cat = QString::null;
962 else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled 964 else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled
963 cat = "Unfiled"; 965 cat = "Unfiled";
964 else 966 else
965 cat = abList->categories()[i - 7]; 967 cat = abList->categories()[i - 7];
966 } 968 }
967 } 969 }
968 970
969 abList->setShowCategory( book, cat ); 971 abList->setShowCategory( book, cat );
970 972
971 if ( book.isEmpty() ) 973 if ( book.isEmpty() )
972 book = "List"; 974 book = "List";
973 if ( cat.isEmpty() ) 975 if ( cat.isEmpty() )
974 cat = "All"; 976 cat = "All";
975 977
976 setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); 978 setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) );
977} 979}
978 980
979void AddressbookWindow::slotSetLetter( char c ) { 981void AddressbookWindow::slotSetLetter( char c ) {
980 982
981 abList->setShowByLetter( c ); 983 abList->setShowByLetter( c );
982 984
983} 985}
984 986
985void AddressbookWindow::populateCategories() 987void AddressbookWindow::populateCategories()
986{ 988{
987 catMenu->clear(); 989 catMenu->clear();
988 990
989 int id, rememberId; 991 int id, rememberId;
990 id = 1; 992 id = 1;
991 rememberId = 0; 993 rememberId = 0;
992 994
993 catMenu->insertItem( tr( "List" ), id++ ); 995 catMenu->insertItem( tr( "List" ), id++ );
994 catMenu->insertItem( tr( "Phone Book" ), id++ ); 996 catMenu->insertItem( tr( "Phone Book" ), id++ );
995 catMenu->insertItem( tr( "Company Book" ), id++ ); 997 catMenu->insertItem( tr( "Company Book" ), id++ );
996 catMenu->insertItem( tr( "Email Book" ), id++ ); 998 catMenu->insertItem( tr( "Email Book" ), id++ );
997 catMenu->insertItem( tr( "Cards" ), id++ ); 999 catMenu->insertItem( tr( "Cards" ), id++ );
998 catMenu->insertSeparator(); 1000 catMenu->insertSeparator();
999 1001
1000 catMenu->insertItem( tr( "All" ), id++ ); 1002 catMenu->insertItem( tr( "All" ), id++ );
1001 QStringList categories = abList->categories(); 1003 QStringList categories = abList->categories();
1002 categories.append( tr( "Unfiled" ) ); 1004 categories.append( tr( "Unfiled" ) );
1003 for ( QStringList::Iterator it = categories.begin(); 1005 for ( QStringList::Iterator it = categories.begin();
1004 it != categories.end(); ++it ) { 1006 it != categories.end(); ++it ) {
1005 catMenu->insertItem( *it, id ); 1007 catMenu->insertItem( *it, id );
1006 if ( *it == abList->showCategory() ) 1008 if ( *it == abList->showCategory() )
1007 rememberId = id; 1009 rememberId = id;
1008 ++id; 1010 ++id;
1009 } 1011 }
1010 1012
1011 if ( abList->showBook().isEmpty() ) { 1013 if ( abList->showBook().isEmpty() ) {
1012 catMenu->setItemChecked( 1, true ); 1014 catMenu->setItemChecked( 1, true );
1013 } else if ( abList->showBook() == "Phone" ) { 1015 } else if ( abList->showBook() == "Phone" ) {
1014 catMenu->setItemChecked( 2, true ); 1016 catMenu->setItemChecked( 2, true );
1015 } else if ( abList->showBook() == "Company" ) { 1017 } else if ( abList->showBook() == "Company" ) {
1016 catMenu->setItemChecked( 3, true ); 1018 catMenu->setItemChecked( 3, true );
1017 } else if ( abList->showBook() == "Email" ) { 1019 } else if ( abList->showBook() == "Email" ) {
1018 catMenu->setItemChecked( 4, true ); 1020 catMenu->setItemChecked( 4, true );
1019 } else if ( abList->showBook() == "Cards" ) { 1021 } else if ( abList->showBook() == "Cards" ) {
1020 catMenu->setItemChecked( 5, true ); 1022 catMenu->setItemChecked( 5, true );
1021 } 1023 }
1022 1024
1023 if ( abList->showCategory().isEmpty() ) { 1025 if ( abList->showCategory().isEmpty() ) {
1024 slotSetCategory( 6 ); 1026 slotSetCategory( 6 );
1025 } 1027 }
1026 else { 1028 else {
1027 slotSetCategory( rememberId ); 1029 slotSetCategory( rememberId );
1028 } 1030 }
1029} 1031}
1030 1032
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 12d7421..b01583f 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,515 +1,515 @@
1/* 1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> 2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 * 3 *
4 * This file is an add-on for the OPIE Palmtop Environment 4 * This file is an add-on for the OPIE Palmtop Environment
5 * 5 *
6 * This file may be distributed and/or modified under the terms of the 6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software 7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file. 9 * of this file.
10 * 10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 * 13 *
14 * 14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more 15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This 16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name. 17 * is made to operate exactly in interface with the exception of name.
18 * 18 *
19 */ 19 */
20 20
21#include "contacteditor.h" 21#include "contacteditor.h"
22#include "addresspicker.h" 22#include "addresspicker.h"
23 23
24#include <qpe/categoryselect.h> 24#include <qpe/categoryselect.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/qpedialog.h> 26#include <qpe/qpedialog.h>
27 27
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34#include <qscrollview.h> 34#include <qscrollview.h>
35#include <qtoolbutton.h> 35#include <qtoolbutton.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qvaluelist.h> 38#include <qvaluelist.h>
39 39
40static inline bool containsAlphaNum( const QString &str ); 40static inline bool containsAlphaNum( const QString &str );
41static inline bool constainsWhiteSpace( const QString &str ); 41static inline bool constainsWhiteSpace( const QString &str );
42 42
43// helper functions, convert our comma delimited list to proper 43// helper functions, convert our comma delimited list to proper
44// file format... 44// file format...
45void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 45void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
46 QString &strAll ); 46 QString &strAll );
47 47
48// helper convert from file format to comma delimited... 48// helper convert from file format to comma delimited...
49void parseEmailTo( const QString &strDefaultEmail, 49void parseEmailTo( const QString &strDefaultEmail,
50 const QString &strOtherEmail, QString &strBack ); 50 const QString &strOtherEmail, QString &strBack );
51 51
52 ContactEditor::ContactEditor(const OContact &entry, 52 ContactEditor::ContactEditor(const OContact &entry,
53 const QValueList<int> *newOrderedValues, 53 const QValueList<int> *newOrderedValues,
54 QStringList *slNewOrdered, 54 QStringList *slNewOrdered,
55 QWidget *parent, 55 QWidget *parent,
56 const char *name, 56 const char *name,
57 WFlags fl ) 57 WFlags fl )
58 : QDialog( parent, name, TRUE, fl ), 58 : QDialog( parent, name, TRUE, fl ),
59 orderedValues( newOrderedValues ), 59 orderedValues( newOrderedValues ),
60 slOrdered( *slNewOrdered ) 60 slOrdered( *slNewOrdered )
61{ 61{
62 62
63 init(); 63 init();
64 initMap(); 64 initMap();
65 setEntry( entry ); 65 setEntry( entry );
66 qDebug("finish"); 66 qDebug("finish");
67} 67}
68 68
69ContactEditor::~ContactEditor() { 69ContactEditor::~ContactEditor() {
70} 70}
71 71
72void ContactEditor::init() { 72void ContactEditor::init() {
73 73
74 useFullName = TRUE; 74 useFullName = TRUE;
75 75
76 int i = 0; 76 int i = 0;
77/** SHut up and stop leaking 77/** SHut up and stop leaking
78 slHomeAddress = new QStringList; 78 slHomeAddress = new QStringList;
79 slBusinessAddress = new QStringList; 79 slBusinessAddress = new QStringList;
80 slChooserNames = new QStringList; 80 slChooserNames = new QStringList;
81 slChooserValues = new QStringList; 81 slChooserValues = new QStringList;
82 82
83 slDynamicEntries = new QStringList; 83 slDynamicEntries = new QStringList;
84*/ 84*/
85 //*slDynamicEntries = *slOrdered; 85 //*slDynamicEntries = *slOrdered;
86 86
87 for (i = 0; i <= 6; i++) { 87 for (i = 0; i <= 6; i++) {
88 slHomeAddress.append( "" ); 88 slHomeAddress.append( "" );
89 slBusinessAddress.append( "" ); 89 slBusinessAddress.append( "" );
90 } 90 }
91 91
92 { 92 {
93 hasGender = FALSE; 93 hasGender = FALSE;
94 hasTitle = FALSE; 94 hasTitle = FALSE;
95 hasCompany = FALSE; 95 hasCompany = FALSE;
96 hasNotes = FALSE; 96 hasNotes = FALSE;
97 hasStreet = FALSE; 97 hasStreet = FALSE;
98 hasStreet2 = FALSE; 98 hasStreet2 = FALSE;
99 hasPOBox = FALSE; 99 hasPOBox = FALSE;
100 hasCity = FALSE; 100 hasCity = FALSE;
101 hasState = FALSE; 101 hasState = FALSE;
102 hasZip = FALSE; 102 hasZip = FALSE;
103 hasCountry = FALSE; 103 hasCountry = FALSE;
104 104
105 QStringList::ConstIterator it = slOrdered.begin(); 105 QStringList::ConstIterator it = slOrdered.begin();
106 for ( i = 0; it != slOrdered.end(); i++, ++it ) { 106 for ( i = 0; it != slOrdered.end(); i++, ++it ) {
107 107
108 if ( (*it) == tr( "Business Fax" ) ) { 108 if ( (*it) == "Business Fax" ) {
109 slChooserNames.append( *it ); 109 slChooserNames.append( tr( "Business Fax" ) );
110 slChooserValues.append("" ); 110 slChooserValues.append("" );
111 //slDynamicEntries->remove( it ); 111 //slDynamicEntries->remove( it );
112 continue; 112 continue;
113 } 113 }
114 114
115 if ( (*it) == tr( "Home Fax" ) ) { 115 if ( (*it) == "Home Fax" ) {
116 slChooserNames.append( *it ); 116 slChooserNames.append( tr( "Home Fax" ) );
117 slChooserValues.append("" ); 117 slChooserValues.append("" );
118 //slDynamicEntries->remove( it ); 118 //slDynamicEntries->remove( it );
119 continue; 119 continue;
120 } 120 }
121 121
122 122
123 if ( (*it) == tr( "Business Phone" ) ) { 123 if ( (*it) == "Business Phone" ) {
124 slChooserNames.append( *it ); 124 slChooserNames.append( tr( "Business Phone" ) );
125 slChooserValues.append( "" ); 125 slChooserValues.append( "" );
126 //slDynamicEntries->remove( it ); 126 //slDynamicEntries->remove( it );
127 continue; 127 continue;
128 } 128 }
129 129
130 if ( (*it) == tr( "Home Phone" ) ) { 130 if ( (*it) == "Home Phone" ) {
131 slChooserNames.append( *it ); 131 slChooserNames.append( tr( "Home Phone" ) );
132 slChooserValues.append( "" ); 132 slChooserValues.append( "" );
133 //slDynamicEntries->remove( it ); 133 //slDynamicEntries->remove( it );
134 continue; 134 continue;
135 } 135 }
136 136
137/* 137/*
138 if ( (*it).right( 2 ) == tr( "IM" ) ) { 138 if ( (*it).right( 2 ) == tr( "IM" ) ) {
139 slChooserNames.append( *it ); 139 slChooserNames.append( *it );
140 slChooserValues.append( "" ); 140 slChooserValues.append( "" );
141 //slDynamicEntries->remove( it ); 141 //slDynamicEntries->remove( it );
142 continue; 142 continue;
143 } */ 143 } */
144 144
145 if ( (*it) == tr( "Business Mobile" ) ) { 145 if ( (*it) == "Business Mobile" ) {
146 slChooserNames.append( *it ); 146 slChooserNames.append( tr( "Business Mobile" ) );
147 slChooserValues.append( "" ); 147 slChooserValues.append( "" );
148 //slDynamicEntries->remove( it ); 148 //slDynamicEntries->remove( it );
149 continue; 149 continue;
150 } 150 }
151 151
152 if ( (*it) == tr( "Home Mobile" ) ) { 152 if ( (*it) == "Home Mobile" ) {
153 slChooserNames.append( *it ); 153 slChooserNames.append( tr( "Home Mobile" ) );
154 slChooserValues.append( "" ); 154 slChooserValues.append( "" );
155 //slDynamicEntries->remove( it ); 155 //slDynamicEntries->remove( it );
156 continue; 156 continue;
157 } 157 }
158 158
159 159
160 if ( (*it) == tr( "Business WebPage" ) ) { 160 if ( (*it) == "Business WebPage" ) {
161 slChooserNames.append( *it ); 161 slChooserNames.append( tr( "Business WebPage" ) );
162 slChooserValues.append( "" ); 162 slChooserValues.append( "" );
163 //slDynamicEntries->remove( it ); 163 //slDynamicEntries->remove( it );
164 continue; 164 continue;
165 } 165 }
166 166
167 if ( (*it) == tr( "Home Web Page" ) ) { 167 if ( (*it) == "Home Web Page" ) {
168 slChooserNames.append( *it ); 168 slChooserNames.append( tr( "Home Web Page" ) );
169 slChooserValues.append( "" ); 169 slChooserValues.append( "" );
170 //slDynamicEntries->remove( it ); 170 //slDynamicEntries->remove( it );
171 continue; 171 continue;
172 } 172 }
173 173
174 if ( (*it) == tr( "Business Pager" ) ) { 174 if ( (*it) == "Business Pager" ) {
175 slChooserNames.append( *it ); 175 slChooserNames.append( tr( "Business Pager" ) );
176 slChooserValues.append( "" ); 176 slChooserValues.append( "" );
177 //slDynamicEntries->remove( it ); 177 //slDynamicEntries->remove( it );
178 continue; 178 continue;
179 } 179 }
180 180
181 if ( *it == tr( "Default Email" ) ) { 181 if ( *it == "Default Email" ) {
182 slChooserNames.append( *it ); 182 slChooserNames.append( tr( "Default Email" ) );
183 slChooserValues.append( "" ); 183 slChooserValues.append( "" );
184 //slDynamicEntries->remove( it ); 184 //slDynamicEntries->remove( it );
185 continue; 185 continue;
186 } 186 }
187 187
188 if ( *it == tr( "Emails" ) ) { 188 if ( *it == "Emails" ) {
189 slChooserNames.append( *it ); 189 slChooserNames.append( tr( "Emails" ) );
190 slChooserValues.append( "" ); 190 slChooserValues.append( "" );
191 //slDynamicEntries->remove( it ); 191 //slDynamicEntries->remove( it );
192 continue; 192 continue;
193 } 193 }
194 194
195 if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) 195 if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" )
196 continue; 196 continue;
197 197
198 if ( *it == tr( "Name Title" ) ) { 198 if ( *it == "Name Title" ) {
199 //slDynamicEntries->remove( it ); 199 //slDynamicEntries->remove( it );
200 continue; 200 continue;
201 } 201 }
202 202
203 if ( *it == tr( "First Name" ) ) { 203 if ( *it == "First Name" ) {
204 //slDynamicEntries->remove( it ); 204 //slDynamicEntries->remove( it );
205 continue; 205 continue;
206 } 206 }
207 207
208 if ( *it == tr( "Middle Name" ) ) { 208 if ( *it == "Middle Name" ) {
209 //slDynamicEntries->remove( it ); 209 //slDynamicEntries->remove( it );
210 continue; 210 continue;
211 } 211 }
212 212
213 if ( *it == tr( "Last Name" ) ) { 213 if ( *it == "Last Name" ) {
214 //slDynamicEntries->remove( it ); 214 //slDynamicEntries->remove( it );
215 continue; 215 continue;
216 } 216 }
217 217
218 if ( *it == tr( "Suffix" ) ) { 218 if ( *it == "Suffix" ) {
219 //slDynamicEntries->remove( it ); 219 //slDynamicEntries->remove( it );
220 continue; 220 continue;
221 } 221 }
222 222
223 if ( *it == tr( "File As" ) ) { 223 if ( *it == "File As" ) {
224 //slDynamicEntries->remove( it ); 224 //slDynamicEntries->remove( it );
225 continue; 225 continue;
226 } 226 }
227 227
228 if ( *it == tr( "Gender" ) ) { 228 if ( *it == "Gender" ) {
229 hasGender = TRUE; 229 hasGender = TRUE;
230 //slDynamicEntries->remove( it ); 230 //slDynamicEntries->remove( it );
231 continue; 231 continue;
232 } 232 }
233 233
234 if ( *it == tr( "Job Title" ) ) { 234 if ( *it == "Job Title" ) {
235 hasTitle = TRUE; 235 hasTitle = TRUE;
236 //slDynamicEntries->remove( it ); 236 //slDynamicEntries->remove( it );
237 continue; 237 continue;
238 } 238 }
239 239
240 if ( *it == tr( "Company") || *it == tr( "Organization" ) ) { 240 if ( ( *it == "Company") || (*it == "Organization" ) ) {
241 hasCompany = TRUE; 241 hasCompany = TRUE;
242 //slDynamicEntries->remove( it ); 242 //slDynamicEntries->remove( it );
243 continue; 243 continue;
244 } 244 }
245 245
246 if ( *it == tr( "Notes" ) ) { 246 if ( *it == "Notes" ) {
247 hasNotes = TRUE; 247 hasNotes = TRUE;
248 //slDynamicEntries->remove( it ); 248 //slDynamicEntries->remove( it );
249 continue; 249 continue;
250 } 250 }
251 251
252 if ( *it == tr( "Groups" ) ) { 252 if ( *it == "Groups" ) {
253 //slDynamicEntries->remove( it ); 253 //slDynamicEntries->remove( it );
254 continue; 254 continue;
255 } 255 }
256 256
257 if ( (*it) == tr( "Business Street" ) ) { 257 if ( (*it) == "Business Street" ) {
258 hasStreet = TRUE; 258 hasStreet = TRUE;
259 //slDynamicEntries->remove( it ); 259 //slDynamicEntries->remove( it );
260 continue; 260 continue;
261 } 261 }
262 262
263 if ( (*it) == tr( "Home Street" ) ) { 263 if ( (*it) == "Home Street" ) {
264 hasStreet = TRUE; 264 hasStreet = TRUE;
265 //slDynamicEntries->remove( it ); 265 //slDynamicEntries->remove( it );
266 continue; 266 continue;
267 } 267 }
268/* 268/*
269 if ( (*it).right( 8 ) == tr( "Street 2" ) ) { 269 if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
270 hasStreet2 = TRUE; 270 hasStreet2 = TRUE;
271 //slDynamicEntries->remove( it ); 271 //slDynamicEntries->remove( it );
272 continue; 272 continue;
273 } 273 }
274 274
275 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { 275 if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
276 hasPOBox = TRUE; 276 hasPOBox = TRUE;
277 //slDynamicEntries->remove( it ); 277 //slDynamicEntries->remove( it );
278 continue; 278 continue;
279 } */ 279 } */
280 280
281 if ( (*it) == tr( "Business City" ) ) { 281 if ( (*it) == "Business City" ) {
282 hasCity = TRUE; 282 hasCity = TRUE;
283 //slDynamicEntries->remove( it ); 283 //slDynamicEntries->remove( it );
284 continue; 284 continue;
285 } 285 }
286 286
287 if ( (*it) == tr( "Business State" ) ) { 287 if ( (*it) == "Business State" ) {
288 hasState = TRUE; 288 hasState = TRUE;
289 //slDynamicEntries->remove( it ); 289 //slDynamicEntries->remove( it );
290 continue; 290 continue;
291 } 291 }
292 292
293 if ( (*it) == tr( "Business Zip" ) ) { 293 if ( (*it) == "Business Zip" ) {
294 hasZip = TRUE; 294 hasZip = TRUE;
295 //slDynamicEntries->remove( it ); 295 //slDynamicEntries->remove( it );
296 continue; 296 continue;
297 } 297 }
298 298
299 if ( (*it) == tr( "Business Country" ) ) { 299 if ( (*it) == "Business Country" ) {
300 hasCountry = TRUE; 300 hasCountry = TRUE;
301 //slDynamicEntries->remove( it ); 301 //slDynamicEntries->remove( it );
302 continue; 302 continue;
303 } 303 }
304 304
305 if ( (*it) == tr( "Home City" ) ) { 305 if ( (*it) == "Home City" ) {
306 hasCity = TRUE; 306 hasCity = TRUE;
307 //slDynamicEntries->remove( it ); 307 //slDynamicEntries->remove( it );
308 continue; 308 continue;
309 } 309 }
310 310
311 if ( (*it) == tr( "Home State" ) ) { 311 if ( (*it) == "Home State" ) {
312 hasState = TRUE; 312 hasState = TRUE;
313 //slDynamicEntries->remove( it ); 313 //slDynamicEntries->remove( it );
314 continue; 314 continue;
315 } 315 }
316 316
317 if ( (*it) == tr( "Home Zip" ) ) { 317 if ( (*it) == "Home Zip" ) {
318 hasZip = TRUE; 318 hasZip = TRUE;
319 //slDynamicEntries->remove( it ); 319 //slDynamicEntries->remove( it );
320 continue; 320 continue;
321 } 321 }
322 322
323 if ( (*it) == tr( "Home Country" ) ) { 323 if ( (*it) == "Home Country" ) {
324 hasCountry = TRUE; 324 hasCountry = TRUE;
325 //slDynamicEntries->remove( it ); 325 //slDynamicEntries->remove( it );
326 continue; 326 continue;
327 } 327 }
328 328
329 329
330 slDynamicEntries.append( *it ); 330 slDynamicEntries.append( *it );
331 } 331 }
332 } 332 }
333 333
334 QVBoxLayout *vb = new QVBoxLayout( this ); 334 QVBoxLayout *vb = new QVBoxLayout( this );
335 335
336 tabMain = new QTabWidget( this ); 336 tabMain = new QTabWidget( this );
337 vb->addWidget( tabMain ); 337 vb->addWidget( tabMain );
338 338
339 QWidget *tabViewport = new QWidget ( tabMain ); 339 QWidget *tabViewport = new QWidget ( tabMain );
340 340
341 vb = new QVBoxLayout( tabViewport ); 341 vb = new QVBoxLayout( tabViewport );
342 342
343 svGeneral = new QScrollView( tabViewport ); 343 svGeneral = new QScrollView( tabViewport );
344 vb->addWidget( svGeneral, 0, 0 ); 344 vb->addWidget( svGeneral, 0, 0 );
345 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 345 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
346 svGeneral->setFrameStyle( QFrame::NoFrame ); 346 svGeneral->setFrameStyle( QFrame::NoFrame );
347 347
348 QWidget *container = new QWidget( svGeneral->viewport() ); 348 QWidget *container = new QWidget( svGeneral->viewport() );
349 svGeneral->addChild( container ); 349 svGeneral->addChild( container );
350 350
351 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 351 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
352 gl->setResizeMode( QLayout::FreeResize ); 352 gl->setResizeMode( QLayout::FreeResize );
353 353
354 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 354 btnFullName = new QPushButton( tr( "Full Name..." ), container );
355 gl->addWidget( btnFullName, 0, 0 ); 355 gl->addWidget( btnFullName, 0, 0 );
356 txtFullName = new QLineEdit( container ); 356 txtFullName = new QLineEdit( container );
357 gl->addWidget( txtFullName, 0, 1 ); 357 gl->addWidget( txtFullName, 0, 1 );
358 358
359 QLabel *l = new QLabel( tr( "Job Title" ), container ); 359 QLabel *l = new QLabel( tr( "Job Title" ), container );
360 gl->addWidget( l, 1, 0 ); 360 gl->addWidget( l, 1, 0 );
361 txtJobTitle = new QLineEdit( container ); 361 txtJobTitle = new QLineEdit( container );
362 gl->addWidget( txtJobTitle, 1, 1 ); 362 gl->addWidget( txtJobTitle, 1, 1 );
363 363
364 l = new QLabel( tr( "Organization" ), container ); 364 l = new QLabel( tr( "Organization" ), container );
365 gl->addWidget( l, 2, 0 ); 365 gl->addWidget( l, 2, 0 );
366 txtOrganization = new QLineEdit( container ); 366 txtOrganization = new QLineEdit( container );
367 gl->addWidget( txtOrganization, 2, 1 ); 367 gl->addWidget( txtOrganization, 2, 1 );
368 368
369 cmbChooserField1 = new QComboBox( FALSE, container ); 369 cmbChooserField1 = new QComboBox( FALSE, container );
370 cmbChooserField1->setMaximumWidth( 90 ); 370 cmbChooserField1->setMaximumWidth( 90 );
371 gl->addWidget( cmbChooserField1, 3, 0 ); 371 gl->addWidget( cmbChooserField1, 3, 0 );
372 txtChooserField1 = new QLineEdit( container ); 372 txtChooserField1 = new QLineEdit( container );
373 gl->addWidget( txtChooserField1, 3, 1 ); 373 gl->addWidget( txtChooserField1, 3, 1 );
374 374
375 cmbChooserField2 = new QComboBox( FALSE, container ); 375 cmbChooserField2 = new QComboBox( FALSE, container );
376 cmbChooserField2->setMaximumWidth( 90 ); 376 cmbChooserField2->setMaximumWidth( 90 );
377 gl->addWidget( cmbChooserField2, 4, 0 ); 377 gl->addWidget( cmbChooserField2, 4, 0 );
378 txtChooserField2 = new QLineEdit( container ); 378 txtChooserField2 = new QLineEdit( container );
379 gl->addWidget( txtChooserField2, 4, 1 ); 379 gl->addWidget( txtChooserField2, 4, 1 );
380 380
381 cmbChooserField3 = new QComboBox( FALSE, container ); 381 cmbChooserField3 = new QComboBox( FALSE, container );
382 cmbChooserField3->setMaximumWidth( 90 ); 382 cmbChooserField3->setMaximumWidth( 90 );
383 gl->addWidget( cmbChooserField3, 5, 0 ); 383 gl->addWidget( cmbChooserField3, 5, 0 );
384 txtChooserField3 = new QLineEdit( container ); 384 txtChooserField3 = new QLineEdit( container );
385 gl->addWidget( txtChooserField3, 5, 1 ); 385 gl->addWidget( txtChooserField3, 5, 1 );
386 386
387 l = new QLabel( tr( "File As" ), container ); 387 l = new QLabel( tr( "File As" ), container );
388 gl->addWidget( l, 6, 0 ); 388 gl->addWidget( l, 6, 0 );
389 cmbFileAs = new QComboBox( TRUE, container ); 389 cmbFileAs = new QComboBox( TRUE, container );
390 gl->addWidget( cmbFileAs, 6, 1 ); 390 gl->addWidget( cmbFileAs, 6, 1 );
391 391
392 l = new QLabel( tr( "Category" ), container ); 392 l = new QLabel( tr( "Category" ), container );
393 gl->addWidget( l, 7, 0 ); 393 gl->addWidget( l, 7, 0 );
394 cmbCat = new CategorySelect( container ); 394 cmbCat = new CategorySelect( container );
395 gl->addWidget( cmbCat, 7, 1 ); 395 gl->addWidget( cmbCat, 7, 1 );
396 396
397 btnNote = new QPushButton( tr( "Notes..." ), container ); 397 btnNote = new QPushButton( tr( "Notes..." ), container );
398 gl->addWidget( btnNote, 8, 1 ); 398 gl->addWidget( btnNote, 8, 1 );
399 399
400 tabMain->insertTab( tabViewport, tr( "General" ) ); 400 tabMain->insertTab( tabViewport, tr( "General" ) );
401 401
402 tabViewport = new QWidget ( tabMain ); 402 tabViewport = new QWidget ( tabMain );
403 403
404 vb = new QVBoxLayout( tabViewport ); 404 vb = new QVBoxLayout( tabViewport );
405 405
406 svAddress = new QScrollView( tabViewport ); 406 svAddress = new QScrollView( tabViewport );
407 vb->addWidget( svAddress, 0, 0 ); 407 vb->addWidget( svAddress, 0, 0 );
408 svAddress->setResizePolicy( QScrollView::AutoOneFit ); 408 svAddress->setResizePolicy( QScrollView::AutoOneFit );
409 svAddress->setFrameStyle( QFrame::NoFrame ); 409 svAddress->setFrameStyle( QFrame::NoFrame );
410 410
411 container = new QWidget( svAddress->viewport() ); 411 container = new QWidget( svAddress->viewport() );
412 svAddress->addChild( container ); 412 svAddress->addChild( container );
413 413
414 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem 414 gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
415 415
416 cmbAddress = new QComboBox( FALSE, container ); 416 cmbAddress = new QComboBox( FALSE, container );
417 cmbAddress->insertItem( tr( "Business" ) ); 417 cmbAddress->insertItem( tr( "Business" ) );
418 cmbAddress->insertItem( tr( "Home" ) ); 418 cmbAddress->insertItem( tr( "Home" ) );
419 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); 419 gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
420 420
421 l = new QLabel( tr( "Address" ), container ); 421 l = new QLabel( tr( "Address" ), container );
422 gl->addWidget( l, 1, 0 ); 422 gl->addWidget( l, 1, 0 );
423 txtAddress = new QLineEdit( container ); 423 txtAddress = new QLineEdit( container );
424 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); 424 gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 );
425/* 425/*
426 l = new QLabel( tr( "Address 2" ), container ); 426 l = new QLabel( tr( "Address 2" ), container );
427 gl->addWidget( l, 2, 0 ); 427 gl->addWidget( l, 2, 0 );
428 txtAddress2 = new QLineEdit( container ); 428 txtAddress2 = new QLineEdit( container );
429 gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); 429 gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 );
430 430
431 l = new QLabel( tr( "P.O. Box" ), container ); 431 l = new QLabel( tr( "P.O. Box" ), container );
432 gl->addWidget( l, 3, 0 ); 432 gl->addWidget( l, 3, 0 );
433 txtPOBox = new QLineEdit( container ); 433 txtPOBox = new QLineEdit( container );
434 gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); 434 gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 );
435*/ 435*/
436 l = new QLabel( tr( "City" ), container ); 436 l = new QLabel( tr( "City" ), container );
437 gl->addWidget( l, 2, 0 ); 437 gl->addWidget( l, 2, 0 );
438 txtCity = new QLineEdit( container ); 438 txtCity = new QLineEdit( container );
439 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); 439 gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 );
440 440
441 l = new QLabel( tr( "State" ), container ); 441 l = new QLabel( tr( "State" ), container );
442 gl->addWidget( l, 3, 0 ); 442 gl->addWidget( l, 3, 0 );
443 txtState = new QLineEdit( container ); 443 txtState = new QLineEdit( container );
444 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); 444 gl->addMultiCellWidget( txtState, 3, 3, 1, 2 );
445 445
446 l = new QLabel( tr( "Zip Code" ), container ); 446 l = new QLabel( tr( "Zip Code" ), container );
447 gl->addWidget( l, 4, 0 ); 447 gl->addWidget( l, 4, 0 );
448 txtZip = new QLineEdit( container ); 448 txtZip = new QLineEdit( container );
449 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); 449 gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 );
450 450
451 l = new QLabel( tr( "Country" ), container ); 451 l = new QLabel( tr( "Country" ), container );
452 gl->addWidget( l, 5, 0 ); 452 gl->addWidget( l, 5, 0 );
453 cmbCountry = new QComboBox( TRUE, container ); 453 cmbCountry = new QComboBox( TRUE, container );
454 cmbCountry->insertItem( tr( "" ) ); 454 cmbCountry->insertItem( tr( "" ) );
455 cmbCountry->insertItem( tr ( "United States" ) ); 455 cmbCountry->insertItem( tr ( "United States" ) );
456 cmbCountry->insertItem( tr ( "United Kingdom" ) ); 456 cmbCountry->insertItem( tr ( "United Kingdom" ) );
457 cmbCountry->insertItem( tr ( "Afganistan" ) ); 457 cmbCountry->insertItem( tr ( "Afganistan" ) );
458 cmbCountry->insertItem( tr ( "Albania" ) ); 458 cmbCountry->insertItem( tr ( "Albania" ) );
459 cmbCountry->insertItem( tr ( "Algeria" ) ); 459 cmbCountry->insertItem( tr ( "Algeria" ) );
460 cmbCountry->insertItem( tr ( "American Samoa" ) ); 460 cmbCountry->insertItem( tr ( "American Samoa" ) );
461 cmbCountry->insertItem( tr ( "Andorra" ) ); 461 cmbCountry->insertItem( tr ( "Andorra" ) );
462 cmbCountry->insertItem( tr ( "Angola" ) ); 462 cmbCountry->insertItem( tr ( "Angola" ) );
463 cmbCountry->insertItem( tr ( "Anguilla" ) ); 463 cmbCountry->insertItem( tr ( "Anguilla" ) );
464 cmbCountry->insertItem( tr ( "Antartica" ) ); 464 cmbCountry->insertItem( tr ( "Antartica" ) );
465 cmbCountry->insertItem( tr ( "Argentina" ) ); 465 cmbCountry->insertItem( tr ( "Argentina" ) );
466 cmbCountry->insertItem( tr ( "Armania" ) ); 466 cmbCountry->insertItem( tr ( "Armania" ) );
467 cmbCountry->insertItem( tr ( "Aruba" ) ); 467 cmbCountry->insertItem( tr ( "Aruba" ) );
468 cmbCountry->insertItem( tr ( "Australia" ) ); 468 cmbCountry->insertItem( tr ( "Australia" ) );
469 cmbCountry->insertItem( tr ( "Austria" ) ); 469 cmbCountry->insertItem( tr ( "Austria" ) );
470 cmbCountry->insertItem( tr ( "Azerbaijan" ) ); 470 cmbCountry->insertItem( tr ( "Azerbaijan" ) );
471 cmbCountry->insertItem( tr ( "Bahamas" ) ); 471 cmbCountry->insertItem( tr ( "Bahamas" ) );
472 cmbCountry->insertItem( tr ( "Bahrain" ) ); 472 cmbCountry->insertItem( tr ( "Bahrain" ) );
473 cmbCountry->insertItem( tr ( "Bangladesh" ) ); 473 cmbCountry->insertItem( tr ( "Bangladesh" ) );
474 cmbCountry->insertItem( tr ( "Barbados" ) ); 474 cmbCountry->insertItem( tr ( "Barbados" ) );
475 cmbCountry->insertItem( tr ( "Belarus" ) ); 475 cmbCountry->insertItem( tr ( "Belarus" ) );
476 cmbCountry->insertItem( tr ( "Belgium" ) ); 476 cmbCountry->insertItem( tr ( "Belgium" ) );
477 cmbCountry->insertItem( tr ( "Belize" ) ); 477 cmbCountry->insertItem( tr ( "Belize" ) );
478 cmbCountry->insertItem( tr ( "Benin" ) ); 478 cmbCountry->insertItem( tr ( "Benin" ) );
479 cmbCountry->insertItem( tr ( "Bermuda" ) ); 479 cmbCountry->insertItem( tr ( "Bermuda" ) );
480 cmbCountry->insertItem( tr ( "Bhutan" ) ); 480 cmbCountry->insertItem( tr ( "Bhutan" ) );
481 cmbCountry->insertItem( tr ( "Boliva" ) ); 481 cmbCountry->insertItem( tr ( "Boliva" ) );
482 cmbCountry->insertItem( tr ( "Botswana" ) ); 482 cmbCountry->insertItem( tr ( "Botswana" ) );
483 cmbCountry->insertItem( tr ( "Bouvet Island" ) ); 483 cmbCountry->insertItem( tr ( "Bouvet Island" ) );
484 cmbCountry->insertItem( tr ( "Brazil" ) ); 484 cmbCountry->insertItem( tr ( "Brazil" ) );
485 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); 485 cmbCountry->insertItem( tr ( "Brunei Darussalam" ) );
486 cmbCountry->insertItem( tr ( "Bulgaria" ) ); 486 cmbCountry->insertItem( tr ( "Bulgaria" ) );
487 cmbCountry->insertItem( tr ( "Burkina Faso" ) ); 487 cmbCountry->insertItem( tr ( "Burkina Faso" ) );
488 cmbCountry->insertItem( tr ( "Burundi" ) ); 488 cmbCountry->insertItem( tr ( "Burundi" ) );
489 cmbCountry->insertItem( tr ( "Cambodia" ) ); 489 cmbCountry->insertItem( tr ( "Cambodia" ) );
490 cmbCountry->insertItem( tr ( "Camaroon" ) ); 490 cmbCountry->insertItem( tr ( "Camaroon" ) );
491 cmbCountry->insertItem( tr ( "Canada" ) ); 491 cmbCountry->insertItem( tr ( "Canada" ) );
492 cmbCountry->insertItem( tr ( "Cape Verde" ) ); 492 cmbCountry->insertItem( tr ( "Cape Verde" ) );
493 cmbCountry->insertItem( tr ( "Cayman Islands" ) ); 493 cmbCountry->insertItem( tr ( "Cayman Islands" ) );
494 cmbCountry->insertItem( tr ( "Chad" ) ); 494 cmbCountry->insertItem( tr ( "Chad" ) );
495 cmbCountry->insertItem( tr ( "Chile" ) ); 495 cmbCountry->insertItem( tr ( "Chile" ) );
496 cmbCountry->insertItem( tr ( "China" ) ); 496 cmbCountry->insertItem( tr ( "China" ) );
497 cmbCountry->insertItem( tr ( "Christmas Island" ) ); 497 cmbCountry->insertItem( tr ( "Christmas Island" ) );
498 cmbCountry->insertItem( tr ( "Colombia" ) ); 498 cmbCountry->insertItem( tr ( "Colombia" ) );
499 cmbCountry->insertItem( tr ( "Comoros" ) ); 499 cmbCountry->insertItem( tr ( "Comoros" ) );
500 cmbCountry->insertItem( tr ( "Congo" ) ); 500 cmbCountry->insertItem( tr ( "Congo" ) );
501 cmbCountry->insertItem( tr ( "Cook Island" ) ); 501 cmbCountry->insertItem( tr ( "Cook Island" ) );
502 cmbCountry->insertItem( tr ( "Costa Rica" ) ); 502 cmbCountry->insertItem( tr ( "Costa Rica" ) );
503 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); 503 cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) );
504 cmbCountry->insertItem( tr ( "Croatia" ) ); 504 cmbCountry->insertItem( tr ( "Croatia" ) );
505 cmbCountry->insertItem( tr ( "Cuba" ) ); 505 cmbCountry->insertItem( tr ( "Cuba" ) );
506 cmbCountry->insertItem( tr ( "Cyprus" ) ); 506 cmbCountry->insertItem( tr ( "Cyprus" ) );
507 cmbCountry->insertItem( tr ( "Czech Republic" ) ); 507 cmbCountry->insertItem( tr ( "Czech Republic" ) );
508 cmbCountry->insertItem( tr ( "Denmark" ) ); 508 cmbCountry->insertItem( tr ( "Denmark" ) );
509 cmbCountry->insertItem( tr ( "Djibouti" ) ); 509 cmbCountry->insertItem( tr ( "Djibouti" ) );
510 cmbCountry->insertItem( tr ( "Dominica" ) ); 510 cmbCountry->insertItem( tr ( "Dominica" ) );
511 cmbCountry->insertItem( tr ( "Dominican Republic" ) ); 511 cmbCountry->insertItem( tr ( "Dominican Republic" ) );
512 cmbCountry->insertItem( tr ( "East Timor" ) ); 512 cmbCountry->insertItem( tr ( "East Timor" ) );
513 cmbCountry->insertItem( tr ( "Ecuador" ) ); 513 cmbCountry->insertItem( tr ( "Ecuador" ) );
514 cmbCountry->insertItem( tr ( "Egypt" ) ); 514 cmbCountry->insertItem( tr ( "Egypt" ) );
515 cmbCountry->insertItem( tr ( "El Salvador" ) ); 515 cmbCountry->insertItem( tr ( "El Salvador" ) );
@@ -1171,588 +1171,590 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
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 =="Department" )
1364 (*itLE)->setText( ent.department() ); 1364 (*itLE)->setText( ent.department() );
1365 1365
1366 if ( *it == tr("Company" )) 1366 if ( *it == "Company" )
1367 (*itLE)->setText( ent.company() ); 1367 (*itLE)->setText( ent.company() );
1368 1368
1369 if ( *it == tr("Office" )) 1369 if ( *it == "Office" )
1370 (*itLE)->setText( ent.office() ); 1370 (*itLE)->setText( ent.office() );
1371 1371
1372 if ( *it == tr("Profession" )) 1372 if ( *it == "Profession" )
1373 (*itLE)->setText( ent.profession() ); 1373 (*itLE)->setText( ent.profession() );
1374 1374
1375 if ( *it == tr("Assistant" )) 1375 if ( *it == "Assistant" )
1376 (*itLE)->setText( ent.assistant() ); 1376 (*itLE)->setText( ent.assistant() );
1377 1377
1378 if ( *it == tr("Manager" )) 1378 if ( *it == "Manager" )
1379 (*itLE)->setText( ent.manager() ); 1379 (*itLE)->setText( ent.manager() );
1380 1380
1381 if ( *it == tr("Spouse" )) 1381 if ( *it == "Spouse" )
1382 (*itLE)->setText( ent.spouse() ); 1382 (*itLE)->setText( ent.spouse() );
1383 1383
1384 if ( *it == tr("Birthday" )) 1384 if ( *it == "Birthday" )
1385 (*itLE)->setText( ent.birthday() ); 1385 (*itLE)->setText( ent.birthday() );
1386 1386
1387 if ( *it == tr("Anniversary" )) 1387 if ( *it == "Anniversary" )
1388 (*itLE)->setText( ent.anniversary() ); 1388 (*itLE)->setText( ent.anniversary() );
1389 1389
1390 if ( *it == tr("Nickname" )) 1390 if ( *it == "Nickname" )
1391 (*itLE)->setText( ent.nickname() ); 1391 (*itLE)->setText( ent.nickname() );
1392 1392
1393 if ( *it == tr("Children" )) 1393 if ( *it == "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 == "Business Phone") || ( *it == "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 == "Business Fax") || ( *it == "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 == "Business Mobile" ) || ( *it == "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 == "Default Email" )
1417 *itV = ent.defaultEmail(); 1417 *itV = ent.defaultEmail();
1418 1418
1419 if ( *it == tr("Emails" )) 1419 if ( *it == "Emails" )
1420 *itV = ent.emailList().join(", "); // :SX 1420 *itV = ent.emailList().join(", "); // :SX
1421 1421
1422 if ( *it == tr("Home Phone" )) 1422 if ( *it == "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 == "Home Fax" )
1429 *itV = ent.homeFax(); 1429 *itV = ent.homeFax();
1430 1430
1431 if ( *it == tr("Home Mobile" )) 1431 if ( *it == "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 == "Business Pager" ) || ( *it == "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 == "Home Web Page" )
1465 *itV = ent.homeWebpage(); 1465 *itV = ent.homeWebpage();
1466 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") ) 1466
1467 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1467 *itV = ent.businessWebpage(); 1468 *itV = ent.businessWebpage();
1468 1469
1469 1470
1470 } 1471 }
1471 1472
1472 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1473 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1473 1474
1474 QString gender = ent.gender(); 1475 QString gender = ent.gender();
1475 cmbGender->setCurrentItem( gender.toInt() ); 1476 cmbGender->setCurrentItem( gender.toInt() );
1476 1477
1477 txtNote->setText( ent.notes() ); 1478 txtNote->setText( ent.notes() );
1478 1479
1479 slotCmbChooser1Change( cmbChooserField1->currentItem() ); 1480 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1480 slotCmbChooser2Change( cmbChooserField2->currentItem() ); 1481 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1481 slotCmbChooser3Change( cmbChooserField3->currentItem() ); 1482 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1482 1483
1483 slotAddressTypeChange( cmbAddress->currentItem() ); 1484 slotAddressTypeChange( cmbAddress->currentItem() );
1484 1485
1485} 1486}
1486 1487
1487void ContactEditor::saveEntry() { 1488void ContactEditor::saveEntry() {
1488 1489
1489 if ( useFullName == TRUE ) { 1490 if ( useFullName == TRUE ) {
1490 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1491 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1491 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1492 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1492 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1493 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1493 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1494 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1494 1495
1495 useFullName = FALSE; 1496 useFullName = FALSE;
1496 } 1497}
1497 1498
1498 /*if ( ent.firstName() != txtFirstName->text() || 1499 /*if ( ent.firstName() != txtFirstName->text() ||
1499 ent.lastName != txtLastName->text() || 1500 ent.lastName != txtLastName->text() ||
1500 ent.middleName != txtMiddleName->text() ) { 1501 ent.middleName != txtMiddleName->text() ) {
1501 */ 1502 */
1502 ent.setFirstName( txtFirstName->text() ); 1503 ent.setFirstName( txtFirstName->text() );
1503 ent.setLastName( txtLastName->text() ); 1504 ent.setLastName( txtLastName->text() );
1504 ent.setMiddleName( txtMiddleName->text() ); 1505 ent.setMiddleName( txtMiddleName->text() );
1505 ent.setSuffix( txtSuffix->text() ); 1506 ent.setSuffix( txtSuffix->text() );
1506 1507
1507 //} 1508 //}
1508 1509
1509 ent.setFileAs( cmbFileAs->currentText() ); 1510 ent.setFileAs( cmbFileAs->currentText() );
1510 1511
1511 ent.setCategories( cmbCat->currentCategories() ); 1512 ent.setCategories( cmbCat->currentCategories() );
1512 1513
1513 if (hasTitle) 1514 if (hasTitle)
1514 ent.setJobTitle( txtJobTitle->text() ); 1515 ent.setJobTitle( txtJobTitle->text() );
1515 1516
1516 if (hasCompany) 1517 if (hasCompany)
1517 ent.setCompany( txtOrganization->text() ); 1518 ent.setCompany( txtOrganization->text() );
1518 1519
1519 if (hasNotes) 1520 if (hasNotes)
1520 ent.setNotes( txtNote->text() ); 1521 ent.setNotes( txtNote->text() );
1521 1522
1522 if (hasStreet) { 1523 if (hasStreet) {
1523 ent.setHomeStreet( slHomeAddress[0] ); 1524 ent.setHomeStreet( slHomeAddress[0] );
1524 ent.setBusinessStreet( slBusinessAddress[0] ); 1525 ent.setBusinessStreet( slBusinessAddress[0] );
1525 } 1526 }
1526/* 1527/*
1527 if (hasStreet2) { 1528 if (hasStreet2) {
1528 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1529 ent.setHomeStreet2( (*slHomeAddress)[1] );
1529 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1530 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1530 } 1531 }
1531 1532
1532 if (hasPOBox) { 1533 if (hasPOBox) {
1533 ent.setHomePOBox( (*slHomeAddress)[2] ); 1534 ent.setHomePOBox( (*slHomeAddress)[2] );
1534 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1535 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1535 } 1536 }
1536*/ 1537*/
1537 if (hasCity) { 1538 if (hasCity) {
1538 ent.setHomeCity( slHomeAddress[3] ); 1539 ent.setHomeCity( slHomeAddress[3] );
1539 ent.setBusinessCity( slBusinessAddress[3] ); 1540 ent.setBusinessCity( slBusinessAddress[3] );
1540 } 1541 }
1541 1542
1542 if (hasState) { 1543 if (hasState) {
1543 ent.setHomeState( slHomeAddress[4] ); 1544 ent.setHomeState( slHomeAddress[4] );
1544 ent.setBusinessState( slBusinessAddress[4] ); 1545 ent.setBusinessState( slBusinessAddress[4] );
1545 } 1546 }
1546 1547
1547 if (hasZip) { 1548 if (hasZip) {
1548 ent.setHomeZip( slHomeAddress[5] ); 1549 ent.setHomeZip( slHomeAddress[5] );
1549 ent.setBusinessZip( slBusinessAddress[5] ); 1550 ent.setBusinessZip( slBusinessAddress[5] );
1550 } 1551 }
1551 1552
1552 if (hasCountry) { 1553 if (hasCountry) {
1553 ent.setHomeCountry( slHomeAddress[6] ); 1554 ent.setHomeCountry( slHomeAddress[6] );
1554 ent.setBusinessCountry( slBusinessAddress[6] ); 1555 ent.setBusinessCountry( slBusinessAddress[6] );
1555 } 1556 }
1556 1557
1557 QStringList::ConstIterator it; 1558 QStringList::ConstIterator it;
1558 QListIterator<QLineEdit> itLE( listValue ); 1559 QListIterator<QLineEdit> itLE( listValue );
1559 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { 1560 for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
1560 if ( *it == tr("Department" )) 1561 if ( *it == "Department" )
1561 ent.setDepartment( (*itLE)->text() ); 1562 ent.setDepartment( (*itLE)->text() );
1562 1563
1563 if ( *it == tr("Company" )) 1564 if ( *it == "Company" )
1564 ent.setCompany( (*itLE)->text() ); 1565 ent.setCompany( (*itLE)->text() );
1565 1566
1566 if ( *it == tr("Office" )) 1567 if ( *it == "Office" )
1567 ent.setOffice( (*itLE)->text() ); 1568 ent.setOffice( (*itLE)->text() );
1568 1569
1569 if ( *it == tr("Profession" )) 1570 if ( *it == "Profession" )
1570 ent.setProfession( (*itLE)->text() ); 1571 ent.setProfession( (*itLE)->text() );
1571 1572
1572 if ( *it == tr("Assistant" )) 1573 if ( *it == "Assistant" )
1573 ent.setAssistant( (*itLE)->text() ); 1574 ent.setAssistant( (*itLE)->text() );
1574 1575
1575 if ( *it == tr("Manager" )) 1576 if ( *it == "Manager" )
1576 ent.setManager( (*itLE)->text() ); 1577 ent.setManager( (*itLE)->text() );
1577 1578
1578 if ( *it == tr("Spouse" )) 1579 if ( *it == "Spouse" )
1579 ent.setSpouse( (*itLE)->text() ); 1580 ent.setSpouse( (*itLE)->text() );
1580 1581
1581 if ( *it == tr("Birthday" )) 1582 if ( *it == "Birthday" )
1582 ent.setBirthday( (*itLE)->text() ); 1583 ent.setBirthday( (*itLE)->text() );
1583 1584
1584 if ( *it == tr("Anniversary" )) 1585 if ( *it == "Anniversary" )
1585 ent.setAnniversary( (*itLE)->text() ); 1586 ent.setAnniversary( (*itLE)->text() );
1586 1587
1587 if ( *it == tr("Nickname" )) 1588 if ( *it == "Nickname" )
1588 ent.setNickname( (*itLE)->text() ); 1589 ent.setNickname( (*itLE)->text() );
1589 1590
1590 if ( *it == tr("Children" )) 1591 if ( *it == "Children" )
1591 ent.setChildren( (*itLE)->text() ); 1592 ent.setChildren( (*itLE)->text() );
1592 1593
1593 } 1594 }
1594 1595
1595 QStringList::ConstIterator itV; 1596 QStringList::ConstIterator itV;
1596 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { 1597 for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
1597 1598
1598 if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) 1599 if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
1599 ent.setBusinessPhone( *itV ); 1600 ent.setBusinessPhone( *itV );
1600/* 1601/*
1601 if ( *it == tr("Business 2 Phone" ) 1602 if ( *it == tr("Business 2 Phone" )
1602 ent.setBusiness2Phone( *itV ); 1603 ent.setBusiness2Phone( *itV );
1603*/ 1604*/
1604 if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) 1605 if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
1605 ent.setBusinessFax( *itV ); 1606 ent.setBusinessFax( *itV );
1606 1607
1607 if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" )) 1608 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1608 ent.setBusinessMobile( *itV ); 1609 ent.setBusinessMobile( *itV );
1609/* 1610/*
1610 if ( *it == "Company Phone" ) 1611 if ( *it == "Company Phone" )
1611 ent.setCompanyPhone( *itV ); 1612 ent.setCompanyPhone( *itV );
1612*/ 1613*/
1613 //if ( *it == "Default Email" ) 1614 //if ( *it == "Default Email" )
1614 //ent.setDefaultEmail( *itV ); 1615 //ent.setDefaultEmail( *itV );
1615 1616
1616 if ( *it == tr("Emails" )) { 1617 if ( *it == "Emails" ){
1617 QString allemail; 1618 QString allemail;
1618 QString defaultmail; 1619 QString defaultmail;
1619 parseEmailFrom( *itV, defaultmail, allemail ); 1620 parseEmailFrom( *itV, defaultmail, allemail );
1620 // ent.clearEmails(); 1621 // ent.clearEmails();
1621 ent.setDefaultEmail( defaultmail ); 1622 ent.setDefaultEmail( defaultmail );
1622 ent.setEmails( allemail ); 1623 ent.setEmails( allemail );
1623 } 1624 }
1624 1625
1625 if ( *it == tr("Home Phone" )) 1626 if ( *it == "Home Phone" )
1626 ent.setHomePhone( *itV ); 1627 ent.setHomePhone( *itV );
1627/* 1628/*
1628 if ( *it == "Home 2 Phone" ) 1629 if ( *it == "Home 2 Phone" )
1629 ent.setHome2Phone( *itV ); 1630 ent.setHome2Phone( *itV );
1630*/ 1631*/
1631 if ( *it == tr("Home Fax" )) 1632 if ( *it == "Home Fax" )
1632 ent.setHomeFax( *itV ); 1633 ent.setHomeFax( *itV );
1633 1634
1634 if ( *it == tr("Home Mobile" )) 1635 if ( *it == "Home Mobile" )
1635 ent.setHomeMobile( *itV ); 1636 ent.setHomeMobile( *itV );
1636/* 1637/*
1637 if ( *it == "Car Phone" ) 1638 if ( *it == "Car Phone" )
1638 ent.setCarPhone( *itV ); 1639 ent.setCarPhone( *itV );
1639 1640
1640 if ( *it == "ISDN Phone" ) 1641 if ( *it == "ISDN Phone" )
1641 ent.setISDNPhone( *itV ); 1642 ent.setISDNPhone( *itV );
1642 1643
1643 if ( *it == "Other Phone" ) 1644 if ( *it == "Other Phone" )
1644 ent.setOtherPhone( *itV ); 1645 ent.setOtherPhone( *itV );
1645*/ 1646*/
1646 if ( *it == tr("Business Pager") || *it == tr("Work Pager") ) 1647 if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
1647 ent.setBusinessPager( *itV ); 1648 ent.setBusinessPager( *itV );
1648/* 1649/*
1649 if ( *it == "Home Pager" ) 1650 if ( *it == "Home Pager" )
1650 ent.setHomePager( *itV ); 1651 ent.setHomePager( *itV );
1651 1652
1652 if ( *it == "AIM IM" ) 1653 if ( *it == "AIM IM" )
1653 ent.setAIMIM( *itV ); 1654 ent.setAIMIM( *itV );
1654 1655
1655 if ( *it == "ICQ IM" ) 1656 if ( *it == "ICQ IM" )
1656 ent.setICQIM( *itV ); 1657 ent.setICQIM( *itV );
1657 1658
1658 if ( *it == "Jabber IM" ) 1659 if ( *it == "Jabber IM" )
1659 ent.setJabberIM( *itV ); 1660 ent.setJabberIM( *itV );
1660 1661
1661 if ( *it == "MSN IM" ) 1662 if ( *it == "MSN IM" )
1662 ent.setMSNIM( *itV ); 1663 ent.setMSNIM( *itV );
1663 1664
1664 if ( *it == "Yahoo IM" ) 1665 if ( *it == "Yahoo IM" )
1665 ent.setYahooIM( *itV ); 1666 ent.setYahooIM( *itV );
1666*/ 1667*/
1667 if ( *it == tr("Home Web Page") ) 1668 if ( *it == "Home Web Page" )
1668 ent.setHomeWebpage( *itV ); 1669 ent.setHomeWebpage( *itV );
1669 if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" )) 1670
1671 if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
1670 ent.setBusinessWebpage( *itV ); 1672 ent.setBusinessWebpage( *itV );
1671 1673
1672 1674
1673 } 1675 }
1674 1676
1675 int gender = cmbGender->currentItem(); 1677 int gender = cmbGender->currentItem();
1676 ent.setGender( QString::number( gender ) ); 1678 ent.setGender( QString::number( gender ) );
1677 1679
1678 QString str = txtNote->text(); 1680 QString str = txtNote->text();
1679 if ( !str.isNull() ) 1681 if ( !str.isNull() )
1680 ent.setNotes( str ); 1682 ent.setNotes( str );
1681 1683
1682} 1684}
1683 1685
1684void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1686void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1685 QString &strAll ) 1687 QString &strAll )
1686{ 1688{
1687 int where, 1689 int where,
1688 start; 1690 start;
1689 if ( txt.isEmpty() ) 1691 if ( txt.isEmpty() )
1690 return; 1692 return;
1691 // find the first 1693 // find the first
1692 where = txt.find( ',' ); 1694 where = txt.find( ',' );
1693 if ( where < 0 ) { 1695 if ( where < 0 ) {
1694 strDefaultEmail = txt; 1696 strDefaultEmail = txt;
1695 strAll = txt; 1697 strAll = txt;
1696 } else { 1698 } else {
1697 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1699 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1698 strAll = strDefaultEmail; 1700 strAll = strDefaultEmail;
1699 while ( where > -1 ) { 1701 while ( where > -1 ) {
1700 strAll.append(" "); 1702 strAll.append(" ");
1701 start = where; 1703 start = where;
1702 where = txt.find( ',', where + 1 ); 1704 where = txt.find( ',', where + 1 );
1703 if ( where > - 1 ) 1705 if ( where > - 1 )
1704 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1706 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1705 else // grab until the end... 1707 else // grab until the end...
1706 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1708 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1707 } 1709 }
1708 } 1710 }
1709} 1711}
1710 1712
1711void parseEmailTo( const QString &strDefaultEmail, 1713void parseEmailTo( const QString &strDefaultEmail,
1712 const QString &strOtherEmail, QString &strBack ) 1714 const QString &strOtherEmail, QString &strBack )
1713{ 1715{
1714 // create a comma dilimeted set of emails... 1716 // create a comma dilimeted set of emails...
1715 // use the power of short circuiting... 1717 // use the power of short circuiting...
1716 bool foundDefault = false; 1718 bool foundDefault = false;
1717 QString strTmp; 1719 QString strTmp;
1718 int start = 0; 1720 int start = 0;
1719 int where; 1721 int where;
1720 // start at the beginng. 1722 // start at the beginng.
1721 strBack = strDefaultEmail; 1723 strBack = strDefaultEmail;
1722 where = 0; 1724 where = 0;
1723 while ( where > -1 ) { 1725 while ( where > -1 ) {
1724 start = where; 1726 start = where;
1725 where = strOtherEmail.find( ' ', where + 1 ); 1727 where = strOtherEmail.find( ' ', where + 1 );
1726 if ( where > 0 ) { 1728 if ( where > 0 ) {
1727 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); 1729 strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
1728 } else 1730 } else
1729 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); 1731 strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
1730 if ( foundDefault || strTmp != strDefaultEmail ) { 1732 if ( foundDefault || strTmp != strDefaultEmail ) {
1731 strBack.append( ", " ); 1733 strBack.append( ", " );
1732 strBack.append( strTmp ); 1734 strBack.append( strTmp );
1733 } else 1735 } else
1734 foundDefault = true; 1736 foundDefault = true;
1735 } 1737 }
1736} 1738}
1737 1739
1738 1740
1739static inline bool containsAlphaNum( const QString &str ) 1741static inline bool containsAlphaNum( const QString &str )
1740{ 1742{
1741 int i, 1743 int i,
1742 count = str.length(); 1744 count = str.length();
1743 for ( i = 0; i < count; i++ ) 1745 for ( i = 0; i < count; i++ )
1744 if ( !str[i].isSpace() ) 1746 if ( !str[i].isSpace() )
1745 return TRUE; 1747 return TRUE;
1746 return FALSE; 1748 return FALSE;
1747} 1749}
1748 1750
1749static inline bool constainsWhiteSpace( const QString &str ) 1751static inline bool constainsWhiteSpace( const QString &str )
1750{ 1752{
1751 int i, 1753 int i,
1752 count = str.length(); 1754 count = str.length();
1753 for (i = 0; i < count; i++ ) 1755 for (i = 0; i < count; i++ )
1754 if ( str[i].isSpace() ) 1756 if ( str[i].isSpace() )
1755 return TRUE; 1757 return TRUE;
1756 return FALSE; 1758 return FALSE;
1757} 1759}
1758 1760