Add copy options to webui context menu (addresses #6815) (#7036)

* Add copy options to webui context menu
Add Copy Hash to gui (closes #6964)

* Use switch statement

* Use camel case, switch from signal to qaction.

* Rename variable

* Change variable name
This commit is contained in:
Tom Piccirello 2017-08-06 04:35:12 -04:00 committed by Mike Tzou
parent 08aa827366
commit 145641ac41
8 changed files with 90 additions and 0 deletions

View file

@ -451,6 +451,36 @@ initializeWindows = function() {
}
};
copyNameFN = function() {
var selectedRows = torrentsTable.selectedRowsIds();
var names = [];
if (selectedRows.length) {
var rows = torrentsTable.getFilteredAndSortedRows();
for (var i = 0; i < selectedRows.length; i++) {
var hash = selectedRows[i];
names.push(rows[hash].full_data.name);
}
}
return names.join("\n");
};
copyMagnetLinkFN = function() {
var selectedRows = torrentsTable.selectedRowsIds();
var magnets = [];
if (selectedRows.length) {
var rows = torrentsTable.getFilteredAndSortedRows();
for (var i = 0; i < selectedRows.length; i++) {
var hash = selectedRows[i];
magnets.push(rows[hash].full_data.magnet_uri);
}
}
return magnets.join("\n");
};
copyHashFN = function() {
return torrentsTable.selectedRowsIds().join("\n");
};
['pauseAll', 'resumeAll'].each(function(item) {
addClickEvent(item, function(e) {
new Event(e).stop();