summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp56
1 files changed, 39 insertions, 17 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 66e94ef..6d92ac3 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -404,99 +404,99 @@ void ContactEditor::init() {
404 gl->addWidget( e, i, 1); 404 gl->addWidget( e, i, 1);
405 } 405 }
406 406
407 l = new QLabel( tr("Gender"), container ); 407 l = new QLabel( tr("Gender"), container );
408 gl->addWidget( l, slDynamicEntries->count(), 0 ); 408 gl->addWidget( l, slDynamicEntries->count(), 0 );
409 cmbGender = new QComboBox( container ); 409 cmbGender = new QComboBox( container );
410 cmbGender->insertItem( "", 0 ); 410 cmbGender->insertItem( "", 0 );
411 cmbGender->insertItem( tr("Male"), 1); 411 cmbGender->insertItem( tr("Male"), 1);
412 cmbGender->insertItem( tr("Female"), 2); 412 cmbGender->insertItem( tr("Female"), 2);
413 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); 413 gl->addWidget( cmbGender, slDynamicEntries->count(), 1 );
414 414
415 tabMain->insertTab( tabViewport, tr( "Details" ) ); 415 tabMain->insertTab( tabViewport, tr( "Details" ) );
416 416
417 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 417 dlgNote = new QDialog( this, "Note Dialog", TRUE );
418 dlgNote->setCaption( tr("Enter Note") ); 418 dlgNote->setCaption( tr("Enter Note") );
419 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 419 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
420 txtNote = new QMultiLineEdit( dlgNote ); 420 txtNote = new QMultiLineEdit( dlgNote );
421 vbNote->addWidget( txtNote ); 421 vbNote->addWidget( txtNote );
422 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 422 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
423 423
424 dlgName = new QDialog( this, "Name Dialog", TRUE ); 424 dlgName = new QDialog( this, "Name Dialog", TRUE );
425 dlgName->setCaption( tr("Edit Name") ); 425 dlgName->setCaption( tr("Edit Name") );
426 gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); 426 gl = new QGridLayout( dlgName, 4, 2, 2, 3 );
427 427
428 l = new QLabel( tr("First Name"), dlgName ); 428 l = new QLabel( tr("First Name"), dlgName );
429 gl->addWidget( l, 0, 0 ); 429 gl->addWidget( l, 0, 0 );
430 txtFirstName = new QLineEdit( dlgName ); 430 txtFirstName = new QLineEdit( dlgName );
431 gl->addWidget( txtFirstName, 0, 1 ); 431 gl->addWidget( txtFirstName, 0, 1 );
432 432
433 l = new QLabel( tr("Middle Name"), dlgName ); 433 l = new QLabel( tr("Middle Name"), dlgName );
434 gl->addWidget( l, 1, 0 ); 434 gl->addWidget( l, 1, 0 );
435 txtMiddleName = new QLineEdit( dlgName ); 435 txtMiddleName = new QLineEdit( dlgName );
436 gl->addWidget( txtMiddleName, 1, 1 ); 436 gl->addWidget( txtMiddleName, 1, 1 );
437 437
438 l = new QLabel( tr("Last Name"), dlgName ); 438 l = new QLabel( tr("Last Name"), dlgName );
439 gl->addWidget( l, 2, 0 ); 439 gl->addWidget( l, 2, 0 );
440 txtLastName = new QLineEdit( dlgName ); 440 txtLastName = new QLineEdit( dlgName );
441 gl->addWidget( txtLastName, 2, 1 ); 441 gl->addWidget( txtLastName, 2, 1 );
442 442
443 l = new QLabel( tr("Suffix"), dlgName ); 443 l = new QLabel( tr("Suffix"), dlgName );
444 gl->addWidget( l, 3, 0 ); 444 gl->addWidget( l, 3, 0 );
445 txtSuffix = new QLineEdit( dlgName ); 445 txtSuffix = new QLineEdit( dlgName );
446 gl->addWidget( txtSuffix, 3, 1 ); 446 gl->addWidget( txtSuffix, 3, 1 );
447 447
448 cmbChooserField1->insertStringList( *slChooserNames ); 448 cmbChooserField1->insertStringList( *slChooserNames );
449 cmbChooserField2->insertStringList( *slChooserNames ); 449 cmbChooserField2->insertStringList( *slChooserNames );
450 cmbChooserField3->insertStringList( *slChooserNames ); 450 cmbChooserField3->insertStringList( *slChooserNames );
451 451
452 cmbChooserField1->setCurrentItem( 1 ); 452 cmbChooserField1->setCurrentItem( 0 );
453 cmbChooserField2->setCurrentItem( 2 ); 453 cmbChooserField2->setCurrentItem( 1 );
454 cmbChooserField3->setCurrentItem( 3 ); 454 cmbChooserField3->setCurrentItem( 2 );
455 455
456 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 456 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
457 457
458 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 458 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
459 459
460 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); 460 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) );
461 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); 461 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) );
462 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); 462 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) );
463 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); 463 connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) );
464 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 464 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
465 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 465 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
466 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); 466 connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) );
467 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); 467 connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) );
468 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); 468 connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) );
469 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 469 connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) );
470 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); 470 connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) );
471 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); 471 connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) );
472 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); 472 connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) );
473 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); 473 connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) );
474 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); 474 connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) );
475 new QPEDialogListener(this); 475 new QPEDialogListener(this);
476} 476}
477 477
478void ContactEditor::initMap() 478void ContactEditor::initMap()
479{ 479{
480 /* 480 /*
481 // since the fields and the XML fields exist, create a map 481 // since the fields and the XML fields exist, create a map
482 // between them... 482 // between them...
483 Config cfg1( "AddressBook" ); 483 Config cfg1( "AddressBook" );
484 Config cfg2( "AddressBook" ); 484 Config cfg2( "AddressBook" );
485 QString strCfg1, 485 QString strCfg1,
486 strCfg2; 486 strCfg2;
487 int i; 487 int i;
488 488
489 // This stuff better exist... 489 // This stuff better exist...
490 cfg1.setGroup( "AddressFields" ); 490 cfg1.setGroup( "AddressFields" );
491o cfg2.setGroup( "XMLFields" ); 491o cfg2.setGroup( "XMLFields" );
492 i = 0; 492 i = 0;
493 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); 493 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null );
494 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 494 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
495 QString::null ); 495 QString::null );
496 while ( !strCfg1.isNull() && !strCfg2.isNull() ) { 496 while ( !strCfg1.isNull() && !strCfg2.isNull() ) {
497 mapField.insert( strCfg1, strCfg2 ); 497 mapField.insert( strCfg1, strCfg2 );
498 strCfg1 = cfg1.readEntry( "Field" + QString::number(i), 498 strCfg1 = cfg1.readEntry( "Field" + QString::number(i),
499 QString::null ); 499 QString::null );
500 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), 500 strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++),
501 QString::null ); 501 QString::null );
502 } 502 }
@@ -914,443 +914,465 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
914} 914}
915 915
916void ContactEditor::cleanupFields() { 916void ContactEditor::cleanupFields() {
917 917
918 QStringList::Iterator it = slChooserValues->begin(); 918 QStringList::Iterator it = slChooserValues->begin();
919 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { 919 for ( int i = 0; it != slChooserValues->end(); i++, ++it ) {
920 (*it) = ""; 920 (*it) = "";
921 } 921 }
922 922
923 for ( int i = 0; i < 7; i++ ) { 923 for ( int i = 0; i < 7; i++ ) {
924 (*slHomeAddress)[i] = ""; 924 (*slHomeAddress)[i] = "";
925 (*slBusinessAddress)[i] = ""; 925 (*slBusinessAddress)[i] = "";
926 } 926 }
927 927
928 QStringList::ConstIterator cit; 928 QStringList::ConstIterator cit;
929 QListIterator<QLineEdit> itLE( listValue ); 929 QListIterator<QLineEdit> itLE( listValue );
930 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { 930 for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) {
931 (*itLE)->setText( "" ); 931 (*itLE)->setText( "" );
932 } 932 }
933 933
934 txtFirstName->setText(""); 934 txtFirstName->setText("");
935 txtMiddleName->setText(""); 935 txtMiddleName->setText("");
936 txtLastName->setText(""); 936 txtLastName->setText("");
937 txtSuffix->setText(""); 937 txtSuffix->setText("");
938 txtNote->setText(""); 938 txtNote->setText("");
939 txtFullName->setText(""); 939 txtFullName->setText("");
940 txtJobTitle->setText(""); 940 txtJobTitle->setText("");
941 txtOrganization->setText(""); 941 txtOrganization->setText("");
942 txtChooserField1->setText(""); 942 txtChooserField1->setText("");
943 txtChooserField2->setText(""); 943 txtChooserField2->setText("");
944 txtChooserField3->setText(""); 944 txtChooserField3->setText("");
945 txtAddress->setText(""); 945 txtAddress->setText("");
946 //txtAddress2->setText(""); 946 //txtAddress2->setText("");
947 txtCity->setText(""); 947 txtCity->setText("");
948 //txtPOBox->setText(""); 948 //txtPOBox->setText("");
949 txtState->setText(""); 949 txtState->setText("");
950 txtZip->setText(""); 950 txtZip->setText("");
951 QLineEdit *txtTmp = cmbCountry->lineEdit(); 951 QLineEdit *txtTmp = cmbCountry->lineEdit();
952 txtTmp->setText(""); 952 txtTmp->setText("");
953 txtTmp = cmbFileAs->lineEdit(); 953 txtTmp = cmbFileAs->lineEdit();
954 txtTmp->setText(""); 954 txtTmp->setText("");
955 955
956} 956}
957 957
958void ContactEditor::setEntry( const Contact &entry ) { 958void ContactEditor::setEntry( const Contact &entry ) {
959 959
960 cleanupFields(); 960 cleanupFields();
961 961
962
962 ent = entry; 963 ent = entry;
963 964
964 useFullName = FALSE; 965 useFullName = FALSE;
965 txtFirstName->setText( ent.firstName() ); 966 txtFirstName->setText( ent.firstName() );
966 txtMiddleName->setText( ent.middleName() ); 967 txtMiddleName->setText( ent.middleName() );
967 txtLastName->setText( ent.lastName() ); 968 txtLastName->setText( ent.lastName() );
968 txtSuffix->setText( ent.suffix() ); 969 txtSuffix->setText( ent.suffix() );
969 970
970 QString *tmpString = new QString; 971 QString *tmpString = new QString;
971 *tmpString = ent.firstName() + " " + ent.middleName() + 972 *tmpString = ent.firstName() + " " + ent.middleName() +
972 + " " + ent.lastName() + " " + ent.suffix(); 973 + " " + ent.lastName() + " " + ent.suffix();
973 974
974 txtFullName->setText( tmpString->simplifyWhiteSpace() ); 975 txtFullName->setText( tmpString->simplifyWhiteSpace() );
975 976
976 cmbFileAs->setEditText( ent.fileAs() ); 977 cmbFileAs->setEditText( ent.fileAs() );
977 978
978 if (hasTitle) 979 if (hasTitle)
979 txtJobTitle->setText( ent.jobTitle() ); 980 txtJobTitle->setText( ent.jobTitle() );
980 981
981 if (hasCompany) 982 if (hasCompany)
982 txtOrganization->setText( ent.company() ); 983 txtOrganization->setText( ent.company() );
983 984
984 if (hasNotes) 985 if (hasNotes)
985 txtNote->setText( ent.notes() ); 986 txtNote->setText( ent.notes() );
986 987
987 if (hasStreet) { 988 if (hasStreet) {
988 (*slHomeAddress)[0] = ent.homeStreet(); 989 (*slHomeAddress)[0] = ent.homeStreet();
989 (*slBusinessAddress)[0] = ent.businessStreet(); 990 (*slBusinessAddress)[0] = ent.businessStreet();
990 } 991 }
991/* 992/*
992 if (hasStreet2) { 993 if (hasStreet2) {
993 (*slHomeAddress)[1] = ent.homeStreet2(); 994 (*slHomeAddress)[1] = ent.homeStreet2();
994 (*slBusinessAddress)[1] = ent.businessStreet2(); 995 (*slBusinessAddress)[1] = ent.businessStreet2();
995 } 996 }
996 997
997 if (hasPOBox) { 998 if (hasPOBox) {
998 (*slHomeAddress)[2] = ent.homePOBox(); 999 (*slHomeAddress)[2] = ent.homePOBox();
999 (*slBusinessAddress)[2] = ent.businessPOBox(); 1000 (*slBusinessAddress)[2] = ent.businessPOBox();
1000 } 1001 }
1001*/ 1002*/
1002 if (hasCity) { 1003 if (hasCity) {
1003 (*slHomeAddress)[3] = ent.homeCity(); 1004 (*slHomeAddress)[3] = ent.homeCity();
1004 (*slBusinessAddress)[3] = ent.homeCity(); 1005 (*slBusinessAddress)[3] = ent.homeCity();
1005 } 1006 }
1006 1007
1007 if (hasState) { 1008 if (hasState) {
1008 (*slHomeAddress)[4] = ent.homeState(); 1009 (*slHomeAddress)[4] = ent.homeState();
1009 (*slBusinessAddress)[4] = ent.businessState(); 1010 (*slBusinessAddress)[4] = ent.businessState();
1010 } 1011 }
1011 1012
1012 if (hasZip) { 1013 if (hasZip) {
1013 (*slHomeAddress)[5] = ent.homeZip(); 1014 (*slHomeAddress)[5] = ent.homeZip();
1014 (*slBusinessAddress)[5] = ent.businessZip(); 1015 (*slBusinessAddress)[5] = ent.businessZip();
1015 } 1016 }
1016 1017
1018 if (hasCountry) {
1019 (*slHomeAddress)[6] = ent.homeCountry();
1020 (*slBusinessAddress)[6] = ent.businessCountry();
1021 }
1022
1017 QStringList::ConstIterator it; 1023 QStringList::ConstIterator it;
1018 QListIterator<QLineEdit> itLE( listValue ); 1024 QListIterator<QLineEdit> itLE( listValue );
1019 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { 1025 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) {
1020 if ( *it == "Department" ) 1026 if ( *it == "Department" )
1021 (*itLE)->setText( ent.department() ); 1027 (*itLE)->setText( ent.department() );
1022 1028
1023 if ( *it == "Company" ) 1029 if ( *it == "Company" )
1024 (*itLE)->setText( ent.company() ); 1030 (*itLE)->setText( ent.company() );
1025 1031
1026 if ( *it == "Office" ) 1032 if ( *it == "Office" )
1027 (*itLE)->setText( ent.office() ); 1033 (*itLE)->setText( ent.office() );
1028 1034
1029 if ( *it == "Profession" ) 1035 if ( *it == "Profession" )
1030 (*itLE)->setText( ent.profession() ); 1036 (*itLE)->setText( ent.profession() );
1031 1037
1032 if ( *it == "Assistant" ) 1038 if ( *it == "Assistant" )
1033 (*itLE)->setText( ent.assistant() ); 1039 (*itLE)->setText( ent.assistant() );
1034 1040
1035 if ( *it == "Manager" ) 1041 if ( *it == "Manager" )
1036 (*itLE)->setText( ent.manager() ); 1042 (*itLE)->setText( ent.manager() );
1037 1043
1038 if ( *it == "Spouse" ) 1044 if ( *it == "Spouse" )
1039 (*itLE)->setText( ent.spouse() ); 1045 (*itLE)->setText( ent.spouse() );
1040 1046
1041 if ( *it == "Birthday" ) 1047 if ( *it == "Birthday" )
1042 (*itLE)->setText( ent.birthday() ); 1048 (*itLE)->setText( ent.birthday() );
1043 1049
1044 if ( *it == "Anniversary" ) 1050 if ( *it == "Anniversary" )
1045 (*itLE)->setText( ent.anniversary() ); 1051 (*itLE)->setText( ent.anniversary() );
1046 1052
1047 if ( *it == "Nickname" ) 1053 if ( *it == "Nickname" )
1048 (*itLE)->setText( ent.nickname() ); 1054 (*itLE)->setText( ent.nickname() );
1049 1055
1050 if ( *it == "Children" ) 1056 if ( *it == "Children" )
1051 (*itLE)->setText( ent.children() ); 1057 (*itLE)->setText( ent.children() );
1052 1058
1053 } 1059 }
1054 1060
1055 QStringList::Iterator itV; 1061 QStringList::Iterator itV;
1056 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { 1062 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) {
1057 1063
1058 if ( *it == "Business Phone" ) 1064 if ( *it == "Business Phone" || *it == "Work Phone" )
1059 *itV = ent.businessPhone(); 1065 *itV = ent.businessPhone();
1060/* 1066/*
1061 if ( *it == "Business 2 Phone" ) 1067 if ( *it == "Business 2 Phone" )
1062 *itV = ent.business2Phone(); 1068 *itV = ent.business2Phone();
1063*/ 1069*/
1064 if ( *it == "Business Fax" ) 1070 if ( *it == "Business Fax" || *it == "Work Fax" )
1065 *itV = ent.businessFax(); 1071 *itV = ent.businessFax();
1066 1072
1067 if ( *it == "Business Mobile" ) 1073 if ( *it == "Business Mobile" || *it == "work Mobile" )
1068 *itV = ent.businessMobile(); 1074 *itV = ent.businessMobile();
1069/* 1075/*
1070 if ( *it == "Company Phone" ) 1076 if ( *it == "Company Phone" )
1071 *itV = ent.companyPhone(); 1077 *itV = ent.companyPhone();
1072*/ 1078*/
1073 if ( *it == "Default Email" ) 1079 if ( *it == "Default Email" )
1074 *itV = ent.defaultEmail(); 1080 *itV = ent.defaultEmail();
1075 1081
1076 if ( *it == "Emails" ) 1082 if ( *it == "Emails" )
1077 *itV = ent.emails(); 1083 *itV = ent.emails();
1078 1084
1079 if ( *it == "Home Phone" ) 1085 if ( *it == "Home Phone" )
1080 *itV = ent.homePhone(); 1086 *itV = ent.homePhone();
1081/* 1087/*
1082 if ( *it == "Home 2 Phone" ) 1088 if ( *it == "Home 2 Phone" )
1083 *itV = ent.home2Phone(); 1089 *itV = ent.home2Phone();
1084*/ 1090*/
1085 if ( *it == "Home Fax" ) 1091 if ( *it == "Home Fax" )
1086 *itV = ent.homeFax(); 1092 *itV = ent.homeFax();
1087 1093
1088 if ( *it == "Home Mobile" ) 1094 if ( *it == "Home Mobile" )
1089 *itV = ent.homeMobile(); 1095 *itV = ent.homeMobile();
1090/* 1096/*
1091 if ( *it == "Car Phone" ) 1097 if ( *it == "Car Phone" )
1092 *itV = ent.carPhone(); 1098 *itV = ent.carPhone();
1093 1099
1094 if ( *it == "ISDN Phone" ) 1100 if ( *it == "ISDN Phone" )
1095 *itV = ent.ISDNPhone(); 1101 *itV = ent.ISDNPhone();
1096 1102
1097 if ( *it == "Other Phone" ) 1103 if ( *it == "Other Phone" )
1098 *itV = ent.otherPhone(); 1104 *itV = ent.otherPhone();
1099*/ 1105*/
1100 if ( *it == "Business Pager" ) 1106 if ( *it == "Business Pager" || *it == "Work Pager" )
1101 *itV = ent.businessPager(); 1107 *itV = ent.businessPager();
1102/* 1108/*
1103 if ( *it == "Home Pager") 1109 if ( *it == "Home Pager")
1104 *itV = ent.homePager(); 1110 *itV = ent.homePager();
1105 1111
1106 if ( *it == "AIM IM" ) 1112 if ( *it == "AIM IM" )
1107 *itV = ent.AIMIM(); 1113 *itV = ent.AIMIM();
1108 1114
1109 if ( *it == "ICQ IM" ) 1115 if ( *it == "ICQ IM" )
1110 *itV = ent.ICQIM(); 1116 *itV = ent.ICQIM();
1111 1117
1112 if ( *it == "Jabber IM" ) 1118 if ( *it == "Jabber IM" )
1113 *itV = ent.jabberIM(); 1119 *itV = ent.jabberIM();
1114 1120
1115 if ( *it == "MSN IM" ) 1121 if ( *it == "MSN IM" )
1116 *itV = ent.MSNIM(); 1122 *itV = ent.MSNIM();
1117 1123
1118 if ( *it == "Yahoo IM" ) 1124 if ( *it == "Yahoo IM" )
1119 *itV = ent.yahooIM(); 1125 *itV = ent.yahooIM();
1120*/ 1126*/
1121 if ( *it == "Home Web Page" ) 1127 if ( *it == "Home Web Page" )
1122 *itV = ent.homeWebpage(); 1128 *itV = ent.homeWebpage();
1123 if ( *it == "Business Web Page" ) 1129 if ( *it == "Business Web Page" || *it == "Work Web Page" )
1124 *itV = ent.businessWebpage(); 1130 *itV = ent.businessWebpage();
1125 1131
1126 1132
1127 } 1133 }
1128 1134
1129 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); 1135 cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
1130 1136
1131 QString gender = ent.gender(); 1137 QString gender = ent.gender();
1132 cmbGender->setCurrentItem( gender.toInt() ); 1138 cmbGender->setCurrentItem( gender.toInt() );
1133 1139
1134 txtNote->setText( ent.notes() ); 1140 txtNote->setText( ent.notes() );
1135 1141
1142 slotCmbChooser1Change( cmbChooserField1->currentItem() );
1143 slotCmbChooser2Change( cmbChooserField2->currentItem() );
1144 slotCmbChooser3Change( cmbChooserField3->currentItem() );
1145
1146 slotAddressTypeChange( cmbAddress->currentItem() );
1147
1136} 1148}
1137 1149
1138void ContactEditor::saveEntry() { 1150void ContactEditor::saveEntry() {
1139 1151
1140 if ( useFullName == TRUE ) { 1152 if ( useFullName == TRUE ) {
1141 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); 1153 txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
1142 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); 1154 txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
1143 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); 1155 txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
1144 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); 1156 txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
1145 1157
1146 useFullName = FALSE; 1158 useFullName = FALSE;
1147 } 1159 }
1148 1160
1149 /*if ( ent.firstName() != txtFirstName->text() || 1161 /*if ( ent.firstName() != txtFirstName->text() ||
1150 ent.lastName != txtLastName->text() || 1162 ent.lastName != txtLastName->text() ||
1151 ent.middleName != txtMiddleName->text() ) { 1163 ent.middleName != txtMiddleName->text() ) {
1152 */ 1164 */
1153 ent.setFirstName( txtFirstName->text() ); 1165 ent.setFirstName( txtFirstName->text() );
1154 ent.setLastName( txtLastName->text() ); 1166 ent.setLastName( txtLastName->text() );
1155 ent.setMiddleName( txtMiddleName->text() ); 1167 ent.setMiddleName( txtMiddleName->text() );
1156 1168
1157 //} 1169 //}
1158 1170
1159 ent.setFileAs( cmbFileAs->currentText() ); 1171 ent.setFileAs( cmbFileAs->currentText() );
1160 1172
1161 ent.setCategories( cmbCat->currentCategories() ); 1173 ent.setCategories( cmbCat->currentCategories() );
1162 1174
1163 if (hasTitle) 1175 if (hasTitle)
1164 ent.setJobTitle( txtJobTitle->text() ); 1176 ent.setJobTitle( txtJobTitle->text() );
1165 1177
1166 if (hasCompany) 1178 if (hasCompany)
1167 ent.setCompany( txtOrganization->text() ); 1179 ent.setCompany( txtOrganization->text() );
1168 1180
1169 if (hasNotes) 1181 if (hasNotes)
1170 ent.setNotes( txtNote->text() ); 1182 ent.setNotes( txtNote->text() );
1171 1183
1172 if (hasStreet) { 1184 if (hasStreet) {
1173 ent.setHomeStreet( (*slHomeAddress)[0] ); 1185 ent.setHomeStreet( (*slHomeAddress)[0] );
1174 ent.setBusinessStreet( (*slBusinessAddress)[0] ); 1186 ent.setBusinessStreet( (*slBusinessAddress)[0] );
1175 } 1187 }
1176/* 1188/*
1177 if (hasStreet2) { 1189 if (hasStreet2) {
1178 ent.setHomeStreet2( (*slHomeAddress)[1] ); 1190 ent.setHomeStreet2( (*slHomeAddress)[1] );
1179 ent.setBusinessStreet2( (*slBusinessAddress)[1] ); 1191 ent.setBusinessStreet2( (*slBusinessAddress)[1] );
1180 } 1192 }
1181 1193
1182 if (hasPOBox) { 1194 if (hasPOBox) {
1183 ent.setHomePOBox( (*slHomeAddress)[2] ); 1195 ent.setHomePOBox( (*slHomeAddress)[2] );
1184 ent.setBusinessPOBox( (*slBusinessAddress)[2] ); 1196 ent.setBusinessPOBox( (*slBusinessAddress)[2] );
1185 } 1197 }
1186*/ 1198*/
1187 if (hasCity) { 1199 if (hasCity) {
1188 ent.setHomeCity( (*slHomeAddress)[3] ); 1200 ent.setHomeCity( (*slHomeAddress)[3] );
1189 ent.setBusinessCity( (*slBusinessAddress)[3] ); 1201 ent.setBusinessCity( (*slBusinessAddress)[3] );
1190 } 1202 }
1191 1203
1192 if (hasState) { 1204 if (hasState) {
1193 ent.setHomeState( (*slHomeAddress)[4] ); 1205 ent.setHomeState( (*slHomeAddress)[4] );
1194 ent.setBusinessState( (*slBusinessAddress)[4] ); 1206 ent.setBusinessState( (*slBusinessAddress)[4] );
1195 } 1207 }
1196 1208
1197 if (hasZip) { 1209 if (hasZip) {
1198 ent.setHomeZip( (*slHomeAddress)[5] ); 1210 ent.setHomeZip( (*slHomeAddress)[5] );
1199 ent.setBusinessZip( (*slBusinessAddress)[5] ); 1211 ent.setBusinessZip( (*slBusinessAddress)[5] );
1200 } 1212 }
1213
1214 if (hasCountry) {
1215 ent.setHomeCountry( (*slHomeAddress)[6] );
1216 ent.setBusinessCountry( (*slBusinessAddress)[6] );
1217 }
1201 1218
1202 QStringList::ConstIterator it; 1219 QStringList::ConstIterator it;
1203 QListIterator<QLineEdit> itLE( listValue ); 1220 QListIterator<QLineEdit> itLE( listValue );
1204 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { 1221 for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) {
1205 if ( *it == "Department" ) 1222 if ( *it == "Department" )
1206 ent.setDepartment( (*itLE)->text() ); 1223 ent.setDepartment( (*itLE)->text() );
1207 1224
1208 if ( *it == "Company" ) 1225 if ( *it == "Company" )
1209 ent.setCompany( (*itLE)->text() ); 1226 ent.setCompany( (*itLE)->text() );
1210 1227
1211 if ( *it == "Office" ) 1228 if ( *it == "Office" )
1212 ent.setOffice( (*itLE)->text() ); 1229 ent.setOffice( (*itLE)->text() );
1213 1230
1214 if ( *it == "Profession" ) 1231 if ( *it == "Profession" )
1215 ent.setProfession( (*itLE)->text() ); 1232 ent.setProfession( (*itLE)->text() );
1216 1233
1217 if ( *it == "Assistant" ) 1234 if ( *it == "Assistant" )
1218 ent.setAssistant( (*itLE)->text() ); 1235 ent.setAssistant( (*itLE)->text() );
1219 1236
1220 if ( *it == "Manager" ) 1237 if ( *it == "Manager" )
1221 ent.setManager( (*itLE)->text() ); 1238 ent.setManager( (*itLE)->text() );
1222 1239
1223 if ( *it == "Spouse" ) 1240 if ( *it == "Spouse" )
1224 ent.setSpouse( (*itLE)->text() ); 1241 ent.setSpouse( (*itLE)->text() );
1225 1242
1226 if ( *it == "Birthday" ) 1243 if ( *it == "Birthday" )
1227 ent.setBirthday( (*itLE)->text() ); 1244 ent.setBirthday( (*itLE)->text() );
1228 1245
1229 if ( *it == "Anniversary" ) 1246 if ( *it == "Anniversary" )
1230 ent.setAnniversary( (*itLE)->text() ); 1247 ent.setAnniversary( (*itLE)->text() );
1231 1248
1232 if ( *it == "Nickname" ) 1249 if ( *it == "Nickname" )
1233 ent.setNickname( (*itLE)->text() ); 1250 ent.setNickname( (*itLE)->text() );
1234 1251
1235 if ( *it == "Children" ) 1252 if ( *it == "Children" )
1236 ent.setChildren( (*itLE)->text() ); 1253 ent.setChildren( (*itLE)->text() );
1237 1254
1238 } 1255 }
1239 1256
1240 QStringList::ConstIterator itV; 1257 QStringList::ConstIterator itV;
1241 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { 1258 for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) {
1242 1259
1243 if ( *it == "Business Phone" ) 1260 if ( *it == "Business Phone" || *it == "Work Phone" )
1244 ent.setBusinessPhone( *itV ); 1261 ent.setBusinessPhone( *itV );
1245/* 1262/*
1246 if ( *it == "Business 2 Phone" ) 1263 if ( *it == "Business 2 Phone" )
1247 ent.setBusiness2Phone( *itV ); 1264 ent.setBusiness2Phone( *itV );
1248*/ 1265*/
1249 if ( *it == "Business Fax" ) 1266 if ( *it == "Business Fax" || *it == "Work Fax" )
1250 ent.setBusinessFax( *itV ); 1267 ent.setBusinessFax( *itV );
1251 1268
1252 if ( *it == "Business Mobile" ) 1269 if ( *it == "Business Mobile" || *it == "Work Mobile" )
1253 ent.setBusinessMobile( *itV ); 1270 ent.setBusinessMobile( *itV );
1254/* 1271/*
1255 if ( *it == "Company Phone" ) 1272 if ( *it == "Company Phone" )
1256 ent.setCompanyPhone( *itV ); 1273 ent.setCompanyPhone( *itV );
1257*/ 1274*/
1258 if ( *it == "Default Email" ) 1275 //if ( *it == "Default Email" )
1259 ent.setDefaultEmail( *itV ); 1276 //ent.setDefaultEmail( *itV );
1260 1277
1261 if ( *it == "Emails" ) 1278 if ( *it == "Emails" ) {
1279 QString allemail;
1280 QString defaultmail;
1281 parseEmailFrom( *itV, defaultmail, allemail );
1282 ent.setDefaultEmail( defaultmail );
1262 ent.setEmails( *itV ); 1283 ent.setEmails( *itV );
1284 }
1263 1285
1264 if ( *it == "Home Phone" ) 1286 if ( *it == "Home Phone" )
1265 ent.setHomePhone( *itV ); 1287 ent.setHomePhone( *itV );
1266/* 1288/*
1267 if ( *it == "Home 2 Phone" ) 1289 if ( *it == "Home 2 Phone" )
1268 ent.setHome2Phone( *itV ); 1290 ent.setHome2Phone( *itV );
1269*/ 1291*/
1270 if ( *it == "Home Fax" ) 1292 if ( *it == "Home Fax" )
1271 ent.setHomeFax( *itV ); 1293 ent.setHomeFax( *itV );
1272 1294
1273 if ( *it == "Home Mobile" ) 1295 if ( *it == "Home Mobile" )
1274 ent.setHomeMobile( *itV ); 1296 ent.setHomeMobile( *itV );
1275/* 1297/*
1276 if ( *it == "Car Phone" ) 1298 if ( *it == "Car Phone" )
1277 ent.setCarPhone( *itV ); 1299 ent.setCarPhone( *itV );
1278 1300
1279 if ( *it == "ISDN Phone" ) 1301 if ( *it == "ISDN Phone" )
1280 ent.setISDNPhone( *itV ); 1302 ent.setISDNPhone( *itV );
1281 1303
1282 if ( *it == "Other Phone" ) 1304 if ( *it == "Other Phone" )
1283 ent.setOtherPhone( *itV ); 1305 ent.setOtherPhone( *itV );
1284*/ 1306*/
1285 if ( *it == "Business Pager" ) 1307 if ( *it == "Business Pager" || *it == "Work Pager" )
1286 ent.setBusinessPager( *itV ); 1308 ent.setBusinessPager( *itV );
1287/* 1309/*
1288 if ( *it == "Home Pager" ) 1310 if ( *it == "Home Pager" )
1289 ent.setHomePager( *itV ); 1311 ent.setHomePager( *itV );
1290 1312
1291 if ( *it == "AIM IM" ) 1313 if ( *it == "AIM IM" )
1292 ent.setAIMIM( *itV ); 1314 ent.setAIMIM( *itV );
1293 1315
1294 if ( *it == "ICQ IM" ) 1316 if ( *it == "ICQ IM" )
1295 ent.setICQIM( *itV ); 1317 ent.setICQIM( *itV );
1296 1318
1297 if ( *it == "Jabber IM" ) 1319 if ( *it == "Jabber IM" )
1298 ent.setJabberIM( *itV ); 1320 ent.setJabberIM( *itV );
1299 1321
1300 if ( *it == "MSN IM" ) 1322 if ( *it == "MSN IM" )
1301 ent.setMSNIM( *itV ); 1323 ent.setMSNIM( *itV );
1302 1324
1303 if ( *it == "Yahoo IM" ) 1325 if ( *it == "Yahoo IM" )
1304 ent.setYahooIM( *itV ); 1326 ent.setYahooIM( *itV );
1305*/ 1327*/
1306 if ( *it == "Home Web Page" ) 1328 if ( *it == "Home Web Page" )
1307 ent.setHomeWebpage( *itV ); 1329 ent.setHomeWebpage( *itV );
1308 if ( *it == "Business Web Page" ) 1330 if ( *it == "Business Web Page" || *it == "Work Web Page" )
1309 ent.setBusinessWebpage( *itV ); 1331 ent.setBusinessWebpage( *itV );
1310 1332
1311 1333
1312 } 1334 }
1313 1335
1314 int gender = cmbGender->currentItem(); 1336 int gender = cmbGender->currentItem();
1315 ent.setGender( QString::number( gender ) ); 1337 ent.setGender( QString::number( gender ) );
1316 1338
1317 QString str = txtNote->text(); 1339 QString str = txtNote->text();
1318 if ( !str.isNull() ) 1340 if ( !str.isNull() )
1319 ent.setNotes( str ); 1341 ent.setNotes( str );
1320 1342
1321} 1343}
1322 1344
1323void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 1345void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
1324 QString &strAll ) 1346 QString &strAll )
1325{ 1347{
1326 int where, 1348 int where,
1327 start; 1349 start;
1328 if ( txt.isEmpty() ) 1350 if ( txt.isEmpty() )
1329 return; 1351 return;
1330 // find the first 1352 // find the first
1331 where = txt.find( ',' ); 1353 where = txt.find( ',' );
1332 if ( where < 0 ) { 1354 if ( where < 0 ) {
1333 strDefaultEmail = txt; 1355 strDefaultEmail = txt;
1334 strAll = txt; 1356 strAll = txt;
1335 } else { 1357 } else {
1336 strDefaultEmail = txt.left( where ).stripWhiteSpace(); 1358 strDefaultEmail = txt.left( where ).stripWhiteSpace();
1337 strAll = strDefaultEmail; 1359 strAll = strDefaultEmail;
1338 while ( where > -1 ) { 1360 while ( where > -1 ) {
1339 strAll.append(" "); 1361 strAll.append(" ");
1340 start = where; 1362 start = where;
1341 where = txt.find( ',', where + 1 ); 1363 where = txt.find( ',', where + 1 );
1342 if ( where > - 1 ) 1364 if ( where > - 1 )
1343 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); 1365 strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
1344 else // grab until the end... 1366 else // grab until the end...
1345 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); 1367 strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
1346 } 1368 }
1347 } 1369 }
1348} 1370}
1349 1371
1350void parseEmailTo( const QString &strDefaultEmail, 1372void parseEmailTo( const QString &strDefaultEmail,
1351 const QString &strOtherEmail, QString &strBack ) 1373 const QString &strOtherEmail, QString &strBack )
1352{ 1374{
1353 // create a comma dilimeted set of emails... 1375 // create a comma dilimeted set of emails...
1354 // use the power of short circuiting... 1376 // use the power of short circuiting...
1355 bool foundDefault = false; 1377 bool foundDefault = false;
1356 QString strTmp; 1378 QString strTmp;