--- a/engine/src/FeedEngine.cpp Mon May 03 16:09:50 2010 +0100
+++ b/engine/src/FeedEngine.cpp Wed May 05 10:50:52 2010 +0100
@@ -144,6 +144,11 @@
EXPORT_C void CFeedEngine::UpdateAllFeedsL(TBool aAutoUpdate)
{
+ if (iClientState != EIdle)
+ {
+ User::Leave(KErrInUse);
+ }
+
iAutoUpdatedInitiator = aAutoUpdate;
if (iFeedsUpdating.Count() > 0)
{
@@ -176,6 +181,11 @@
{
DP1("UpdateNextFeed. %d feeds left to update", iFeedsUpdating.Count());
+ if (iClientState != EIdle)
+ {
+ User::Leave(KErrInUse);
+ }
+
// reset active feed, will be set again in UpdateFeedL if needed
iActiveFeed = NULL;
@@ -229,10 +239,11 @@
if (iActiveFeed->LastUpdated() == 0)
{
- iCatchupMode = ETrue;
- iCatchupCounter = 0;
+ newFeed = ETrue;
}
+ showsAdded = 0;
+
iActiveFeed->SetLastError(KErrNone);
DBUpdateFeedL(*iActiveFeed);
@@ -273,10 +284,12 @@
aItem.SetDescriptionL(*description);
CleanupStack::PopAndDestroy(description);
- if (iCatchupMode) {
- // in catchup mode, we let one show be unplayed
- if (++iCatchupCounter > 1) {
- aItem.SetPlayState(EPlayed);
+ if (newFeed) {
+ // for new feeds, set all shows played
+ aItem.SetPlayState(EPlayed);
+ // except the first one
+ if (showsAdded == 0) {
+ aItem.SetPlayState(ENeverPlayed);
}
}
@@ -286,7 +299,9 @@
iPodcastModel.SettingsEngine().DownloadAutomatically())
{
iPodcastModel.ShowEngine().AddDownloadL(aItem);
- }
+ }
+
+ showsAdded++;
}
void CFeedEngine::GetFeedImageL(CFeedInfo *aFeedInfo)
@@ -363,7 +378,8 @@
descPtr.Copy(aItem.Description());
PodcastUtils::SQLEncode(descPtr);
- _LIT(KSqlStatement, "insert into feeds (url, title, description, imageurl, imagefile, link, built, lastupdated, uid, feedtype, customtitle, lasterror) values (\"%S\",\"%S\", \"%S\", \"%S\", \"%S\", \"%S\", \"%Ld\", \"%Ld\", \"%u\", \"%u\", \"%u\", \"%d\")");
+ _LIT(KSqlStatement, "insert into feeds (url, title, description, imageurl, imagefile, link, built, lastupdated, uid, feedtype, customtitle, lasterror)"
+ " values (\"%S\",\"%S\", \"%S\", \"%S\", \"%S\", \"%S\", \"%Ld\", \"%Ld\", \"%u\", \"%u\", \"%u\", \"%d\")");
iSqlBuffer.Format(KSqlStatement,
&aItem.Url(), titleBuf, descBuf, &aItem.ImageUrl(), &aItem.ImageFileName(), &aItem.Link(),
aItem.BuildDate().Int64(), aItem.LastUpdated().Int64(), aItem.Uid(), EAudioPodcast, aItem.CustomTitle(), aItem.LastError());
@@ -475,7 +491,8 @@
descPtr.Copy(aItem.Description());
PodcastUtils::SQLEncode(descPtr);
- _LIT(KSqlStatement, "update feeds set url=\"%S\", title=\"%S\", description=\"%S\", imageurl=\"%S\", imagefile=\"%S\",link=\"%S\", built=\"%Lu\", lastupdated=\"%Lu\", feedtype=\"%u\", customtitle=\"%u\", lasterror=\"%d\" where uid=\"%u\"");
+ _LIT(KSqlStatement, "update feeds set url=\"%S\", title=\"%S\", description=\"%S\", imageurl=\"%S\", imagefile=\"%S\"," \
+ "link=\"%S\", built=\"%Lu\", lastupdated=\"%Lu\", feedtype=\"%u\", customtitle=\"%u\", lasterror=\"%d\" where uid=\"%u\"");
iSqlBuffer.Format(KSqlStatement,
&aItem.Url(), titleBuf, descBuf, &aItem.ImageUrl(), &aItem.ImageFileName(), &aItem.Link(),
aItem.BuildDate().Int64(), aItem.LastUpdated().Int64(), EAudioPodcast, aItem.CustomTitle(), aItem.LastError(), aItem.Uid());