-rw-r--r-- | kabc/addressee.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 155ce24..7e1e414 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -297,25 +297,50 @@ void Addressee::computeCsum(const QString &dev) } uint cs = getCsum4List(l); #if 0 for ( iii = 0; iii < l.count(); ++iii) qDebug("%d***%s***",iii,l[iii].latin1()); qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); #endif setCsum( dev, QString::number (cs )); } +bool Addressee::matchAddress( QRegExp* re ) const +{ + KABC::Address::List::Iterator addressIter; + for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); + ++addressIter ) { + if ( (*addressIter).matchAddress( re ) ) + return true; + } + return false; +} +bool Addressee::matchPhoneNumber( QRegExp* re ) const +{ + KABC::PhoneNumber::List::Iterator phoneIter; + + for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { +#if QT_VERSION >= 0x030000 + if (re->search( (*phoneIter).number() ) == 0) +#else + if (re->match( (*phoneIter).number() ) == 0) +#endif + return true; + } + return false; + +} void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) { // merge all standard non-outlook fields. //if isSubSet (e.g. mobile phone sync) merge all fields detach(); if ( isSubSet ) { if ( mData->name.isEmpty() ) mData->name = ad.mData->name; if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |