This commit is contained in:
Cheng Zhao 2013-09-23 16:51:00 +08:00
Π ΠΎΠ΄ΠΈΡ‚Π΅Π»ΡŒ 76ac8f2719
ΠšΠΎΠΌΠΌΠΈΡ‚ f444e9dc74
1 ΠΈΠ·ΠΌΠ΅Π½Ρ‘Π½Π½Ρ‹Ρ… Ρ„Π°ΠΉΠ»ΠΎΠ²: 19 Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠΉ ΠΈ 17 ΡƒΠ΄Π°Π»Π΅Π½ΠΈΠΉ

ΠŸΡ€ΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ Ρ„Π°ΠΉΠ»

@ -8,54 +8,56 @@ messageBoxTypes = ['none', 'info', 'warning']
module.exports =
showOpenDialog: (window, options, callback) ->
if window? and window.constructor isnt BrowserWindow
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
options = title: 'Open', properties: ['openFile'] unless options?
options.properties = options.properties ? ['openFile']
options ?= title: 'Open', properties: ['openFile']
options.properties ?= ['openFile']
throw new TypeError('Properties need to be array') unless Array.isArray options.properties
properties = 0
for prop, value of fileDialogProperties
properties |= value if prop in options.properties
options.title = options.title ? ''
options.defaultPath = options.defaultPath ? ''
options.title ?= ''
options.defaultPath ?= ''
binding.showOpenDialog options.title,
options.defaultPath,
binding.showOpenDialog String(options.title),
String(options.defaultPath),
properties,
window
showSaveDialog: (window, options) ->
throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow
options = title: 'Save' unless options?
options.title = options.title ? ''
options.defaultPath = options.defaultPath ? ''
options ?= title: 'Save'
options.title ?= ''
options.defaultPath ?= ''
binding.showSaveDialog window, options.title, options.defaultPath
binding.showSaveDialog window,
String(options.title),
String(options.defaultPath)
showMessageBox: (window, options, callback) ->
if window? and window.constructor isnt BrowserWindow
unless window?.constructor is BrowserWindow
# Shift.
callback = options
options = window
window = null
options = type: 'none' unless options?
options.type = options.type ? 'none'
options ?= type: 'none'
options.type ?= 'none'
options.type = messageBoxTypes.indexOf options.type
throw new TypeError('Invalid message box type') unless options.type > -1
throw new TypeError('Buttons need to be array') unless Array.isArray options.buttons
options.title = options.title ? ''
options.message = options.message ? ''
options.detail = options.detail ? ''
options.title ?= ''
options.message ?= ''
options.detail ?= ''
binding.showMessageBox options.type,
options.buttons,