Fix for bug 3540 - show sorting when pubDate is not set in feed RCL_3
authorSebastian Brannstrom <sebastianb@symbian.org>
Sat, 16 Oct 2010 15:58:45 +0100
branchRCL_3
changeset 254 042bb9038b32
parent 248 31659d49b2e7
child 255 a13c58ace598
Fix for bug 3540 - show sorting when pubDate is not set in feed
engine/src/FeedParser.cpp
--- a/engine/src/FeedParser.cpp	Wed Jul 28 14:18:09 2010 +0100
+++ b/engine/src/FeedParser.cpp	Sat Oct 16 15:58:45 2010 +0100
@@ -272,7 +272,27 @@
 			break;
 		case EStateItem:
 			if (str.CompareF(KTagItem) == 0) 
-				{				
+				{
+				
+				// check if we have a valid pubdate
+				
+				if (iActiveShow->PubDate().Int64() == 0)
+					{
+					// set pubDate to present time
+					TTime now;
+					now.UniversalTime();
+					
+					// but we want reverse sorting, so let's do a little trick...
+					TTimeIntervalHours delta;
+					delta = iItemsParsed;
+					
+					// ... remove an hour per show we've parsed so far
+					now -= delta;
+					
+					iActiveShow->SetPubDate(now);
+					}
+				
+						
 				iCallbacks.NewShowL(*iActiveShow);
 				
 				delete iActiveShow;