Attachment
Since: BlackBerry 10.0.0
#include <bb/pim/message/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().
You can also use the MessageService class to retrieve message attachments. You can download the attachment of a Message by calling MessageService::downloadAttachment().
Each Attachment object has a key, which is represented by an AttachmentKey, and this key uniquely identifies the attachment.
Overview
Public Functions Index
Attachment () | |
Attachment (const QString &mimeType, const QString &name, const QUrl &path) | |
Attachment (const QString &mimeType, const QString &name, const QUrl &path, const QVariantMap &metaData) | |
Attachment (const QString &mimeType, const QString &name, const QString &textData) | |
Attachment (const QString &mimeType, const QString &name, const QByteArray &data) | |
Attachment (const QString &mimeType, const QString &name, const QByteArray &data, const QVariantMap &metaData) | |
Attachment (AttachmentPrivate *attachmentPrivate) | |
Attachment (const Attachment &other) | |
~Attachment () | |
int | availableSize () const |
qint64 | availableSize64 () const |
QString | contentId () const |
QByteArray | data () const |
QByteArray | iconData () const |
QUrl | iconPath () const |
AttachmentKey | id () const |
bool | isInline () const |
bool | isValid () const |
QVariantMap | metaData () const |
QString | mimeType () const |
QString | name () const |
bool | operator!= (const Attachment &other) const |
Attachment & | operator= (const Attachment &other) |
bool | operator== (const Attachment &other) const |
QUrl | path () const |
int | totalSize () const |
qint64 | totalSize64 () const |
Public Functions
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. |
BlackBerry 10.0.0
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. |
BlackBerry 10.0.0
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. |
BlackBerry 10.0.0
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. |
BlackBerry 10.0.0
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. |
BlackBerry 10.0.0
Constructs an Attachment from the provided private data.
Parameters | |
---|---|
attachmentPrivate |
The private data to construct the attachment from. |
BlackBerry 10.0.0
Copy constructor.
This function constructs an Attachment containing exactly the same values as the provided Attachment.
Parameters | |
---|---|
other |
The Attachment to be copied. |
BlackBerry 10.0.0
Destructor.
This function cleans up and frees the attachment's data and resources.
BlackBerry 10.0.0
int
Retrieves the available size (in bytes) of this Attachment.
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.
The attachment's available size (in bytes). Returns -1 for size values greater than 2^31-1
BlackBerry 10.0.0
qint64
Retrieves the available size (in bytes) of this Attachment.
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.
The attachment's available size (in bytes) as a qint64.
BlackBerry 10.3.0
QString
Retrieves the content ID for this Attachment.
The attachment's content ID.
BlackBerry 10.0.0
QByteArray
Retrieves the data of this Attachment.
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.
The attachment's data.
BlackBerry 10.0.0
QByteArray
Retrieves the icon data of this Attachment.
This function returns the data of any icon associated with the attachment. If the attachment icon was specified using a path, the data from the file at the path is lazily loaded and then returned.
The attachment's icon data.
BlackBerry 10.0.0
QUrl
Retrieves the file path of the icon of this Attachment.
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.
The attachment's icon path as a file:// URL, if it exists, and an empty QUrl otherwise.
BlackBerry 10.0.0
AttachmentKey
Retrieves the attachment ID of this Attachment.
This function returns the ID that's associated with the attachment.
The attachment's ID.
BlackBerry 10.0.0
bool
Indicates whether this Attachment is an inline attachment.
true if this Attachment is an inline attachment, false otherwise.
BlackBerry 10.0.0
bool
Indicates whether this Attachment is valid.
true if this Attachment is valid, false otherwise.
BlackBerry 10.0.0
QVariantMap
Retrieves the metadata of this Attachment.
This function returns any metadata that's associated with the attachment. Metadata is returned as a QVariantMap. The interpretation and use of its keys and values are implementation-specific.
The attachment's metadata.
BlackBerry 10.0.0
QString
Retrieves the MIME type of this Attachment.
The attachment's MIME type.
BlackBerry 10.0.0
QString
Retrieves the name of this Attachment.
The attachment's name.
BlackBerry 10.0.0
bool
Inequality operator.
This function indicates whether this Attachment does not have exactly the same values as the provided Attachment.
Parameters | |
---|---|
other |
The Attachment to compare values with. |
true if the attachments are not considered equal, false otherwise.
BlackBerry 10.0.0
Attachment &
Assignment operator.
This operator copies all values from the provided Attachment into this Attachment.
Parameters | |
---|---|
other |
The Attachment from which to copy all values. |
An Attachment with all copied data.
BlackBerry 10.0.0
bool
Equality operator.
This function indicates whether this Attachment has exactly the same values as the provided Attachment.
Parameters | |
---|---|
other |
The Attachment to compare values with. |
true if the attachments are considered equal, false otherwise.
BlackBerry 10.0.0
QUrl
Retrieves the file path of this Attachment on the file system.
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.
The attachment's path as a file:// URL, if it exists, and an empty QUrl otherwise.
BlackBerry 10.0.0
int
Retrieves the total size (in bytes) of this Attachment.
The attachment's total size (in bytes). Returns -1 for size values greater than 2^31-1
BlackBerry 10.0.0
qint64
Retrieves the total size (in bytes) of this Attachment.
The attachment's total size (in bytes) as a qint64.
BlackBerry 10.3.0