feat: add methods to allow customization of save dialog during will-download event (#15497)

* feat: add method to DownloadItem that allows customization of dialog options

* docs: add docs for get/setSaveDialogOptions

* add missing copy constructor for DialogSettings on mac and linux

* fix: don't filter dialog options for mas build, don't return properties

* test: add test for get/setSaveDialogOptions

* fix: remove openDevtools added for debugging

* test: fix failing test because of new event parameter

* docs: use SaveDialogOptions instead of Object
This commit is contained in:
Heilig Benedek 2018-11-08 15:51:06 +01:00 committed by John Kleinschmidt
parent 673004b878
commit ca2d74e118
13 changed files with 203 additions and 49 deletions

View file

@ -88,6 +88,19 @@ Returns `String` - The save path of the download item. This will be either the p
set via `downloadItem.setSavePath(path)` or the path selected from the shown
save dialog.
#### `downloadItem.setSaveDialogOptions(options)`
* `options` SaveDialogOptions - Set the save file dialog options. This object has the same
properties as the `options` parameter of [`dialog.showSaveDialog()`](dialog.md).
This API allows the user to set custom options for the save dialog that opens
for the download item by default.
The API is only available in session's `will-download` callback function.
#### `downloadItem.getSaveDialogOptions()`
Returns `SaveDialogOptions` - Returns the object previously set by `downloadItem.setSaveDialogOptions(options)`.
#### `downloadItem.pause()`
Pauses the download.