Merge remote-tracking branch 'origin/master' into macos-open-save-panel

This commit is contained in:
Kevin Sawicki 2017-02-09 11:25:05 -08:00
commit f7f4de36af
17 changed files with 317 additions and 353 deletions

View file

@ -127,9 +127,9 @@ module.exports = {
const wrappedCallback = typeof callback === 'function' ? function (success, result) {
return callback(success ? result : void 0)
} : null
return binding.showOpenDialog(title, buttonLabel, defaultPath, filters,
dialogProperties, message, window,
wrappedCallback)
const settings = {title, buttonLabel, defaultPath, filters, message, window}
settings.properties = dialogProperties
return binding.showOpenDialog(settings, wrappedCallback)
},
showSaveDialog: function (...args) {
@ -187,9 +187,8 @@ module.exports = {
const wrappedCallback = typeof callback === 'function' ? function (success, result) {
return callback(success ? result : void 0)
} : null
return binding.showSaveDialog(title, buttonLabel, defaultPath, filters,
message, nameFieldLabel, showsTagField,
window, wrappedCallback)
const settings = {title, buttonLabel, defaultPath, filters, message, nameFieldLabel, showsTagField, window}
return binding.showSaveDialog(settings, wrappedCallback)
},
showMessageBox: function (...args) {
@ -203,7 +202,10 @@ module.exports = {
}
}
let {buttons, cancelId, defaultId, detail, icon, message, title, type} = options
let {
buttons, cancelId, checkboxLabel, checkboxChecked, defaultId, detail,
icon, message, title, type
} = options
if (type == null) {
type = 'none'
@ -242,6 +244,14 @@ module.exports = {
throw new TypeError('Detail must be a string')
}
checkboxChecked = !!checkboxChecked
if (checkboxLabel == null) {
checkboxLabel = ''
} else if (typeof checkboxLabel !== 'string') {
throw new TypeError('checkboxLabel must be a string')
}
if (icon == null) {
icon = null
}
@ -264,8 +274,8 @@ module.exports = {
const flags = options.noLink ? messageBoxOptions.noLink : 0
return binding.showMessageBox(messageBoxType, buttons, defaultId, cancelId,
flags, title, message, detail, icon, window,
callback)
flags, title, message, detail, checkboxLabel,
checkboxChecked, icon, window, callback)
},
showErrorBox: function (...args) {