|
|
@ -422,38 +422,40 @@ window.qBittorrent.PropFiles = (function() { |
|
|
|
const rootNode = new window.qBittorrent.FileTree.FolderNode(); |
|
|
|
const rootNode = new window.qBittorrent.FileTree.FolderNode(); |
|
|
|
|
|
|
|
|
|
|
|
rows.forEach(function(row) { |
|
|
|
rows.forEach(function(row) { |
|
|
|
|
|
|
|
const pathItems = row.fileName.split(window.qBittorrent.Filesystem.PathSeparator); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pathItems.pop(); // remove last item (i.e. file name)
|
|
|
|
let parent = rootNode; |
|
|
|
let parent = rootNode; |
|
|
|
let folderPath = window.qBittorrent.Filesystem.folderName(row.fileName); |
|
|
|
pathItems.forEach(function(folderName) { |
|
|
|
while (folderPath) { |
|
|
|
|
|
|
|
const folderName = window.qBittorrent.Filesystem.fileName(folderPath); |
|
|
|
|
|
|
|
if (folderName === '.unwanted') |
|
|
|
if (folderName === '.unwanted') |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
let parentNode = null; |
|
|
|
let folderNode = null; |
|
|
|
if (parent.children !== null) { |
|
|
|
if (parent.children !== null) { |
|
|
|
for (let i = 0; i < parent.children.length; ++i) { |
|
|
|
for (let i = 0; i < parent.children.length; ++i) { |
|
|
|
const childFolder = parent.children[i]; |
|
|
|
const childFolder = parent.children[i]; |
|
|
|
if (childFolder.name === folderName) { |
|
|
|
if (childFolder.name === folderName) { |
|
|
|
parentNode = childFolder; |
|
|
|
folderNode = childFolder; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (parentNode === null) { |
|
|
|
if (folderNode === null) { |
|
|
|
parentNode = new window.qBittorrent.FileTree.FolderNode(); |
|
|
|
folderNode = new window.qBittorrent.FileTree.FolderNode(); |
|
|
|
parentNode.path = folderPath; |
|
|
|
folderNode.path = (parent.path === "") |
|
|
|
parentNode.name = folderName; |
|
|
|
? folderName |
|
|
|
parentNode.rowId = rowId; |
|
|
|
: [parent.path, folderName].join(window.qBittorrent.Filesystem.PathSeparator); |
|
|
|
parentNode.root = parent; |
|
|
|
folderNode.name = folderName; |
|
|
|
parent.addChild(parentNode); |
|
|
|
folderNode.rowId = rowId; |
|
|
|
|
|
|
|
folderNode.root = parent; |
|
|
|
|
|
|
|
parent.addChild(folderNode); |
|
|
|
|
|
|
|
|
|
|
|
++rowId; |
|
|
|
++rowId; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
parent = parentNode; |
|
|
|
parent = folderNode; |
|
|
|
folderPath = window.qBittorrent.Filesystem.folderName(folderPath); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isChecked = row.checked ? TriState.Checked : TriState.Unchecked; |
|
|
|
const isChecked = row.checked ? TriState.Checked : TriState.Unchecked; |
|
|
|
const remaining = (row.priority === FilePriority.Ignored) ? 0 : row.remaining; |
|
|
|
const remaining = (row.priority === FilePriority.Ignored) ? 0 : row.remaining; |
|
|
|