Author: damoxc
Revision: 4960
Log:
add removing a torrent from the dialog
Diff:
Modified: trunk/deluge/ui/web/js/deluge-add.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-add.js 2009-03-31 00:41:05 UTC (rev
4959)
+++ trunk/deluge/ui/web/js/deluge-add.js 2009-03-31 00:51:43 UTC (rev
4960)
@@ -24,6 +24,15 @@
Deluge.Add = {
torrents: new Hash(),
+ clearFiles: function() {
+ var root = this.Files.getRootNode();
+ if (!root.hasChildNodes()) return;
+ root.cascade(function(node) {
+ if (!node.parentNode || !node.getOwnerTree()) return;
+ node.remove();
+ });
+ },
+
onAdd: function() {
torrents = new Array();
this.torrents.each(function(info, hash) {
@@ -69,13 +78,8 @@
});
}
- var root = Deluge.Add.Files.getRootNode();
- if (!root.hasChildNodes()) return;
- root.cascade(function(node) {
- if (!node.parentNode || !node.getOwnerTree()) return;
- node.remove();
- });
- walk(torrentInfo['files'], root);
+ this.clearFiles();
+ walk(torrentInfo['files'], this.Files.getRootNode());
},
onTorrentAdded: function(info) {
@@ -88,7 +92,13 @@
},
onRemove: function() {
+ var selection = this.Grid.getSelectionModel();
+ if (!selection.hasSelection()) return;
+ var torrent = selection.getSelected();
+ delete this.torrents[torrent.id];
+ this.Store.remove(torrent);
+ this.clearFiles();
}
}
@@ -132,7 +142,7 @@
stripeRows: true,
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true,
- listeners: {'rowselect': Deluge.Add.onSelect}
+ listeners: {'rowselect': {fn: Deluge.Add.onSelect, scope:
Deluge.Add}}
}),
hideHeaders: true,
autoExpandColumn: 'torrent',
@@ -162,7 +172,9 @@
id: 'remove',
cls: 'x-btn-text-icon',
text: _('Remove'),
- icon: '/icons/remove.png'
+ icon: '/icons/remove.png',
+ handler: Deluge.Add.onRemove,
+ scope: Deluge.Add
}
]
})
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---