Make add button accept non .torrent files

This commit is contained in:
Mathias Rasmussen
2016-05-31 03:04:02 +02:00
parent 1b8f180255
commit 556d0cb1c5
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.
*/