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.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index d7e3925..3d82553 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -60,54 +60,76 @@ bool PhoneNumber::operator==( const PhoneNumber &p ) const
return true;
}
bool PhoneNumber::operator!=( const PhoneNumber &p ) const
{
return !( p == *this );
}
bool PhoneNumber::simplifyNumber()
{
QString Number;
int i;
Number = mNumber.stripWhiteSpace ();
mNumber = "";
for ( i = 0; i < Number.length(); ++i) {
if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' )
mNumber += Number.at(i);
}
return ( mNumber.length() > 0 );
}
// make cellphone compatible
void PhoneNumber::simplifyType()
{
- if ( mType & Fax ) mType = Fax;
- else if ( mType & Cell ) mType = Cell;
- else if ( mType & Work ) mType = Work ;
- else if ( mType & Home ) mType = Home;
- else mType = Pref;
+ if ( mType & Fax ) mType = Fax;
+ else if ( mType & Cell ) mType = Cell;
+ else if ( mType & Work ) mType = Work ;
+ else if ( mType & Home ) mType = Home;
+ else mType = Pref;
}
+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);
+}
+
void PhoneNumber::setId( const QString &id )
{
mId = id;
}
QString PhoneNumber::id() const
{
return mId;
}
void PhoneNumber::setNumber( const QString &number )
{
mNumber = number;
}
QString PhoneNumber::number() const
{
return mNumber;
}
void PhoneNumber::setType( int type )
{
mType = type;
}