Module: deluge
Branch: master
Commit: 066d199c7878520e9824fdd3be34b9b0e1c91c1a

Author: Damien Churchill <[email protected]>
Date:   Wed Apr 28 13:39:56 2010 +0100

fix setting a custom limit when one is already set
focus and select the spinner contents upon window show

---

 deluge/ui/web/js/deluge-all/OtherLimitWindow.js |    5 +++
 deluge/ui/web/js/deluge-all/StatusbarMenu.js    |   33 ++++++++++++----------
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/OtherLimitWindow.js 
b/deluge/ui/web/js/deluge-all/OtherLimitWindow.js
index 8769fe0..aee1b42 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 092181e..78adf9b 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();
        }
 });

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to