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

View File

@ -46,9 +46,18 @@ Deluge.Widgets.Details = new Class({
4: Deluge.Keys.Options 4: Deluge.Keys.Options
}, },
clear: function() {
this.pages.each(function(page) {
if (page.clear) page.clear();
});
},
update: function(torrentId) { update: function(torrentId) {
this.torrentId = 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]; var keys = this.keys[this.currentPage], page = this.pages[this.currentPage];
Deluge.Client.get_torrent_status(torrentId, keys, { Deluge.Client.get_torrent_status(torrentId, keys, {
onSuccess: function(torrent) { onSuccess: function(torrent) {
@ -95,6 +104,13 @@ Deluge.Widgets.StatisticsPage = new Class({
this.bar.set('width', this.getWidth() - 12); 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) { update: function(torrent) {
var data = { var data = {
downloaded: torrent.total_done.toBytes()+' ('+torrent.total_payload_download.toBytes()+')', downloaded: torrent.total_done.toBytes()+' ('+torrent.total_payload_download.toBytes()+')',
@ -136,6 +152,12 @@ Deluge.Widgets.DetailsPage = new Class({
this.parent('Details'); this.parent('Details');
}, },
clear: function() {
this.element.getElements('dd').each(function(item) {
item.set('text', '');
}, this);
},
update: function(torrent) { update: function(torrent) {
var data = { var data = {
torrent_name: torrent.name, torrent_name: torrent.name,
@ -266,6 +288,10 @@ Deluge.Widgets.FilesPage = new Class({
}; };
}, },
clear: function() {
this.grid.clear();
},
resized: function(e) { resized: function(e) {
if (!this.grid) { if (!this.grid) {
this.beenResized = e; 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) { update: function(torrent) {
if (this.torrentId != torrent.id) { if (this.torrentId != torrent.id) {
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.apply_options.addEvent('click', this.bound.apply);
this.form.reset.addEvent('click', this.bound.reset); this.form.reset_options.addEvent('click', this.bound.reset);
}, },
apply: function(event) { 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) { reset: function(event) {
if (this.torrentId) { if (this.torrentId) {
delete this.changed[this.torrentId]; delete this.changed[this.torrentId];

View File

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