Added support for launching music and video player when tapping on a downloaded show symbian1
authorteknolog
Sat, 15 May 2010 11:13:19 +0100
branchsymbian1
changeset 90 d0c0c3e6f7a1
parent 88 f4b512d870e8
child 129 7ef9faf10a81
child 145 cc0182a5da39
Added support for launching music and video player when tapping on a downloaded show
application/data/PodcastClient_english.rls
application/group/Podcast.mmp
application/inc/buildno.h
application/sis/buildno.txt
application/sis/podcatcher_udeb.pkg
application/sis/podcatcher_udeb.sis
application/sis/podcatcher_udeb_signed.sis
application/sis/podcatcher_urel.pkg
application/src/PodcastShowsView.cpp
engine/inc/ConnectionEngine.h
engine/inc/PodcastModel.h
engine/src/ConnectionEngine.cpp
engine/src/HttpEventHandler.cpp
engine/src/PodcastModel.cpp
--- a/application/data/PodcastClient_english.rls	Tue May 11 22:27:35 2010 +0100
+++ b/application/data/PodcastClient_english.rls	Sat May 15 11:13:19 2010 +0100
@@ -145,7 +145,7 @@
 rls_string STRING_r_view_remove_download_cmd "Remove download"
 
 rls_string STRING_r_error_notfound "Error: Not found on server"
-rls_string STRING_r_error_invalid_address "Error: Invalid address"
+rls_string STRING_r_error_invalid_address "Error: Connection failed"
 rls_string STRING_r_error_general "Error: General error %d"
 rls_string STRING_r_error_http "Error: HTTP error %d"
 rls_string STRING_r_error_disk_full "Error: Disk full"
--- a/application/group/Podcast.mmp	Tue May 11 22:27:35 2010 +0100
+++ b/application/group/Podcast.mmp	Sat May 15 11:13:19 2010 +0100
@@ -106,3 +106,5 @@
 LIBRARY ws32.lib 
 LIBRARY hlplch.lib
 LIBRARY bitgdi.lib 
+LIBRARY  apmime.lib    // TDataType
+LIBRARY  commonui.lib  // CDocumentHandler
--- a/application/inc/buildno.h	Tue May 11 22:27:35 2010 +0100
+++ b/application/inc/buildno.h	Sat May 15 11:13:19 2010 +0100
@@ -1,2 +1,2 @@
 // Build number generated by increment_buildno.py, do not edit manually
-#define BUILD_NO 22
\ No newline at end of file
+#define BUILD_NO 23
\ No newline at end of file
--- a/application/sis/buildno.txt	Tue May 11 22:27:35 2010 +0100
+++ b/application/sis/buildno.txt	Sat May 15 11:13:19 2010 +0100
@@ -1,1 +1,1 @@
-22
\ No newline at end of file
+23
\ No newline at end of file
--- a/application/sis/podcatcher_udeb.pkg	Tue May 11 22:27:35 2010 +0100
+++ b/application/sis/podcatcher_udeb.pkg	Sat May 15 11:13:19 2010 +0100
@@ -1,7 +1,7 @@
 &EN
 :"Symbian Foundation"
 %{"Podcatcher"}
-#{"Podcatcher"},(0xA0009D00), 1, 00, 22, TYPE=SA
+#{"Podcatcher"},(0xA0009D00), 1, 00, 23, TYPE=SA
 
 ;Supports S60 3rd edition
 [0x101F7961], 0, 0, 0, {"Series60ProductID"}
Binary file application/sis/podcatcher_udeb.sis has changed
Binary file application/sis/podcatcher_udeb_signed.sis has changed
--- a/application/sis/podcatcher_urel.pkg	Tue May 11 22:27:35 2010 +0100
+++ b/application/sis/podcatcher_urel.pkg	Sat May 15 11:13:19 2010 +0100
@@ -1,7 +1,7 @@
 &EN
 :"Symbian Foundation"
 %{"Podcatcher"}
-#{"Podcatcher"},(0xA0009D00), 1, 00, 22, TYPE=SA
+#{"Podcatcher"},(0xA0009D00), 1, 00, 23, TYPE=SA
 
 ;Supports S60 3rd edition
 [0x101F7961], 0, 0, 0, {"Series60ProductID"}
--- a/application/src/PodcastShowsView.cpp	Tue May 11 22:27:35 2010 +0100
+++ b/application/src/PodcastShowsView.cpp	Sat May 15 11:13:19 2010 +0100
@@ -337,7 +337,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/inc/ConnectionEngine.h	Tue May 11 22:27:35 2010 +0100
+++ b/engine/inc/ConnectionEngine.h	Sat May 15 11:13:19 2010 +0100
@@ -69,6 +69,7 @@
 	TConnectionState ConnectionState();
 	IMPORT_C void AddObserver(MConnectionObserver* aObserver);
 	RSocketServ& SockServ();
+	void Stop();
 private: // Methods
 	CConnectionEngine(CPodcastModel& aPodcastModel);
 	void ConstructL();
--- a/engine/inc/PodcastModel.h	Tue May 11 22:27:35 2010 +0100
+++ b/engine/inc/PodcastModel.h	Sat May 15 11:13:19 2010 +0100
@@ -25,6 +25,8 @@
 #include <es_sock.h>
 #include <http/rhttpsession.h>
 #include <cmmanager.h>
+#include <aknserverapp.h>  // MAknServerAppExitObserver
+#include <DocumentHandler.h>
 
 #include "FeedInfo.h"
 #include "ShowInfo.h"
@@ -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();
@@ -101,6 +103,17 @@
 	void OpenDBL();
 	// From ImageHandler
 	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 +136,7 @@
    RCmManager iCmManager;
    TBool iIsFirstStartup;
    CImageHandler* iImageHandler;
+   CDocumentHandler* iDocHandler;
 };
 
 #endif // PODCASTMODEL_H
--- a/engine/src/ConnectionEngine.cpp	Tue May 11 22:27:35 2010 +0100
+++ b/engine/src/ConnectionEngine.cpp	Sat May 15 11:13:19 2010 +0100
@@ -117,9 +117,9 @@
 		}
 	}
 
-void CConnectionEngine::Error( TInt /*aError*/ )
+void CConnectionEngine::Error( TInt aError )
 	{
-
+	DP1("CConnectionEngine::Error, aError=%d", aError)
 	}
 
 TBool CConnectionEngine::ConnectionSettingL()
@@ -208,6 +208,14 @@
 	iConnectionState = CConnectionEngine::EConnecting;
 	}
 
+void CConnectionEngine::Stop()
+	{
+	DP("CConnectionEngine::Stop");
+	iConnection.Stop();
+	iConnectionState = CConnectionEngine::ENotConnected;
+	}
+
+
 RConnection& CConnectionEngine::Connection()
 	{
 	return iConnection;	
--- a/engine/src/HttpEventHandler.cpp	Tue May 11 22:27:35 2010 +0100
+++ b/engine/src/HttpEventHandler.cpp	Sat May 15 11:13:19 2010 +0100
@@ -222,7 +222,7 @@
 			{
 			DP1("<unrecognised event: %d>", aEvent.iStatus);
 			// close off the transaction if it's an error
-			if (aEvent.iStatus < 0)
+			if (aEvent.iStatus < 100)
 				{
 				iRespBodyFile.Close();
 				aTransaction.Close();
--- 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);
+    }