--- a/engine/inc/ShowEngine.h Mon Apr 05 13:54:26 2010 +0100
+++ b/engine/inc/ShowEngine.h Sat Apr 24 18:58:55 2010 +0100
@@ -70,6 +70,7 @@
IMPORT_C void GetMimeType(const TDesC& aFileName, TDes& aMimeType);
+ IMPORT_C void CheckForDeletedShows(TUint aFeedUid);
IMPORT_C CMetaDataReader& MetaDataReader();
private:
--- a/engine/src/PodcastModel.cpp Mon Apr 05 13:54:26 2010 +0100
+++ b/engine/src/PodcastModel.cpp Sat Apr 24 18:58:55 2010 +0100
@@ -435,6 +435,7 @@
EXPORT_C void CPodcastModel::GetShowsByFeedL(TUint aFeedUid)
{
iActiveShowList.ResetAndDestroy();
+ iShowEngine->CheckForDeletedShows(aFeedUid);
iShowEngine->GetShowsByFeedL(iActiveShowList, aFeedUid);
}
--- a/engine/src/ShowEngine.cpp Mon Apr 05 13:54:26 2010 +0100
+++ b/engine/src/ShowEngine.cpp Sat Apr 24 18:58:55 2010 +0100
@@ -1359,3 +1359,33 @@
{
iDownloadErrors = KMaxDownloadErrors;
}
+
+EXPORT_C void CShowEngine::CheckForDeletedShows(TUint aFeedUid)
+ {
+ RShowInfoArray shows;
+
+ TRAPD(err, DBGetShowsByFeedL(shows, aFeedUid));
+
+ if (err != KErrNone)
+ {
+ // probably a catastrophic error, but it doesn't
+ // matter for this method
+ return;
+ }
+
+ for (int i=0;i<shows.Count();i++)
+ {
+ if (shows[i]->DownloadState() == EDownloaded && shows[i]->FileName() != KNullDesC)
+ {
+ if(!BaflUtils::FileExists(iPodcastModel.FsSession(),shows[i]->FileName()))
+ {
+ // file doesn't exist anymore, assume it was deleted from outside
+ DP1("Show %S does not exist on disk, flagging as non downloaded", &shows[i]->FileName());
+ shows[i]->SetDownloadState(ENotDownloaded);
+ shows[i]->SetPlayState(EPlayed);
+ TRAP_IGNORE(DBUpdateShowL(*shows[i]));
+ }
+ }
+ }
+ }
+