engine/src/FeedEngine.cpp
changeset 117 3b59b88b089e
parent 116 a2e43aa1ad11
child 126 c2f1ea38ec70
--- a/engine/src/FeedEngine.cpp	Mon Apr 05 11:33:41 2010 +0100
+++ b/engine/src/FeedEngine.cpp	Mon Apr 05 13:54:26 2010 +0100
@@ -243,15 +243,16 @@
 	_LIT(KFileNameFormat, "%lu.xml");
 	iUpdatingFeedFileName.AppendFormat(KFileNameFormat, aFeedUid);
 	
+	iClientState = EUpdatingFeed;
+			
+	for (TInt i=0;i<iObservers.Count();i++)
+		{
+		TRAP_IGNORE(iObservers[i]->FeedDownloadStartedL(iAutoUpdatedInitiator?MFeedEngineObserver::EFeedAutoUpdate:MFeedEngineObserver::EFeedManualUpdate, iActiveFeed->Uid()));
+		}
+
 	if(iFeedClient->GetL(iActiveFeed->Url(), iUpdatingFeedFileName, iPodcastModel.SettingsEngine().SpecificIAP()))
 		{
-		iClientState = EUpdatingFeed;
 		
-		for (TInt i=0;i<iObservers.Count();i++)
-			{
-			TRAP_IGNORE(iObservers[i]->FeedDownloadStartedL(iAutoUpdatedInitiator?MFeedEngineObserver::EFeedAutoUpdate:MFeedEngineObserver::EFeedManualUpdate, iActiveFeed->Uid()));
-			}
-
 		DP("FeedEngine::UpdateFeedL END, return ETrue");
 		return ETrue;
 		}
@@ -604,6 +605,11 @@
 								}	
 							}
 						}
+					else
+						{
+						// even if it fails, this will allow us to move on
+						iClientState = EIdle;
+						}
 					}
 				iCancelRequested = EFalse;
 				}break;
@@ -655,6 +661,9 @@
 			
 			BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName);
 			}break;
+		case EIdle:
+			UpdateNextFeedL();	
+			break;
 		default:
 			Panic(EPodcatcherPanicFeedEngineState);
 			break;
@@ -899,7 +908,7 @@
 	iSortedFeeds.Reset();
 	CFeedInfo *feedInfo = NULL;
 	
-	_LIT(KSqlStatement, "select url, title, description, imageurl, imagefile, link, built, lastupdated, uid, feedtype, customtitle from feeds");
+	_LIT(KSqlStatement, "select url, title, description, imageurl, imagefile, link, built, lastupdated, uid, feedtype, customtitle, lasterror from feeds");
 	iSqlBuffer.Format(KSqlStatement);
 
 	sqlite3_stmt *st;
@@ -957,7 +966,7 @@
 				feedInfo->SetCustomTitle();
 				}
 			
-			TInt lasterror = sqlite3_column_int(st, 11);
+			sqlite3_int64 lasterror = sqlite3_column_int(st, 11);
 			feedInfo->SetLastError(lasterror);
 			
 			TLinearOrder<CFeedInfo> sortOrder( CFeedEngine::CompareFeedsByTitle);