Don't default to "Open", "Save", just let OS decide

This commit is contained in:
Ben Gotow 2016-05-15 01:01:52 -05:00
parent 40c531737d
commit 84cce6c2c1
4 changed files with 9 additions and 13 deletions

View file

@ -76,11 +76,7 @@ module.exports = {
throw new TypeError('Title must be a string')
}
if (options.buttonLabel == null) {
if (options.properties.indexOf('openDirectory') !== -1) {
options.buttonLabel = 'Choose'
} else {
options.buttonLabel = 'Open'
}
options.buttonLabel = ''
} else if (typeof options.buttonLabel !== 'string') {
throw new TypeError('buttonLabel must be a string')
}
@ -95,7 +91,7 @@ module.exports = {
wrappedCallback = typeof callback === 'function' ? function (success, result) {
return callback(success ? result : void 0)
} : null
return binding.showOpenDialog(String(options.title), String(options.buttonLabel), String(options.defaultPath), options.filters, properties, window, wrappedCallback)
return binding.showOpenDialog(options.title, options.buttonLabel, options.defaultPath, options.filters, properties, window, wrappedCallback)
},
showSaveDialog: function (...args) {
@ -113,7 +109,7 @@ module.exports = {
throw new TypeError('Title must be a string')
}
if (options.buttonLabel == null) {
options.buttonLabel = 'Save'
options.buttonLabel = ''
} else if (typeof options.buttonLabel !== 'string') {
throw new TypeError('buttonLabel must be a string')
}
@ -128,7 +124,7 @@ module.exports = {
wrappedCallback = typeof callback === 'function' ? function (success, result) {
return callback(success ? result : void 0)
} : null
return binding.showSaveDialog(String(options.title), String(options.buttonLabel), String(options.defaultPath), options.filters, window, wrappedCallback)
return binding.showSaveDialog(options.title, options.buttonLabel, options.defaultPath, options.filters, window, wrappedCallback)
},
showMessageBox: function (...args) {