summaryrefslogtreecommitdiffabout
path: root/kabc/phonenumber.cpp
Side-by-side diff
Diffstat (limited to 'kabc/phonenumber.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/phonenumber.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 3d82553..abb3b3b 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -89,24 +89,19 @@ void PhoneNumber::simplifyType()
}
bool PhoneNumber::contains( const PhoneNumber &p )
{
- QString Number;
- QString Num;
- uint i;
- Number = mNumber.stripWhiteSpace ();
- Num = "";
- for ( i = 0; i < Number.length(); ++i) {
- if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' )
- Num += Number.at(i);
- }
- QString NumberR;
- QString NumR;
- NumberR = p.mNumber.stripWhiteSpace ();
- NumR = "";
- for ( i = 0; i < NumberR.length(); ++i) {
- if ( NumberR.at(i).isDigit() || NumberR.at(i) == '+'|| NumberR.at(i) == '*'|| NumberR.at(i) == '#' )
- NumR += NumberR.at(i);
- }
- return (Num == NumR);
+ PhoneNumber myself;
+ PhoneNumber other;
+ myself = *this;
+ other = p;
+ myself.simplifyNumber();
+ other.simplifyNumber();
+ if ( myself.number() != other.number ())
+ return false;
+ myself.simplifyType();
+ other.simplifyType();
+ if ( myself.type() == other.type())
+ return true;
+ return false;
}
void PhoneNumber::setId( const QString &id )