Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMailAddress Class Reference
[QtMessagingModule, QtPimModule]

The QMailAddress class provides an interface for manipulating message address strings. More...

    #include <QMailAddress>

Public Functions

Static Public Members


Detailed Description

The QMailAddress class provides an interface for manipulating message address strings.

QMailAddress provides functions for splitting the address strings of messages into name and address components, and for combining the individual components into correctly formatted address strings. QMailAddress can be used to manipulate the address elements exposed by the QMailMessage class.

Address strings are expected to use the format "name_part '<'address_part'>'", where name_part describes a message sender or recipient and address_part defines the address at which they can be contacted. The address component is not validated, so it can contain an email address, phone number, or any other type of textual address representation.

See also QMailMessage.


Member Function Documentation

QMailAddress::QMailAddress ()

Constructs an empty QMailAddress object.

QMailAddress::QMailAddress ( const QString & addressText )

Constructs a QMailAddress object, extracting the name and address components from addressText.

If addressText cannot be separated into name and address components, both name() and address() will return the entirety of addressText.

See also name() and address().

QMailAddress::QMailAddress ( const QString & name, const QString & address )

Constructs a QMailAddress object with the given name and address.

QMailAddress::~QMailAddress ()

Destroys a QMailAddress object.

QString QMailAddress::address () const

Returns the address component of a mail address string.

QString QMailAddress::displayName () const

Returns a name to represent the address. If the address matches that of a stored Contact then the display name will be the contact's label. If no matching Contact is found, the name component of the address will be returned.

See also matchContact().

QString QMailAddress::displayName ( QContactModel & fromModel ) const

This is an overloaded member function, provided for convenience.

Returns a name to represent the address by querying the existing QContactModel fromModel. If the address matches that of a stored Contact then the display name will be the contact's label. If no matching Contact is found, the name component of the address will be returned.

See also matchContact().

QList<QMailAddress> QMailAddress::fromStringList ( const QString & list )   [static]

Returns a list containing a QMailAddress object constructed from each comma-separated address in list.

QList<QMailAddress> QMailAddress::fromStringList ( const QStringList & list )   [static]

This is an overloaded member function, provided for convenience.

Returns a list containing a QMailAddress object constructed from each address string in list.

QList<QMailAddress> QMailAddress::groupMembers () const

Returns a list containing the individual addresses that comprise the address group. If the address is not a group address, an empty list is returned.

See also isGroup().

bool QMailAddress::isChatAddress () const

Returns true if the address component has the form of an instant message address; otherwise returns false.

See also isEmailAddress(), isPhoneNumber(), and matchContact().

bool QMailAddress::isEmailAddress () const

Returns true if the address component has the form of an email address; otherwise returns false.

See also isPhoneNumber(), isChatAddress(), and matchContact().

bool QMailAddress::isGroup () const

Returns true if the address is that of a group.

bool QMailAddress::isNull () const

Returns true if the address object has not been initialized.

bool QMailAddress::isPhoneNumber () const

Returns true if the address component has the form of a phone number; otherwise returns false.

See also isEmailAddress(), isChatAddress(), and matchContact().

QContact QMailAddress::matchContact () const

Find the stored Contact whose email address or phone number matches the address component of the address text. If no matching contact is found, an empty Contact is returned.

See also displayName(), matchesExistingContact(), QContactModel::matchPhoneNumber(), and QContactModel::matchEmailAddress().

QContact QMailAddress::matchContact ( QContactModel & fromModel ) const

This is an overloaded member function, provided for convenience.

Find the stored Contact whose email address or phone number matches the address component of the address text within the existing QContactModel fromModel. If no matching contact is found, a null Contact is returned.

See also displayName(), QContactModel::matchPhoneNumber(), and QContactModel::matchEmailAddress().

bool QMailAddress::matchesExistingContact () const

Returns true if there exists a stored Contact whose email address or phone number matches the address component of the address text; otherwise returns false.

See also matchContact().

QString QMailAddress::name () const

Returns the name component of a mail address string.

QString QMailAddress::removeComments ( const QString & input )   [static]

Returns the content of input with any comment sections removed. Any subsequent leading or trailing whitespace is then also removed.

QString QMailAddress::removeWhitespace ( const QString & input )   [static]

Returns the content of input with any whitespace characters removed. Whitespace within quotes or comment sections is preserved.

QString QMailAddress::toString () const

Returns a string containing the name and address in a standardised format.

QStringList QMailAddress::toStringList ( const QList<QMailAddress> & list )   [static]

Returns a string list containing the result of calling toString() on each address in list.

See also toString().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3