Diffstat (limited to 'kaddressbook/nameeditdialog.cpp') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -207,65 +207,70 @@ QString NameEditDialog::additionalName() const | |||
207 | { | 207 | { |
208 | return mAdditionalNameEdit->text(); | 208 | return mAdditionalNameEdit->text(); |
209 | } | 209 | } |
210 | 210 | ||
211 | QString NameEditDialog::customFormattedName() const | 211 | QString NameEditDialog::customFormattedName() const |
212 | { | 212 | { |
213 | return mFormattedNameEdit->text(); | 213 | return mFormattedNameEdit->text(); |
214 | } | 214 | } |
215 | 215 | ||
216 | int NameEditDialog::formattedNameType() const | 216 | int NameEditDialog::formattedNameType() const |
217 | { | 217 | { |
218 | return mFormattedNameCombo->currentItem(); | 218 | return mFormattedNameCombo->currentItem(); |
219 | } | 219 | } |
220 | 220 | ||
221 | bool NameEditDialog::changed() const | 221 | bool NameEditDialog::changed() const |
222 | { | 222 | { |
223 | return mChanged; | 223 | return mChanged; |
224 | } | 224 | } |
225 | 225 | ||
226 | QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) | 226 | QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) |
227 | { | 227 | { |
228 | QString retval; | 228 | QString retval; |
229 | switch ( type ) { | 229 | switch ( type ) { |
230 | case SimpleName: | 230 | case SimpleName: |
231 | retval = addr.givenName() + " " + addr.familyName(); | 231 | retval = addr.givenName() + " " + addr.familyName(); |
232 | break; | 232 | break; |
233 | case FullName: | 233 | case FullName: |
234 | retval =addr.prefix() + " " + addr.givenName() + " " + | 234 | retval =addr.prefix() + " " + addr.givenName() + " " + |
235 | addr.additionalName() + " " + addr.familyName() + " " + | 235 | addr.additionalName() + " " + addr.familyName() + " " + |
236 | addr.suffix(); | 236 | addr.suffix(); |
237 | break; | 237 | break; |
238 | case ReverseName: | 238 | case ReverseName: |
239 | retval = addr.familyName() + ", " + addr.givenName(); | 239 | if ( !addr.familyName().isEmpty() ) { |
240 | retval = addr.familyName(); | ||
241 | if ( !addr.givenName().isEmpty() ) | ||
242 | retval += ", " + addr.givenName(); | ||
243 | } else | ||
244 | retval = addr.givenName(); | ||
240 | break; | 245 | break; |
241 | default: | 246 | default: |
242 | return ""; | 247 | return ""; |
243 | break; | 248 | break; |
244 | } | 249 | } |
245 | return retval.stripWhiteSpace (); | 250 | return retval.stripWhiteSpace (); |
246 | } | 251 | } |
247 | 252 | ||
248 | void NameEditDialog::parseBoxChanged( bool value ) | 253 | void NameEditDialog::parseBoxChanged( bool value ) |
249 | { | 254 | { |
250 | //AddresseeConfig::instance()->setUid( addr.uid() ); | 255 | //AddresseeConfig::instance()->setUid( addr.uid() ); |
251 | AddresseeConfig::instance()->setAutomaticNameParsing( value ); | 256 | AddresseeConfig::instance()->setAutomaticNameParsing( value ); |
252 | } | 257 | } |
253 | 258 | ||
254 | void NameEditDialog::typeChanged( int pos ) | 259 | void NameEditDialog::typeChanged( int pos ) |
255 | { | 260 | { |
256 | mFormattedNameEdit->setEnabled( pos == 0 ); | 261 | mFormattedNameEdit->setEnabled( pos == 0 ); |
257 | } | 262 | } |
258 | 263 | ||
259 | void NameEditDialog::modified() | 264 | void NameEditDialog::modified() |
260 | { | 265 | { |
261 | mChanged = true; | 266 | mChanged = true; |
262 | } | 267 | } |
263 | 268 | ||
264 | void NameEditDialog::updateTypeCombo() | 269 | void NameEditDialog::updateTypeCombo() |
265 | { | 270 | { |
266 | KABC::Addressee addr; | 271 | KABC::Addressee addr; |
267 | addr.setPrefix( mPrefixCombo->currentText() ); | 272 | addr.setPrefix( mPrefixCombo->currentText() ); |
268 | addr.setGivenName( mGivenNameEdit->text() ); | 273 | addr.setGivenName( mGivenNameEdit->text() ); |
269 | addr.setAdditionalName( mAdditionalNameEdit->text() ); | 274 | addr.setAdditionalName( mAdditionalNameEdit->text() ); |
270 | addr.setFamilyName( mFamilyNameEdit->text() ); | 275 | addr.setFamilyName( mFamilyNameEdit->text() ); |
271 | addr.setSuffix( mSuffixCombo->currentText() ); | 276 | addr.setSuffix( mSuffixCombo->currentText() ); |