From 8fcfa3b97a6f33bcb9cc5f54974a0279bbda2071 Mon Sep 17 00:00:00 2001 From: gabriel Date: Sat, 7 May 2016 22:05:46 +0200 Subject: [PATCH] Allow to torrent a single file --- main/menu.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/main/menu.js b/main/menu.js index 5b06d8e0..7c5c33cf 100644 --- a/main/menu.js +++ b/main/menu.js @@ -108,6 +108,18 @@ function getMenuItem (label) { } } +// Prompts the user for a file, then makes a torrent out of the data +function showOpenSeedFile () { + electron.dialog.showOpenDialog({ + title: 'Select a file for the torrent file', + properties: ['openFile'] + }, function (filenames) { + if (!Array.isArray(filenames)) return + var file = filenames[0] + windows.main.send('dispatch', 'showCreateTorrent', file) + }) +} + // Prompts the user for a file or folder, then makes a torrent out of the data function showOpenSeedFiles () { // Allow only a single selection @@ -144,7 +156,12 @@ function showOpenTorrentAddress () { function getAppMenuTemplate () { var fileMenu = [ { - label: 'Create New Torrent...', + label: 'Create New Torrent from File', + accelerator: 'CmdOrCtrl+F', + click: showOpenSeedFile + }, + { + label: 'Create New Torrent from Folder', accelerator: 'CmdOrCtrl+N', click: showOpenSeedFiles },