@JoeCFD I found the solution now the problem is writing on Android, after downloading all the stuff and I try to write I get this error
"Problem opening save file "/storage/emulated/0/Pictures/tmpImg.jpg" for download "Operation not permitted"
Meanwhile If i create the file I get
"Problem opening save file "/storage/emulated/0/Pictures/tmpImg.jpg" for download "Permission Denied"
This is the code I used:
void DownloadManager::startDownload()
{
if (downloadQueue.isEmpty())
{
qDebug() << "[DownloadManager::startNextDownload]" << downloadedCount << " " << totalCount << " files download succesfully";
emit finished();
return;
}
QUrl url = downloadQueue.dequeue();
// QString filename = saveFileName(url);
QString filename = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
//Prendo nome primo elemento ed inserisco nella lista, poi lo rimuovo
if(!imagesName.isEmpty())
{
filename.append("/");
filename.append(imagesName.first());
imagesName.removeFirst();
}
qDebug() << "[DownloadManager::startNextDownload] Filename " << filename;
output.setFileName(filename);
if (!output.open(QIODevice::WriteOnly))
{
qDebug() << "[DownloadManager::startNextDownload] Problem opening save file " << filename << " for download " << output.errorString();
qDebug() << "[DownloadManager::startNextDownload] Skipping download";
startNextDownload();
return; // skip this download
}
//Download the file into the location
QNetworkRequest request(url);
currentDownload = manager.get(request);
connect(currentDownload, &QNetworkReply::finished,
this, &DownloadManager::downloadFinished);
connect(currentDownload, &QNetworkReply::readyRead,
this, &DownloadManager::downloadReadyRead);
// prepare the output
qDebug() << "[DownloadManager::startNextDownload] Downloading " << url;
}