FileAttachment

Since: BlackBerry 10.2.0

#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 the file path to the downloaded attachment on the file system (or the attachment to be downloaded), 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
qint64availableSize64 () 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
qint64totalSize64 () const

Public Functions

FileAttachment ()

Constructs an empty, invalid FileAttachment.

Since:

BlackBerry 10.2.0

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

The ID of this attachment.

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 to where this attachment is or will be downloaded to. This is not the path used to open or read the attachment, however, you should open and read the attachment using the following path: "/fs/pim/attachments/<accountId>/<messageId>/<id>/name". The attachment will be downloaded if necessary before returning bytes.

Since:

BlackBerry 10.2.0

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

FileAttachment (

Copy constructor.

This method constructs a FileAttachment containing exactly the same values as the provided FileAttachment.

Parameters
other

The FileAttachment to be copied.

Since:

BlackBerry 10.2.0

~FileAttachment ()

Destructor.

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

Since:

BlackBerry 10.2.0

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

Retrieves the account ID of this FileAttachment.

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

Return:

The file attachment's account ID.

Since:

BlackBerry 10.2.0

int availableSize ()

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

This method 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). Returns -1 for size values greater than 2^31-1

Since:

BlackBerry 10.2.0

qint64 availableSize64 ()

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

This method 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) as a qint64.

Since:

BlackBerry 10.3.0

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

Retrieves the conversation ID of this FileAttachment.

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

Return:

The file attachment's conversation ID.

Since:

BlackBerry 10.2.0

QDateTime date ()

Retrieves the date that this FileAttachment was sent.

Return:

The file attachment's sent date.

Since:

BlackBerry 10.2.0

QString downloadPath ()

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

This method 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 been downloaded yet.

Return:

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

Since:

BlackBerry 10.2.0

QString fullPath ()

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

This method returns the path to the file attachment's data as a URL using the file:// schema. Accessing this path causes 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.2.0

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

Retrieves the file attachment ID of this FileAttachment.

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

Return:

The file attachment's ID.

Since:

BlackBerry 10.2.0

bool isValid ()

Indicates whether this FileAttachment is valid.

Return:

true if this FileAttachment is valid, false otherwise.

Since:

BlackBerry 10.2.0

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

Retrieves the message ID of this FileAttachment.

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

Return:

The file attachment's message ID.

Since:

BlackBerry 10.2.0

QString mimeType ()

Retrieves the MIME type of this FileAttachment.

Return:

The file attachment's MIME type.

Since:

BlackBerry 10.2.0

QString name ()

Retrieves the name of this FileAttachment.

Return:

The file attachment's name.

Since:

BlackBerry 10.2.0

bool operator!= (

Inequality operator.

This method 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.2.0

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

bool operator== (

Equality operator.

This method 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.2.0

QString sender ()

Retrieves the sender of this FileAttachment.

Return:

The file attachment's sender.

Since:

BlackBerry 10.2.0

int totalSize ()

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

Return:

The file attachment's total size (in bytes). Returns -1 for size values greater than 2^31-1

Since:

BlackBerry 10.2.0

qint64 totalSize64 ()

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

Return:

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

Since:

BlackBerry 10.3.0

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus