Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMailMessagePart Class Reference
[QtMessagingModule, QtPimModule]

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.

Public Functions

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 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.

See also QMailMessagePartContainer.


Member Function Documentation

QMailMessagePart::QMailMessagePart ()

Constructs an empty message part object.

QString QMailMessagePart::attachmentPath () const

Returns the path to a QMailMessagePart attachment file. Returns an empty path for parts that are not attachments or have not been detached.

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.

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().

bool QMailMessagePart::detachAttachment ( const QString & path )

Detaches a file attachment QMailMessagePart, decoding and saving the file part into the directory specified by path, and recording the attachment path in the part. The name of the file is taken from the part. If another file already exists in the path a new unique name of the format <filename>.<random chars> is saved. Returns true on success or false otherwise.

QString QMailMessagePart::detachFileName () const

Returns the leaf file name to which the part will be written if detached from the message.

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]

This is an overloaded member function, provided for convenience.

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::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]

This is an overloaded member function, provided for convenience.

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.

int QMailMessagePart::partNumber () const

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

See also setPartNumber().

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.

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::setPartNumber ( int partNumber )

Sets the number of the part within its parent part container to partNumber.

See also partNumber().

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

Writes the decoded body of the part to a file under the directory specified by path. A 'qtopiamail' directory element will be included in the full path, to avoid filename clashes. Returns the path of the file written on sucess, or an empty string otherwise.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment créer une fenêtre À propos

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web