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

QMailMessagePartContainer Class Reference
[QtMessagingModule, QtPimModule]

The QMailMessagePartContainer class provides access to a collection of message parts. More...

    #include <QMailMessagePartContainer>

This class is under development and is subject to change.

Inherited by QMailMessage and QMailMessagePart.

Public Types

Public Functions

Protected Functions


Detailed Description

The QMailMessagePartContainer class provides access to a collection of message parts.

Message formats such as email messages conforming to RFC 2822 (Internet Message Format) can consist of multiple independent parts, whose relationship to each other is defined by the message that contains those parts. The QMailMessagePartContainer class provides storage for these related message parts, and the interface through which they are accessed.

The multipartType() function returns a member of the MultipartType enumeration, which describes the relationship of the parts in the container to each other.

The part container can instead contain a message body element. In this case, it cannot contain sub-parts, and the multipartType() function will return MultipartType::MultipartNone for the part. The body element can be accessed via the body() function.

The QMailMessagePart class is itself derived from QMailMessagePartContainer, which allows messages to support the nesting of part collections within other part collections.

See also QMailMessagePart, QMailMessage, and QMailMessageBody.


Member Type Documentation

enum QMailMessagePartContainer::MultipartType

This enumerated type is used to describe the multipart encoding of a message or message part.

ConstantValueDescription
QMailMessagePartContainer::MultipartNone0The container does not hold parts.
QMailMessagePartContainer::MultipartSigned1The container holds parts encoded according to RFC 1847 "multipart/signed"
QMailMessagePartContainer::MultipartEncrypted2The container holds parts encoded according to RFC 1847 "multipart/encrypted"
QMailMessagePartContainer::MultipartMixed3The container holds parts encoded according to RFC 2046 "multipart/mixed"
QMailMessagePartContainer::MultipartAlternative4The container holds parts encoded according to RFC 2046 "multipart/alternative"
QMailMessagePartContainer::MultipartDigest5The container holds parts encoded according to RFC 2046 "multipart/digest"
QMailMessagePartContainer::MultipartParallel6The container holds parts encoded according to RFC 2046 "multipart/parallel"
QMailMessagePartContainer::MultipartRelated7The container holds parts encoded according to RFC 2387 "multipart/related"
QMailMessagePartContainer::MultipartFormData8The container holds parts encoded according to RFC 2388 "multipart/form-data"
QMailMessagePartContainer::MultipartReport9The container holds parts encoded according to RFC 3462 "multipart/report"


Member Function Documentation

QMailMessagePartContainer::QMailMessagePartContainer ( Subclass * p )   [protected]

Constructs an empty part container object, in the space allocated within the subclass instance at p.

void QMailMessagePartContainer::appendHeaderField ( const QString & id, const QString & value )   [virtual]

Appends a new header field with id id and value value to the existing list of header fields. Any existing header fields with the same id are not modified. If value is of the form "<id>:<content>", then only the part after the semi-colon is processed.

RFC 2822 encoding requires header fields to be transmitted in ASCII characters. If value contains non-ASCII characters, it will be encoded to ASCII via the QMailMessageHeaderField::encodeContent() function; depending on the specific header field this may result in illegal content. Where possible, clients should encode non-ASCII data prior to calling appendHeaderField.

See also QMailMessageHeaderField.

void QMailMessagePartContainer::appendHeaderField ( const QMailMessageHeaderField & field )   [virtual]

This is an overloaded member function, provided for convenience.

Appends a new header field with the properties of field. Any existing header fields with the same id are not modified.

void QMailMessagePartContainer::appendPart ( const QMailMessagePart & part )

Append part to the list of attachments for the message.

QMailMessageBody QMailMessagePartContainer::body () const

Returns the body element contained by the part.

See also setBody().

QByteArray QMailMessagePartContainer::boundary () const

Returns the boundary text used to delimit the container's parts when encoded in RFC 2822 form.

See also setBoundary().

void QMailMessagePartContainer::clearParts ()

Clears the list of attachments associated with the message.

QMailMessageContentType QMailMessagePartContainer::contentType () const

Returns the content type of this part. Where hasBody() is true, the type of the contained body element is returned; otherwise a content type matching the multipartType() for this part is returned.

See also hasBody(), QMailMessageBody::contentType(), and multipartType().

bool QMailMessagePartContainer::hasBody () const

Returns true if the part contains a body element; otherwise returns false.

QMailMessageHeaderField QMailMessagePartContainer::headerField ( const QString & id, QMailMessageHeaderField::FieldType fieldType = QMailMessageHeaderField::StructuredField ) const

Returns an object containing the value of the first header field with the given id. If fieldType is QMailMessageHeaderField::StructuredField, then the field content will be parsed assuming a format equivalent to that used for the RFC 2045 'Content-Type' and RFC 2183 'Content-Disposition' header fields.

See also setHeaderField().

QString QMailMessagePartContainer::headerFieldText ( const QString & id ) const

Returns the text of the first header field with the given id.

QList<QMailMessageHeaderField> QMailMessagePartContainer::headerFields ( const QString & id, QMailMessageHeaderField::FieldType fieldType = QMailMessageHeaderField::StructuredField ) const

Returns a list of objects containing the value of each header field with the given id. If fieldType is QMailMessageHeaderField::StructuredField, then the field content will be parsed assuming a format equivalent to that used for the RFC 2045 'Content-Type' and RFC 2183 'Content-Disposition' header fields.

QList<QMailMessageHeaderField> QMailMessagePartContainer::headerFields () const

This is an overloaded member function, provided for convenience.

Returns a list of objects containing the value of each header field contained by the part. Header field objects returned by this function are not 'structured'.

QStringList QMailMessagePartContainer::headerFieldsText ( const QString & id ) const

Returns a list containing the text of each header field with the given id.

MultipartType QMailMessagePartContainer::multipartType () const

Returns the type of multipart relationship shared by the parts contained within this container, or MultipartNone if the content is not a multipart message.

See also setMultipartType().

const QMailMessagePart & QMailMessagePartContainer::partAt ( uint pos ) const

Returns a const reference to the item at position pos in the list of attachments for the message.

pos must be a valid index position in the list (i.e., 0 <= i < partCount()).

QMailMessagePart & QMailMessagePartContainer::partAt ( uint pos )

This is an overloaded member function, provided for convenience.

Returns a non-const reference to the item at position pos in the list of attachments for the message.

pos must be a valid index position in the list (i.e., 0 <= i < partCount()).

uint QMailMessagePartContainer::partCount () const

Returns the number of attachments the message has.

void QMailMessagePartContainer::prependPart ( const QMailMessagePart & part )

Prepend part to the list of attachments for the message.

void QMailMessagePartContainer::removeHeaderField ( const QString & id )   [virtual]

Removes all existing header fields with id equal to id.

void QMailMessagePartContainer::setBody ( const QMailMessageBody & body )

Sets the part to contain the body element body.

See also body().

void QMailMessagePartContainer::setBoundary ( const QByteArray & text )

Sets the boundary text used to delimit the container's parts when encoded in RFC 2822 form to text.

See also boundary().

void QMailMessagePartContainer::setHeaderField ( const QString & id, const QString & value )   [virtual]

Sets the value of the first header field with identity id to value if it already exists; otherwise adds the header with the supplied id and value. If value is of the form "<id>:<content>", then only the part after the semi-colon is processed.

RFC 2822 encoding requires header fields to be transmitted in ASCII characters. If value contains non-ASCII characters, it will be encoded to ASCII via the QMailMessageHeaderField::encodeContent() function; depending on the specific header field this may result in illegal content. Where possible, clients should encode non-ASCII data prior to calling setHeaderField.

See also headerField() and QMailMessageHeaderField.

void QMailMessagePartContainer::setHeaderField ( const QMailMessageHeaderField & field )   [virtual]

This is an overloaded member function, provided for convenience.

Sets the first header field with identity matching field to have the content of field.

void QMailMessagePartContainer::setMultipartType ( MultipartType type )

Sets the multipart state of the message to type.

See also multipartType().

QMailMessageBody::TransferEncoding QMailMessagePartContainer::transferEncoding () const

Returns the transfer encoding type of this part. Where hasBody() is true, the transfer encoding type of the contained body element is returned; otherwise, the transfer encoding type specified by the 'Content-Transfer-Encoding' field of the header for this part is returned.

See also hasBody() and QMailMessageBody::transferEncoding().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3