|
|
@ -77,13 +77,20 @@ subDownloadThread::~subDownloadThread(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void subDownloadThread::run(){ |
|
|
|
void subDownloadThread::run(){ |
|
|
|
// XXX: Trick to get a unique filename
|
|
|
|
// Get a unique filename
|
|
|
|
QString filePath; |
|
|
|
QString filePath; |
|
|
|
QTemporaryFile *tmpfile = new QTemporaryFile(); |
|
|
|
QTemporaryFile tmpfile; |
|
|
|
if (tmpfile->open()) { |
|
|
|
tmpfile.setAutoRemove(false); |
|
|
|
filePath = tmpfile->fileName(); |
|
|
|
if (tmpfile.open()) { |
|
|
|
|
|
|
|
filePath = tmpfile.fileName(); |
|
|
|
|
|
|
|
qDebug("Temporary filename is: %s", filePath.toLocal8Bit().data()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
emit downloadFailureST(this, url, tr("I/O Error")); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
delete tmpfile; |
|
|
|
tmpfile.close(); |
|
|
|
|
|
|
|
// Now temporary file is created but closed so that
|
|
|
|
|
|
|
|
// curl can use it
|
|
|
|
FILE *f = fopen(filePath.toLocal8Bit().data(), "wb"); |
|
|
|
FILE *f = fopen(filePath.toLocal8Bit().data(), "wb"); |
|
|
|
if(!f) { |
|
|
|
if(!f) { |
|
|
|
std::cerr << "couldn't open destination file" << "\n"; |
|
|
|
std::cerr << "couldn't open destination file" << "\n"; |
|
|
|