10-24-2013 02:07 AM
As above, is there a way to check if email attachment has been downloaded? I do not want to download it if it hasnt been downloaded yet.
Currently the Attachment.data downloads the attachment if it has not been downloaded yet.
I know there is a downloadstatus signal, but that is used when the download has been initiated.
There is a AttachmentDownloadStatus class, so is there a way to get that status without forcing the download?
10-24-2013 03:12 AM
The Message->attachments() method will give you a list of Attachment objects without downloading them.
10-24-2013 05:51 AM
There are signals emited when an attachment is downloaded or its status changes.
The use of AttachmentDownloadStatus is not at all clear from the documentation so let me look into that and report back.
10-24-2013 06:15 AM
OK, the only way to establish the status of an Attachment is via the signals in the MessageService class. You can see percentage downloaded is a parameter to the attachmentDownloadStatusChanged signal for example.
10-24-2013 08:09 PM
I found two ways of retrieving attachments
1. Using Message::attachments()
This method retrieves attachments for the message.
Only way to check downloaded status is through downloaded signal, but i want to check if message has been downloaded without activating download.
None existent IsDownloaded method
2. Using MessageService::attachments()
This method retrieves attachments for all messages in current conversation.
calling FileAttachment::downloadPath will return empty QURL if attachment has not been downloaded and thus can be used as a way for me to check if attachment has been downloaded without activating download.
However, as all attachments for conversation is retrieved, I would have to loop through all attachments and check messageid before saving them, my thoughts are would there be a performance hit if conversation has many attachments? The is a filter when using MessageService::attachments but no filter for messageID.
Seems like the 2 classes are more or less the same but just the scope of retrieving attachments and some methods. Any advice?
10-25-2013 01:23 AM
I don't imagine performance would be a significant issue but the only way to be sure is to test with real data so I suggest you do just that.
10-25-2013 02:31 AM
i found the availableSize and totalSize methods for the Attachment class,
the docs say it is used to see if attachment has been downloaded, therefore I do a check for
if (attachment.availableSize == attachment.totalSize)
to see if attachment has been downloaded. Currently waiting for device to test (again haha)