Attempted fix for bug 2434; added KErrInUse leaves if update called when engine is in use
--- a/engine/inc/FeedEngine.h Mon May 03 15:18:30 2010 +0100
+++ b/engine/inc/FeedEngine.h Wed May 05 10:31:04 2010 +0100
@@ -151,8 +151,9 @@
// observers that will receive callbacks, not owning
RArray<MFeedEngineObserver*> iObservers;
- TBool iCatchupMode;
- TUint iCatchupCounter;
+ // new feeds only add one show to download list when auto downloading
+ TBool newFeed;
+ TUint showsAdded;
sqlite3& iDB;
--- a/engine/src/FeedEngine.cpp Mon May 03 15:18:30 2010 +0100
+++ b/engine/src/FeedEngine.cpp Wed May 05 10:31:04 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)