update the proxyfield comboboxes and switch some simplestores to arraystores

This commit is contained in:
Damien Churchill 2010-04-28 08:21:30 +01:00
commit 9f185da446
2 changed files with 120 additions and 121 deletions

View file

@ -57,7 +57,7 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
fieldLabel: _('Inbound'), fieldLabel: _('Inbound'),
mode: 'local', mode: 'local',
width: 150, width: 150,
store: new Ext.data.SimpleStore({ store: new Ext.data.ArrayStore({
fields: ['id', 'text'], fields: ['id', 'text'],
data: [ data: [
[0, _('Forced')], [0, _('Forced')],

View file

@ -48,13 +48,13 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
initComponent: function() { initComponent: function() {
Deluge.preferences.ProxyField.superclass.initComponent.call(this); Deluge.preferences.ProxyField.superclass.initComponent.call(this);
this.type = this.add({ this.proxyType = this.add({
xtype: 'combo', xtype: 'combo',
fieldLabel: _('Type'), fieldLabel: _('Type'),
name: 'type', name: 'proxytype',
mode: 'local', mode: 'local',
width: 150, width: 150,
store: new Ext.data.SimpleStore({ store: new Ext.data.ArrayStore({
fields: ['id', 'text'], fields: ['id', 'text'],
data: [ data: [
[0, _('None')], [0, _('None')],
@ -65,11 +65,11 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
[5, _('HTTP with Auth')] [5, _('HTTP with Auth')]
] ]
}), }),
value: 0, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text'
}) });
this.hostname = this.add({ this.hostname = this.add({
xtype: 'textfield', xtype: 'textfield',
name: 'hostname', name: 'hostname',
@ -105,8 +105,8 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
width: 220 width: 220
}); });
this.type.on('change', this.onFieldChange, this); this.proxyType.on('change', this.onFieldChange, this);
this.type.on('select', this.onTypeSelect, this); this.proxyType.on('select', this.onTypeSelect, this);
this.setting = false; this.setting = false;
}, },
@ -116,7 +116,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
getValue: function() { getValue: function() {
return { return {
'type': this.type.getValue(), 'type': this.proxyType.getValue(),
'hostname': this.hostname.getValue(), 'hostname': this.hostname.getValue(),
'port': Number(this.port.getValue()), 'port': Number(this.port.getValue()),
'username': this.username.getValue(), 'username': this.username.getValue(),
@ -127,9 +127,9 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
// Set the values of the proxies // Set the values of the proxies
setValue: function(value) { setValue: function(value) {
this.setting = true; this.setting = true;
this.type.setValue(value['type']); this.proxyType.setValue(value['type']);
var index = this.type.getStore().find('id', value['type']); var index = this.proxyType.getStore().find('id', value['type']);
var record = this.type.getStore().getAt(index); var record = this.proxyType.getStore().getAt(index);
this.hostname.setValue(value['hostname']); this.hostname.setValue(value['hostname']);
this.port.setValue(value['port']); this.port.setValue(value['port']);
@ -167,4 +167,3 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
} }
} }
}); });