mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Delete temporary after they aren't needed. Closes #1188.
This commit is contained in:
parent
ecfd06cfe9
commit
423d60cced
6 changed files with 12 additions and 5 deletions
|
@ -134,8 +134,8 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
||||||
}
|
}
|
||||||
// Success
|
// Success
|
||||||
QTemporaryFile *tmpfile = new QTemporaryFile;
|
QTemporaryFile *tmpfile = new QTemporaryFile;
|
||||||
tmpfile->setAutoRemove(false);
|
|
||||||
if (tmpfile->open()) {
|
if (tmpfile->open()) {
|
||||||
|
tmpfile->setAutoRemove(false);
|
||||||
QString filePath = tmpfile->fileName();
|
QString filePath = tmpfile->fileName();
|
||||||
qDebug("Temporary filename is: %s", qPrintable(filePath));
|
qDebug("Temporary filename is: %s", qPrintable(filePath));
|
||||||
if (reply->isOpen() || reply->open(QIODevice::ReadOnly)) {
|
if (reply->isOpen() || reply->open(QIODevice::ReadOnly)) {
|
||||||
|
@ -153,6 +153,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
||||||
emit downloadFinished(url, filePath);
|
emit downloadFinished(url, filePath);
|
||||||
} else {
|
} else {
|
||||||
delete tmpfile;
|
delete tmpfile;
|
||||||
|
fsutils::forceRemove(filePath);
|
||||||
// Error when reading the request
|
// Error when reading the request
|
||||||
emit downloadFailure(url, tr("I/O Error"));
|
emit downloadFailure(url, tr("I/O Error"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "ui_trackersadditiondlg.h"
|
#include "ui_trackersadditiondlg.h"
|
||||||
#include "downloadthread.h"
|
#include "downloadthread.h"
|
||||||
#include "qtorrenthandle.h"
|
#include "qtorrenthandle.h"
|
||||||
|
#include "fs_utils.h"
|
||||||
|
|
||||||
class TrackersAdditionDlg : public QDialog, private Ui::TrackersAdditionDlg{
|
class TrackersAdditionDlg : public QDialog, private Ui::TrackersAdditionDlg{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -79,6 +80,7 @@ public slots:
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
uTorrentListButton->setEnabled(true);
|
uTorrentListButton->setEnabled(true);
|
||||||
sender()->deleteLater();
|
sender()->deleteLater();
|
||||||
|
fsutils::forceRemove(path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QList<QUrl> existingTrackers;
|
QList<QUrl> existingTrackers;
|
||||||
|
@ -113,7 +115,7 @@ public slots:
|
||||||
}
|
}
|
||||||
// Clean up
|
// Clean up
|
||||||
list_file.close();
|
list_file.close();
|
||||||
list_file.remove();
|
fsutils::forceRemove(path);
|
||||||
//To restore the cursor ...
|
//To restore the cursor ...
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
uTorrentListButton->setEnabled(true);
|
uTorrentListButton->setEnabled(true);
|
||||||
|
|
|
@ -2704,6 +2704,7 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) {
|
||||||
h.pause();
|
h.pause();
|
||||||
emit newDownloadedTorrentFromRss(url);
|
emit newDownloadedTorrentFromRss(url);
|
||||||
}
|
}
|
||||||
|
fsutils::forceRemove(file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return current download rate for the BT
|
// Return current download rate for the BT
|
||||||
|
|
|
@ -629,6 +629,7 @@ void RSSImp::updateFeedIcon(const QString& url, const QString& iconPath)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem* item = m_feedList->getTreeItemFromUrl(url);
|
QTreeWidgetItem* item = m_feedList->getTreeItemFromUrl(url);
|
||||||
item->setData(0, Qt::DecorationRole, QVariant(QIcon(iconPath)));
|
item->setData(0, Qt::DecorationRole, QVariant(QIcon(iconPath)));
|
||||||
|
fsutils::forceRemove(iconPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSImp::updateFeedInfos(const QString& url, const QString& display_name, uint nbUnread)
|
void RSSImp::updateFeedInfos(const QString& url, const QString& display_name, uint nbUnread)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "rssparser.h"
|
#include "rssparser.h"
|
||||||
#include "downloadthread.h"
|
#include "downloadthread.h"
|
||||||
|
#include "fs_utils.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
@ -496,12 +497,13 @@ void RssParser::parseFeed(const ParsingJob& job)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
QFile::remove(job.filePath);
|
fileRss.close();
|
||||||
emit feedParsingFinished(job.feedUrl, QString());
|
emit feedParsingFinished(job.feedUrl, QString());
|
||||||
|
fsutils::forceRemove(job.filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RssParser::reportFailure(const ParsingJob& job, const QString& error)
|
void RssParser::reportFailure(const ParsingJob& job, const QString& error)
|
||||||
{
|
{
|
||||||
QFile::remove(job.filePath);
|
|
||||||
emit feedParsingFinished(job.feedUrl, error);
|
emit feedParsingFinished(job.feedUrl, error);
|
||||||
|
fsutils::forceRemove(job.filePath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ void SearchEngine::pythonDownloadSuccess(QString url, QString file_path) {
|
||||||
on_search_button_clicked();
|
on_search_button_clicked();
|
||||||
}
|
}
|
||||||
// Delete temp file
|
// Delete temp file
|
||||||
QFile::remove(file_path+".msi");
|
fsutils::forceRemove(file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchEngine::pythonDownloadFailure(QString url, QString error) {
|
void SearchEngine::pythonDownloadFailure(QString url, QString error) {
|
||||||
|
|
Loading…
Reference in a new issue