Move torrents to parent category when category is removed

PR #23620.
This commit is contained in:
Vladimir Golovnev
2025-12-21 19:49:29 +03:00
committed by GitHub
parent 25224f6050
commit 57c99b54c8

View File

@@ -1102,10 +1102,11 @@ bool SessionImpl::setCategoryOptions(const QString &categoryName, const Category
bool SessionImpl::removeCategory(const QString &name) bool SessionImpl::removeCategory(const QString &name)
{ {
const QString parentCategory = parentCategoryName(name);
for (TorrentImpl *const torrent : asConst(m_torrents)) for (TorrentImpl *const torrent : asConst(m_torrents))
{ {
if (torrent->belongsToCategory(name)) if (torrent->belongsToCategory(name))
torrent->setCategory(u""_s); torrent->setCategory(parentCategory);
} }
// remove stored category and its subcategories if exist // remove stored category and its subcategories if exist