Author: damoxc

Revision: 5834

Log:
        fix a bug in converting non-boolean values back to boolean in the 
options manager

Diff:
Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.OptionsManager.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.OptionsManager.js   2009-10-11 
18:46:35 UTC (rev 5833)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.OptionsManager.js   2009-10-12 
09:53:13 UTC (rev 5834)
@@ -207,7 +207,12 @@
                                                value = Number(value);
                                                break;
                                        case 'boolean':
-                                               value = Boolean(value);
+                                               if (Ext.type(value) == 
'string') {
+                                                       value = 
value.toLowerCase();
+                                                       value = (value == 
'true' || value == '1' || value == 'on') ? true : false;
+                                               } else {
+                                                       value = Boolean(value);
+                                               }
                                                break;
                                }
                        }                       
@@ -243,7 +248,7 @@
         * @private
         */
        onFieldChange: function(field, event) {
-               this.update(field._doption, field.getValue());
+           this.update(field._doption, field.getValue());
        },
        
        /**
@@ -268,4 +273,4 @@
                        bind.setValue(newValue);
                }, this)
        }
-});
\ No newline at end of file
+});

Modified: trunk/deluge/ui/web/js/Deluge.OptionsManager.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.OptionsManager.js     2009-10-11 18:46:35 UTC 
(rev 5833)
+++ trunk/deluge/ui/web/js/Deluge.OptionsManager.js     2009-10-12 09:53:13 UTC 
(rev 5834)
@@ -207,7 +207,12 @@
                                                value = Number(value);
                                                break;
                                        case 'boolean':
-                                               value = Boolean(value);
+                                               if (Ext.type(value) == 
'string') {
+                                                       value = 
value.toLowerCase();
+                                                       value = (value == 
'true' || value == '1' || value == 'on') ? true : false;
+                                               } else {
+                                                       value = Boolean(value);
+                                               }
                                                break;
                                }
                        }                       
@@ -243,7 +248,7 @@
         * @private
         */
        onFieldChange: function(field, event) {
-               this.update(field._doption, field.getValue());
+           this.update(field._doption, field.getValue());
        },
        
        /**
@@ -268,4 +273,4 @@
                        bind.setValue(newValue);
                }, this)
        }
-});
\ No newline at end of file
+});



--~--~---------~--~----~------------~-------~--~----~
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