# HG changeset patch # User teknolog # Date 1272131935 -3600 # Node ID b03018fb341808275b8d22075ef2d3d84a47b10e # Parent 3b59b88b089e73dcead03e6bf50d2cdc911c749a Added method that checks for deleted downloaded files and updates DB accordingly diff -r 3b59b88b089e -r b03018fb3418 engine/inc/ShowEngine.h --- 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: diff -r 3b59b88b089e -r b03018fb3418 engine/src/PodcastModel.cpp --- 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); } diff -r 3b59b88b089e -r b03018fb3418 engine/src/ShowEngine.cpp --- 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;iDownloadState() == 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])); + } + } + } + } +