Author: damoxc
Revision: 4925
Log:
display the torrent files in the tree
Diff:
Modified: trunk/deluge/ui/web/js/deluge-add.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-add.js 2009-03-23 22:18:01 UTC (rev
4924)
+++ trunk/deluge/ui/web/js/deluge-add.js 2009-03-23 22:32:48 UTC (rev
4925)
@@ -36,6 +36,8 @@
onSuccess: function(result) {
}
})
+ this.Store.loadData([]);
+ this.torrents.empty();
this.Window.hide();
},
@@ -43,6 +45,32 @@
},
+ 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) {
this.Store.loadData([[info['info_hash'], info['name']]], true);
this.torrents[info['info_hash']] = info;
@@ -50,6 +78,10 @@
onUrl: function(button, event) {
this.Url.Window.show();
+ },
+
+ onRemove: function() {
+
}
}
@@ -74,14 +106,8 @@
dataIndex: 'size'
}],
- loader: new Deluge.FilesTreeLoader({
- uiProviders: {
- 'col': Ext.tree.ColumnNodeUI
- }
- }),
-
- root: new Ext.tree.AsyncTreeNode({
- text:'Tasks'
+ root: new Ext.tree.TreeNode({
+ text: 'Files'
})
})
@@ -101,7 +127,7 @@
stripeRows: true,
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true,
- listeners: {'rowselect': Deluge.Connections.onSelect}
+ listeners: {'rowselect': Deluge.Add.onSelect}
}),
hideHeaders: true,
autoExpandColumn: 'torrent',
@@ -229,7 +255,10 @@
iconCls: 'x-deluge-add-window-icon',
items: [Deluge.Add.Grid, Deluge.Add.Options],
buttons: [{
- text: _('Cancel')
+ text: _('Cancel'),
+ handler: function() {
+ Deluge.Add.Window.hide();
+ }
}, {
text: _('Add'),
handler: Deluge.Add.onAdd,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---