equal
deleted
inserted
replaced
168 } |
168 } |
169 |
169 |
170 void CShowEngine::Progress(CHttpClient* /*aHttpClient */, TInt aBytes, |
170 void CShowEngine::Progress(CHttpClient* /*aHttpClient */, TInt aBytes, |
171 TInt aTotalBytes) |
171 TInt aTotalBytes) |
172 { |
172 { |
173 iShowDownloading->SetShowSize(aTotalBytes); |
173 //iShowDownloading->SetShowSize(aTotalBytes); |
174 TRAP_IGNORE(NotifyShowDownloadUpdatedL(aBytes, aTotalBytes)); |
174 TRAP_IGNORE(NotifyShowDownloadUpdatedL(aBytes, aTotalBytes)); |
175 } |
175 } |
176 |
176 |
177 void CShowEngine::Disconnected(CHttpClient* /*aClient */) |
177 void CShowEngine::Disconnected(CHttpClient* /*aClient */) |
178 { |
178 { |
251 |
251 |
252 void CShowEngine::CompleteL(CHttpClient* /*aHttpClient*/, TInt aError) |
252 void CShowEngine::CompleteL(CHttpClient* /*aHttpClient*/, TInt aError) |
253 { |
253 { |
254 if (iShowDownloading != NULL) |
254 if (iShowDownloading != NULL) |
255 { |
255 { |
256 DP2("CShowEngine::CompleteL file=%S, aError=%d", &iShowDownloading->FileName(), aError); |
256 DP2("CShowEngine::CompleteL file=%S, aError=%d", &iShowDownloading->FileName(), aError); |
|
257 |
257 if(aError != KErrCouldNotConnect) |
258 if(aError != KErrCouldNotConnect) |
258 { |
259 { |
259 if(aError == KErrDisconnected && iPodcastModel.SettingsEngine().DownloadSuspended()) |
260 if(aError == KErrDisconnected && iPodcastModel.SettingsEngine().DownloadSuspended()) |
260 { |
261 { |
261 // no error if disconnect happened because of suspended downloading |
262 // no error if disconnect happened because of suspended downloading |
277 } |
278 } |
278 else if (mimeType.Left(5) == KMimeVideo) |
279 else if (mimeType.Left(5) == KMimeVideo) |
279 { |
280 { |
280 iShowDownloading->SetShowType(EVideoPodcast); |
281 iShowDownloading->SetShowType(EVideoPodcast); |
281 } |
282 } |
|
283 |
|
284 // setting file size |
|
285 TEntry entry; |
|
286 TInt err = iPodcastModel.FsSession().Entry(iShowDownloading->FileName(), entry); |
|
287 if (err == KErrNone) |
|
288 { |
|
289 iShowDownloading->SetShowSize(entry.iSize); |
|
290 } |
282 |
291 |
283 iShowDownloading->SetDownloadState(EDownloaded); |
292 iShowDownloading->SetDownloadState(EDownloaded); |
284 DBUpdateShowL(*iShowDownloading); |
293 DBUpdateShowL(*iShowDownloading); |
285 DBRemoveDownloadL(iShowDownloading->Uid()); |
294 DBRemoveDownloadL(iShowDownloading->Uid()); |
286 AddShowToMpxCollection(*iShowDownloading); |
295 AddShowToMpxCollection(*iShowDownloading); |
289 delete iShowDownloading; |
298 delete iShowDownloading; |
290 iShowDownloading = NULL; |
299 iShowDownloading = NULL; |
291 } |
300 } |
292 else |
301 else |
293 { |
302 { |
|
303 if (aError == HTTPStatus::ERequestedRangeNotSatisfiable) |
|
304 { |
|
305 DP("ERequestedRangeNotSatisfiable, resetting download"); |
|
306 // file size got messed up, so delete downloaded file an re-queue |
|
307 BaflUtils::DeleteFile(iPodcastModel.FsSession(),iShowDownloading->FileName()); |
|
308 iShowDownloading->SetDownloadState(EQueued); |
|
309 DBUpdateShowL(*iShowDownloading); |
|
310 } |
294 // 400 and 500 series errors are serious errors on which probably another download will fail |
311 // 400 and 500 series errors are serious errors on which probably another download will fail |
295 if(aError >= HTTPStatus::EBadRequest && aError <= HTTPStatus::EBadRequest+200) |
312 else if (aError>= HTTPStatus::EBadRequest && aError <= HTTPStatus::EBadRequest+200) |
296 { |
313 { |
297 iShowDownloading->SetDownloadState(EFailedDownload); |
314 iShowDownloading->SetDownloadState(EFailedDownload); |
298 DBUpdateShowL(*iShowDownloading); |
315 DBUpdateShowL(*iShowDownloading); |
299 DBRemoveDownloadL(iShowDownloading->Uid()); |
316 DBRemoveDownloadL(iShowDownloading->Uid()); |
300 NotifyShowFinishedL(aError); |
317 NotifyShowFinishedL(aError); |