author | eilers <eilers> | 2003-03-04 16:55:58 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-04 16:55:58 (UTC) |
commit | ca913d1f2035b6ddb77be497516e4dfc2371e5b3 (patch) (side-by-side diff) | |
tree | 8783f481948e488d6103382b201a36fcd8ca2662 | |
parent | bb765b9cd286d85eb8fa1d18199dfb7a29d57fc5 (diff) | |
download | opie-ca913d1f2035b6ddb77be497516e4dfc2371e5b3.zip opie-ca913d1f2035b6ddb77be497516e4dfc2371e5b3.tar.gz opie-ca913d1f2035b6ddb77be497516e4dfc2371e5b3.tar.bz2 |
Some finetuning to behave like the previous release if just one first and
lastname is used..
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 7bc5bde..c4a7b10 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -1013,36 +1013,36 @@ void ContactEditor::slotAddressTypeChange( int index ) { txtZip->setText( slHomeAddress[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText( slHomeAddress[6] ); } } void ContactEditor::slotFullNameChange( const QString &textChanged ) { qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); int index = cmbFileAs->currentItem(); cmbFileAs->clear(); - cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); - cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); + cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); + cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); cmbFileAs->setCurrentItem( index ); useFullName = true; } void ContactEditor::accept() { if ( isEmpty() ) { cleanupFields(); reject(); } else { saveEntry(); cleanupFields(); QDialog::accept(); @@ -1139,35 +1139,38 @@ QString ContactEditor::parseName( const QString fullName, int type ) { strMiddleName = allSecondNames.join(" "); } else { // No comma separator used: We use the first word as firstname, the // last as second/lastname and everything in the middle as middlename QStringList allNames = QStringList::split(" ", simplifiedName); QStringList::Iterator it = allNames.begin(); strFirstName = *it++; QStringList allSecondNames; for ( ; it != --allNames.end(); ++it ) allSecondNames.append( *it ); strMiddleName = allSecondNames.join(" "); strLastName = *(--allNames.end()); - + } + if ( strFirstName == strLastName ) + strFirstName = ""; + qWarning(" strFirstName: %s", strFirstName.latin1()); qWarning(" strMiddleName: %s", strMiddleName.latin1()); qWarning(" strLastName: %s", strLastName.latin1()); qWarning(" strSuffix: %s", strSuffix.latin1()); qWarning(" strTitle: %s", strTitle.latin1()); switch (type) { case NAME_FL: return strFirstName + " " + strLastName; case NAME_LF: return strLastName + ", " + strFirstName; case NAME_LFM: return strLastName + ", " + strFirstName + " " + strMiddleName; |