More catchup with 5th edition RCL_3
authorSebastian Brannstrom <sebastianb@symbian.org>
Tue, 16 Nov 2010 13:05:42 +0000
branchRCL_3
changeset 369 c683165bec63
parent 368 b131f7696342
child 370 83825edad8e1
More catchup with 5th edition
application/inc/buildno.h
application/sis/buildno.txt
application/sis/podcatcher_udeb.pkg
application/sis/podcatcher_udeb_template.pkg
application/sis/podcatcher_urel.pkg
application/sis/podcatcher_urel_template.pkg
application/src/PodcastFeedView.cpp
engine/inc/FeedParser.h
engine/src/FeedParser.cpp
engine/src/PodcastUtils.cpp
engine/src/ShowEngine.cpp
--- a/application/inc/buildno.h	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/inc/buildno.h	Tue Nov 16 13:05:42 2010 +0000
@@ -1,2 +1,2 @@
 // Build number generated by increment_buildno.py, do not edit manually
-#define BUILD_NO 12
\ No newline at end of file
+#define BUILD_NO 1
\ No newline at end of file
--- a/application/sis/buildno.txt	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/sis/buildno.txt	Tue Nov 16 13:05:42 2010 +0000
@@ -1,1 +1,1 @@
-12
\ No newline at end of file
+1
\ No newline at end of file
--- a/application/sis/podcatcher_udeb.pkg	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/sis/podcatcher_udeb.pkg	Tue Nov 16 13:05:42 2010 +0000
@@ -1,7 +1,7 @@
 &EN,SP
 :"Symbian Foundation"
 %{"Podcatcher","Podcatcher"}
-#{"Podcatcher","Podcatcher"},(0xA0009D00), 1, 00, 12, TYPE=SA
+#{"Podcatcher","Podcatcher"},(0xA0009D00), 1, 10, 1, TYPE=SA
 
 ;Supports Symbian^3
 [0x20022E6D], 0, 0, 0, {"Series60ProductID","Series60ProductID"}
--- a/application/sis/podcatcher_udeb_template.pkg	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/sis/podcatcher_udeb_template.pkg	Tue Nov 16 13:05:42 2010 +0000
@@ -1,7 +1,7 @@
 &EN,SP
 :"Symbian Foundation"
 %{"Podcatcher","Podcatcher"}
-#{"Podcatcher","Podcatcher"},(0xA0009D00), 1, 00, BUILDNO, TYPE=SA
+#{"Podcatcher","Podcatcher"},(0xA0009D00), 1, 10, BUILDNO, TYPE=SA
 
 ;Supports Symbian^3
 [0x20022E6D], 0, 0, 0, {"Series60ProductID","Series60ProductID"}
--- a/application/sis/podcatcher_urel.pkg	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/sis/podcatcher_urel.pkg	Tue Nov 16 13:05:42 2010 +0000
@@ -1,7 +1,7 @@
 &EN,SP
 :"Symbian Foundation"
 %{"Podcatcher","Podcatcher"}
-#{"Podcatcher","Podcatcher"},(0xA0009D00), 0, 90, 12, TYPE=SA
+#{"Podcatcher","Podcatcher"},(0xA0009D00), 1, 10, 1, TYPE=SA
 
 ;Supports Symbian^3
 [0x20022E6D], 0, 0, 0, {"Series60ProductID","Series60ProductID"}
--- a/application/sis/podcatcher_urel_template.pkg	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/sis/podcatcher_urel_template.pkg	Tue Nov 16 13:05:42 2010 +0000
@@ -1,7 +1,7 @@
 &EN,SP
 :"Symbian Foundation"
 %{"Podcatcher","Podcatcher"}
-#{"Podcatcher","Podcatcher"},(0xA0009D00), 0, 90, BUILDNO, TYPE=SA
+#{"Podcatcher","Podcatcher"},(0xA0009D00), 1, 10, BUILDNO, TYPE=SA
 
 ;Supports Symbian^3
 [0x20022E6D], 0, 0, 0, {"Series60ProductID","Series60ProductID"}
--- a/application/src/PodcastFeedView.cpp	Tue Nov 16 10:26:34 2010 +0000
+++ b/application/src/PodcastFeedView.cpp	Tue Nov 16 13:05:42 2010 +0000
@@ -161,7 +161,7 @@
 	//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
 	// If item is visible, redraw it
 	if (iListContainer->Listbox()->TopItemIndex() <= aIndex
-			&& iListContainer->Listbox()->BottomItemIndex() > aIndex)
+			&& iListContainer->Listbox()->BottomItemIndex() >= aIndex)
 		{
 		iListContainer->Listbox()->DrawItem(aIndex);
 		}
--- a/engine/inc/FeedParser.h	Tue Nov 16 10:26:34 2010 +0000
+++ b/engine/inc/FeedParser.h	Tue Nov 16 13:05:42 2010 +0000
@@ -62,6 +62,13 @@
 	ELatin1
 };
 
+enum TFeedDirection
+	{
+	EFeedUnknown,
+	EFeedAddsAtTop,
+	EFeedAddsAtBottom
+	};
+
 const int KBufferLength = 1024;
 
 class CFeedParser : public CBase, public Xml::MContentHandler 
@@ -102,6 +109,8 @@
 	TEncoding iEncoding;
 	RFs& iRfs;
 	TInt iFileSize;
+	TFeedDirection iFeedDirection;
+	TTime iPreviousPubDate;
 };
 
 #endif
--- a/engine/src/FeedParser.cpp	Tue Nov 16 10:26:34 2010 +0000
+++ b/engine/src/FeedParser.cpp	Tue Nov 16 13:05:42 2010 +0000
@@ -73,6 +73,8 @@
 	HBufC* charset = HBufC::NewLC(KMaxParseBuffer);
 	charset->Des().Copy(aDocParam.CharacterSetName().DesC());
 	iEncoding = EUtf8;
+	iFeedDirection = EFeedUnknown;
+	iPreviousPubDate = 0;
 	if (charset->CompareF(_L("utf-8")) == 0) {
 		DP("setting UTF8");
 		iEncoding = EUtf8;
@@ -302,6 +304,24 @@
 					iActiveShow->SetPubDate(now);
 					}
 				
+				if (iFeedDirection == EFeedUnknown)
+					{
+					if (iPreviousPubDate.Int64() != 0) {
+						if (iActiveShow->PubDate() > iPreviousPubDate)
+							{
+							DP("Feed adds at bottom");
+							iFeedDirection = EFeedAddsAtBottom;
+							}
+						else
+							{
+							DP("Feed adds at top");
+							iFeedDirection = EFeedAddsAtTop;
+							}
+					}
+					iPreviousPubDate = iActiveShow->PubDate();
+					}
+				
+				
 				if (iUid)
 					{
 					iActiveShow->SetUid(iUid);
@@ -316,7 +336,8 @@
 				
 				iItemsParsed++;
 				DP2("iItemsParsed: %d, iMaxItems: %d", iItemsParsed, iMaxItems);
-				if (iItemsParsed >= iMaxItems) 
+				// we stop parsing after iMaxItems, but not if feed builds at bottom
+				if (iItemsParsed >= iMaxItems && iFeedDirection != EFeedAddsAtBottom) 
 					{
 					iStoppedParsing = ETrue;
 					DP("*** Too many items, aborting parsing");
--- a/engine/src/PodcastUtils.cpp	Tue Nov 16 10:26:34 2010 +0000
+++ b/engine/src/PodcastUtils.cpp	Tue Nov 16 13:05:42 2010 +0000
@@ -118,8 +118,9 @@
 	DP("    change HTML encoded chars to unicode");
 	startPos = str.Locate('&');
 	endPos = str.Locate(';');
-	while (startPos != KErrNotFound && endPos != KErrNotFound && endPos > startPos)
+	while (startPos != KErrNotFound && endPos != KErrNotFound && endPos > startPos && endPos < str.Length())
 		{
+//		DP2("startPos=%d, endPos=%d", startPos, endPos);
 		TPtrC ptr(str.Mid(startPos+1, endPos-startPos));
 		// check for whitespace
 		if (ptr.Locate(' ') == KErrNotFound)
@@ -162,10 +163,9 @@
 				_LIT(KQuot, "quot;");
 				_LIT(KNbsp, "nbsp;");
 				_LIT(KCopy, "copy;");
-				
+
 				// copy start of string
 				tmp.Copy(str.Left(startPos));
-				
 				if (ptr.CompareF(KAmp) == 0)
 					{
 					tmp.Append('&');
@@ -182,27 +182,26 @@
 					{
 					tmp.Append('\xA9');
 					}
-				
 				// copy end of string
 				tmp.Append(str.Mid(endPos+1));
 				str.Copy(tmp);
 				}
 			}
 		
-		TInt newPos = str.Mid(startPos+1).Locate('&');
-		
-		if (newPos != KErrNotFound)
-			{
-			startPos = startPos+1 + newPos;
-			endPos = str.Locate(';');
-			}
-		else
-			{
-			startPos = KErrNotFound;
-			endPos = KErrNotFound;
+		if (startPos+1 <= str.Length()) {
+			TInt newPos = str.Mid(startPos+1).Locate('&');
+			if (newPos != KErrNotFound)
+				{
+				startPos = startPos+1 + newPos;
+				endPos = str.Locate(';');
+				}
+			else
+				{
+				startPos = KErrNotFound;
+				endPos = KErrNotFound;
+				}
 			}
 		}
-		
 	CleanupStack::PopAndDestroy(tmpBuf);
 	
 	if(str.Length()>1)
--- a/engine/src/ShowEngine.cpp	Tue Nov 16 10:26:34 2010 +0000
+++ b/engine/src/ShowEngine.cpp	Tue Nov 16 13:05:42 2010 +0000
@@ -1689,10 +1689,13 @@
 			break;
 		}
 	
-	TTime deleteDate;
-	deleteDate.HomeTime();
-	deleteDate += daysAhead;
-	aShow->SetDeleteDate(deleteDate);
+	if (daysAhead.Int() > 0)
+		{
+		TTime deleteDate;
+		deleteDate.HomeTime();
+		deleteDate += daysAhead;
+		aShow->SetDeleteDate(deleteDate);
+		}
 	
 	UpdateShowL(*aShow);
 	DP("CShowEngine::PostPlayHandling END");