mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-10 15:32:48 -07:00
Add ability to rename torrent files from the WebUI
Renaming folders is not yet supported. Closes #8892.
This commit is contained in:
parent
9fecd18293
commit
2bce9f6179
6 changed files with 171 additions and 1 deletions
|
@ -520,6 +520,33 @@ window.qBittorrent.PropFiles = (function() {
|
|||
targets: '#torrentFilesTableDiv tr',
|
||||
menu: 'torrentFilesMenu',
|
||||
actions: {
|
||||
Rename: function(element, ref) {
|
||||
const hash = torrentsTable.getCurrentTorrentHash();
|
||||
if (!hash) return;
|
||||
const rowId = torrentFilesTable.selectedRowsIds()[0];
|
||||
if (!rowId) return;
|
||||
const row = torrentFilesTable.rows[rowId];
|
||||
if (!row) return;
|
||||
const node = torrentFilesTable.getNode(rowId);
|
||||
if (node.isFolder) return;
|
||||
|
||||
const name = row.full_data.name;
|
||||
const fileId = row.full_data.fileId;
|
||||
|
||||
new MochaUI.Window({
|
||||
id: 'renamePage',
|
||||
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'rename_file.html?hash=' + hash + '&id=' + fileId + '&name=' + encodeURIComponent(name),
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
paddingVertical: 0,
|
||||
paddingHorizontal: 0,
|
||||
width: 250,
|
||||
height: 100
|
||||
});
|
||||
},
|
||||
|
||||
FilePrioIgnore: function(element, ref) {
|
||||
filesPriorityMenuClicked(FilePriority.Ignored);
|
||||
|
@ -543,6 +570,13 @@ window.qBittorrent.PropFiles = (function() {
|
|||
this.hideItem('FilePrio');
|
||||
else
|
||||
this.showItem('FilePrio');
|
||||
|
||||
const rowId = torrentFilesTable.selectedRowsIds()[0];
|
||||
const node = torrentFilesTable.getNode(rowId);
|
||||
if (node.isFolder)
|
||||
this.hideItem('Rename');
|
||||
else
|
||||
this.showItem('Rename');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue