So I'm saving (downloading) new multimedia files to the appropriate folders, then opening the image gallery, or music gallery (however it's call on English version), or videos app. Only to find that there's nothing new there, on the music gallery I can manually refresh and then it finds the new file. On the image gallery I have to reset the phone to force a refresh.
Do you know how to notify the system that a new multimedia file is available so it can update its cache?
My current code to save files is pretty simple.
private slots:
void fileDownloaded(QNetworkReply* pReply) {
QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
/* We'll deduct if the redirection is valid in the redirectUrl function */
QUrl _urlRedirectedTo = this->redirectUrl(possibleRedirectUrl.toUrl(),_urlRedirectedTo);
if(!_urlRedirectedTo.isEmpty()) {
QNetworkRequest request(_urlRedirectedTo);
reply=m_WebCtrl.get(request);
connect(reply,SIGNAL(downloadProgress(qint64,qint64)),
SLOT(fileDownloading(qint64,qint64)));
connect(reply,SIGNAL(readyRead()),
SLOT(readyRead()));
downloadTo.close();
downloadTo.open(QIODevice::WriteOnly);
} else {
QByteArray m_DownloadedData;
m_DownloadedData = pReply->readAll();
downloadTo.write(m_DownloadedData);
downloadTo.close();
//emit a signal
emit downloaded();
}
pReply->deleteLater();
}