FileAttachment

Since: BlackBerry 10.0.2

#include <bb/pim/message/FileAttachment>

To link against this class, add the following line to your .pro file: LIBS += -lbbpim

The FileAttachment class represents a file attachment.

This class includes information about a file attachment, such as file path to the ( perhaps not yet ) downloaded attachment on the file system, MIME type, and sender.

You can retrieve the list of attachments by calling MessageService::attachments().

You can download the attachment of a Message by calling MessageService::downloadAttachment().

Each FileAttachment object has a key, which is represented by a FileAttachmentKey, and this key uniquely identifies the file attachment.

See also:

MessageService


Overview

Public Functions Index

FileAttachment ()
FileAttachment (const bb::pim::message::AttachmentKey id, const bb::pim::account::AccountKey accountId, const bb::pim::message::MessageKey messageId, const bb::pim::message::ConversationKey conversationId, const QString &name, const QString &mimeType, const QString &downloadPath)
FileAttachment (FileAttachmentPrivate *fileAttachmentPrivate)
FileAttachment (const FileAttachment &other)
~FileAttachment ()
bb::pim::account::AccountKeyaccountId () const
intavailableSize () const
bb::pim::message::ConversationKeyconversationId () const
QDateTimedate () const
QStringdownloadPath () const
QStringfullPath () const
bb::pim::message::AttachmentKeyid () const
boolisValid () const
bb::pim::message::MessageKeymessageId () const
QStringmimeType () const
QStringname () const
booloperator!= (const FileAttachment &other) const
FileAttachment &operator= (const FileAttachment &other)
booloperator== (const FileAttachment &other) const
QStringsender () const
inttotalSize () const

Public Functions

FileAttachment ()

Constructs an empty, invalid FileAttachment.

This constructor may be used when returning a FileAttachment by value to indicate an error. When you use this constructor to create a FileAttachment, the isValid() will return false for the attachment.

Since:

BlackBerry 10.0.2

FileAttachment (

Constructs a FileAttachment with the provided name, MIME type and download file path.

This constructor creates a file attachment object with the provided name, MIME type and download file path.

Parameters
id

This attachment's id

accountId

The account id of this attachment

messageId

The message id of this attachment

conversationId

The conversation id of this attachment

name

The name of this attachment

mimeType

The MIME type of this attachment

downloadPath

The path where this attachment is or would be downloaded to. This is not the path that should be used to open or read the attachment, however. You should instead open and read the attachment from the following path: "/fs/pim/attachments/<accountId>/<messageId>/<id>/name". The attachment will be downloaded if necessary before returning bytes.

Since:

BlackBerry 10.0.2

FileAttachment (
  • FileAttachmentPrivate *fileAttachmentPrivate)

Constructs a FileAttachment from the provided private data.

Parameters
fileAttachmentPrivate

The private data to construct the file attachment from.

Since:

BlackBerry 10.0.2

FileAttachment (

Copy constructor.

This function constructs an FileAttachment containing exactly the same values as the provided FileAttachment.

Parameters
other

The FileAttachment to be copied.

Since:

BlackBerry 10.0.2

~FileAttachment ()

Destructor.

This function cleans up and frees the file attachment's data and resources.

Since:

BlackBerry 10.0.2

bb::pim::account::AccountKey accountId ()

Retrieves the account ID of this FileAttachment.

This function returns the account ID that's associated with the file attachment.

Return:

The file attachment's account ID.

Since:

BlackBerry 10.0.2

int availableSize ()

Retrieves the available size (in bytes) of this FileAttachment.

This function returns the available size (in bytes) of the file attachment. The available size is typically the same as the total size but may be different for some services. For example, the messaging service uses the available size to determine how much of the file attachment has actually been downloaded.

Return:

The file attachment's available size (in bytes).

Since:

BlackBerry 10.0.2

bb::pim::message::ConversationKey conversationId ()

Retrieves the conversation ID of this FileAttachment.

This function returns the conversation ID that's associated with the file attachment.

Return:

The file attachment's conversation ID.

Since:

BlackBerry 10.0.2

QDateTime date ()

Retrieves the date that this FileAttachment was sent.

Return:

The file attachment's sent date.

Since:

BlackBerry 10.0.2

QString downloadPath ()

Retrieves the download path to the FileAttachment on the file system.

This function returns the path to the file attachment's data as a URL using the file:// schema. This path is empty if the attachment hasn't yet been downloaded.

Return:

The file attachment's download path as a file:// URL.

Since:

BlackBerry 10.0.2

QString fullPath ()

Retrieves the file path of this FileAttachment on the file system.

This function returns the path to the file attachment's data as a URL using the file:// schema. Accessing this path will cause the attachment to first be downloaded if it hasn't been already.

Return:

The file attachment's path as a file:// URL.

Since:

BlackBerry 10.0.2

bb::pim::message::AttachmentKey id ()

Retrieves the file attachment ID of this FileAttachment.

This function returns the ID that's associated with the file attachment.

Return:

The file attachment's ID.

Since:

BlackBerry 10.0.2

bool isValid ()

Indicates whether this FileAttachment is valid.

Return:

true if this FIleAttachment is valid, false otherwise.

Since:

BlackBerry 10.0.2

bb::pim::message::MessageKey messageId ()

Retrieves the message ID of this FileAttachment.

This function returns the message ID that's associated with the file attachment.

Return:

The file attachment's message ID.

Since:

BlackBerry 10.0.2

QString mimeType ()

Retrieves the MIME type of this FileAttachment.

Return:

The file attachment's MIME type.

Since:

BlackBerry 10.0.2

QString name ()

Retrieves the name of this FileAttachment.

Return:

The file attachment's name.

Since:

BlackBerry 10.0.2

bool operator!= (

Inequality operator.

This function indicates whether this FileAttachment does not have exactly the same values as the provided FileAttachment.

Parameters
other

The FileAttachment to compare values with.

Return:

true if the file attachments are not considered equal, false otherwise.

Since:

BlackBerry 10.0.2

FileAttachment & operator= (

Assignment operator.

This operator copies all values from the provided FileAttachment into this FileAttachment.

Parameters
other

The FileAttachment from which to copy all values.

Return:

A FileAttachment with all copied data.

Since:

BlackBerry 10.0.2

bool operator== (

Equality operator.

This function indicates whether this FileAttachment has exactly the same values as the provided FileAttachment.

Parameters
other

The FileAttachment to compare values with.

Return:

true if the file attachments are considered equal, false otherwise.

Since:

BlackBerry 10.0.2

QString sender ()

Retrieves the sender of this FileAttachment.

Return:

The file attachment's sender.

Since:

BlackBerry 10.0.2

int totalSize ()

Retrieves the total size (in bytes) of this FileAttachment.

Return:

The file attachment's total size (in bytes).

Since:

BlackBerry 10.0.2

Last modified: 2014-03-13

comments powered by Disqus