-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 56 |
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 @@ -444,19 +444,19 @@ void ContactEditor::init() { gl->addWidget( l, 3, 0 ); txtSuffix = new QLineEdit( dlgName ); gl->addWidget( txtSuffix, 3, 1 ); cmbChooserField1->insertStringList( *slChooserNames ); cmbChooserField2->insertStringList( *slChooserNames ); cmbChooserField3->insertStringList( *slChooserNames ); - cmbChooserField1->setCurrentItem( 1 ); - cmbChooserField2->setCurrentItem( 2 ); - cmbChooserField3->setCurrentItem( 3 ); + cmbChooserField1->setCurrentItem( 0 ); + cmbChooserField2->setCurrentItem( 1 ); + cmbChooserField3->setCurrentItem( 2 ); connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); @@ -954,16 +954,17 @@ void ContactEditor::cleanupFields() { txtTmp->setText(""); } void ContactEditor::setEntry( const Contact &entry ) { cleanupFields(); + ent = entry; useFullName = FALSE; txtFirstName->setText( ent.firstName() ); txtMiddleName->setText( ent.middleName() ); txtLastName->setText( ent.lastName() ); txtSuffix->setText( ent.suffix() ); @@ -1009,16 +1010,21 @@ void ContactEditor::setEntry( const Contact &entry ) { (*slBusinessAddress)[4] = ent.businessState(); } if (hasZip) { (*slHomeAddress)[5] = ent.homeZip(); (*slBusinessAddress)[5] = ent.businessZip(); } + if (hasCountry) { + (*slHomeAddress)[6] = ent.homeCountry(); + (*slBusinessAddress)[6] = ent.businessCountry(); + } + QStringList::ConstIterator it; QListIterator<QLineEdit> itLE( listValue ); for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { if ( *it == "Department" ) (*itLE)->setText( ent.department() ); if ( *it == "Company" ) (*itLE)->setText( ent.company() ); @@ -1050,26 +1056,26 @@ void ContactEditor::setEntry( const Contact &entry ) { if ( *it == "Children" ) (*itLE)->setText( ent.children() ); } QStringList::Iterator itV; for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { - if ( *it == "Business Phone" ) + if ( *it == "Business Phone" || *it == "Work Phone" ) *itV = ent.businessPhone(); /* if ( *it == "Business 2 Phone" ) *itV = ent.business2Phone(); */ - if ( *it == "Business Fax" ) + if ( *it == "Business Fax" || *it == "Work Fax" ) *itV = ent.businessFax(); - if ( *it == "Business Mobile" ) + if ( *it == "Business Mobile" || *it == "work Mobile" ) *itV = ent.businessMobile(); /* if ( *it == "Company Phone" ) *itV = ent.companyPhone(); */ if ( *it == "Default Email" ) *itV = ent.defaultEmail(); @@ -1092,17 +1098,17 @@ void ContactEditor::setEntry( const Contact &entry ) { *itV = ent.carPhone(); if ( *it == "ISDN Phone" ) *itV = ent.ISDNPhone(); if ( *it == "Other Phone" ) *itV = ent.otherPhone(); */ - if ( *it == "Business Pager" ) + if ( *it == "Business Pager" || *it == "Work Pager" ) *itV = ent.businessPager(); /* if ( *it == "Home Pager") *itV = ent.homePager(); if ( *it == "AIM IM" ) *itV = ent.AIMIM(); @@ -1115,29 +1121,35 @@ void ContactEditor::setEntry( const Contact &entry ) { if ( *it == "MSN IM" ) *itV = ent.MSNIM(); if ( *it == "Yahoo IM" ) *itV = ent.yahooIM(); */ if ( *it == "Home Web Page" ) *itV = ent.homeWebpage(); - if ( *it == "Business Web Page" ) + if ( *it == "Business Web Page" || *it == "Work Web Page" ) *itV = ent.businessWebpage(); } cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); QString gender = ent.gender(); cmbGender->setCurrentItem( gender.toInt() ); txtNote->setText( ent.notes() ); + slotCmbChooser1Change( cmbChooserField1->currentItem() ); + slotCmbChooser2Change( cmbChooserField2->currentItem() ); + slotCmbChooser3Change( cmbChooserField3->currentItem() ); + + slotAddressTypeChange( cmbAddress->currentItem() ); + } void ContactEditor::saveEntry() { if ( useFullName == TRUE ) { txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); @@ -1194,16 +1206,21 @@ void ContactEditor::saveEntry() { ent.setBusinessState( (*slBusinessAddress)[4] ); } if (hasZip) { ent.setHomeZip( (*slHomeAddress)[5] ); ent.setBusinessZip( (*slBusinessAddress)[5] ); } + if (hasCountry) { + ent.setHomeCountry( (*slHomeAddress)[6] ); + ent.setBusinessCountry( (*slBusinessAddress)[6] ); + } + QStringList::ConstIterator it; QListIterator<QLineEdit> itLE( listValue ); for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { if ( *it == "Department" ) ent.setDepartment( (*itLE)->text() ); if ( *it == "Company" ) ent.setCompany( (*itLE)->text() ); @@ -1235,36 +1252,41 @@ void ContactEditor::saveEntry() { if ( *it == "Children" ) ent.setChildren( (*itLE)->text() ); } QStringList::ConstIterator itV; for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { - if ( *it == "Business Phone" ) + if ( *it == "Business Phone" || *it == "Work Phone" ) ent.setBusinessPhone( *itV ); /* if ( *it == "Business 2 Phone" ) ent.setBusiness2Phone( *itV ); */ - if ( *it == "Business Fax" ) + if ( *it == "Business Fax" || *it == "Work Fax" ) ent.setBusinessFax( *itV ); - if ( *it == "Business Mobile" ) + if ( *it == "Business Mobile" || *it == "Work Mobile" ) ent.setBusinessMobile( *itV ); /* if ( *it == "Company Phone" ) ent.setCompanyPhone( *itV ); */ - if ( *it == "Default Email" ) - ent.setDefaultEmail( *itV ); - - if ( *it == "Emails" ) + //if ( *it == "Default Email" ) + //ent.setDefaultEmail( *itV ); + + if ( *it == "Emails" ) { + QString allemail; + QString defaultmail; + parseEmailFrom( *itV, defaultmail, allemail ); + ent.setDefaultEmail( defaultmail ); ent.setEmails( *itV ); + } if ( *it == "Home Phone" ) ent.setHomePhone( *itV ); /* if ( *it == "Home 2 Phone" ) ent.setHome2Phone( *itV ); */ if ( *it == "Home Fax" ) @@ -1277,17 +1299,17 @@ void ContactEditor::saveEntry() { ent.setCarPhone( *itV ); if ( *it == "ISDN Phone" ) ent.setISDNPhone( *itV ); if ( *it == "Other Phone" ) ent.setOtherPhone( *itV ); */ - if ( *it == "Business Pager" ) + if ( *it == "Business Pager" || *it == "Work Pager" ) ent.setBusinessPager( *itV ); /* if ( *it == "Home Pager" ) ent.setHomePager( *itV ); if ( *it == "AIM IM" ) ent.setAIMIM( *itV ); @@ -1300,17 +1322,17 @@ void ContactEditor::saveEntry() { if ( *it == "MSN IM" ) ent.setMSNIM( *itV ); if ( *it == "Yahoo IM" ) ent.setYahooIM( *itV ); */ if ( *it == "Home Web Page" ) ent.setHomeWebpage( *itV ); - if ( *it == "Business Web Page" ) + if ( *it == "Business Web Page" || *it == "Work Web Page" ) ent.setBusinessWebpage( *itV ); } int gender = cmbGender->currentItem(); ent.setGender( QString::number( gender ) ); |