almost fixes the bug where if you apply a filter, whichever torrent was

selected before continues to be displayed in the tabs
This commit is contained in:
Damien Churchill 2008-10-14 00:59:08 +00:00
parent d20628baff
commit c6ed7e297b
3 changed files with 43 additions and 5 deletions

View File

@ -19,8 +19,8 @@
<label><input type="checkbox" name="private" />$_('Private')</label><br />
<label><input type="checkbox" name="prioritize_first_last" />$_('Prioritize First/Last')</label><br />
<input type="button" name="edit_trackers" value="$_('Edit Trackers')" class="deluge_button" /><br />
<input type="button" name="reset" value="$_('Reset')" class="deluge_button" />
<input type="button" name="apply" value="$_('Apply')" class="deluge_button" /><br/>
<input type="button" name="reset_options" value="$_('Reset')" class="deluge_button" />
<input type="button" name="apply_options" value="$_('Apply')" class="deluge_button" /><br/>
</fieldset>
</form>
<br style="clear: both;" />

View File

@ -46,9 +46,18 @@ Deluge.Widgets.Details = new Class({
4: Deluge.Keys.Options
},
clear: function() {
this.pages.each(function(page) {
if (page.clear) page.clear();
});
},
update: function(torrentId) {
this.torrentId = torrentId;
if (!this.torrentId) return;
if (!this.torrentId) {
this.clear();
return;
};
var keys = this.keys[this.currentPage], page = this.pages[this.currentPage];
Deluge.Client.get_torrent_status(torrentId, keys, {
onSuccess: function(torrent) {
@ -95,6 +104,13 @@ Deluge.Widgets.StatisticsPage = new Class({
this.bar.set('width', this.getWidth() - 12);
},
clear: function() {
this.bar.update('', 0);
this.element.getElements('dd').each(function(item) {
item.set('text', '');
}, this);
},
update: function(torrent) {
var data = {
downloaded: torrent.total_done.toBytes()+' ('+torrent.total_payload_download.toBytes()+')',
@ -136,6 +152,12 @@ Deluge.Widgets.DetailsPage = new Class({
this.parent('Details');
},
clear: function() {
this.element.getElements('dd').each(function(item) {
item.set('text', '');
}, this);
},
update: function(torrent) {
var data = {
torrent_name: torrent.name,
@ -266,6 +288,10 @@ Deluge.Widgets.FilesPage = new Class({
};
},
clear: function() {
this.grid.clear();
},
resized: function(e) {
if (!this.grid) {
this.beenResized = e;
@ -335,6 +361,11 @@ Deluge.Widgets.PeersPage = new Class({
});
},
clear: function() {
this.grid.rows.empty();
this.grid.body.empty();
},
update: function(torrent) {
if (this.torrentId != torrent.id) {
this.torrentId = torrent.id;
@ -458,8 +489,8 @@ Deluge.Widgets.OptionsPage = new Class({
}
});
this.form.apply.addEvent('click', this.bound.apply);
this.form.reset.addEvent('click', this.bound.reset);
this.form.apply_options.addEvent('click', this.bound.apply);
this.form.reset_options.addEvent('click', this.bound.reset);
},
apply: function(event) {
@ -476,6 +507,10 @@ Deluge.Widgets.OptionsPage = new Class({
});
},
clear: function() {
//if (this.form && this.form.reset) this.form.reset();
},
reset: function(event) {
if (this.torrentId) {
delete this.changed[this.torrentId];

View File

@ -79,6 +79,9 @@ Deluge.Widgets.TorrentGrid = new Class({
}, this);
this.rows.each(function(row) {
if (!torrents.has(row.id)) {
if (this.selectedRow && this.selectedRow.id == row.id) {
this.deselectRow(row);
};
delete this.rows[this.rows.indexOf(row)];
};
}, this);