144 if (iShowDownloading) |
144 if (iShowDownloading) |
145 { |
145 { |
146 BaflUtils::DeleteFile(iPodcastModel.FsSession(), iShowDownloading->FileName()); |
146 BaflUtils::DeleteFile(iPodcastModel.FsSession(), iShowDownloading->FileName()); |
147 } |
147 } |
148 |
148 |
149 NotifyShowDownloadUpdatedL(-1, -1); |
149 if (resumeAfterRemove) |
150 NotifyDownloadQueueUpdatedL(); |
150 { |
151 |
|
152 if (resumeAfterRemove) { |
|
153 ResumeDownloadsL(); |
151 ResumeDownloadsL(); |
154 } |
152 } |
|
153 else |
|
154 { |
|
155 NotifyShowDownloadUpdatedL(-1, -1); |
|
156 NotifyDownloadQueueUpdatedL(); |
|
157 } |
155 |
158 |
156 DownloadNextShowL(); |
159 DownloadNextShowL(); |
157 DP("CShowEngine::RemoveDownloadL END"); |
160 DP("CShowEngine::RemoveDownloadL END"); |
158 } |
161 } |
159 |
162 |
1010 |
1013 |
1011 if (rc == SQLITE_OK) |
1014 if (rc == SQLITE_OK) |
1012 { |
1015 { |
1013 Cleanup_sqlite3_finalize_PushL(st); |
1016 Cleanup_sqlite3_finalize_PushL(st); |
1014 rc = sqlite3_step(st); |
1017 rc = sqlite3_step(st); |
1015 if (rc =! SQLITE_DONE) |
1018 if (rc != SQLITE_DONE) |
1016 { |
1019 { |
1017 User::Leave(KErrUnknown); |
1020 User::Leave(KErrUnknown); |
1018 } |
1021 } |
1019 CleanupStack::PopAndDestroy(); // st |
1022 CleanupStack::PopAndDestroy(); // st |
1020 } |
1023 } |
1246 NotifyDownloadQueueUpdatedL(); |
1249 NotifyDownloadQueueUpdatedL(); |
1247 return; |
1250 return; |
1248 } |
1251 } |
1249 else |
1252 else |
1250 { |
1253 { |
|
1254 if (iShowDownloading) { |
|
1255 delete iShowDownloading; |
|
1256 } |
|
1257 |
1251 // Start the download |
1258 // Start the download |
1252 CShowInfo *info = DBGetNextDownloadL(); |
1259 iShowDownloading = DBGetNextDownloadL(); |
1253 CleanupStack::PushL(info); |
1260 |
1254 while(info != NULL) |
1261 while(iShowDownloading != NULL) |
1255 { |
1262 { |
1256 DP1("CShowEngine::DownloadNextShow\tDownloading: %S", &(info->Title())); |
1263 DP1("CShowEngine::DownloadNextShow\tDownloading: %S", &(iShowDownloading->Title())); |
1257 info->SetDownloadState(EDownloading); |
1264 iShowDownloading->SetDownloadState(EDownloading); |
1258 info->SetLastError(KErrNone); |
1265 iShowDownloading->SetLastError(KErrNone); |
1259 DBUpdateShowL(*info); |
1266 DBUpdateShowL(*iShowDownloading); |
1260 iShowDownloading = info; |
|
1261 // Inform the observers |
1267 // Inform the observers |
1262 // important to do this after we change download state |
1268 // important to do this after we change download state |
1263 NotifyDownloadQueueUpdatedL(); |
1269 NotifyDownloadQueueUpdatedL(); |
1264 |
1270 |
1265 TRAPD(error,GetShowL(info)); |
1271 TRAPD(error,GetShowL(iShowDownloading)); |
1266 if (error != KErrNone) |
1272 if (error == KErrNone) |
1267 { |
|
1268 info->SetDownloadState(EFailedDownload); |
|
1269 DBRemoveDownloadL(info->Uid()); |
|
1270 DBUpdateShowL(*info); |
|
1271 CleanupStack::PopAndDestroy(info); |
|
1272 info = DBGetNextDownloadL(); |
|
1273 |
|
1274 if(info == NULL) |
|
1275 { |
|
1276 iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
1277 iShowDownloading = NULL; |
|
1278 } |
|
1279 else |
|
1280 { |
|
1281 CleanupStack::PushL(info); |
|
1282 } |
|
1283 } |
|
1284 else |
|
1285 { |
1273 { |
1286 break; |
1274 break; |
1287 } |
1275 } |
|
1276 else |
|
1277 { |
|
1278 iShowDownloading->SetDownloadState(EFailedDownload); |
|
1279 DBRemoveDownloadL(iShowDownloading->Uid()); |
|
1280 DBUpdateShowL(*iShowDownloading); |
|
1281 CleanupStack::PopAndDestroy(iShowDownloading); |
|
1282 |
|
1283 iShowDownloading = DBGetNextDownloadL(); |
|
1284 if(iShowDownloading == NULL) |
|
1285 { |
|
1286 iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
1287 } |
|
1288 } |
1288 } |
1289 } |
1289 CleanupStack::Pop(info); // lives on as iShowDownloading |
|
1290 } |
1290 } |
1291 } |
1291 } |
1292 else |
1292 else |
1293 { |
1293 { |
1294 // Inform the observers |
1294 // Inform the observers |