remove a torrent from the grid as well as displaying an error message

This commit is contained in:
Damien Churchill 2010-03-14 00:44:04 +00:00
parent 450d526eca
commit e2840148af
1 changed files with 7 additions and 7 deletions

View File

@ -535,6 +535,7 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
}, },
onTorrentAdd: function(torrentId, info) { onTorrentAdd: function(torrentId, info) {
var r = this.grid.getStore().getById(torrentId);
if (!info) { if (!info) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('Error'), title: _('Error'),
@ -544,14 +545,13 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error'
}); });
return; this.grid.getStore().remove(r);
} } else {
var r = this.grid.getStore().getById(torrentId);
r.set('info_hash', info['info_hash']); r.set('info_hash', info['info_hash']);
r.set('text', info['name']); r.set('text', info['name']);
this.grid.getStore().commitChanges(); this.grid.getStore().commitChanges();
this.optionsPanel.addTorrent(info); this.optionsPanel.addTorrent(info);
}
}, },
onUrl: function(button, event) { onUrl: function(button, event) {