equal
deleted
inserted
replaced
26 #include "Podcatcher.pan" |
26 #include "Podcatcher.pan" |
27 |
27 |
28 #include <cmdestination.h> |
28 #include <cmdestination.h> |
29 #include <cmmanager.h> |
29 #include <cmmanager.h> |
30 #include <bautils.h> |
30 #include <bautils.h> |
|
31 #include <aknserverapp.h> // MAknServerAppExitObserver |
|
32 #include <DocumentHandler.h> |
|
33 |
31 |
34 |
32 const TInt KDefaultGranu = 5; |
35 const TInt KDefaultGranu = 5; |
33 _LIT(KDBFileName, "podcatcher.sqlite"); |
36 _LIT(KDBFileName, "podcatcher.sqlite"); |
34 _LIT(KDBTemplateFileName, "podcatcher.sqlite.template"); |
37 _LIT(KDBTemplateFileName, "podcatcher.sqlite.template"); |
35 |
38 |
60 iActiveShowList.ResetAndDestroy(); |
63 iActiveShowList.ResetAndDestroy(); |
61 iActiveShowList.Close(); |
64 iActiveShowList.Close(); |
62 delete iConnectionEngine; |
65 delete iConnectionEngine; |
63 iCmManager.Close(); |
66 iCmManager.Close(); |
64 delete iImageHandler; |
67 delete iImageHandler; |
|
68 delete iDocHandler; |
65 } |
69 } |
66 |
70 |
67 CPodcastModel::CPodcastModel() |
71 CPodcastModel::CPodcastModel() |
68 { |
72 { |
69 } |
73 } |
75 iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified); |
79 iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified); |
76 iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
80 iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
77 iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
81 iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
78 |
82 |
79 iImageHandler = CImageHandler::NewL(FsSession(), *this); |
83 iImageHandler = CImageHandler::NewL(FsSession(), *this); |
|
84 iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
80 |
85 |
81 TRAPD(err,iCmManager.OpenL()); |
86 TRAPD(err,iCmManager.OpenL()); |
82 DP1("iCmManager.OpenL(),err=%d;", err); |
87 DP1("iCmManager.OpenL(),err=%d;", err); |
83 |
88 |
84 if (err == KErrNone) |
89 if (err == KErrNone) |
225 EXPORT_C CConnectionEngine& CPodcastModel::ConnectionEngine() |
230 EXPORT_C CConnectionEngine& CPodcastModel::ConnectionEngine() |
226 { |
231 { |
227 return *iConnectionEngine; |
232 return *iConnectionEngine; |
228 } |
233 } |
229 |
234 |
230 EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit) |
235 EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool /* aPlayOnInit */) |
231 { |
236 { |
232 // TODO: interact with MPX |
237 TRAPD(err, LaunchFileEmbeddedL(aPodcast->FileName())); |
|
238 |
|
239 if (err == KErrNone) |
|
240 { |
|
241 aPodcast->SetPlayState(EPlayed); |
|
242 iShowEngine->UpdateShowL(*aPodcast); |
|
243 } |
|
244 |
233 } |
245 } |
234 |
246 |
235 EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo() |
247 EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo() |
236 { |
248 { |
237 return iActiveFeed; |
249 return iActiveFeed; |
478 |
490 |
479 EXPORT_C CImageHandler& CPodcastModel::ImageHandler() |
491 EXPORT_C CImageHandler& CPodcastModel::ImageHandler() |
480 { |
492 { |
481 return *iImageHandler; |
493 return *iImageHandler; |
482 } |
494 } |
|
495 |
|
496 void CPodcastModel::LaunchFileEmbeddedL(const TDesC& aFilename) |
|
497 { |
|
498 //Set the exit observer so HandleServerAppExit will be called |
|
499 iDocHandler->SetExitObserver(this); |
|
500 |
|
501 TDataType emptyDataType = TDataType(); |
|
502 //Open a file embedded |
|
503 iDocHandler->OpenFileEmbeddedL(aFilename, emptyDataType); |
|
504 } |
|
505 |
|
506 void CPodcastModel::HandleServerAppExit(TInt aReason) |
|
507 { |
|
508 //Handle closing the handler application |
|
509 MAknServerAppExitObserver::HandleServerAppExit(aReason); |
|
510 } |
|
511 |