Closed Bug 1696777 Opened 3 years ago Closed 1 year ago

Add APIs for opening attachments

Categories

(Thunderbird :: Add-Ons: Extensions API, enhancement)

enhancement

Tracking

(thunderbird_esr102 wontfix)

RESOLVED FIXED
114 Branch
Tracking Status
thunderbird_esr102 --- wontfix

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(3 files)

Bug 1522828 is for detach/deleting attachments, but I think it would be useful if add-ons could trigger displaying and downloading of a messages attachments as well.

For example, an extension could add a different attachments list display, or allow searching all messages for attachments, list those, and then make those available for opening/preview/etc.

I'm not quite sure if having something like bug 1606552, or access to the attachment data would negate the need for this though.

I have created an example add-on that does a preview for image and pdf attachments. It also allows to download them:
https://github.com/thundernest/sample-extensions/tree/master/attachmentPreview

Regarding the "download" part of this bug:
As shown, I consider this already possible.

Regarding the "preview" part of this bug:
Do you request to let Thunderbird render also previews for other content types than images? Does it do that already somewhere? My example add-on is manually doing the pdf preview. I believe this is how it should be.

Regarding the "opening" part of this bug:
I was not yet able to get browser.downloads.open() working properly, so this will need some work. Ideas?

(In reply to John Bieling (:TbSync) from comment #1)

Regarding the "preview" part of this bug:
Do you request to let Thunderbird render also previews for other content types than images? Does it do that already somewhere? My example add-on is manually doing the pdf preview. I believe this is how it should be.

Ok, I'm getting confused by Conversation's options for previewing and opening. Which are slightly different. In the pdf context though - given that pdf is now integrated into Thunderbird - I think add-ons should be able to call an open function on the pdf attachment and that function will follow the user's content type (aka Files & Attachments) preferences. So if the user has to open in Thunderbird there, then it should do that.

Regarding the "opening" part of this bug:
I was not yet able to get browser.downloads.open() working properly, so this will need some work. Ideas?

I think we might just have to have a dedicated API to open an attachment. The only other alternative would be to require the add-on to save it async before providing a button, but that would be a really bad experience.

It seems "preview" should be defined. To me, it is a very fast display (tooltip or panel on mouse hover) of about a page's worth of content (text/plain types, image thumbnail, formatted text like doc or pdf). It probably means using a platform specific implementation to do so for formatted types, as attempted in Bug 457546. It may or may not require draining the entire stream when reading the file, which would be "downloading" and opening - which isn't exactly a "preview".

Sorry, terminology is bad here, I'm going to drop the preview. John and I have been discussing on Matrix, and realised that "preview" here was in Conversation's terms of allowing to see something within Thunderbird, rather than preview as in a hover-over/thumbnail like thing.

Also removing "downloading" from the scope, since we already have that functionality.

Summary: Add APIs for downloading/opening/previewing attachments → Add APIs for opening attachments
Assignee: nobody → standard8
Attachment #9327685 - Attachment description: WIP: Bug 1696777 - Move MsgOpenEMLFile to MailUtils.jsm for better access. → Bug 1696777 - Move MsgOpenEMLFile to MailUtils.jsm for better access. r?john.bieling!
Status: NEW → ASSIGNED
Attachment #9327686 - Attachment description: WIP: Bug 1696777 - Move AttachmentInfo to a module so that it can be more easily re-used from non-window contexts. → Bug 1696777 - Move AttachmentInfo to a module so that it can be more easily re-used from non-window contexts. r?john.bieling!
Attachment #9327687 - Attachment description: WIP: Bug 1696777 - Add a message.openAttachment API for WebExtensions. → Bug 1696777 - Add a message.openAttachment API for WebExtensions. r?john.bieling!
Target Milestone: --- → 114 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/7e13abe8e7ea
Move MsgOpenEMLFile to MailUtils.jsm for better access. r=john.bieling
https://hg.mozilla.org/comm-central/rev/14893c25d56e
Move AttachmentInfo to a module so that it can be more easily re-used from non-window contexts. r=john.bieling
https://hg.mozilla.org/comm-central/rev/decfbffda0b2
Add a message.openAttachment API for WebExtensions. r=john.bieling

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Blocks: 1849453
Blocks: 1849455
Regressions: 1851563
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: