From e05e0b4e35ff9686370228221ecfc58377a7549d Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 20 Aug 2009 01:08:09 +0000 Subject: [PATCH] add support for binding an option to multiple fields --- deluge/ui/web/js/Deluge.OptionsManager.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/deluge/ui/web/js/Deluge.OptionsManager.js b/deluge/ui/web/js/Deluge.OptionsManager.js index 45cda078e..d90d54057 100644 --- a/deluge/ui/web/js/Deluge.OptionsManager.js +++ b/deluge/ui/web/js/Deluge.OptionsManager.js @@ -78,7 +78,8 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {Ext.form.Field} field */ bind: function(option, field) { - this.binds[option] = field; + this.binds[option] = this.binds[option] || []; + this.binds[option].push(field); field._doption = option; field.on('focus', this.onFieldFocus, this); @@ -258,11 +259,13 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { // If we don't have a bind there's nothing to do. if (Ext.isEmpty(this.binds[option])) return; - // The field is currently focused so we don't want to change - // it. - if (this.binds[option] == this.focused) return; - - // Set the form field to the new value. - this.binds[option].setValue(newValue); + Ext.each(this.binds[option], function(bind) { + // The field is currently focused so we don't want to + // change it. + if (bind == this.focused) return; + + // Set the form field to the new value. + bind.setValue(newValue); + }, this) } }); \ No newline at end of file