gi-webkit-3.0.14: WebKit bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.WebKit.Objects.FileChooserRequest

Contents

Description

Whenever the user interacts with an <input type='file' /> HTML element, WebKit will need to show a dialog to choose one or more files to be uploaded to the server along with the rest of the form data. For that to happen in a general way, instead of just opening a FileChooserDialog (which might be not desirable in some cases, such as when an embedding applications prefers to use its own file chooser dialog), WebKit will fire the WebView::run-file-chooser signal with a FileChooserRequest object, which will allow the client application to specify the files to be selected, to inspect the details of the request (e.g. if multiple selection should be allowed) and to cancel the request, in case nothing was selected.

In case the client application does not wish to handle this signal, WebKit will provide a default handler which will asynchronously run a regular FileChooserDialog for the user to interact with.

Synopsis

Exported types

Methods

getMimeTypes

fileChooserRequestGetMimeTypes Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileChooserRequest a) 
=> a

request: a FileChooserRequest

-> m [Text]

Returns: a Nothing-terminated array of strings if a list of accepted MIME types is defined or Nothing otherwise, meaning that any MIME type should be accepted. This array and its contents are owned by WebKitGTK+ and should not be modified or freed.

Get the list of MIME types the file chooser dialog should handle, in the format specified in RFC 2046 for "media types". Its contents depend on the value of the 'accept' attribute for HTML input elements. This function should normally be called before presenting the file chooser dialog to the user, to decide whether to allow the user to select multiple files at once or only one.

Since: 1.10

getMimeTypesFilter

fileChooserRequestGetMimeTypesFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileChooserRequest a) 
=> a

request: a FileChooserRequest

-> m FileFilter

Returns: a FileFilter if a list of accepted MIME types is defined or Nothing otherwise. The returned object is owned by WebKitGTK+ should not be modified or freed.

Get the filter currently associated with the request, ready to be used by FileChooser. This function should normally be called before presenting the file chooser dialog to the user, to decide whether to apply a filter so the user would not be allowed to select files with other MIME types.

See fileChooserRequestGetMimeTypes if you are interested in getting the list of accepted MIME types.

Since: 1.10

getSelectMultiple

fileChooserRequestGetSelectMultiple Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileChooserRequest a) 
=> a

request: a FileChooserRequest

-> m Bool

Returns: True if the file chooser should allow selecting multiple files or False otherwise.

Determine whether the file chooser associated to this FileChooserRequest should allow selecting multiple files, which depends on the HTML input element having a 'multiple' attribute defined.

Since: 1.10

getSelectedFiles

fileChooserRequestGetSelectedFiles Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileChooserRequest a) 
=> a

request: a FileChooserRequest

-> m [Text]

Returns: a Nothing-terminated array of strings if there are selected files associated with the request or Nothing otherwise. This array and its contents are owned by WebKitGTK+ and should not be modified or freed.

Get the list of selected files currently associated to the request. Initially, the return value of this method contains any files selected in previous file chooser requests for this HTML input element. Once webkit_file_chooser_request_select_files, the value will reflect whatever files are given.

This function should normally be called only before presenting the file chooser dialog to the user, to decide whether to perform some extra action, like pre-selecting the files from a previous request.

Since: 1.10

selectFiles

fileChooserRequestSelectFiles Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileChooserRequest a) 
=> a

request: a FileChooserRequest

-> [Text]

files: a Nothing-terminated array of strings, containing paths to local files.

-> m () 

Ask WebKit to select local files for upload and complete the request.

Since: 1.10

Properties

filter

mimeTypes

selectMultiple

selectedFiles