reset the add torrent window on hide

This commit is contained in:
Damien Churchill 2009-12-12 15:56:49 +00:00
parent 35186faf78
commit 42e904b63c
3 changed files with 21 additions and 3 deletions

View File

@ -221,6 +221,7 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
clear: function() {
this.clearFiles();
this.optionsManager.resetAll();
},
clearFiles: function() {
@ -252,6 +253,7 @@ Ext.deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
'prioritize_first_last_pieces': config.prioritize_first_last_pieces
}
this.optionsManager.options = options;
this.optionsManager.resetAll();
},
scope: this
});
@ -454,6 +456,7 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
});
this.optionsPanel = this.add(new Ext.deluge.add.OptionsPanel());
this.on('hide', this.onHide, this);
this.on('show', this.onShow, this);
},
@ -489,6 +492,12 @@ Ext.deluge.add.AddWindow = Ext.extend(Ext.deluge.add.Window, {
this.file.show();
},
onHide: function() {
this.optionsPanel.setActiveTab(0);
this.optionsPanel.files.setDisabled(true);
this.optionsPanel.form.setDisabled(true);
},
onRemove: function() {
var selection = this.grid.getSelectionModel();
if (!selection.hasSelection()) return;

View File

@ -135,8 +135,17 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
* Reset the options back to the default values for the specified id.
*/
reset: function() {
if (!this.changed[this.currentId]) return;
delete this.changed[this.currentId];
if (this.changed[this.currentId]) delete this.changed[this.currentId];
if (this.stored[this.currentId]) delete this.stored[this.currentId];
},
/**
* Reset the options back to their defaults for all ids.
*/
resetAll: function() {
this.changed = {};
this.stored = {};
this.changeId(null);
},
/**

File diff suppressed because one or more lines are too long