author | zautrix <zautrix> | 2004-09-13 21:35:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-13 21:35:12 (UTC) |
commit | bd6b4acb39498ffea3beea7d9b5f7620b60c14db (patch) (side-by-side diff) | |
tree | e2d7425b7bb49fbcb7acb5ced497ac1fed06dfaf /kabc | |
parent | 06eabf6e82c0390699d11fd12580d91261829431 (diff) | |
download | kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.zip kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.gz kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.bz2 |
Many bugfixes
-rw-r--r-- | kabc/addressee.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 6b282e2..4cdd5e5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -756,125 +756,129 @@ QString Addressee::photoLabel() return i18n("Photo"); } void Addressee::setSound( const Sound &sound ) { if ( sound == mData->sound ) return; detach(); mData->empty = false; mData->sound = sound; } Sound Addressee::sound() const { return mData->sound; } QString Addressee::soundLabel() { return i18n("Sound"); } void Addressee::setAgent( const Agent &agent ) { if ( agent == mData->agent ) return; detach(); mData->empty = false; mData->agent = agent; } Agent Addressee::agent() const { return mData->agent; } QString Addressee::agentLabel() { return i18n("Agent"); } void Addressee::setNameFromString( const QString &str ) { setFormattedName( str ); setName( str ); - QStringList titles; + static bool first = true; + static QStringList titles; + static QStringList suffixes; + static QStringList prefixes; + + if ( first ) { + first = false; titles += i18n( "Dr." ); titles += i18n( "Miss" ); titles += i18n( "Mr." ); titles += i18n( "Mrs." ); titles += i18n( "Ms." ); titles += i18n( "Prof." ); - QStringList suffixes; suffixes += i18n( "I" ); suffixes += i18n( "II" ); suffixes += i18n( "III" ); suffixes += i18n( "Jr." ); suffixes += i18n( "Sr." ); - QStringList prefixes; prefixes += "van"; prefixes += "von"; prefixes += "de"; -//US KConfig config( "kabcrc" ); KConfig config( locateLocal( "config", "kabcrc") ); config.setGroup( "General" ); titles += config.readListEntry( "Prefixes" ); titles.remove( "" ); prefixes += config.readListEntry( "Inclusions" ); prefixes.remove( "" ); suffixes += config.readListEntry( "Suffixes" ); suffixes.remove( "" ); + } // clear all name parts setPrefix( "" ); setGivenName( "" ); setAdditionalName( "" ); setFamilyName( "" ); setSuffix( "" ); if ( str.isEmpty() ) return; int i = str.find(','); if( i < 0 ) { QStringList parts = QStringList::split( " ", str ); int leftOffset = 0; int rightOffset = parts.count() - 1; QString suffix; while ( rightOffset >= 0 ) { if ( suffixes.contains( parts[ rightOffset ] ) ) { suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); rightOffset--; } else break; } setSuffix( suffix ); if ( rightOffset < 0 ) return; if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); rightOffset--; } else setFamilyName( parts[ rightOffset ] ); QString prefix; while ( leftOffset < rightOffset ) { if ( titles.contains( parts[ leftOffset ] ) ) { prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); leftOffset++; } else break; } setPrefix( prefix ); if ( leftOffset < rightOffset ) { setGivenName( parts[ leftOffset ] ); |