fix setting the download priority for files in the files tab

This commit is contained in:
Damien Churchill 2009-05-27 11:49:27 +00:00
parent 668683f369
commit 91a471e781
1 changed files with 4 additions and 8 deletions

View File

@ -129,26 +129,22 @@ Copyright:
default: default:
var indexes = {}; var indexes = {};
function walk(node) { function walk(node) {
if (!node.attributes.fileIndex) return; if (Ext.isEmpty(node.attributes.fileIndex)) return;
indexes[node.attributes.fileIndex] = node.attributes.priority; indexes[node.attributes.fileIndex] = node.attributes.priority;
} }
this.getRootNode().cascade(walk); this.getRootNode().cascade(walk);
var nodes = this.getSelectionModel().getSelectedNodes(); var nodes = this.getSelectionModel().getSelectedNodes();
Ext.each(nodes, function(node) { Ext.each(nodes, function(node) {
if (!node.attributes.fileIndex) return; if (Ext.isEmpty(node.attributes.fileIndex)) return;
indexes[node.attributes.fileIndex] = baseItem.filePriority; indexes[node.attributes.fileIndex] = baseItem.filePriority;
}); });
alert(Ext.keys(indexes)); var priorities = new Array(Ext.keys(indexes).length);
priorities = new Array(Ext.keys(indexes).length);
for (var index in indexes) { for (var index in indexes) {
priorities[index] = indexes[index]; priorities[index] = indexes[index];
} }
alert(this.torrentId);
alert(priorities);
Deluge.Client.core.set_torrent_file_priorities(this.torrentId, priorities, { Deluge.Client.core.set_torrent_file_priorities(this.torrentId, priorities, {
success: function() { success: function() {
Ext.each(nodes, function(node) { Ext.each(nodes, function(node) {