mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
add removing a torrent from the dialog
This commit is contained in:
parent
e608db8ce2
commit
44188cf276
1 changed files with 21 additions and 9 deletions
|
@ -24,6 +24,15 @@ Copyright:
|
||||||
Deluge.Add = {
|
Deluge.Add = {
|
||||||
torrents: new Hash(),
|
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() {
|
onAdd: function() {
|
||||||
torrents = new Array();
|
torrents = new Array();
|
||||||
this.torrents.each(function(info, hash) {
|
this.torrents.each(function(info, hash) {
|
||||||
|
@ -69,13 +78,8 @@ Deluge.Add = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var root = Deluge.Add.Files.getRootNode();
|
this.clearFiles();
|
||||||
if (!root.hasChildNodes()) return;
|
walk(torrentInfo['files'], this.Files.getRootNode());
|
||||||
root.cascade(function(node) {
|
|
||||||
if (!node.parentNode || !node.getOwnerTree()) return;
|
|
||||||
node.remove();
|
|
||||||
});
|
|
||||||
walk(torrentInfo['files'], root);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onTorrentAdded: function(info) {
|
onTorrentAdded: function(info) {
|
||||||
|
@ -88,7 +92,13 @@ Deluge.Add = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onRemove: function() {
|
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 @@ 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.Add.onSelect}
|
listeners: {'rowselect': {fn: Deluge.Add.onSelect, scope: Deluge.Add}}
|
||||||
}),
|
}),
|
||||||
hideHeaders: true,
|
hideHeaders: true,
|
||||||
autoExpandColumn: 'torrent',
|
autoExpandColumn: 'torrent',
|
||||||
|
@ -162,7 +172,9 @@ Deluge.Add.Grid = new Ext.grid.GridPanel({
|
||||||
id: 'remove',
|
id: 'remove',
|
||||||
cls: 'x-btn-text-icon',
|
cls: 'x-btn-text-icon',
|
||||||
text: _('Remove'),
|
text: _('Remove'),
|
||||||
icon: '/icons/remove.png'
|
icon: '/icons/remove.png',
|
||||||
|
handler: Deluge.Add.onRemove,
|
||||||
|
scope: Deluge.Add
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue