summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Side-by-side diff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp28
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
@@ -45,2 +45,4 @@ using namespace KABC;
static bool matchBinaryPattern( int value, int pattern );
+static bool matchBinaryPatternA( int value, int pattern );
+static bool matchBinaryPatternP( int value, int pattern );
@@ -383,3 +385,3 @@ void Addressee::setOriginalExternalUID( const QString &id )
mData->empty = false;
- qDebug("*******Set orig uid %s ", id.latin1());
+ //qDebug("*******Set orig uid %s ", id.latin1());
mData->originalExternalUID = id;
@@ -396,3 +398,3 @@ void Addressee::setUid( const QString &id )
detach();
- qDebug("****setuid %s ", id.latin1());
+ //qDebug("****setuid %s ", id.latin1());
mData->empty = false;
@@ -1292,3 +1294,3 @@ PhoneNumber Addressee::phoneNumber( int type ) const
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 )
@@ -1529,3 +1531,3 @@ Address Addressee::address( int type ) const
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 )
@@ -1837,3 +1839,2 @@ QDataStream &KABC::operator>>( QDataStream &s, Addressee &a )
}
-
bool matchBinaryPattern( int value, int pattern )
@@ -1851 +1852,18 @@ bool matchBinaryPattern( int value, int pattern )
}
+
+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 ) );
+}