Allow to move content files to Trash instead of deleting them

PR #20252.
This commit is contained in:
Vladimir Golovnev 2024-06-29 08:21:35 +03:00 committed by GitHub
parent c5fa05299b
commit 4e27e88f6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 383 additions and 116 deletions

View file

@ -1096,11 +1096,11 @@ void TorrentsController::deleteAction()
requireParams({u"hashes"_s, u"deleteFiles"_s});
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
const DeleteOption deleteOption = parseBool(params()[u"deleteFiles"_s]).value_or(false)
? DeleteTorrentAndFiles : DeleteTorrent;
const BitTorrent::TorrentRemoveOption deleteOption = parseBool(params()[u"deleteFiles"_s]).value_or(false)
? BitTorrent::TorrentRemoveOption::RemoveContent : BitTorrent::TorrentRemoveOption::KeepContent;
applyToTorrents(hashes, [deleteOption](const BitTorrent::Torrent *torrent)
{
BitTorrent::Session::instance()->deleteTorrent(torrent->id(), deleteOption);
BitTorrent::Session::instance()->removeTorrent(torrent->id(), deleteOption);
});
}