menu: open torrent file dialog comes from main window
This commit is contained in:
4
index.js
4
index.js
@@ -101,11 +101,11 @@ var template = [
|
|||||||
label: 'Open Torrent File...',
|
label: 'Open Torrent File...',
|
||||||
accelerator: 'CmdOrCtrl+O',
|
accelerator: 'CmdOrCtrl+O',
|
||||||
click: function () {
|
click: function () {
|
||||||
electron.dialog.showOpenDialog({
|
electron.dialog.showOpenDialog(mainWindow, {
|
||||||
title: 'Select a .torrent file to open.',
|
title: 'Select a .torrent file to open.',
|
||||||
properties: [ 'openFile', 'multiSelections' ]
|
properties: [ 'openFile', 'multiSelections' ]
|
||||||
}, function (filenames) {
|
}, function (filenames) {
|
||||||
if (!Array.isArary(filenames)) return
|
if (!Array.isArray(filenames)) return
|
||||||
filenames.forEach(function (filename) {
|
filenames.forEach(function (filename) {
|
||||||
mainWindow.send('action', 'addTorrent', filename)
|
mainWindow.send('action', 'addTorrent', filename)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user