--- a/application/src/PodcastShowsView.cpp Wed May 26 11:53:31 2010 +0100
+++ b/application/src/PodcastShowsView.cpp Wed May 26 13:13:30 2010 +0100
@@ -338,7 +338,8 @@
((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
break;
case EDownloaded:
- #pragma message("LAPER Replace activate playview with activate playback in mpx")
+ iPodcastModel.PlayPausePodcastL(showInfo, ETrue);
+ UpdateListboxItemsL();
break;
default:
break;
--- a/engine/group/engine.mmp Wed May 26 11:53:31 2010 +0100
+++ b/engine/group/engine.mmp Wed May 26 13:13:30 2010 +0100
@@ -68,5 +68,9 @@
LIBRARY bitmaptransforms.lib
LIBRARY eikcore.lib
LIBRARY mpxcollectionhelper.lib
+LIBRARY apmime.lib // TDataType
+LIBRARY commonui.lib // CDocumentHandler
+LIBRARY apparc.lib
+LIBRARY avkon.lib
CAPABILITY NetworkServices UserEnvironment
--- a/engine/inc/PodcastModel.h Wed May 26 11:53:31 2010 +0100
+++ b/engine/inc/PodcastModel.h Wed May 26 13:13:30 2010 +0100
@@ -31,6 +31,8 @@
#include "debug.h"
#include <sqlite3.h>
#include "ImageHandler.h"
+#include <aknserverapp.h> // MAknServerAppExitObserver
+#include <DocumentHandler.h>
// SQLite leaks memory when sorting, so to test our own memory leaks we need to disable this
//#define DONT_SORT_SQL
@@ -52,7 +54,7 @@
/**
* This class handles application storage needs and ownership of audioplayer, resource lists etc.
*/
-class CPodcastModel : public CBase, public MImageHandlerCallback
+class CPodcastModel : public CBase, public MImageHandlerCallback, public MAknServerAppExitObserver
{
public:
IMPORT_C static CPodcastModel* NewL();
@@ -100,7 +102,19 @@
void ResetDB();
void OpenDBL();
// From ImageHandler
- void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);
+ void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);
+
+private: // Functions from base classes
+
+ /**
+ * From MAknServerAppExitObserver.
+ * Handles the exit of a connected server application.
+ */
+ void HandleServerAppExit(TInt aReason);
+
+private: // Private functions
+ void LaunchFileEmbeddedL(const TDesC& aFilename);
+
private:
CShowInfo* iPlayingPodcast;
@@ -123,6 +137,7 @@
RCmManager iCmManager;
TBool iIsFirstStartup;
CImageHandler* iImageHandler;
+ CDocumentHandler* iDocHandler;
};
#endif // PODCASTMODEL_H
--- a/engine/src/PodcastModel.cpp Wed May 26 11:53:31 2010 +0100
+++ b/engine/src/PodcastModel.cpp Wed May 26 13:13:30 2010 +0100
@@ -28,6 +28,9 @@
#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 +65,7 @@
delete iConnectionEngine;
iCmManager.Close();
delete iImageHandler;
+ delete iDocHandler;
}
CPodcastModel::CPodcastModel()
@@ -77,6 +81,7 @@
iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
iImageHandler = CImageHandler::NewL(FsSession(), *this);
+ iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());
TRAPD(err,iCmManager.OpenL());
DP1("iCmManager.OpenL(),err=%d;", err);
@@ -227,9 +232,16 @@
return *iConnectionEngine;
}
-EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit)
+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()
@@ -480,3 +492,20 @@
{
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);
+ }
+