summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index cbcd11f..adea1a1 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -984,131 +984,131 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
int spPos2;
commapos = simplifiedName.find( ',', 0, TRUE);
spCount = simplifiedName.contains( ' ', TRUE );
if ( commapos == -1 ) {
switch (spCount) {
case 0:
return simplifiedName;
case 1:
spPos = simplifiedName.find( ' ', 0, TRUE );
strFirstName = simplifiedName.left( spPos );
strLastName = simplifiedName.mid( spPos + 1 );
break;
case 2:
spPos = simplifiedName.find( ' ', 0, TRUE );
strFirstName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strLastName = simplifiedName.mid( spPos2 + 1 );
break;
case 3:
spPos = simplifiedName.find( ' ', 0, TRUE );
strFirstName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
+ strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
strSuffix = simplifiedName.mid( spPos + 1 );
break;
case 4:
spPos = simplifiedName.find( ' ', 0, TRUE );
strTitle = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
+ strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strSuffix = simplifiedName.mid( spPos2 + 1 );
break;
default:
spPos = simplifiedName.find( ' ', 0, TRUE );
strTitle = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
+ strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strSuffix = simplifiedName.mid( spPos2 + 1 );
break;
}
} else {
simplifiedName.replace( commapos, 1, " " );
simplifiedName = simplifiedName.simplifyWhiteSpace();
switch (spCount) {
case 0:
return simplifiedName;
case 1:
spPos = simplifiedName.find( ' ', 0, TRUE );
strLastName = simplifiedName.left( spPos );
strFirstName = simplifiedName.mid( spPos + 1 );
break;
case 2:
spPos = simplifiedName.find( ' ', 0, TRUE );
strLastName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strMiddleName = simplifiedName.mid( spPos2 + 1 );
break;
case 3:
spPos = simplifiedName.find( ' ', 0, TRUE );
strLastName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
+ strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
strSuffix = simplifiedName.mid( spPos + 1 );
break;
case 4:
spPos = simplifiedName.find( ' ', 0, TRUE );
strLastName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
+ strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strSuffix = simplifiedName.mid( spPos2 + 1 );
break;
default:
spPos = simplifiedName.find( ' ', 0, TRUE );
strLastName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strSuffix = simplifiedName.mid( spPos2 + 1 );
break;
}
}
switch (type) {
case NAME_FL:
return strFirstName + " " + strLastName;
case NAME_LF:
return strLastName + ", " + strFirstName;
case NAME_LFM:
return strLastName + ", " + strFirstName + " " + strMiddleName;
case NAME_FMLS:
return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
@@ -1350,64 +1350,65 @@ void ContactEditor::setEntry( const Contact &entry ) {
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 ) );
txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
useFullName = FALSE;
}
/*if ( ent.firstName() != txtFirstName->text() ||
ent.lastName != txtLastName->text() ||
ent.middleName != txtMiddleName->text() ) {
*/
ent.setFirstName( txtFirstName->text() );
ent.setLastName( txtLastName->text() );
ent.setMiddleName( txtMiddleName->text() );
+ ent.setSuffix( txtSuffix->text() );
//}
ent.setFileAs( cmbFileAs->currentText() );
ent.setCategories( cmbCat->currentCategories() );
if (hasTitle)
ent.setJobTitle( txtJobTitle->text() );
if (hasCompany)
ent.setCompany( txtOrganization->text() );
if (hasNotes)
ent.setNotes( txtNote->text() );
if (hasStreet) {
ent.setHomeStreet( (*slHomeAddress)[0] );
ent.setBusinessStreet( (*slBusinessAddress)[0] );
}
/*
if (hasStreet2) {
ent.setHomeStreet2( (*slHomeAddress)[1] );
ent.setBusinessStreet2( (*slBusinessAddress)[1] );
}
if (hasPOBox) {
ent.setHomePOBox( (*slHomeAddress)[2] );
ent.setBusinessPOBox( (*slBusinessAddress)[2] );
}
*/
if (hasCity) {