clear the files tree on add/cancel

This commit is contained in:
Damien Churchill 2009-04-02 19:28:27 +00:00
parent a7ad189bd0
commit b07715862f
1 changed files with 8 additions and 2 deletions

View File

@ -24,6 +24,12 @@ Copyright:
Deluge.Add = { Deluge.Add = {
torrents: new Hash(), torrents: new Hash(),
clear: function() {
this.clearFiles();
this.Store.loadData([]);
this.torrents.empty();
},
clearFiles: function() { clearFiles: function() {
var root = this.Files.getRootNode(); var root = this.Files.getRootNode();
if (!root.hasChildNodes()) return; if (!root.hasChildNodes()) return;
@ -45,8 +51,7 @@ Deluge.Add = {
onSuccess: function(result) { onSuccess: function(result) {
} }
}) })
this.Store.loadData([]); this.clear();
this.torrents.empty();
this.Window.hide(); this.Window.hide();
}, },
@ -350,6 +355,7 @@ Deluge.Add.Window = new Ext.Window({
buttons: [{ buttons: [{
text: _('Cancel'), text: _('Cancel'),
handler: function() { handler: function() {
Deluge.Add.clear();
Deluge.Add.Window.hide(); Deluge.Add.Window.hide();
} }
}, { }, {