author | zautrix <zautrix> | 2005-01-14 19:02:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-14 19:02:53 (UTC) |
commit | 620f8de219ee34c209960f02c8296c0568dd5d8b (patch) (side-by-side diff) | |
tree | 772170b3b9ceaf8c204e2bdd9cbb333427de30cd /kaddressbook/nameeditdialog.cpp | |
parent | 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (diff) | |
download | kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.zip kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.tar.gz kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.tar.bz2 |
formatted name fixes
Diffstat (limited to 'kaddressbook/nameeditdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/nameeditdialog.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index 8213c2b..f5dba0f 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp @@ -196,80 +196,82 @@ QString NameEditDialog::givenName() const 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: - return addr.givenName() + " " + addr.familyName(); + retval = addr.givenName() + " " + addr.familyName(); break; case FullName: - return addr.prefix() + " " + addr.givenName() + " " + + retval =addr.prefix() + " " + addr.givenName() + " " + addr.additionalName() + " " + addr.familyName() + " " + addr.suffix(); break; case ReverseName: - return addr.familyName() + ", " + addr.givenName(); + retval = addr.familyName() + ", " + 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 ) ); |