Fix for bug 3959 part 2, shows being deleted directly after download symbian1
authorSebastian Brannstrom <sebastianb@symbian.org>
Fri, 19 Nov 2010 01:27:00 +0000
branchsymbian1
changeset 375 82f59b3393b3
parent 374 f067cee22e48
child 377 684802056d6f
Fix for bug 3959 part 2, shows being deleted directly after download
engine/src/FeedEngine.cpp
engine/src/ShowEngine.cpp
--- a/engine/src/FeedEngine.cpp	Fri Nov 19 01:08:10 2010 +0000
+++ b/engine/src/FeedEngine.cpp	Fri Nov 19 01:27:00 2010 +0000
@@ -1201,4 +1201,9 @@
 void CFeedEngine::ParserShowUpdatedL(CShowInfo& aShow)
 	{
 	iPodcastModel.ShowEngine().UpdateShowL(aShow);
+	if (aShow.PlayState() == ENeverPlayed && 
+				iPodcastModel.SettingsEngine().DownloadAutomatically()) 
+			{
+			iPodcastModel.ShowEngine().AddDownloadL(aShow);
+			}
 	}
--- a/engine/src/ShowEngine.cpp	Fri Nov 19 01:08:10 2010 +0000
+++ b/engine/src/ShowEngine.cpp	Fri Nov 19 01:27:00 2010 +0000
@@ -524,7 +524,7 @@
 //	TTimeIntervalYears years(5);
 //	now += years;
 	
-	_LIT(KSqlStatement, "select filename from shows where downloadstate=%d and deletedate < \"%Ld\"");
+	_LIT(KSqlStatement, "select filename from shows where downloadstate=%d and deletedate != 0 and deletedate < \"%Ld\"");
 	iSqlBuffer.Format(KSqlStatement, EDownloaded, now.Int64());
 
 	sqlite3_stmt *st;
@@ -1460,6 +1460,12 @@
 EXPORT_C void CShowEngine::UpdateShowL(CShowInfo& aInfo)
 	{
 	DBUpdateShowL(aInfo);
+	
+	// hack to ensure change in playstate is stored for the show actively downloading
+	if (iShowDownloading && iShowDownloading->Uid() == aInfo.Uid())
+		{
+		iShowDownloading->SetPlayState(aInfo.PlayState());
+		}	
 	}
 
 EXPORT_C CMetaDataReader& CShowEngine::MetaDataReader()