author | zautrix <zautrix> | 2004-09-21 07:05:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-21 07:05:01 (UTC) |
commit | 434ddaa08e0a650422ef271332a1d11879028095 (patch) (side-by-side diff) | |
tree | e4f229120d8bfa9febb7ab123b1311329f0e6aa4 /kabc/addressee.cpp | |
parent | ed49c55dac215ac2ed9286ebfc36e5a19417f0bb (diff) | |
download | kdepimpi-434ddaa08e0a650422ef271332a1d11879028095.zip kdepimpi-434ddaa08e0a650422ef271332a1d11879028095.tar.gz kdepimpi-434ddaa08e0a650422ef271332a1d11879028095.tar.bz2 |
DTM sync fixes
-rw-r--r-- | kabc/addressee.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e241281..31ce1d6 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -42,8 +42,10 @@ $Id$ using namespace KABC; static bool matchBinaryPattern( int value, int pattern ); +static bool matchBinaryPatternA( int value, int pattern ); +static bool matchBinaryPatternP( int value, int pattern ); struct Addressee::AddresseeData : public KShared { QString uid; @@ -380,9 +382,9 @@ void Addressee::setOriginalExternalUID( const QString &id ) { if ( id == mData->originalExternalUID ) return; detach(); mData->empty = false; - qDebug("*******Set orig uid %s ", id.latin1()); + //qDebug("*******Set orig uid %s ", id.latin1()); mData->originalExternalUID = id; } QString Addressee::originalExternalUID() const @@ -393,9 +395,9 @@ QString Addressee::originalExternalUID() const void Addressee::setUid( const QString &id ) { if ( id == mData->uid ) return; detach(); - qDebug("****setuid %s ", id.latin1()); + //qDebug("****setuid %s ", id.latin1()); mData->empty = false; mData->uid = id; } @@ -1289,9 +1291,9 @@ PhoneNumber Addressee::phoneNumber( int type ) const { PhoneNumber phoneNumber( "", type ); PhoneNumber::List::ConstIterator it; for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { - if ( matchBinaryPattern( (*it).type(), type ) ) { + if ( matchBinaryPatternP( (*it).type(), type ) ) { if ( (*it).type() & PhoneNumber::Pref ) return (*it); else if ( phoneNumber.number().isEmpty() ) phoneNumber = (*it); @@ -1526,9 +1528,9 @@ Address Addressee::address( int type ) const { Address address( type ); Address::List::ConstIterator it; for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { - if ( matchBinaryPattern( (*it).type(), type ) ) { + if ( matchBinaryPatternA( (*it).type(), type ) ) { if ( (*it).type() & Address::Pref ) return (*it); else if ( address.isEmpty() ) address = (*it); @@ -1834,9 +1836,8 @@ QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) a.mData->empty = false; return s; } - bool matchBinaryPattern( int value, int pattern ) { /** We want to match all telephonnumbers/addresses which have the bits in the @@ -1848,4 +1849,21 @@ bool matchBinaryPattern( int value, int pattern ) return ( value == 0 ); else return ( pattern == ( pattern & value ) ); } + +bool matchBinaryPatternP( int value, int pattern ) +{ + + if ( pattern == 0 ) + return ( value == 0 ); + else + return ( (pattern |PhoneNumber::Pref ) == ( value |PhoneNumber::Pref ) ); +} +bool matchBinaryPatternA( int value, int pattern ) +{ + + if ( pattern == 0 ) + return ( value == 0 ); + else + return ( (pattern | Address::Pref) == ( value | Address::Pref ) ); +} |