-rw-r--r-- | kabc/phonenumber.cpp | 31 |
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() | |||
89 | } | 89 | } |
90 | bool PhoneNumber::contains( const PhoneNumber &p ) | 90 | bool PhoneNumber::contains( const PhoneNumber &p ) |
91 | { | 91 | { |
92 | QString Number; | 92 | PhoneNumber myself; |
93 | QString Num; | 93 | PhoneNumber other; |
94 | uint i; | 94 | myself = *this; |
95 | Number = mNumber.stripWhiteSpace (); | 95 | other = p; |
96 | Num = ""; | 96 | myself.simplifyNumber(); |
97 | for ( i = 0; i < Number.length(); ++i) { | 97 | other.simplifyNumber(); |
98 | if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) | 98 | if ( myself.number() != other.number ()) |
99 | Num += Number.at(i); | 99 | return false; |
100 | } | 100 | myself.simplifyType(); |
101 | QString NumberR; | 101 | other.simplifyType(); |
102 | QString NumR; | 102 | if ( myself.type() == other.type()) |
103 | NumberR = p.mNumber.stripWhiteSpace (); | 103 | return true; |
104 | NumR = ""; | 104 | return false; |
105 | for ( i = 0; i < NumberR.length(); ++i) { | ||
106 | if ( NumberR.at(i).isDigit() || NumberR.at(i) == '+'|| NumberR.at(i) == '*'|| NumberR.at(i) == '#' ) | ||
107 | NumR += NumberR.at(i); | ||
108 | } | ||
109 | return (Num == NumR); | ||
110 | } | 105 | } |
111 | 106 | ||
112 | void PhoneNumber::setId( const QString &id ) | 107 | void PhoneNumber::setId( const QString &id ) |