Browse Source

Delete temporary after they aren't needed. Closes #1188.

adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
423d60cced
  1. 3
      src/downloadthread.cpp
  2. 4
      src/properties/trackersadditiondlg.h
  3. 1
      src/qtlibtorrent/qbtsession.cpp
  4. 1
      src/rss/rss_imp.cpp
  5. 6
      src/rss/rssparser.cpp
  6. 2
      src/searchengine/searchengine.cpp

3
src/downloadthread.cpp

@ -134,8 +134,8 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) { @@ -134,8 +134,8 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
}
// Success
QTemporaryFile *tmpfile = new QTemporaryFile;
tmpfile->setAutoRemove(false);
if (tmpfile->open()) {
tmpfile->setAutoRemove(false);
QString filePath = tmpfile->fileName();
qDebug("Temporary filename is: %s", qPrintable(filePath));
if (reply->isOpen() || reply->open(QIODevice::ReadOnly)) {
@ -153,6 +153,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) { @@ -153,6 +153,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
emit downloadFinished(url, filePath);
} else {
delete tmpfile;
fsutils::forceRemove(filePath);
// Error when reading the request
emit downloadFailure(url, tr("I/O Error"));
}

4
src/properties/trackersadditiondlg.h

@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
#include "ui_trackersadditiondlg.h"
#include "downloadthread.h"
#include "qtorrenthandle.h"
#include "fs_utils.h"
class TrackersAdditionDlg : public QDialog, private Ui::TrackersAdditionDlg{
Q_OBJECT
@ -79,6 +80,7 @@ public slots: @@ -79,6 +80,7 @@ public slots:
setCursor(Qt::ArrowCursor);
uTorrentListButton->setEnabled(true);
sender()->deleteLater();
fsutils::forceRemove(path);
return;
}
QList<QUrl> existingTrackers;
@ -113,7 +115,7 @@ public slots: @@ -113,7 +115,7 @@ public slots:
}
// Clean up
list_file.close();
list_file.remove();
fsutils::forceRemove(path);
//To restore the cursor ...
setCursor(Qt::ArrowCursor);
uTorrentListButton->setEnabled(true);

1
src/qtlibtorrent/qbtsession.cpp

@ -2704,6 +2704,7 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) { @@ -2704,6 +2704,7 @@ void QBtSession::processDownloadedFile(QString url, QString file_path) {
h.pause();
emit newDownloadedTorrentFromRss(url);
}
fsutils::forceRemove(file_path);
}
// Return current download rate for the BT

1
src/rss/rss_imp.cpp

@ -629,6 +629,7 @@ void RSSImp::updateFeedIcon(const QString& url, const QString& iconPath) @@ -629,6 +629,7 @@ void RSSImp::updateFeedIcon(const QString& url, const QString& iconPath)
{
QTreeWidgetItem* item = m_feedList->getTreeItemFromUrl(url);
item->setData(0, Qt::DecorationRole, QVariant(QIcon(iconPath)));
fsutils::forceRemove(iconPath);
}
void RSSImp::updateFeedInfos(const QString& url, const QString& display_name, uint nbUnread)

6
src/rss/rssparser.cpp

@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
#include "rssparser.h"
#include "downloadthread.h"
#include "fs_utils.h"
#include <QDebug>
#include <QFile>
#include <QRegExp>
@ -496,12 +497,13 @@ void RssParser::parseFeed(const ParsingJob& job) @@ -496,12 +497,13 @@ void RssParser::parseFeed(const ParsingJob& job)
}
// Clean up
QFile::remove(job.filePath);
fileRss.close();
emit feedParsingFinished(job.feedUrl, QString());
fsutils::forceRemove(job.filePath);
}
void RssParser::reportFailure(const ParsingJob& job, const QString& error)
{
QFile::remove(job.filePath);
emit feedParsingFinished(job.feedUrl, error);
fsutils::forceRemove(job.filePath);
}

2
src/searchengine/searchengine.cpp

@ -163,7 +163,7 @@ void SearchEngine::pythonDownloadSuccess(QString url, QString file_path) { @@ -163,7 +163,7 @@ void SearchEngine::pythonDownloadSuccess(QString url, QString file_path) {
on_search_button_clicked();
}
// Delete temp file
QFile::remove(file_path+".msi");
fsutils::forceRemove(file_path);
}
void SearchEngine::pythonDownloadFailure(QString url, QString error) {

Loading…
Cancel
Save