summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/nameeditdialog.cpp7
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
@@ -207,65 +207,70 @@ 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() );