Struct ashpd::documents::FileTransferProxy[][src]

pub struct FileTransferProxy<'a>(_);
Expand description

The interface operates as a middle-man between apps when transferring files via drag-and-drop or copy-paste, taking care of the necessary exporting of files in the document portal.

Toolkits are expected to use the application/vnd.portal.filetransfer mimetype when using this mechanism for file exchange via copy-paste or drag-and-drop.

The data that is transmitted with this mimetype should be the key returned by the StartTransfer method. Upon receiving this mimetype, the target should call RetrieveFiles with the key, to obtain the list of files. The portal will take care of exporting files in the document store as necessary to make them accessible to the target.

Implementations

Create a new instance of FileTransferProxy.

Get a reference to the underlying Proxy.

Adds files to a session. This method can be called multiple times on a given session. Note that only regular files (not directories) can be added.

Arguments

Retrieves files that were previously added to the session with add_files. The files will be exported in the document portal as-needed for the caller, and they will be writable if the owner of the session allowed it.

Returns the list of file paths.

Arguments

Starts a session for a file transfer. The caller should call FileTransferProxy::add_files at least once, to add files to this session.

Arguments

  • writeable - Sets whether the chosen application can write to the files or not.
  • auto_stop - Whether to stop the transfer automatically after the first FileTransferProxy::retrieve_files call.

Returns

a key that can be passed to FileTransferProxy::retrieve_files to obtain the files.

Ends the transfer. Further calls to FileTransferProxy::add_files or FileTransferProxy::retrieve_files for this key will return an error.

Arguments

Emitted when the transfer is closed.

Returns

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.