Merge branch 'pr/607'

This commit is contained in:
Feross Aboukhadijeh
2016-05-31 11:55:04 -07:00
4 changed files with 25 additions and 2 deletions

View File

@@ -2,7 +2,8 @@ module.exports = {
openSeedFile,
openSeedDirectory,
openTorrentFile,
openTorrentAddress
openTorrentAddress,
openAddFiles
}
var electron = require('electron')
@@ -83,6 +84,24 @@ function openTorrentAddress () {
windows.main.dispatch('openTorrentAddress')
}
/*
* Show open dialog for all file types (.torrent, files to seed)
*/
function openAddFiles () {
if (!windows.main.win) return
log('openAddFiles')
var opts = {
title: 'Select a .torrent file to open or start seeding files.',
properties: [ 'openFile', 'multiSelections' ]
}
setTitle(opts.title)
electron.dialog.showOpenDialog(windows.main.win, opts, function (selectedPaths) {
resetTitle()
if (!Array.isArray(selectedPaths)) return
windows.main.dispatch('onOpen', selectedPaths)
})
}
/**
* Dialogs on do not show a title on OS X, so the window title is used instead.
*/

View File

@@ -46,6 +46,7 @@ function init () {
*/
ipc.on('openTorrentFile', () => dialog.openTorrentFile())
ipc.on('openAddFiles', () => dialog.openAddFiles())
/**
* Dock