Add option to automatically remove .torrent files upon adding

Some browsers do not download files, intended for immediate opening,
into a temporary directory, and thus a regular download directories
accumulate those unneeded files.

The option allows qBittorrent to clean after itself and delete those
files whether they were succesfully added or not (user-selectable
policy).
This commit is contained in:
Eugene Shalygin 2016-04-07 16:58:30 +02:00
parent 35c51ad3b1
commit 6e73fa80b8
10 changed files with 391 additions and 49 deletions

View file

@ -70,6 +70,7 @@
#include "base/net/portforwarder.h"
#include "base/preferences.h"
#include "base/settingsstorage.h"
#include "base/torrentfileguard.h"
#include "base/torrentfilter.h"
#include "base/unicodestrings.h"
#include "base/utils/misc.h"
@ -1229,6 +1230,8 @@ bool Session::addTorrent(QString source, const AddTorrentParams &params)
m_downloadedTorrents[handler->url()] = params;
}
else {
TorrentFileGuard guard(source);
guard.markAsAddedToSession();
return addTorrent_impl(params, MagnetUri(), TorrentInfo::loadFromFile(source));
}