From fe6bcd62bee8b75bd271ce54d317b4f6fe2246cb Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sat, 23 Jan 2010 20:34:32 +0000 Subject: [PATCH] remove all the torrents from the store upon logout --- deluge/ui/web/js/Deluge.Torrents.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deluge/ui/web/js/Deluge.Torrents.js b/deluge/ui/web/js/Deluge.Torrents.js index eead22a23..6968d2261 100644 --- a/deluge/ui/web/js/Deluge.Torrents.js +++ b/deluge/ui/web/js/Deluge.Torrents.js @@ -209,6 +209,8 @@ Copyright: initComponent: function() { Ext.deluge.TorrentGrid.superclass.initComponent.call(this); Deluge.Events.on('torrentRemoved', this.onTorrentRemoved, this); + Deluge.Events.on('logout', this.onDisconnect, this); + this.on('rowcontextmenu', function(grid, rowIndex, e) { e.stopEvent(); var selection = grid.getSelectionModel(); @@ -222,11 +224,11 @@ Copyright: /** * Returns the record representing the torrent at the specified index. * - * @param {int} The row index of the torrent you wish to retrieve. + * @param index {int} The row index of the torrent you wish to retrieve. * @return {Ext.data.Record} The record representing the torrent. */ - getTorrent: function(rowIndex) { - return this.getStore().getAt(rowIndex); + getTorrent: function(index) { + return this.getStore().getAt(index); }, getSelected: function() { @@ -245,6 +247,10 @@ Copyright: } }, + onDisconnect: function() { + this.getStore().removeAll(); + }, + // private onTorrentRemoved: function(torrentIds) { var selModel = this.getSelectionModel();