diff --git a/src/webui/www/private/addtorrent.html b/src/webui/www/private/addtorrent.html index b82e24f75..551b3c762 100644 --- a/src/webui/www/private/addtorrent.html +++ b/src/webui/www/private/addtorrent.html @@ -130,6 +130,16 @@ +
+ + + + +
+ + +
+
QBT_TR(Torrent settings)QBT_TR[CONTEXT=AddNewTorrentDialog] diff --git a/src/webui/www/private/scripts/addtorrent.js b/src/webui/www/private/scripts/addtorrent.js index c02af8a7e..135c2893b 100644 --- a/src/webui/www/private/scripts/addtorrent.js +++ b/src/webui/www/private/scripts/addtorrent.js @@ -123,17 +123,39 @@ window.qBittorrent.AddTorrent ??= (() => { }; const changeTMM = (item) => { + const savepath = document.getElementById("savepath"); + const useDownloadPath = document.getElementById("useDownloadPath"); if (item.selectedIndex === 1) { - document.getElementById("savepath").disabled = true; + savepath.disabled = true; const categorySelect = document.getElementById("categorySelect"); const categoryName = categorySelect.options[categorySelect.selectedIndex].value; const category = categories[categoryName]; - document.getElementById("savepath").value = (category === undefined) ? "" : category["savePath"]; + savepath.value = (category === undefined) ? "" : category["savePath"]; + + useDownloadPath.disabled = true; + useDownloadPath.checked = false; + changeUseDownloadPath(useDownloadPath); } else { - document.getElementById("savepath").disabled = false; - document.getElementById("savepath").value = defaultSavePath; + savepath.disabled = false; + savepath.value = defaultSavePath; + + useDownloadPath.disabled = false; + } + + changeUseDownloadPath(useDownloadPath); + }; + + const changeUseDownloadPath = (elem) => { + const downloadPath = document.getElementById("downloadPath"); + if (elem.checked) { + downloadPath.disabled = false; + downloadPath.value = defaultSavePath; + } + else { + downloadPath.disabled = true; + downloadPath.value = ""; } }; @@ -220,6 +242,10 @@ window.qBittorrent.AddTorrent ??= (() => { getCategories(); }); + window.addEventListener("DOMContentLoaded", () => { + document.getElementById("useDownloadPath").addEventListener("change", (e) => changeUseDownloadPath(e.target)); + }); + return exports(); })(); Object.freeze(window.qBittorrent.AddTorrent);