Detailed Description
The QPhoneNumber class provides utility functions to manipulate telephone numbers.
The functions provided by this class are largely intended to assist with the dialing (and "quick dialing") experience, and include:
- stripping a number of any non-telephony characters
- returning the "local" component (non area/country code) of a telephone number
- checking to see how closely two telephone numbers match
- testing whether a phone number starts with a supplied prefix
- converting an alphabetic telephone number into the equivalent numeric number
See also Pim Library.
Member Function Documentation
QString QPhoneNumber::localNumber ( const QString & number ) [static]
Returns the local component of the phone number. In the case of countries with variable length area codes this may only return the end of the local number. In the case of URLs (for example 'sip:user@voipserver'), the original URL is returned.
int QPhoneNumber::matchNumbers ( const QString & num1, const QString & num2 ) [static]
Compare two phone numbers, num1 and num2, to determine the degree to which they match. Returns zero for no match, or increasing positive values for the "quality" of the match between the values.
Both numbers should be in numeric (not alphanumeric) form, unless they are URLs. URLs are just compared strictly for equality. If one argument appears to be a URL, and the other does not appear to be one, then the non protocol part of the URL argument will be compared strictly against the other argument.
See also resolveLetters().
bool QPhoneNumber::matchPrefix ( const QString & num, const QString & prefix ) [static]
Returns whether the given number num appears to start with the given prefix.
For a URL argument num, if the prefix argument is also a URL, a strict prefix match will be performed. If only one of the arguments is a URL, the non protocol part of the URL will be strictly against the other argument.
For non URL arguments, the prefix will be tested against num with and without area code or international prefixes. Both numbers should be in numeric (not alphanumeric) form.
See also resolveLetters().
QString QPhoneNumber::resolveLetters ( const QString & number ) [static]
Convert an alphanumeric phone number into a regular phone number. e.g. 1-800-HEY-PHIL becomes 1-800-439-7445.
If a URL is passed to this function (e.g. 'sip:user@sipserver'), the original value is returned.
Certain letters are not converted into numbers, because they can be used to control the way a number is dialed. These letters are lower case p, w and x, which insert pauses or waits when dialing a number. Upper case letters are always converted into the corresponding numbers.
Note: this is the only function in the API that can take an alphanumeric phone number as an argument. All other functions assume that the number has already been resolved.
QString QPhoneNumber::stripNumber ( const QString & number ) [static]
Strip the given number down to remove non-digit and non-dialing characters. If number seems to be a URI, this function will return the original value.