fix a couple of bugs in the M.O.M and fix the options tab and file priorities in the torrent add window (success!)
This commit is contained in:
parent
acc850dab9
commit
81949449ae
|
@ -85,7 +85,7 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
|||
bodyStyle: 'padding: 5px;',
|
||||
border: false,
|
||||
height: 170,
|
||||
disabled: true
|
||||
//disabled: true
|
||||
});
|
||||
|
||||
var fieldset = this.form.add({
|
||||
|
@ -198,8 +198,6 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
|||
form.layout = new Ext.layout.FormLayout();
|
||||
form.layout.setContainer(form);
|
||||
form.doLayout();
|
||||
|
||||
this.optionsManager.changeId(null);
|
||||
},
|
||||
|
||||
addTorrent: function(torrent) {
|
||||
|
@ -215,9 +213,9 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
|||
priorities[index] = fileIndexes[index];
|
||||
});
|
||||
|
||||
var oldId = this.optionsManager.changeId(torrent['info_hash'], false);
|
||||
this.optionsManager.set('file_priorities', priorities);
|
||||
this.optionsManager.changeId(oldId, false);
|
||||
var oldId = this.optionsManager.changeId(torrent['info_hash'], true);
|
||||
this.optionsManager.setDefault('file_priorities', priorities);
|
||||
this.optionsManager.changeId(oldId, true);
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
|
@ -263,9 +261,9 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
|||
},
|
||||
|
||||
getOptions: function(torrentId) {
|
||||
var oldId = this.optionsManager.changeId(torrentId, false);
|
||||
var oldId = this.optionsManager.changeId(torrentId, true);
|
||||
var options = this.optionsManager.get();
|
||||
this.optionsManager.changeId(oldTorrentId, false);
|
||||
this.optionsManager.changeId(oldId, true);
|
||||
Ext.each(options['file_priorities'], function(priority, index) {
|
||||
options['file_priorities'][index] = (priority) ? 1 : 0;
|
||||
});
|
||||
|
@ -334,7 +332,7 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
|
|||
}
|
||||
priorities[child.attributes.fileindex] = checked;
|
||||
}, this);
|
||||
this.optionsManager.update('file_priorities', priorities);
|
||||
this.optionsManager.setDefault('file_priorities', priorities);
|
||||
},
|
||||
|
||||
onNodeCheck: function(node, checked) {
|
||||
|
|
|
@ -48,10 +48,10 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
|||
* Changes bound fields to use the specified id.
|
||||
* @param {String} id
|
||||
*/
|
||||
changeId: function(id, updateBinds) {
|
||||
changeId: function(id, dontUpdateBinds) {
|
||||
var oldId = this.currentId;
|
||||
this.currentId = id;
|
||||
if (updateBinds) {
|
||||
if (!dontUpdateBinds) {
|
||||
for (var option in this.options) {
|
||||
if (!this.binds[option]) continue;
|
||||
Ext.each(this.binds[option], function(bind) {
|
||||
|
@ -80,10 +80,15 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
|||
if (arguments.length == 1) {
|
||||
var option = arguments[0];
|
||||
return (this.isDirty(option)) ? this.changed[this.currentId][option] : this.getDefault(option);
|
||||
} else if (arguments.length == 0) {
|
||||
var options = {};
|
||||
for (var option in this.options) {
|
||||
options[option] = (this.isDirty(option)) ? this.changed[this.currentId][option] : this.getDefault(option);
|
||||
}
|
||||
return options;
|
||||
} else {
|
||||
var options = {};
|
||||
Ext.each(arguments, function(option) {
|
||||
if (!this.has(option)) return;
|
||||
options[option] = (this.isDirty(option)) ? this.changed[this.currentId][option] : this.getDefault(option);
|
||||
}, this);
|
||||
return options;
|
||||
|
|
Loading…
Reference in New Issue