It seems like the browser you are using has JavaScript disabled. As a result, the site will not function properly. We really want you to enable it so you may experience our site as we intended it. If you have no idea what we are talking about or if you need help, visit http://www.enable-javascript.com×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Oops, it seems like you're using an old browser that we do not fully support. If you're able to, please upgrade your browser here.×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Attachment

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

The Attachment class represents an attachment to a message.

This class includes information about an attachment to a Message object, such as file path to the attachment on the file system, MIME type, and optional metadata. You can retrieve the list of attachments for a Message by calling Message::attachments().

Public Functions

Attachment()

Attachment (

Constructs an Attachment with the provided MIME type, name, and file path.

This constructor creates an attachment object with the provided MIME type and name by using the data that's contained in the file at the provided file path.

Parameters

mimeType

The MIME type of the attachment to construct.

name

The name of the attachment to construct.

path

The URL that specifies the file path of the data to use to construct the attachment. The file:// schema is the only supported schema for the URL. If you want the file at this file path to be deleted if and when the associated message is removed from the messages database, you should listen for storage deletions and delete file yourself. NOTE: It's important to note that a QUrl is passed and not a QString / QByteArray. An implicit conversion will not be performed. Instead, one of the other constructors will be called.

Attachment (

Constructs an Attachment with the provided MIME type, name, path, and metadata.

This constructor creates an attachment object with the provided MIME type, name, and metadata by using the data that's contained in the file at the provided file path.

Parameters

mimeType

The MIME type of the attachment to construct.

name

The name of the attachment to construct.

path

The URL that specifies the file path of the data to use to construct the attachment. The file:// schema is the only supported schema for the URL. If you want the file at this file path to be deleted if and when the associated message is removed from the messages database, you should listen for storage deletions and delete file yourself. NOTE: It's important to note that a QUrl is passed and not a QString / QByteArray. An implicit conversion will not be performed. Instead, one of the other constructors will be called.

metaData

A QVariantMap that contains additional metadata associated with this attachment. The interpretation and use of its keys and values are implementation-specific.

Attachment (

Constructs an Attachment with the provided MIME type, name, and text data.

This constructor creates an attachment object with the provided MIME type, name, and text data. The text data is assumed to be encoded in UTF-8.

Parameters

mimeType

The MIME type of the attachment to construct.

name

The name of the attachment to construct.

textData

The UTF-8 text data for the attachment to construct. NOTE: It's important to note that a QString is passed and not a QUrl / QByteArray. An implicit conversion will not be performed. Instead, one of the other constructors will be called.

Attachment (

Construct an Attachment with the provided MIME type, name, and binary data.

This constructor creates an attachment object with the provided MIME type, name, and binary data (which is represented by a QByteArray).

Parameters

mimeType

The MIME type of the attachment to construct.

name

The name of the attachment to construct.

data

The data for the attachment to construct. NOTE: It's important to note that a QByteArray is passed and not a QUrl / QString. An implicit conversion will not be performed. Instead, one of the other constructors will be called.

Attachment (

Construct an Attachment with the provided MIME type, name, binary data, and metadata.

This constructor creates an attachment object with the provided MIME type, name, binary data (which is represented by a QByteArray), and metadata.

Parameters

mimeType

The MIME type of the attachment to construct.

name

The name of the attachment to construct.

data

The data for the attachment to construct. NOTE: It's important to note that a QByteArray is passed and not a QUrl / QString. An implicit conversion will not be performed. Instead, one of the other constructors will be called.

metaData

A QVariantMap that contains additional metadata associated with this attachment. The interpretation and use of its keys and values are implementation-specific.

~Attachment()

intavailableSize()

This function returns the available size (in bytes) of the 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 attachment has actually been downloaded.

qint64availableSize64()

This function returns, as a uint64, the available size (in bytes) of the 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 attachment has actually been downloaded.

This function returns the attachment's data. If the attachment was constructed with a path, the data from the file at the path is lazily loaded and then returned. If the data is text data, it is encoded in UTF-8.

This function returns the path of any icon associated with the attachment, as a URL using the file::// schema. If the icon was set using data instead of a path, the internal path used to store the icon data is returned, if it exists. Otherwise, an empty QUrl is returned.

Return:

The attachment's icon path as a file:// URL, if it exists, and an empty QUrl otherwise.

This function returns the path to the attachment's data as a URL using the file:// schema. If the attachment was constructed with data instead of a path, the internal path used to store the data is returned, if it exists. Otherwise, an empty QUrl is returned.

Return:

The attachment's path as a file:// URL, if it exists, and an empty QUrl otherwise.

1. Download the tools

Before you start developing, you'll need to visit the Downloads tab. Here you'll find downloads for the BlackBerry 10 Native SDK, BlackBerry 10 Device Simulator, and some other useful tools.

2. Try the sample apps

Now featuring a filter control, the Sample apps tab allows you to search for samples by name or by feature.

Select either the Core or Cascades radio buttons to display the samples relevant to you.

3. Educate yourself

The Documentation tab contains tons of examples, tutorials, and best practices to guide you along the path towards building an awesome app.

You can access all the documentation that you need in the left-hand navigation.

4. Start developing

The Reference tab is where you'll find essential details about how to use our APIs.

You can use the left-hand navigation to choose how you would like to browse the reference: by module, by topic, or alphabetically. If you have an idea of what you are looking for, start typing it in the Filter box.