add a hacky change to the config dictionary to allow the generic preferences class to be used.

This commit is contained in:
Damien Churchill 2008-08-10 21:17:00 +00:00
parent af1f2205bb
commit 75936dd1ab
2 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<form>
<fieldset>
<legend>$_('Ports')</legend>
<label class="fluid">$_('From'):</label><input type="text" class="mooui-spinner" /><label class="fluid">$_('To'):</label><input type="text" class="mooui-spinner" /><br/>
<label class="fluid">$_('From'):</label><input type="text" name="start_listen_port" class="mooui-spinner" /><label class="fluid">$_('To'):</label><input type="text" name="end_listen_port" class="mooui-spinner" /><br/>
<label><input type="checkbox" name="random_port" />$_('Use Random Ports')</label>
</fieldset>
<fieldset>

View File

@ -925,10 +925,18 @@ Deluge.Widgets.PreferencesWindow = new Class({
shown: function(event) {
// we want this to be blocking
var config = Deluge.Client.get_config({async: false});
// Unfortunately we have to modify the listen ports preferences
// in order to not have to modify the generic preferences class.
config['start_listen_port'] = config['listen_ports'][0];
config['end_listen_port'] = config['listen_ports'][1];
// Iterate through the pages and set the fields
this.categories.each(function(category) {
if (category.update && category.core) category.update(config);
});
// Update the config for the webui pages.
var webconfig = Deluge.Client.get_webui_config({async: false});
this.webui.update(webconfig);
}