fix setting a custom limit when one is already set
focus and select the spinner contents upon window show
This commit is contained in:
parent
c8c5e3449a
commit
066d199c78
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -44,7 +44,11 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
|
|||
|
||||
this.items.each(function(item) {
|
||||
if (item.getXType() != 'menucheckitem') return;
|
||||
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 (item.value == 'other') {
|
||||
this.otherWin.group = item.group;
|
||||
this.otherWin.setValue(this.value);
|
||||
this.otherWin.show();
|
||||
} else {
|
||||
config = {}
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onOtherClicked: function(item, e) {
|
||||
this.otherWin.group = item.group;
|
||||
this.otherWin.setValue(this.value);
|
||||
this.otherWin.show();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue