add sorting of the files by filenames, and folders display at the top

This commit is contained in:
Damien Churchill 2009-04-01 16:33:31 +00:00
parent de733b0fae
commit baf3d283e0
2 changed files with 14 additions and 2 deletions

View File

@ -51,7 +51,9 @@ Deluge.Add = {
},
onRender: function(window) {
new Ext.tree.TreeSorter(this.Files, {
folderSort: true
});
},
onSelect: function(selModel, rowIndex, record) {
@ -68,6 +70,7 @@ Deluge.Add = {
} else {
parent.appendChild(new Ext.tree.TreeNode({
filename: file,
text: file, // this needs to be here for sorting reasons
size: fsize(item[0]),
leaf: true,
checked: item[1],
@ -79,7 +82,10 @@ Deluge.Add = {
}
this.clearFiles();
walk(torrentInfo['files'], this.Files.getRootNode());
var root = this.Files.getRootNode();
walk(torrentInfo['files'], root);
root.firstChild.expand();
},
onTorrentAdded: function(info) {

View File

@ -201,6 +201,10 @@ Deluge.Details.Files = {
this.panel = panel;
this.panel.clear = this.clear.bind(this);
this.panel.update = this.update.bind(this);
new Ext.tree.TreeSorter(this.panel, {
folderSort: true
});
},
onRequestComplete: function(files, torrentId) {
@ -225,6 +229,7 @@ Deluge.Details.Files = {
child = new Ext.tree.TreeNode({
id: file,
filename: file,
text: file, // this needs to be here for sorting
size: fsize(item[0]),
progress: item[1],
leaf: true,
@ -238,6 +243,7 @@ Deluge.Details.Files = {
}
var root = this.panel.getRootNode();
walk(files, root);
root.firstChild.expand();
},
clear: function() {