From 713953ec0309b32053ae94107fe9331cbf1252c1 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Tue, 4 Oct 2011 18:34:14 +0100 Subject: web: fix the toolbar actions Use the proper method for getting the torrent ids instead of the implementation within the toolbar. Using the one on the torrent grid will be more likely to work. --- deluge/ui/web/js/deluge-all/Toolbar.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/Toolbar.js b/deluge/ui/web/js/deluge-all/Toolbar.js index a95f2a381..0cdf6a27d 100644 --- a/deluge/ui/web/js/deluge-all/Toolbar.js +++ b/deluge/ui/web/js/deluge-all/Toolbar.js @@ -1,6 +1,6 @@ /*! * Deluge.Toolbar.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This program is free software; you can redistribute it and/or modify @@ -116,53 +116,49 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { connectedButtons: [ 'add', 'remove', 'pause', 'resume', 'up', 'down' ], - + initComponent: function() { Deluge.Toolbar.superclass.initComponent.call(this); deluge.events.on('connect', this.onConnect, this); deluge.events.on('login', this.onLogin, this); }, - + onConnect: function() { Ext.each(this.connectedButtons, function(buttonId) { this.items.get(buttonId).enable(); }, this); }, - + onDisconnect: function() { Ext.each(this.connectedButtons, function(buttonId) { this.items.get(buttonId).disable(); }, this); }, - + onLogin: function() { this.items.get('logout').enable(); }, - + onLogout: function() { this.items.get('logout').disable(); deluge.login.logout(); }, - + onConnectionManagerClick: function() { deluge.connectionManager.show(); }, - + onHelpClick: function() { window.open('http://dev.deluge-torrent.org/wiki/UserGuide'); }, - + onPreferencesClick: function() { deluge.preferences.show(); }, - + onTorrentAction: function(item) { - var selection = deluge.torrents.getSelections(); - var ids = []; - Ext.each(selection, function(record) { - ids.push(record.id); - }); - + var ids = deluge.torrents.getSelectedIds(); + switch (item.id) { case 'remove': deluge.removeWindow.show(ids); @@ -185,7 +181,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { break; } }, - + onTorrentAdd: function() { deluge.add.show(); } -- cgit