author | zautrix <zautrix> | 2005-06-03 14:15:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-03 14:15:57 (UTC) |
commit | 0207d193bdb6c66201562a17e68872e018ec223c (patch) (side-by-side diff) | |
tree | c2b15d8acd9bdc7adee3d074551396d98599966f | |
parent | 7aa43257ffb63e772342f24c1f7945e285171ee6 (diff) | |
download | kdepimpi-0207d193bdb6c66201562a17e68872e018ec223c.zip kdepimpi-0207d193bdb6c66201562a17e68872e018ec223c.tar.gz kdepimpi-0207d193bdb6c66201562a17e68872e018ec223c.tar.bz2 |
formateed name fix
-rw-r--r-- | kaddressbook/nameeditdialog.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index f5dba0f..199f3d6 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp @@ -191,97 +191,102 @@ QString NameEditDialog::familyName() const QString NameEditDialog::givenName() const { return mGivenNameEdit->text(); } QString NameEditDialog::prefix() const { return mPrefixCombo->currentText(); } QString NameEditDialog::suffix() const { return mSuffixCombo->currentText(); } QString NameEditDialog::additionalName() const { return mAdditionalNameEdit->text(); } QString NameEditDialog::customFormattedName() const { return mFormattedNameEdit->text(); } int NameEditDialog::formattedNameType() const { return mFormattedNameCombo->currentItem(); } bool NameEditDialog::changed() const { return mChanged; } QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) { QString retval; switch ( type ) { case SimpleName: retval = addr.givenName() + " " + addr.familyName(); break; case FullName: retval =addr.prefix() + " " + addr.givenName() + " " + addr.additionalName() + " " + addr.familyName() + " " + addr.suffix(); break; case ReverseName: - retval = addr.familyName() + ", " + addr.givenName(); + if ( !addr.familyName().isEmpty() ) { + retval = addr.familyName(); + if ( !addr.givenName().isEmpty() ) + retval += ", " + addr.givenName(); + } else + retval = addr.givenName(); break; default: return ""; break; } return retval.stripWhiteSpace (); } void NameEditDialog::parseBoxChanged( bool value ) { //AddresseeConfig::instance()->setUid( addr.uid() ); AddresseeConfig::instance()->setAutomaticNameParsing( value ); } void NameEditDialog::typeChanged( int pos ) { mFormattedNameEdit->setEnabled( pos == 0 ); } void NameEditDialog::modified() { mChanged = true; } void NameEditDialog::updateTypeCombo() { KABC::Addressee addr; addr.setPrefix( mPrefixCombo->currentText() ); addr.setGivenName( mGivenNameEdit->text() ); addr.setAdditionalName( mAdditionalNameEdit->text() ); addr.setFamilyName( mFamilyNameEdit->text() ); addr.setSuffix( mSuffixCombo->currentText() ); int pos = mFormattedNameCombo->currentItem(); mFormattedNameCombo->clear(); mFormattedNameCombo->insertItem( i18n( "Custom" ) ); mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) ); mFormattedNameCombo->insertItem( formattedName( addr, FullName ) ); mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) ); mFormattedNameCombo->setCurrentItem( pos ); } void NameEditDialog::slotHelp() { #ifndef KAB_EMBEDDED kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); |