# HG changeset patch # User Sebastian Brannstrom # Date 1280323089 -3600 # Node ID 31659d49b2e722e88e2d68d89e84c3c3bfc2546f # Parent 44d205147a837bb98d5d31290d7f39ac1c0a0e4a Fix for bug 3042 diff -r 44d205147a83 -r 31659d49b2e7 engine/src/ShowEngine.cpp --- a/engine/src/ShowEngine.cpp Sat Oct 16 18:04:09 2010 +0100 +++ b/engine/src/ShowEngine.cpp Wed Jul 28 14:18:09 2010 +0100 @@ -170,7 +170,7 @@ void CShowEngine::Progress(CHttpClient* /*aHttpClient */, TInt aBytes, TInt aTotalBytes) { - iShowDownloading->SetShowSize(aTotalBytes); + //iShowDownloading->SetShowSize(aTotalBytes); TRAP_IGNORE(NotifyShowDownloadUpdatedL(aBytes, aTotalBytes)); } @@ -253,7 +253,8 @@ { if (iShowDownloading != NULL) { - DP2("CShowEngine::CompleteL file=%S, aError=%d", &iShowDownloading->FileName(), aError); + DP2("CShowEngine::CompleteL file=%S, aError=%d", &iShowDownloading->FileName(), aError); + if(aError != KErrCouldNotConnect) { if(aError == KErrDisconnected && iPodcastModel.SettingsEngine().DownloadSuspended()) @@ -279,6 +280,14 @@ { iShowDownloading->SetShowType(EVideoPodcast); } + + // setting file size + TEntry entry; + TInt err = iPodcastModel.FsSession().Entry(iShowDownloading->FileName(), entry); + if (err == KErrNone) + { + iShowDownloading->SetShowSize(entry.iSize); + } iShowDownloading->SetDownloadState(EDownloaded); DBUpdateShowL(*iShowDownloading); @@ -291,8 +300,16 @@ } else { + if (aError == HTTPStatus::ERequestedRangeNotSatisfiable) + { + DP("ERequestedRangeNotSatisfiable, resetting download"); + // file size got messed up, so delete downloaded file an re-queue + BaflUtils::DeleteFile(iPodcastModel.FsSession(),iShowDownloading->FileName()); + iShowDownloading->SetDownloadState(EQueued); + DBUpdateShowL(*iShowDownloading); + } // 400 and 500 series errors are serious errors on which probably another download will fail - if(aError >= HTTPStatus::EBadRequest && aError <= HTTPStatus::EBadRequest+200) + else if (aError>= HTTPStatus::EBadRequest && aError <= HTTPStatus::EBadRequest+200) { iShowDownloading->SetDownloadState(EFailedDownload); DBUpdateShowL(*iShowDownloading);