author | zautrix <zautrix> | 2004-10-08 23:38:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-08 23:38:07 (UTC) |
commit | 07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (patch) (side-by-side diff) | |
tree | 03d0e5d20e607e035e17fcdabd6bce789069f41e /kabc | |
parent | 44169895703beb3e8b1551a313d2d341bf742905 (diff) | |
download | kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.zip kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.gz kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.bz2 |
some bugfixes
-rw-r--r-- | kabc/addressee.cpp | 16 | ||||
-rw-r--r-- | kabc/addressee.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e571980..19a1845 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -302,32 +302,48 @@ void Addressee::mergeContact( const Addressee& ad ) if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; // pending: // merging phonenumbers // merging addresses // merging emails; // merging categories; // merging custom; // merging keys qDebug("merge contact %s ", ad.uid().latin1()); setUid( ad.uid() ); setRevision( ad.revision() ); } +void Addressee::simplifyAddresses() +{ + if ( mData->addresses.count() < 3 ) return ; + int count = 0; + Address::List list; + Address::List::Iterator it; + for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { + if ( count > 1 ) + list.append( *it ); + ++count; + } + for( it = list.begin(); it != list.end(); ++it ) { + removeAddress( (*it) ); + } +} + // removes all emails but the first // needed by phone sync void Addressee::simplifyEmails() { if ( mData->emails.count() == 0 ) return ; QString email = mData->emails.first(); detach(); mData->emails.clear(); mData->emails.append( email ); } void Addressee::simplifyPhoneNumbers() { KABC::PhoneNumber::List removeNumbers; KABC::PhoneNumber::List::Iterator phoneIter; for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); diff --git a/kabc/addressee.h b/kabc/addressee.h index 4cafa86..44f0629 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -105,32 +105,33 @@ class Addressee QString getID( const QString & ); void setCsum( const QString &, const QString & ); QString getCsum( const QString & ); void removeID(const QString &); void computeCsum(const QString &dev); ulong getCsum4List( const QStringList & attList); /** Return, if the address book entry is empty. */ bool isEmpty() const; void setExternalUID( const QString &id ); QString externalUID() const; void setOriginalExternalUID( const QString &id ); QString originalExternalUID() const; void mergeContact( const Addressee& ad ); void simplifyEmails(); + void simplifyAddresses(); void simplifyPhoneNumbers(); void simplifyPhoneNumberTypes(); /** Set unique identifier. */ void setUid( const QString &uid ); /** Return unique identifier. */ QString uid() const; /** Return translated label for uid field. */ static QString uidLabel(); |