display the torrent files in the tree
This commit is contained in:
parent
9808302214
commit
2e1cc51f70
|
@ -36,6 +36,8 @@ Deluge.Add = {
|
||||||
onSuccess: function(result) {
|
onSuccess: function(result) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.Store.loadData([]);
|
||||||
|
this.torrents.empty();
|
||||||
this.Window.hide();
|
this.Window.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -43,6 +45,32 @@ Deluge.Add = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSelect: function(selModel, rowIndex, record) {
|
||||||
|
var torrentInfo = Deluge.Add.torrents[record.id];
|
||||||
|
|
||||||
|
function walk(files, parent) {
|
||||||
|
$each(files, function(item, file) {
|
||||||
|
if ($type(item) == 'object') {
|
||||||
|
var child = new Ext.tree.TreeNode({
|
||||||
|
filename: file,
|
||||||
|
text: file
|
||||||
|
});
|
||||||
|
walk(item, child);
|
||||||
|
parent.appendChild(child);
|
||||||
|
} else {
|
||||||
|
parent.appendChild(new Ext.tree.TreeNode({
|
||||||
|
enabled: item[1],
|
||||||
|
filename: file,
|
||||||
|
size: item[0],
|
||||||
|
leaf: true,
|
||||||
|
text: file
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
walk(torrentInfo['files'], Deluge.Add.Files.getRootNode());
|
||||||
|
},
|
||||||
|
|
||||||
onTorrentAdded: function(info) {
|
onTorrentAdded: function(info) {
|
||||||
this.Store.loadData([[info['info_hash'], info['name']]], true);
|
this.Store.loadData([[info['info_hash'], info['name']]], true);
|
||||||
this.torrents[info['info_hash']] = info;
|
this.torrents[info['info_hash']] = info;
|
||||||
|
@ -50,6 +78,10 @@ Deluge.Add = {
|
||||||
|
|
||||||
onUrl: function(button, event) {
|
onUrl: function(button, event) {
|
||||||
this.Url.Window.show();
|
this.Url.Window.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
onRemove: function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,14 +106,8 @@ Deluge.Add.Files = new Ext.tree.ColumnTree({
|
||||||
dataIndex: 'size'
|
dataIndex: 'size'
|
||||||
}],
|
}],
|
||||||
|
|
||||||
loader: new Deluge.FilesTreeLoader({
|
root: new Ext.tree.TreeNode({
|
||||||
uiProviders: {
|
text: 'Files'
|
||||||
'col': Ext.tree.ColumnNodeUI
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
root: new Ext.tree.AsyncTreeNode({
|
|
||||||
text:'Tasks'
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -101,7 +127,7 @@ Deluge.Add.Grid = new Ext.grid.GridPanel({
|
||||||
stripeRows: true,
|
stripeRows: true,
|
||||||
selModel: new Ext.grid.RowSelectionModel({
|
selModel: new Ext.grid.RowSelectionModel({
|
||||||
singleSelect: true,
|
singleSelect: true,
|
||||||
listeners: {'rowselect': Deluge.Connections.onSelect}
|
listeners: {'rowselect': Deluge.Add.onSelect}
|
||||||
}),
|
}),
|
||||||
hideHeaders: true,
|
hideHeaders: true,
|
||||||
autoExpandColumn: 'torrent',
|
autoExpandColumn: 'torrent',
|
||||||
|
@ -229,7 +255,10 @@ Deluge.Add.Window = new Ext.Window({
|
||||||
iconCls: 'x-deluge-add-window-icon',
|
iconCls: 'x-deluge-add-window-icon',
|
||||||
items: [Deluge.Add.Grid, Deluge.Add.Options],
|
items: [Deluge.Add.Grid, Deluge.Add.Options],
|
||||||
buttons: [{
|
buttons: [{
|
||||||
text: _('Cancel')
|
text: _('Cancel'),
|
||||||
|
handler: function() {
|
||||||
|
Deluge.Add.Window.hide();
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
text: _('Add'),
|
text: _('Add'),
|
||||||
handler: Deluge.Add.onAdd,
|
handler: Deluge.Add.onAdd,
|
||||||
|
|
Loading…
Reference in New Issue