Basic MPX integration done - Podcatcher can now add files to MPXCollection, but not remove or update
authorteknolog
Mon, 03 May 2010 16:09:50 +0100
changeset 82 c70a6524a236
parent 81 46e6a623d36d
child 84 fbb6c20a24b5
Basic MPX integration done - Podcatcher can now add files to MPXCollection, but not remove or update
engine/group/engine.mmp
engine/inc/ShowEngine.h
engine/src/ShowEngine.cpp
--- a/engine/group/engine.mmp	Mon May 03 15:23:15 2010 +0100
+++ b/engine/group/engine.mmp	Mon May 03 16:09:50 2010 +0100
@@ -67,5 +67,6 @@
 LIBRARY imageconversion.lib 
 LIBRARY bitmaptransforms.lib 
 LIBRARY eikcore.lib 
+LIBRARY mpxcollectionhelper.lib
 
 CAPABILITY NetworkServices UserEnvironment
--- a/engine/inc/ShowEngine.h	Mon May 03 15:23:15 2010 +0100
+++ b/engine/inc/ShowEngine.h	Mon May 03 16:09:50 2010 +0100
@@ -28,8 +28,11 @@
 #include "ShowEngineObserver.h"
 #include "MetaDataReader.h"
 #include <sqlite3.h>
+#include "mpxcollectionhelper.h"
+#include "mpxcollectionhelperobserver.h"
 
-class CShowEngine : public CBase, public MHttpClientObserver, public MMetaDataReaderObserver
+class CShowEngine : public CBase, public MHttpClientObserver, public MMetaDataReaderObserver,
+					public MMPXCollectionHelperObserver
 {
 public:
 	IMPORT_C static CShowEngine* NewL(CPodcastModel& aPodcastModel);
@@ -84,7 +87,9 @@
 	// from MetaDataReaderObserver
 	void ReadMetaDataL(CShowInfo& aShowInfo);
 	void ReadMetaDataCompleteL();
-	
+	// from MMPXCollectionHelperObserver
+    void HandleAddFileCompleteL( TInt aErr ) {}  
+
 private:
 	CShowEngine(CPodcastModel& aPodcastModel);
 	void ConstructL();
@@ -142,6 +147,8 @@
 	
 	sqlite3& iDB;
     TBuf<KDefaultSQLDataBufferLength> iSqlBuffer;
+    
+    MMPXCollectionHelper* iCollectionHelper;
 };
 
 #endif /*SHOWENGINE_H_*/
--- a/engine/src/ShowEngine.cpp	Mon May 03 15:23:15 2010 +0100
+++ b/engine/src/ShowEngine.cpp	Mon May 03 16:09:50 2010 +0100
@@ -26,10 +26,7 @@
 #include <httperr.h>
 #include "debug.h"
 #include "PodcastUtils.h"
-
-//#include <mpxmedia.h>
-//#include <mpxattribute.h>
-//#include <mpxmediageneraldefs.h>
+#include <mpxcollectionhelperfactory.h>
 
 const TUint KMaxDownloadErrors = 3;
 const TInt KMimeBufLength = 100;
@@ -47,6 +44,9 @@
 	delete iShowDownloading;
 	delete iMetaDataReader;
 	iApaSession.Close();
+	
+	if (iCollectionHelper)
+		delete iCollectionHelper;
 	}
 
 EXPORT_C CShowEngine* CShowEngine::NewL(CPodcastModel& aPodcastModel)
@@ -239,15 +239,14 @@
 		}
 	}
 
-void CShowEngine::AddShowToMpxCollection(CShowInfo &/*aShowInfo*/)
+void CShowEngine::AddShowToMpxCollection(CShowInfo &aShowInfo)
 	{
-/*	RArray<TInt> contentIDs;
-	contentIDs.AppendL( KMPXMediaIdGeneral );
+	if (!iCollectionHelper)
+		iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionHelperL();
 	
-	CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() );
-	CleanupStack::PushL( media );
-	contentIDs.Close();
-	CleanupStack::PopAndDestroy(media);   */
+	// if this leaves, not much we can do anyway
+	TRAP_IGNORE(iCollectionHelper->AddL(aShowInfo.FileName(), this));
+
 	}
 
 void CShowEngine::CompleteL(CHttpClient* /*aHttpClient*/, TInt aError)