Author: damoxc

Revision: 5855

Log:
        fix switching the options when a different torrent is selected
fix showing the private flag

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-10-21 19:48:44 UTC (rev 5854)
+++ branches/1.2_RC/ChangeLog   2009-10-21 20:15:16 UTC (rev 5855)
@@ -12,6 +12,8 @@
        * Fix updating the Connection Manager when a host is added.
        * Add a `--fork` option to allow forking the webui to the background
        * Fix the statusbar menu limits
+       * Fix setting the torrent options via the options tab
+       * Fix the private flag in the options tab
 
 ==== Misc ====
        * Add man pages for deluge-console, deluge-gtk and deluge-web

Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.Details.Options.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.Details.Options.js  2009-10-21 
19:48:44 UTC (rev 5854)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.Details.Options.js  2009-10-21 
20:15:16 UTC (rev 5855)
@@ -71,7 +71,6 @@
                                'prioritize_first_last': false
                        }
                });
-               this.optionsManager.on('changed', this.onOptionChanged, this);
                
                /*
                 * Bandwidth Options
@@ -223,7 +222,9 @@
                        labelSeparator: '',
                        id: 'stop_at_ratio',
                        width: 120,
-                       boxLabel: _('Stop seed at ratio')
+                       boxLabel: _('Stop seed at ratio'),
+                       handler: this.onStopRatioChecked,
+                       scope: this
                });
                
                this.fields.stop_ratio = this.fieldsets.queue.add({
@@ -285,7 +286,8 @@
                        fieldLabel: '',
                        labelSeparator: '',
                        boxLabel: _('Private'),
-                       id: 'private'
+                       id: 'private',
+                       disabled: true
                });
                
                this.fields.prioritize_first_last = this.fieldsets.general.add({
@@ -361,6 +363,8 @@
        },
        
        clear: function() {
+               if (this.torrentId == null) return;
+               this.torrentId = null;
                this.optionsManager.changeId(null);
        },
        
@@ -369,6 +373,10 @@
        },
        
        update: function(torrentId) {
+               if (this.torrentId && !torrentId) this.clear(); // we want to 
clear the pane if we get a null torrent torrentIds
+               
+               if (!torrentId) return; // we don't care about null torrentIds
+               
                if (this.torrentId != torrentId) {
                        this.torrentId = torrentId;
                        this.optionsManager.changeId(torrentId);
@@ -402,17 +410,19 @@
                Deluge.EditTrackers.show();
        },
        
-       onOptionChanged: function(id, key, newValue, oldValue) {
-               if (key == 'stop_at_ratio') {
-                       this.fields.remove_at_ratio.setDisabled(!newValue);
-                       this.fields.stop_ratio.setDisabled(!newValue);
-               }
+       onStopRatioChecked: function(checkbox, checked) {
+               this.fields.remove_at_ratio.setDisabled(!checked);
+               this.fields.stop_ratio.setDisabled(!checked);
        },
        
        onRequestComplete: function(torrent, options) {
-               this.fields['private'].setDisabled(!torrent['private']);
+               this.fields['private'].setValue(torrent['private']);
+               this.fields['private'].setDisabled(true);
                delete torrent['private'];
                this.optionsManager.setDefault(this.torrentId, torrent);
+               var stop_at_ratio = this.optionsManager.get(this.torrentId, 
'stop_at_ratio');
+               this.fields.remove_at_ratio.setDisabled(!stop_at_ratio);
+               this.fields.stop_ratio.setDisabled(!stop_at_ratio);
        }
 });
 Deluge.Details.add(new Ext.deluge.details.OptionsTab());

Modified: trunk/deluge/ui/web/js/Deluge.Details.Options.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Details.Options.js    2009-10-21 19:48:44 UTC 
(rev 5854)
+++ trunk/deluge/ui/web/js/Deluge.Details.Options.js    2009-10-21 20:15:16 UTC 
(rev 5855)
@@ -71,7 +71,6 @@
                                'prioritize_first_last': false
                        }
                });
-               this.optionsManager.on('changed', this.onOptionChanged, this);
                
                /*
                 * Bandwidth Options
@@ -223,7 +222,9 @@
                        labelSeparator: '',
                        id: 'stop_at_ratio',
                        width: 120,
-                       boxLabel: _('Stop seed at ratio')
+                       boxLabel: _('Stop seed at ratio'),
+                       handler: this.onStopRatioChecked,
+                       scope: this
                });
                
                this.fields.stop_ratio = this.fieldsets.queue.add({
@@ -285,7 +286,8 @@
                        fieldLabel: '',
                        labelSeparator: '',
                        boxLabel: _('Private'),
-                       id: 'private'
+                       id: 'private',
+                       disabled: true
                });
                
                this.fields.prioritize_first_last = this.fieldsets.general.add({
@@ -361,6 +363,8 @@
        },
        
        clear: function() {
+               if (this.torrentId == null) return;
+               this.torrentId = null;
                this.optionsManager.changeId(null);
        },
        
@@ -369,6 +373,10 @@
        },
        
        update: function(torrentId) {
+               if (this.torrentId && !torrentId) this.clear(); // we want to 
clear the pane if we get a null torrent torrentIds
+               
+               if (!torrentId) return; // we don't care about null torrentIds
+               
                if (this.torrentId != torrentId) {
                        this.torrentId = torrentId;
                        this.optionsManager.changeId(torrentId);
@@ -402,17 +410,19 @@
                Deluge.EditTrackers.show();
        },
        
-       onOptionChanged: function(id, key, newValue, oldValue) {
-               if (key == 'stop_at_ratio') {
-                       this.fields.remove_at_ratio.setDisabled(!newValue);
-                       this.fields.stop_ratio.setDisabled(!newValue);
-               }
+       onStopRatioChecked: function(checkbox, checked) {
+               this.fields.remove_at_ratio.setDisabled(!checked);
+               this.fields.stop_ratio.setDisabled(!checked);
        },
        
        onRequestComplete: function(torrent, options) {
-               this.fields['private'].setDisabled(!torrent['private']);
+               this.fields['private'].setValue(torrent['private']);
+               this.fields['private'].setDisabled(true);
                delete torrent['private'];
                this.optionsManager.setDefault(this.torrentId, torrent);
+               var stop_at_ratio = this.optionsManager.get(this.torrentId, 
'stop_at_ratio');
+               this.fields.remove_at_ratio.setDisabled(!stop_at_ratio);
+               this.fields.stop_ratio.setDisabled(!stop_at_ratio);
        }
 });
 Deluge.Details.add(new Ext.deluge.details.OptionsTab());



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