Skip to main content

Module attachment

Module attachment 

Expand description

What an attachment does when a person touches it.

A shared picture or file appears inline, and from there it has a ladder of things it can do: open at full size, be saved to somewhere the person chooses, and — once there is a saved copy — open that copy with this device’s own handler. A file that cannot be read says why instead of being a picture nobody can enlarge; a long upload reports how far it has got and can be stopped.

The ladder is data plus geometry: AttachmentSummary::actions says what is on offer and why not, full_size_rect says where a picture of a given shape sits in a given viewport, and AttachmentFace paints the line under a preview and the corner badge that says the preview can be opened. Nothing here reads a file, writes one or asks anyone for permission: the app owns its blob store and its file chooser, and reports what they said.

There is no toolkit-wide “reveal in Files”: an app that wants a saved copy’s folder opened asks the desktop for it through its own platform service. What is here is the part every conversation needs in common — the same four rungs, the same words, the same order.

Structs§

AttachmentFace
The line under an inline preview, and the badge that says it opens.
AttachmentSummary
Everything the ladder needs to know about one attachment.
SavedCopy
A saved copy of an attachment, where the app put it.
UploadProgress
How far an upload has got.

Enums§

AttachmentAction
One rung of the ladder, as the app should carry it out.
AttachmentKind
What kind of thing an attachment is, which decides its glyph and its word.
Availability
Why an attachment is not (or not yet) readable here.

Functions§

full_size_rect
Where a picture of width×height sits in view at full size.