FileChooserRequest

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 #GtkFileChooserDialog (which might be not desirable in some cases, which could prefer to use their own file chooser dialog), WebKit will fire the #WebKitWebView::run-file-chooser signal with a #WebKitFileChooserRequest 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 #GtkFileChooserDialog for the user to interact with.

Constructors

this
this(WebKitFileChooserRequest* webKitFileChooserRequest, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Functions

cancel
void cancel()

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.

getFileChooserRequestStruct
WebKitFileChooserRequest* getFileChooserRequestStruct(bool transferOwnership)

Get the main Gtk struct

getMimeTypes
string[] getMimeTypes()

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
FileFilter getMimeTypesFilter()

Get the filter currently associated with the request, ready to be used by #GtkFileChooser. 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.

getSelectMultiple
bool getSelectMultiple()

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

getSelectedFiles
string[] getSelectedFiles()

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.

getStruct
void* getStruct()

the main Gtk struct as a void*

selectFiles
void selectFiles(string[] files)

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

Static functions

getType
GType getType()

Variables

webKitFileChooserRequest
WebKitFileChooserRequest* webKitFileChooserRequest;

the main Gtk struct

Meta