Home

QMailMessagePart Class Reference

The QMailMessagePart class provides a convenient interface for working with message attachments. More...

    #include <QMailMessagePart>

This class is under development and is subject to change.

Inherits QMailMessagePartContainer and QMailMessagePartFwd.


Public Functions

QMailMessagePart ()
QString contentDescription () const
QMailMessageContentDisposition contentDisposition () const
QString contentID () const
QString contentLanguage () const
QString contentLocation () const
QString displayName () const
QString identifier () const
virtual uint indicativeSize () const
Location location () const
QMailMessageId messageReference () const
int partNumber () const
QMailMessagePart::Location partReference () const
QString referenceResolution () const
ReferenceType referenceType () const
void setContentDescription ( const QString & description )
void setContentDisposition ( const QMailMessageContentDisposition & disposition )
void setContentID ( const QString & id )
void setContentLanguage ( const QString & language )
void setContentLocation ( const QString & location )
void setReference ( const QMailMessageId & id, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )
void setReference ( const QMailMessagePart::Location & location, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )
void setReferenceResolution ( const QString & uri )
QString writeBodyTo ( const QString & path ) const

Reimplemented Public Functions

virtual bool contentAvailable () const
virtual bool partialContentAvailable () const

Static Public Members

QMailMessagePart fromData ( const QByteArray & input, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding, QMailMessageBody::EncodingStatus status = QMailMessageBody::RequiresEncoding )
QMailMessagePart fromData ( const QString & input, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )
QMailMessagePart fromFile ( const QString & filename, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding, QMailMessageBody::EncodingStatus status = QMailMessageBody::RequiresEncoding )
QMailMessagePart fromMessageReference ( const QMailMessageId & messageId, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )
QMailMessagePart fromPartReference ( const QMailMessagePart::Location & partLocation, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )
QMailMessagePart fromStream ( QDataStream & in, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding, QMailMessageBody::EncodingStatus status = QMailMessageBody::RequiresEncoding )
QMailMessagePart fromStream ( QTextStream & in, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )

Detailed Description

The QMailMessagePart class provides a convenient interface for working with message attachments.

A message part inherits the properties of QMailMessagePartContainer, and can therefore contain a message body or a collection of sub-parts.

A message part differs from a message proper in that a part will often have properties specified by the MIME multipart specification, not relevant to messages. These include the 'name' and 'filename' parameters of the Content-Type and Content-Disposition fields, and the Content-Id and Content-Location fields.

A message part may consist entirely of a reference to an external message, or a part within an external message. Parts that consists of references may be used with some protocols that permit data to be transmitted by reference, such as IMAP with the URLAUTH extension. Not all messaging protocols support the use of content references. The partReference() and messageReference() functions enable the creation of reference parts.

See also QMailMessagePartContainer.


Member Function Documentation

QMailMessagePart::QMailMessagePart ()

Constructs an empty message part object.

bool QMailMessagePart::contentAvailable () const   [virtual]

Reimplemented from QMailMessagePartContainer::contentAvailable().

Returns true if the entire content of this part is available; otherwise returns false.

QString QMailMessagePart::contentDescription () const

Returns the Content-Description header field for the part, if present; otherwise returns an empty string.

See also setContentDescription().

QMailMessageContentDisposition QMailMessagePart::contentDisposition () const

Returns the Content-Disposition header field for the part.

See also setContentDisposition().

QString QMailMessagePart::contentID () const

Returns the Content-Id header field for the part, if present; otherwise returns an empty string.

If the header field content is surrounded by angle brackets, these are removed.

See also setContentID().

QString QMailMessagePart::contentLanguage () const

Returns the Content-Language header field for the part, if present; otherwise returns an empty string.

See also setContentLanguage().

QString QMailMessagePart::contentLocation () const

Returns the Content-Location header field for the part, if present; otherwise returns an empty string.

See also setContentLocation().

QString QMailMessagePart::displayName () const

Returns a non-empty string to identify the part, appropriate for display. If the part 'Content-Type' header field contains a 'name' parameter, that value is used. Otherwise, if the part has a 'Content-Disposition' header field containing a 'filename' parameter, that value is used. Otherwise, if the part has a 'Content-ID' header field, that value is used. Finally, a usable name will be created by combining the content type of the part with the part's number.

See also identifier().

QMailMessagePart QMailMessagePart::fromData ( const QByteArray & input, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding, QMailMessageBody::EncodingStatus status = QMailMessageBody::RequiresEncoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, from the data contained in input, of content type type and using the transfer encoding encoding. The current status of the data is specified as status.

See also QMailMessageBody::fromData().

QMailMessagePart QMailMessagePart::fromData ( const QString & input, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, from the data contained in input, of content type type and using the transfer encoding encoding.

See also QMailMessageBody::fromData().

QMailMessagePart QMailMessagePart::fromFile ( const QString & filename, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding, QMailMessageBody::EncodingStatus status = QMailMessageBody::RequiresEncoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, from the data contained in filename, of content type type and using the transfer encoding encoding. The current status of the data is specified as status.

See also QMailMessageBody::fromFile().

QMailMessagePart QMailMessagePart::fromMessageReference ( const QMailMessageId & messageId, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, whose content is a reference to the message identified by messageId. The resulting part has content type type and uses the transfer encoding encoding.

The message reference can only be resolved by transmitting the message to an external server, where both the originating server of the referenced message and the receiving server of the new message support resolution of the content reference.

QMailMessagePart QMailMessagePart::fromPartReference ( const QMailMessagePart::Location & partLocation, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, whose content is a reference to the message part identified by partLocation. The resulting part has content type type and uses the transfer encoding encoding.

The part reference can only be resolved by transmitting the message to an external server, where both the originating server of the referenced part's message and the receiving server of the new message support resolution of the content reference.

QMailMessagePart QMailMessagePart::fromStream ( QDataStream & in, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding, QMailMessageBody::EncodingStatus status = QMailMessageBody::RequiresEncoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, from the data read from in, of content type type and using the transfer encoding encoding. The current status of the data is specified as status.

See also QMailMessageBody::fromStream().

QMailMessagePart QMailMessagePart::fromStream ( QTextStream & in, const QMailMessageContentDisposition & disposition, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )   [static]

Creates a QMailMessagePart containing an attachment of type disposition, from the data read from in, of content type type and using the transfer encoding encoding.

See also QMailMessageBody::fromStream().

QString QMailMessagePart::identifier () const

Returns a non-empty string to identify the part, appropriate for storage. If the part has a 'Content-ID' header field, that value is used. Otherwise, if the part has a 'Content-Disposition' header field containing a 'filename' parameter, that value is used. Otherwise, if the part 'Content-Type' header field contains a 'name' parameter, that value is used. Finally, the part's number will be returned.

uint QMailMessagePart::indicativeSize () const   [virtual]

Returns an indication of the size of the part. This measure should be used only in comparing the relative size of parts with respect to transmission.

Location QMailMessagePart::location () const

Returns the location of the part within the message.

QMailMessageId QMailMessagePart::messageReference () const

Returns the identifier of the message that this part references.

The result will be meaningful only when referenceType() yields QMailMessagePart::MessageReference.

See also referenceType(), partReference(), and referenceResolution().

int QMailMessagePart::partNumber () const

Returns the number of the part, if it has been set; otherwise returns -1.

QMailMessagePart::Location QMailMessagePart::partReference () const

Returns the location of the message part that this part references.

The result will be meaningful only when referenceType() yields QMailMessagePart::PartReference.

See also referenceType(), messageReference(), and referenceResolution().

bool QMailMessagePart::partialContentAvailable () const   [virtual]

Reimplemented from QMailMessagePartContainer::partialContentAvailable().

Returns true if some portion of the content of this part is available; otherwise returns false.

QString QMailMessagePart::referenceResolution () const

Returns the URI that resolves the reference encoded into this message part.

The result will be meaningful only when referenceType() yields other than QMailMessagePart::None.

See also setReferenceResolution() and referenceType().

ReferenceType QMailMessagePart::referenceType () const

Returns the type of reference that this message part constitutes.

See also setReference().

void QMailMessagePart::setContentDescription ( const QString & description )

Sets the Content-Description header field for the part to contain description.

See also contentDescription().

void QMailMessagePart::setContentDisposition ( const QMailMessageContentDisposition & disposition )

Sets the Content-Disposition header field for the part to contain disposition.

See also contentDisposition().

void QMailMessagePart::setContentID ( const QString & id )

Sets the Content-Id header field for the part to contain id.

If id is not surrounded by angle brackets, these are added.

See also contentID().

void QMailMessagePart::setContentLanguage ( const QString & language )

Sets the Content-Language header field for the part to contain language.

See also contentLanguage().

void QMailMessagePart::setContentLocation ( const QString & location )

Sets the Content-Location header field for the part to contain location.

See also contentLocation().

void QMailMessagePart::setReference ( const QMailMessageId & id, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )

Sets the part content to contain a reference to the message identified by id, having content type type and using the transfer encoding encoding.

The message reference can only be resolved by transmitting the message to an external server, where both the originating server of the referenced message and the receiving server of the new message support resolution of the content reference.

See also referenceType() and setReferenceResolution().

void QMailMessagePart::setReference ( const QMailMessagePart::Location & location, const QMailMessageContentType & type, QMailMessageBody::TransferEncoding encoding )

Sets the part content to contain a reference to the message part identified by location, having content type type and using the transfer encoding encoding.

The part reference can only be resolved by transmitting the message to an external server, where both the originating server of the referenced part's message and the receiving server of the new message support resolution of the content reference.

See also referenceType() and setReferenceResolution().

void QMailMessagePart::setReferenceResolution ( const QString & uri )

Sets the URI that resolves the reference encoded into this message part to uri.

The reference URI is meaningful only when referenceType() yields other than QMailMessagePart::None.

See also referenceResolution() and referenceType().

QString QMailMessagePart::writeBodyTo ( const QString & path ) const

Writes the decoded body of the part to a file under the directory specified by path. The name of the resulting file is taken from the part. If that file name already exists in the path a new unique name of the format <random chars>.<filename> is saved.

Returns the path of the file written on success, or an empty string otherwise.


Copyright © 2010 QtSoftware
Messaging Framework