diff --git a/deluge/ui/web/js/deluge-all/OtherLimitWindow.js b/deluge/ui/web/js/deluge-all/OtherLimitWindow.js index 8769fe012..aee1b4246 100644 --- a/deluge/ui/web/js/deluge-all/OtherLimitWindow.js +++ b/deluge/ui/web/js/deluge-all/OtherLimitWindow.js @@ -71,6 +71,7 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, { this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Ok'), this.onOkClick, this); + this.afterMethod('show', this.doFocusField, this); }, setValue: function(value) { @@ -91,5 +92,9 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, { } }); this.hide(); + }, + + doFocusField: function() { + this.form.getForm().findField('limit').focus(true, 10); } }); diff --git a/deluge/ui/web/js/deluge-all/StatusbarMenu.js b/deluge/ui/web/js/deluge-all/StatusbarMenu.js index 092181e1b..78adf9bd1 100644 --- a/deluge/ui/web/js/deluge-all/StatusbarMenu.js +++ b/deluge/ui/web/js/deluge-all/StatusbarMenu.js @@ -44,7 +44,11 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { this.items.each(function(item) { if (item.getXType() != 'menucheckitem') return; - item.on('checkchange', this.onLimitChanged, this); + if (item.value == 'other') { + item.on('click', this.onOtherClicked, this); + } else { + item.on('checkchange', this.onLimitChanged, this); + } }, this); }, @@ -78,20 +82,19 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { }, onLimitChanged: function(item, checked) { - if (!checked) return; // we don't care about unchecks + if (!checked || item.value == 'other') return; // we don't care about unchecks or other + var config = {} + config[item.group] = item.value + deluge.client.core.set_config(config, { + success: function() { + deluge.ui.update(); + } + }); + }, - if (item.value == 'other') { - this.otherWin.group = item.group; - this.otherWin.setValue(this.value); - this.otherWin.show(); - } else { - config = {} - config[item.group] = item.value - deluge.client.core.set_config(config, { - success: function() { - deluge.ui.update(); - } - }); - } + onOtherClicked: function(item, e) { + this.otherWin.group = item.group; + this.otherWin.setValue(this.value); + this.otherWin.show(); } });