engine/src/FeedParser.cpp
branchsymbian1
changeset 374 f067cee22e48
parent 365 3317b29a19f1
--- a/engine/src/FeedParser.cpp	Fri Nov 19 00:16:55 2010 +0000
+++ b/engine/src/FeedParser.cpp	Fri Nov 19 01:08:10 2010 +0000
@@ -54,6 +54,11 @@
 	iMaxItems = aMaxItems;
 	iStoppedParsing = EFalse;
 	iEncoding = ELatin1;
+	if (iNewestShow)
+		delete iNewestShow;
+	iNewestShow = 0;
+	
+	iNewFeed = (iActiveFeed->LastUpdated() == 0) ? ETrue : EFalse;
 
 	TEntry entry;
 	User::LeaveIfError(iRfs.Entry(feedFileName, entry));
@@ -89,6 +94,18 @@
 void CFeedParser::OnEndDocumentL(TInt /*aErrorCode*/)
 	{
 	//DP("OnEndDocumentL()");
+	if (iNewFeed)
+		{
+		// if the feed adds at bottom, this 
+		if (iNewestShow)
+			{
+			iNewestShow->SetPlayState(ENeverPlayed);
+			iCallbacks.ParserShowUpdatedL(*iNewestShow);
+			delete iNewestShow;
+			iNewestShow = 0;
+			}
+		}
+	
 	iCallbacks.ParsingCompleteL(iActiveFeed);
 	}
 
@@ -321,12 +338,25 @@
 					iPreviousPubDate = iActiveShow->PubDate();
 					}
 				
-				
 				if (iUid)
 					{
 					iActiveShow->SetUid(iUid);
 					}
+				
+				if (iNewFeed)
+					{
+					// set all played, except for the newest one
+					iActiveShow->SetPlayState(EPlayed);
+					
+					if (!iNewestShow || iActiveShow->PubDate() > iNewestShow->PubDate())
+						{
+						if (iNewestShow)
+							delete iNewestShow;
 						
+						iNewestShow = new CShowInfo(iActiveShow);
+						}
+					}
+					
 				iCallbacks.NewShowL(*iActiveShow);
 				
 				delete iActiveShow;