engine/src/ShowEngine.cpp
branchsymbian1
changeset 356 697e27864f3a
parent 355 075b3a49cb55
child 364 998e9d114bd5
equal deleted inserted replaced
346:a0eb6aaed052 356:697e27864f3a
    36 	{
    36 	{
    37 	}
    37 	}
    38 
    38 
    39 EXPORT_C CShowEngine::~CShowEngine()
    39 EXPORT_C CShowEngine::~CShowEngine()
    40 	{	
    40 	{	
       
    41 	DP("CShowEngine::~CShowEngine BEGIN");
    41 	delete iShowClient;
    42 	delete iShowClient;
    42 	iObservers.Close();
    43 	iObservers.Close();
    43 	delete iShowDownloading;
    44 	delete iShowDownloading;
    44 	delete iMetaDataReader;
    45 	delete iMetaDataReader;
    45 	iApaSession.Close();
    46 	iApaSession.Close();
       
    47 	DP("CShowEngine::~CShowEngine END");
    46 	}
    48 	}
    47 
    49 
    48 EXPORT_C CShowEngine* CShowEngine::NewL(CPodcastModel& aPodcastModel)
    50 EXPORT_C CShowEngine* CShowEngine::NewL(CPodcastModel& aPodcastModel)
    49 	{
    51 	{
    50 	CShowEngine* self = new (ELeave) CShowEngine(aPodcastModel);
    52 	CShowEngine* self = new (ELeave) CShowEngine(aPodcastModel);
   372 
   374 
   373 EXPORT_C CShowInfo* CShowEngine::GetShowByUidL(TUint aShowUid)
   375 EXPORT_C CShowInfo* CShowEngine::GetShowByUidL(TUint aShowUid)
   374 	{
   376 	{
   375 	return DBGetShowByUidL(aShowUid);
   377 	return DBGetShowByUidL(aShowUid);
   376 	}
   378 	}
       
   379 
   377 CShowInfo* CShowEngine::DBGetShowByUidL(TUint aUid)
   380 CShowInfo* CShowEngine::DBGetShowByUidL(TUint aUid)
   378 	{
   381 	{
   379 	DP("CShowEngine::DBGetShowByUid");
   382 	DP("CShowEngine::DBGetShowByUid");
   380 	CShowInfo *showInfo = NULL;
   383 	CShowInfo *showInfo = NULL;
   381 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype from shows where uid=%u");
   384 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, deletedate from shows where uid=%u");
   382 	iSqlBuffer.Format(KSqlStatement, aUid);
   385 	iSqlBuffer.Format(KSqlStatement, aUid);
   383 
   386 
   384 	sqlite3_stmt *st;
   387 	sqlite3_stmt *st;
   385 
   388 
   386 	//DP1("SQL: %S", &iSqlBuffer.Left(KSqlDPLen));
   389 	//DP1("SQL: %S", &iSqlBuffer.Left(KSqlDPLen));
   406 
   409 
   407 EXPORT_C CShowInfo* CShowEngine::DBGetShowByFileNameL(TFileName aFileName)
   410 EXPORT_C CShowInfo* CShowEngine::DBGetShowByFileNameL(TFileName aFileName)
   408 	{
   411 	{
   409 	DP("CShowEngine::DBGetShowByUid");
   412 	DP("CShowEngine::DBGetShowByUid");
   410 	CShowInfo *showInfo = NULL;
   413 	CShowInfo *showInfo = NULL;
   411 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype from shows where filename=\"%S\"");
   414 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where filename=\"%S\"");
   412 	iSqlBuffer.Format(KSqlStatement, &aFileName);
   415 	iSqlBuffer.Format(KSqlStatement, &aFileName);
   413 
   416 
   414 	sqlite3_stmt *st;
   417 	sqlite3_stmt *st;
   415 
   418 
   416 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   419 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   433 	}
   436 	}
   434 
   437 
   435 void CShowEngine::DBGetAllShowsL(RShowInfoArray& aShowArray)
   438 void CShowEngine::DBGetAllShowsL(RShowInfoArray& aShowArray)
   436 	{
   439 	{
   437 	DP("CShowEngine::DBGetAllShows");
   440 	DP("CShowEngine::DBGetAllShows");
   438 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype from shows");
   441 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows");
   439 	iSqlBuffer.Format(KSqlStatement);
   442 	iSqlBuffer.Format(KSqlStatement);
   440 
   443 
   441 	sqlite3_stmt *st;
   444 	sqlite3_stmt *st;
   442 
   445 
   443 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   446 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   461 	}
   464 	}
   462 
   465 
   463 void CShowEngine::DBGetAllDownloadsL(RShowInfoArray& aShowArray)
   466 void CShowEngine::DBGetAllDownloadsL(RShowInfoArray& aShowArray)
   464 	{
   467 	{
   465 	DP("CShowEngine::DBGetAllDownloads");
   468 	DP("CShowEngine::DBGetAllDownloads");
   466 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror from downloads, shows where downloads.uid=shows.uid");
   469 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from downloads, shows where downloads.uid=shows.uid");
   467 	iSqlBuffer.Format(KSqlStatement);
   470 	iSqlBuffer.Format(KSqlStatement);
   468 
   471 
   469 #ifndef DONT_SORT_SQL
   472 #ifndef DONT_SORT_SQL
   470 	_LIT(KSqlSort, " order by dl_index");
   473 	_LIT(KSqlSort, " order by dl_index");
   471 	iSqlBuffer.Append(KSqlSort);
   474 	iSqlBuffer.Append(KSqlSort);
   511 		{
   514 		{
   512 		User::Leave(KErrCorrupt);
   515 		User::Leave(KErrCorrupt);
   513 		}
   516 		}
   514 	}
   517 	}
   515 
   518 
       
   519 void CShowEngine::DBGetOldShowsL(RShowInfoArray& aShowArray)
       
   520 	{
       
   521 	DP("CShowEngine::DBGetOldShowsL BEGIN");
       
   522 	TTime now;
       
   523 	now.HomeTime();
       
   524 //	TTimeIntervalYears years(5);
       
   525 //	now += years;
       
   526 	
       
   527 	_LIT(KSqlStatement, "select filename from shows where downloadstate=%d and deletedate < \"%Ld\"");
       
   528 	iSqlBuffer.Format(KSqlStatement, EDownloaded, now.Int64());
       
   529 
       
   530 	sqlite3_stmt *st;
       
   531 
       
   532 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
       
   533 			&st, (const void**) NULL);
       
   534 
       
   535 	if (rc == SQLITE_OK)
       
   536 		{
       
   537 		rc = sqlite3_step(st);
       
   538 		Cleanup_sqlite3_finalize_PushL(st);
       
   539 		while (rc == SQLITE_ROW)
       
   540 			{
       
   541 			CShowInfo* showInfo = CShowInfo::NewLC();
       
   542 
       
   543 			const void *filez = sqlite3_column_text16(st, 0);
       
   544 			TPtrC16 file((const TUint16*) filez);
       
   545 			showInfo->SetFileNameL(file);
       
   546 
       
   547 			aShowArray.Append(showInfo);
       
   548 			CleanupStack::Pop(showInfo);
       
   549 			rc = sqlite3_step(st);
       
   550 			}
       
   551 		CleanupStack::PopAndDestroy();//st
       
   552 		}
       
   553 	else
       
   554 		{
       
   555 		User::Leave(KErrCorrupt);
       
   556 		}
       
   557 	DP("CShowEngine::DBGetOldShowsL END");
       
   558 	}
       
   559 
   516 CShowInfo* CShowEngine::DBGetNextDownloadL()
   560 CShowInfo* CShowEngine::DBGetNextDownloadL()
   517 	{
   561 	{
   518 	DP("CShowEngine::DBGetNextDownload");
   562 	DP("CShowEngine::DBGetNextDownload");
   519 	CShowInfo *showInfo = NULL;
   563 	CShowInfo *showInfo = NULL;
   520 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror from downloads, shows where downloads.uid=shows.uid");
   564 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from downloads, shows where downloads.uid=shows.uid");
   521 	iSqlBuffer.Format(KSqlStatement);
   565 	iSqlBuffer.Format(KSqlStatement);
   522 
   566 
   523 #ifdef DONT_SORT_SQL
   567 #ifdef DONT_SORT_SQL
   524 	_LIT(KSqlSort, " limit 1");
   568 	_LIT(KSqlSort, " limit 1");
   525 	iSqlBuffer.Append(KSqlSort);
   569 	iSqlBuffer.Append(KSqlSort);
   558 	}
   602 	}
   559 
   603 
   560 void CShowEngine::DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid)
   604 void CShowEngine::DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid)
   561 	{
   605 	{
   562 	DP1("CShowEngine::DBGetShowsByFeed BEGIN, feedUid=%u", aFeedUid);
   606 	DP1("CShowEngine::DBGetShowsByFeed BEGIN, feedUid=%u", aFeedUid);
   563 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where feeduid=%u");
   607 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where feeduid=%u");
   564 	iSqlBuffer.Format(KSqlStatement, aFeedUid);
   608 	iSqlBuffer.Format(KSqlStatement, aFeedUid);
   565 
       
   566 	if (iShowFilter == ENewShows)
       
   567 		{
       
   568 		_LIT(KSqlStatementNewShows, " and playstate = 0"); // ENeverPlayed
       
   569 		iSqlBuffer.Append(KSqlStatementNewShows);
       
   570 		}
       
   571 	else if (iShowFilter == EDownloadedShows)
       
   572 		{
       
   573 	_LIT(KSqlStatementDownloadedShows, " and downloadstate = 4"); // EDownloaded
       
   574 		iSqlBuffer.Append(KSqlStatementDownloadedShows);
       
   575 		}
       
   576 	else if (iShowFilter == ENewAndDownloadedShows)
       
   577 		{
       
   578 	_LIT(KSqlStatementDownloadedAndNewShows, " and (downloadstate = 4 or playstate = 0)"); // EDownloaded or ENeverPlayed
       
   579 		iSqlBuffer.Append(KSqlStatementDownloadedAndNewShows);
       
   580 	
       
   581 		}
       
   582 	
   609 	
   583 #ifndef DONT_SORT_SQL	
   610 #ifndef DONT_SORT_SQL	
   584 	_LIT(KSqlOrderByDate, " order by pubdate desc");
   611 	_LIT(KSqlOrderByDate, " order by pubdate desc");
   585 	iSqlBuffer.Append(KSqlOrderByDate);
   612 	iSqlBuffer.Append(KSqlOrderByDate);
   586 #endif
   613 #endif
   648 	}
   675 	}
   649 
   676 
   650 void CShowEngine::DBGetDownloadedShowsL(RShowInfoArray& aShowArray)
   677 void CShowEngine::DBGetDownloadedShowsL(RShowInfoArray& aShowArray)
   651 	{
   678 	{
   652 	DP("CShowEngine::DBGetDownloadedShows");
   679 	DP("CShowEngine::DBGetDownloadedShows");
   653 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where downloadstate=%u");
   680 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where downloadstate=%u");
   654 	iSqlBuffer.Format(KSqlStatement, EDownloaded);
   681 	iSqlBuffer.Format(KSqlStatement, EDownloaded);
   655 
   682 
   656 #ifndef DONT_SORT_SQL
   683 #ifndef DONT_SORT_SQL
   657 	_LIT(KSqlSort, " order by title");
   684 	_LIT(KSqlSort, " order by title");
   658 	iSqlBuffer.Append(KSqlSort);
   685 	iSqlBuffer.Append(KSqlSort);
   684 	}
   711 	}
   685 
   712 
   686 void CShowEngine::DBGetNewShowsL(RShowInfoArray& aShowArray)
   713 void CShowEngine::DBGetNewShowsL(RShowInfoArray& aShowArray)
   687 	{
   714 	{
   688 	DP("CShowEngine::DBGetNewShows");
   715 	DP("CShowEngine::DBGetNewShows");
   689 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where playstate=%u");
   716 	_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where playstate=%u order by pubdate desc");
       
   717 
   690 	iSqlBuffer.Format(KSqlStatement, ENeverPlayed);
   718 	iSqlBuffer.Format(KSqlStatement, ENeverPlayed);
   691 
   719 
   692 	sqlite3_stmt *st;
   720 	sqlite3_stmt *st;
   693 
   721 
   694 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   722 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,
   807 	TUint showtype = sqlite3_column_int(st, 13);
   835 	TUint showtype = sqlite3_column_int(st, 13);
   808 	showInfo->SetShowType((TShowType) showtype);
   836 	showInfo->SetShowType((TShowType) showtype);
   809 	
   837 	
   810 	TInt lasterror = sqlite3_column_int(st, 14);
   838 	TInt lasterror = sqlite3_column_int(st, 14);
   811 	showInfo->SetLastError(lasterror);
   839 	showInfo->SetLastError(lasterror);
       
   840 
       
   841 	sqlite3_int64 deletedate = sqlite3_column_int64(st, 15);
       
   842 	TTime timedeletedate(deletedate);
       
   843 	showInfo->SetDeleteDate(timedeletedate);
   812 	}
   844 	}
   813 
   845 
   814 void CShowEngine::DBAddShowL(const CShowInfo& aItem)
   846 void CShowEngine::DBAddShowL(const CShowInfo& aItem)
   815 	{
   847 	{
   816 	DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url());
   848 	DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url());
   823 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   855 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   824 	TPtr descPtr(descBuf->Des());
   856 	TPtr descPtr(descBuf->Des());
   825 	descPtr.Copy(aItem.Description());
   857 	descPtr.Copy(aItem.Description());
   826 	PodcastUtils::SQLEncode(descPtr);
   858 	PodcastUtils::SQLEncode(descPtr);
   827 	
   859 	
   828 	_LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype) values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\")");
   860 	_LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, deletedate) values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\", \"%Lu\")");
   829 	
   861 	
   830 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   862 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   831 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   863 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   832 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   864 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   833 			aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(),
   865 			aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(),
   834 			aItem.PubDate().Int64(), aItem.ShowType());
   866 			aItem.PubDate().Int64(), aItem.ShowType(), aItem.DeleteDate().Int64());
   835 
   867 
   836 	CleanupStack::PopAndDestroy(descBuf);
   868 	CleanupStack::PopAndDestroy(descBuf);
   837 	CleanupStack::PopAndDestroy(titleBuf);
   869 	CleanupStack::PopAndDestroy(titleBuf);
   838 
   870 
   839 	sqlite3_stmt *st;
   871 	sqlite3_stmt *st;
   896 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   928 	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
   897 	TPtr descPtr(descBuf->Des());
   929 	TPtr descPtr(descBuf->Des());
   898 	descPtr.Copy(aItem.Description());
   930 	descPtr.Copy(aItem.Description());
   899 	PodcastUtils::SQLEncode(descPtr);
   931 	PodcastUtils::SQLEncode(descPtr);
   900 
   932 
   901 	_LIT(KSqlStatement, "update shows set url=\"%S\", title=\"%S\", description=\"%S\", filename=\"%S\", position=\"%Lu\", playtime=\"%u\", playstate=\"%u\", downloadstate=\"%u\", feeduid=\"%u\", showsize=\"%u\", trackno=\"%u\",pubdate=\"%Lu\", showtype=\"%d\", lasterror=\"%d\" where uid=\"%u\"");
   933 	_LIT(KSqlStatement, "update shows set url=\"%S\", title=\"%S\", description=\"%S\", filename=\"%S\", position=\"%Lu\", playtime=\"%u\", playstate=\"%u\", downloadstate=\"%u\", feeduid=\"%u\", showsize=\"%u\", trackno=\"%u\",pubdate=\"%Lu\", showtype=\"%d\", lasterror=\"%d\", deletedate=\"%Lu\" where uid=\"%u\"");
   902 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   934 	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
   903 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   935 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
   904 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   936 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
   905 			aItem.ShowSize(), aItem.TrackNo(), aItem.PubDate().Int64(),
   937 			aItem.ShowSize(), aItem.TrackNo(), aItem.PubDate().Int64(),
   906 			aItem.ShowType(), aItem.LastError(), aItem.Uid());
   938 			aItem.ShowType(), aItem.LastError(), aItem.DeleteDate().Int64(), aItem.Uid());
   907 
   939 
   908 	CleanupStack::PopAndDestroy(descBuf);
   940 	CleanupStack::PopAndDestroy(descBuf);
   909 	CleanupStack::PopAndDestroy(titleBuf);
   941 	CleanupStack::PopAndDestroy(titleBuf);
   910 
   942 
   911 	sqlite3_stmt *st;
   943 	sqlite3_stmt *st;
  1438 void CShowEngine::FileError(TUint /*aError*/)
  1470 void CShowEngine::FileError(TUint /*aError*/)
  1439 	{
  1471 	{
  1440 	iDownloadErrors = KMaxDownloadErrors;
  1472 	iDownloadErrors = KMaxDownloadErrors;
  1441 	}
  1473 	}
  1442 
  1474 
       
  1475 EXPORT_C void CShowEngine::ExpireOldShows()
       
  1476 	{
       
  1477 	DP("CShowEngine::ExpireOldShows BEGIN");
       
  1478 	RShowInfoArray oldShowsArray;
       
  1479 	
       
  1480 	TRAPD(err, DBGetOldShowsL(oldShowsArray));
       
  1481 	
       
  1482 	if (err == KErrNone)
       
  1483 		{
       
  1484 		for (int i=0;i<oldShowsArray.Count();i++)
       
  1485 			{
       
  1486 			DP1("    deleting %S", &oldShowsArray[i]->FileName());
       
  1487 			BaflUtils::DeleteFile(iPodcastModel.FsSession(), oldShowsArray[i]->FileName());
       
  1488 			}
       
  1489 		}
       
  1490 	DP("CShowEngine::ExpireOldShows END");
       
  1491 	}
       
  1492 
  1443 EXPORT_C void CShowEngine::CheckForDeletedShows(TUint aFeedUid)
  1493 EXPORT_C void CShowEngine::CheckForDeletedShows(TUint aFeedUid)
  1444 	{
  1494 	{
  1445 	RShowInfoArray shows;
  1495 	RShowInfoArray shows;
  1446 	
  1496 	
  1447 	TRAPD(err, DBGetShowsByFeedL(shows, aFeedUid));
  1497 	TRAPD(err, DBGetShowsByFeedL(shows, aFeedUid));
  1465 				shows[i]->SetPlayState(EPlayed);
  1515 				shows[i]->SetPlayState(EPlayed);
  1466 				TRAP_IGNORE(DBUpdateShowL(*shows[i]));
  1516 				TRAP_IGNORE(DBUpdateShowL(*shows[i]));
  1467 				}
  1517 				}
  1468 			}
  1518 			}
  1469 		}
  1519 		}
  1470 	}
       
  1471 
       
  1472 EXPORT_C void CShowEngine::SetShowFilter(TShowFilter aFilter)
       
  1473 	{
       
  1474 	iShowFilter = aFilter;
       
  1475 	}
  1520 	}
  1476 
  1521 
  1477 EXPORT_C void CShowEngine::MoveDownloadUpL(TUint aUid)
  1522 EXPORT_C void CShowEngine::MoveDownloadUpL(TUint aUid)
  1478 	{
  1523 	{
  1479 	DP("CShowEngine::MoveDownLoadUpL");
  1524 	DP("CShowEngine::MoveDownLoadUpL");
  1597 	else
  1642 	else
  1598 		{
  1643 		{
  1599 		User::Leave(KErrCorrupt);
  1644 		User::Leave(KErrCorrupt);
  1600 		}
  1645 		}
  1601 	}
  1646 	}
       
  1647 
       
  1648 EXPORT_C void CShowEngine::PostPlayHandling(CShowInfo *aShow)
       
  1649 	{
       
  1650 	DP("CShowEngine::PostPlayHandling BEGIN");
       
  1651 	if (!aShow)
       
  1652 		return;
       
  1653 		
       
  1654 	aShow->SetPlayState(EPlayed);
       
  1655 	
       
  1656 	TAutoDeleteSetting deleteSetting = iPodcastModel.SettingsEngine().DeleteAutomatically();
       
  1657 	TTimeIntervalDays daysAhead;
       
  1658 	
       
  1659 	switch (deleteSetting)
       
  1660 		{
       
  1661 		case EAutoDeleteOff:
       
  1662 			break;
       
  1663 		case EAutoDeleteAfter1Day:
       
  1664 			daysAhead = 1;
       
  1665 			break;
       
  1666 		case EAutoDeleteAfter7Days:
       
  1667 			daysAhead = 7;
       
  1668 			break;
       
  1669 		case EAutoDeleteAfter3Days:
       
  1670 			daysAhead = 30;
       
  1671 			break;
       
  1672 		}
       
  1673 	
       
  1674 	TTime deleteDate;
       
  1675 	deleteDate.HomeTime();
       
  1676 	deleteDate += daysAhead;
       
  1677 	aShow->SetDeleteDate(deleteDate);
       
  1678 	
       
  1679 	UpdateShowL(*aShow);
       
  1680 	DP("CShowEngine::PostPlayHandling END");
       
  1681 	}