-rw-r--r-- | kabc/addressee.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 3ce733d..568dfc4 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -1622,191 +1622,193 @@ Key Addressee::key( int type, QString customTypeString ) const if ( customTypeString.isEmpty() ) { return *it; } else { if ( (*it).customTypeString() == customTypeString ) return (*it); } } else { return *it; } } } return Key( QString(), type ); } void Addressee::setKeys( const Key::List& list ) { detach(); mData->keys = list; } Key::List Addressee::keys() const { return mData->keys; } Key::List Addressee::keys( int type, QString customTypeString ) const { Key::List list; Key::List::ConstIterator it; for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { if ( (*it).type() == type ) { if ( type == Key::Custom ) { if ( customTypeString.isEmpty() ) { list.append(*it); } else { if ( (*it).customTypeString() == customTypeString ) list.append(*it); } } else { list.append(*it); } } } return list; } Key Addressee::findKey( const QString &id ) const { Key::List::ConstIterator it; for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { if ( (*it).id() == id ) { return *it; } } return Key(); } QString Addressee::asString() const { return "Smith, agent Smith..."; } void Addressee::dump() const { return; +#if 0 kdDebug(5700) << "Addressee {" << endl; kdDebug(5700) << " Uid: '" << uid() << "'" << endl; kdDebug(5700) << " Name: '" << name() << "'" << endl; kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; kdDebug(5700) << " Title: '" << title() << "'" << endl; kdDebug(5700) << " Role: '" << role() << "'" << endl; kdDebug(5700) << " Organization: '" << organization() << "'" << endl; kdDebug(5700) << " Note: '" << note() << "'" << endl; kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; kdDebug(5700) << " Url: '" << url().url() << "'" << endl; kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; kdDebug(5700) << " Emails {" << endl; QStringList e = emails(); QStringList::ConstIterator it; for( it = e.begin(); it != e.end(); ++it ) { kdDebug(5700) << " " << (*it) << endl; } kdDebug(5700) << " }" << endl; kdDebug(5700) << " PhoneNumbers {" << endl; PhoneNumber::List p = phoneNumbers(); PhoneNumber::List::ConstIterator it2; for( it2 = p.begin(); it2 != p.end(); ++it2 ) { kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl; } kdDebug(5700) << " }" << endl; Address::List a = addresses(); Address::List::ConstIterator it3; for( it3 = a.begin(); it3 != a.end(); ++it3 ) { (*it3).dump(); } kdDebug(5700) << " Keys {" << endl; Key::List k = keys(); Key::List::ConstIterator it4; for( it4 = k.begin(); it4 != k.end(); ++it4 ) { kdDebug(5700) << " Type: " << int((*it4).type()) << " Key: " << (*it4).textData() << " CustomString: " << (*it4).customTypeString() << endl; } kdDebug(5700) << " }" << endl; kdDebug(5700) << "}" << endl; +#endif } void Addressee::insertAddress( const Address &address ) { detach(); mData->empty = false; Address::List::Iterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { if ( (*it).id() == address.id() ) { *it = address; return; } } mData->addresses.append( address ); } void Addressee::removeAddress( const Address &address ) { detach(); Address::List::Iterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { if ( (*it).id() == address.id() ) { mData->addresses.remove( it ); return; } } } Address Addressee::address( int type ) const { Address address( type ); Address::List::ConstIterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { if ( matchBinaryPatternA( (*it).type(), type ) ) { if ( (*it).type() & Address::Pref ) return (*it); else if ( address.isEmpty() ) address = (*it); } } return address; } Address::List Addressee::addresses() const { return mData->addresses; } Address::List Addressee::addresses( int type ) const { Address::List list; Address::List::ConstIterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { if ( matchBinaryPattern( (*it).type(), type ) ) { list.append( *it ); } } return list; |