gi-webkit2-4.0.31: WebKit2 bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.WebKit2.Objects.FileChooserRequest

Description

A request to open a file chooser.

Whenever the user interacts with an HTML input element with file type, 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, which could prefer to use their own file chooser dialog), WebKit will fire the WebView::runFileChooser 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

newtype FileChooserRequest Source #

Memory-managed wrapper type.

Constructors

FileChooserRequest (ManagedPtr FileChooserRequest) 

Instances

Instances details
Eq FileChooserRequest Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

GObject FileChooserRequest Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

ManagedPtrNewtype FileChooserRequest Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

TypedObject FileChooserRequest Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

Methods

glibType :: IO GType

HasParentTypes FileChooserRequest Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

IsGValue (Maybe FileChooserRequest) Source #

Convert FileChooserRequest to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

type ParentTypes FileChooserRequest Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

type ParentTypes FileChooserRequest = '[Object]

class (GObject o, IsDescendantOf FileChooserRequest o) => IsFileChooserRequest o Source #

Type class for types which can be safely cast to FileChooserRequest, for instance with toFileChooserRequest.

Instances

Instances details
(GObject o, IsDescendantOf FileChooserRequest o) => IsFileChooserRequest o Source # 
Instance details

Defined in GI.WebKit2.Objects.FileChooserRequest

toFileChooserRequest :: (MonadIO m, IsFileChooserRequest o) => o -> m FileChooserRequest Source #

Cast to FileChooserRequest, for types for which this is known to be safe. For general casts, use castTo.

Methods

cancel

fileChooserRequestCancel Source #

Arguments

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

request: a FileChooserRequest

-> m () 

Ask WebKit to cancel the request.

It's important to do this in case no selection has been made in the client, otherwise the request won't be properly completed and the browser will keep the request pending forever, which might cause the browser to hang.

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 WebKit and should not be modified or freed.

Get the list of MIME types the file chooser dialog should handle.

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.

getMimeTypesFilter

fileChooserRequestGetMimeTypesFilter Source #

Arguments

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

request: a FileChooserRequest

-> m (Maybe FileFilter)

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

Get the filter currently associated with the request.

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.

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.

Whether the file chooser should allow selecting multiple files.

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.

getSelectedFiles

fileChooserRequestGetSelectedFiles Source #

Arguments

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

request: a FileChooserRequest

-> m (Maybe [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 WebKit and should not be modified or freed.

Get the list of selected files associated to the request.

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.

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.

Properties

filter

The filter currently associated with the request. See fileChooserRequestGetMimeTypesFilter for more details.

getFileChooserRequestFilter :: (MonadIO m, IsFileChooserRequest o) => o -> m (Maybe FileFilter) Source #

Get the value of the “filter” property. When overloading is enabled, this is equivalent to

get fileChooserRequest #filter

mimeTypes

A Nothing-terminated array of strings containing the list of MIME types the file chooser dialog should handle. See fileChooserRequestGetMimeTypes for more details.

getFileChooserRequestMimeTypes :: (MonadIO m, IsFileChooserRequest o) => o -> m [Text] Source #

Get the value of the “mime-types” property. When overloading is enabled, this is equivalent to

get fileChooserRequest #mimeTypes

selectMultiple

Whether the file chooser should allow selecting multiple files. See fileChooserRequestGetSelectMultiple for more details.

getFileChooserRequestSelectMultiple :: (MonadIO m, IsFileChooserRequest o) => o -> m Bool Source #

Get the value of the “select-multiple” property. When overloading is enabled, this is equivalent to

get fileChooserRequest #selectMultiple

selectedFiles

A Nothing-terminated array of strings containing the list of selected files associated to the current request. See fileChooserRequestGetSelectedFiles for more details.

getFileChooserRequestSelectedFiles :: (MonadIO m, IsFileChooserRequest o) => o -> m (Maybe [Text]) Source #

Get the value of the “selected-files” property. When overloading is enabled, this is equivalent to

get fileChooserRequest #selectedFiles