engine/src/FeedParser.cpp
branchRCL_3
changeset 369 c683165bec63
parent 342 9441fb8fd60d
child 376 31968c23152c
equal deleted inserted replaced
368:b131f7696342 369:c683165bec63
    71 	{
    71 	{
    72 	DP("OnStartDocumentL()");
    72 	DP("OnStartDocumentL()");
    73 	HBufC* charset = HBufC::NewLC(KMaxParseBuffer);
    73 	HBufC* charset = HBufC::NewLC(KMaxParseBuffer);
    74 	charset->Des().Copy(aDocParam.CharacterSetName().DesC());
    74 	charset->Des().Copy(aDocParam.CharacterSetName().DesC());
    75 	iEncoding = EUtf8;
    75 	iEncoding = EUtf8;
       
    76 	iFeedDirection = EFeedUnknown;
       
    77 	iPreviousPubDate = 0;
    76 	if (charset->CompareF(_L("utf-8")) == 0) {
    78 	if (charset->CompareF(_L("utf-8")) == 0) {
    77 		DP("setting UTF8");
    79 		DP("setting UTF8");
    78 		iEncoding = EUtf8;
    80 		iEncoding = EUtf8;
    79 	} else if (charset->CompareF(_L("ISO-8859-1")) == 0) {
    81 	} else if (charset->CompareF(_L("ISO-8859-1")) == 0) {
    80 		iEncoding = EUtf8; //Latin1;
    82 		iEncoding = EUtf8; //Latin1;
   300 					now -= delta;
   302 					now -= delta;
   301 					
   303 					
   302 					iActiveShow->SetPubDate(now);
   304 					iActiveShow->SetPubDate(now);
   303 					}
   305 					}
   304 				
   306 				
       
   307 				if (iFeedDirection == EFeedUnknown)
       
   308 					{
       
   309 					if (iPreviousPubDate.Int64() != 0) {
       
   310 						if (iActiveShow->PubDate() > iPreviousPubDate)
       
   311 							{
       
   312 							DP("Feed adds at bottom");
       
   313 							iFeedDirection = EFeedAddsAtBottom;
       
   314 							}
       
   315 						else
       
   316 							{
       
   317 							DP("Feed adds at top");
       
   318 							iFeedDirection = EFeedAddsAtTop;
       
   319 							}
       
   320 					}
       
   321 					iPreviousPubDate = iActiveShow->PubDate();
       
   322 					}
       
   323 				
       
   324 				
   305 				if (iUid)
   325 				if (iUid)
   306 					{
   326 					{
   307 					iActiveShow->SetUid(iUid);
   327 					iActiveShow->SetUid(iUid);
   308 					}
   328 					}
   309 						
   329 						
   314 				// We should now be finished with the show.
   334 				// We should now be finished with the show.
   315 				iActiveShow = NULL;
   335 				iActiveShow = NULL;
   316 				
   336 				
   317 				iItemsParsed++;
   337 				iItemsParsed++;
   318 				DP2("iItemsParsed: %d, iMaxItems: %d", iItemsParsed, iMaxItems);
   338 				DP2("iItemsParsed: %d, iMaxItems: %d", iItemsParsed, iMaxItems);
   319 				if (iItemsParsed >= iMaxItems) 
   339 				// we stop parsing after iMaxItems, but not if feed builds at bottom
       
   340 				if (iItemsParsed >= iMaxItems && iFeedDirection != EFeedAddsAtBottom) 
   320 					{
   341 					{
   321 					iStoppedParsing = ETrue;
   342 					iStoppedParsing = ETrue;
   322 					DP("*** Too many items, aborting parsing");
   343 					DP("*** Too many items, aborting parsing");
   323 					}
   344 					}
   324 				
   345