21 #include <tdeapplication.h>
24 #include "phonenumber.h"
46 void PhoneNumber::init()
51 void PhoneNumber::validateNumber(
const TQString &number )
56 mNumber = mNumber.replace(
'\n',
"" );
57 mNumber = mNumber.replace(
'\r',
"" );
60 bool PhoneNumber::operator==(
const PhoneNumber &p )
const
62 if ( mNumber != p.mNumber )
return false;
63 if ( mType != p.mType )
return false;
68 bool PhoneNumber::operator!=(
const PhoneNumber &p )
const
70 return !( p == *this );
110 TypeList::ConstIterator it;
111 for ( it = list.begin(); it != list.end(); ++it ) {
112 if ( (
type() & (*it) ) && ( (*it) != Pref ) ) {
129 static TypeList list;
131 if ( list.isEmpty() ) {
132 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
133 << Bbs << Modem << Car << Isdn << Pcs << Pager;
147 return i18n(
"Preferred phone",
"Preferred" );
151 return i18n(
"Home phone",
"Home");
154 return i18n(
"Work phone",
"Work");
157 return i18n(
"Messenger");
160 return i18n(
"Preferred Number");
163 return i18n(
"Voice");
169 return i18n(
"Mobile Phone",
"Mobile" );
172 return i18n(
"Video");
175 return i18n(
"Mailbox");
178 return i18n(
"Modem");
181 return i18n(
"Car Phone",
"Car" );
190 return i18n(
"Pager");
193 return i18n(
"Home Fax");
196 return i18n(
"Work Fax");
199 return i18n(
"Other");
203 TQDataStream &TDEABC::operator<<( TQDataStream &s,
const PhoneNumber &phone )
205 return s << phone.mId << phone.mType << phone.mNumber;
208 TQDataStream &TDEABC::operator>>( TQDataStream &s,
PhoneNumber &phone )
210 s >> phone.mId >> phone.mType >> phone.mNumber;
int type() const
Returns the type.
TQString typeLabel() const
Returns a translated string of all types the address has.
PhoneNumber()
Create an empty phone number object.
TQString number() const
Returns the number.
void setType(int)
Sets the type.
void setNumber(const TQString &)
Sets the number.
static TypeList typeList()
Returns a list of all available types.
TQString id() const
Returns the unique identifier.
void setId(const TQString &id)
Sets the unique identifier.
TQString label() const
Returns the translated label for phone number depending on its type.
~PhoneNumber()
Destructor.
static TQString randomString(int length)
static data, shared by ALL addressee objects