Merge branch 'pr/607'
This commit is contained in:
@@ -2,7 +2,8 @@ module.exports = {
|
|||||||
openSeedFile,
|
openSeedFile,
|
||||||
openSeedDirectory,
|
openSeedDirectory,
|
||||||
openTorrentFile,
|
openTorrentFile,
|
||||||
openTorrentAddress
|
openTorrentAddress,
|
||||||
|
openAddFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
var electron = require('electron')
|
var electron = require('electron')
|
||||||
@@ -83,6 +84,24 @@ function openTorrentAddress () {
|
|||||||
windows.main.dispatch('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.
|
* Dialogs on do not show a title on OS X, so the window title is used instead.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ function init () {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ipc.on('openTorrentFile', () => dialog.openTorrentFile())
|
ipc.on('openTorrentFile', () => dialog.openTorrentFile())
|
||||||
|
ipc.on('openAddFiles', () => dialog.openAddFiles())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dock
|
* Dock
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ function dispatch (action, ...args) {
|
|||||||
if (action === 'openTorrentFile') {
|
if (action === 'openTorrentFile') {
|
||||||
ipcRenderer.send('openTorrentFile') /* open torrent file */
|
ipcRenderer.send('openTorrentFile') /* open torrent file */
|
||||||
}
|
}
|
||||||
|
if (action === 'openAddFiles') {
|
||||||
|
ipcRenderer.send('openAddFiles') /* add files with dialog */
|
||||||
|
}
|
||||||
if (action === 'showCreateTorrent') {
|
if (action === 'showCreateTorrent') {
|
||||||
showCreateTorrent(args[0] /* paths */)
|
showCreateTorrent(args[0] /* paths */)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function Header (state) {
|
|||||||
<i
|
<i
|
||||||
class='icon add'
|
class='icon add'
|
||||||
title='Add torrent'
|
title='Add torrent'
|
||||||
onclick=${dispatcher('openTorrentFile')}>
|
onclick=${dispatcher('openAddFiles')}>
|
||||||
add
|
add
|
||||||
</i>
|
</i>
|
||||||
`
|
`
|
||||||
|
|||||||
Reference in New Issue
Block a user