--- a/engine/src/PodcastModel.cpp Tue May 11 22:27:35 2010 +0100
+++ b/engine/src/PodcastModel.cpp Sat May 15 11:13:19 2010 +0100
@@ -28,6 +28,8 @@
#include <cmdestination.h>
#include <cmmanager.h>
#include <bautils.h>
+#include <aknserverapp.h> // MAknServerAppExitObserver
+#include <DocumentHandler.h>
const TInt KDefaultGranu = 5;
_LIT(KDBFileName, "podcatcher.sqlite");
@@ -62,6 +64,7 @@
delete iConnectionEngine;
iCmManager.Close();
delete iImageHandler;
+ delete iDocHandler;
}
CPodcastModel::CPodcastModel()
@@ -79,7 +82,7 @@
iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
iCmManager.OpenL();
iImageHandler = CImageHandler::NewL(FsSession(), *this);
-
+ iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());
UpdateIAPListL();
UpdateSNAPListL();
@@ -225,7 +228,14 @@
EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit)
{
- // TODO: interact with MPX
+ TRAPD(err, LaunchFileEmbeddedL(aPodcast->FileName()));
+
+ if (err == KErrNone)
+ {
+ aPodcast->SetPlayState(EPlayed);
+ iShowEngine->UpdateShowL(*aPodcast);
+ }
+
}
EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo()
@@ -476,3 +486,19 @@
{
return *iImageHandler;
}
+
+void CPodcastModel::LaunchFileEmbeddedL(const TDesC& aFilename)
+ {
+ //Set the exit observer so HandleServerAppExit will be called
+ iDocHandler->SetExitObserver(this);
+
+ TDataType emptyDataType = TDataType();
+ //Open a file embedded
+ iDocHandler->OpenFileEmbeddedL(aFilename, emptyDataType);
+ }
+
+void CPodcastModel::HandleServerAppExit(TInt aReason)
+ {
+ //Handle closing the handler application
+ MAknServerAppExitObserver::HandleServerAppExit(aReason);
+ }