engine/inc/PodcastModel.h
author Sebastian Brannstrom <sebastianb@symbian.org>
Tue, 16 Nov 2010 10:39:20 +0000
branchsymbian1
changeset 364 998e9d114bd5
parent 347 b8d687bb7ca1
permissions -rw-r--r--
Sync with symbian3 branch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#ifndef PODCASTMODEL_H
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#define PODCASTMODEL_H
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include <e32base.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include <eikenv.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include <commdb.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include <CommDbConnPref.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include <es_sock.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include <http/rhttpsession.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <cmmanager.h>
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
    28
#include <aknserverapp.h>  // MAknServerAppExitObserver
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
    29
#include <DocumentHandler.h>
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include "FeedInfo.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include "ShowInfo.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include "debug.h"
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 32
diff changeset
    33
#include <sqlite3.h>
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
#include "ImageHandler.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
// SQLite leaks memory when sorting, so to test our own memory leaks we need to disable this
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
//#define DONT_SORT_SQL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
class RCmManager;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
class CFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
class CShowEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
class CSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
class CCommsDatabase;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
class CConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
class TPodcastIAPItem
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
	TUint32 iIapId;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
	TBuf<KCommsDbSvrMaxFieldLength> iServiceType;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
	TBuf<KCommsDbSvrMaxFieldLength> iBearerType;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
/**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
 * This class handles application storage needs and ownership of audioplayer, resource lists etc.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
 */
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
    56
class CPodcastModel : public CBase, public MImageHandlerCallback, public MAknServerAppExitObserver
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
	IMPORT_C static CPodcastModel* NewL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
	IMPORT_C ~CPodcastModel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
	IMPORT_C CFeedEngine& FeedEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
	IMPORT_C CShowEngine& ShowEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
	IMPORT_C CSettingsEngine& SettingsEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
	IMPORT_C CConnectionEngine& ConnectionEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
	IMPORT_C CShowInfo* PlayingPodcast();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
	IMPORT_C void SetPlayingPodcast(CShowInfo* aPodcast);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
	IMPORT_C void PlayPausePodcastL(CShowInfo * aPodcast, TBool aPlayOnInit = EFalse);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	IMPORT_C CFeedInfo* ActiveFeedInfo();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	IMPORT_C void SetActiveFeedInfo(CFeedInfo* aFeedInfo);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
	RFs& FsSession();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
	IMPORT_C RShowInfoArray& ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
	void SetActiveShowList(RShowInfoArray& aShowArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	IMPORT_C void UpdateIAPListL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	IMPORT_C void UpdateSNAPListL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	IMPORT_C CDesCArrayFlat* IAPNames();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	IMPORT_C RArray<TPodcastIAPItem>& IAPIds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	IMPORT_C CDesCArrayFlat* SNAPNames();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	IMPORT_C RArray<TPodcastIAPItem>& SNAPIds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	void SetProxyUsageIfNeededL(RHTTPSession& aSession);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
	void GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aServerName, TUint32& aPort);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	TInt GetIapId();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	sqlite3* DB();
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 32
diff changeset
    89
	IMPORT_C void DropDB();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
    91
	IMPORT_C void GetShowsDownloadingL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
    92
	IMPORT_C void GetShowsByFeedL(TUint aFeedUid);
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 90
diff changeset
    93
	IMPORT_C void GetNewShowsL();
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 8
diff changeset
    94
	IMPORT_C void MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	TInt FindActiveShowByUid(TUint aUid);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	IMPORT_C TBool IsFirstStartup();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	IMPORT_C CImageHandler& ImageHandler();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	CPodcastModel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	void ConstructL();
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 32
diff changeset
   102
	void ResetDB();
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 32
diff changeset
   103
	void OpenDBL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	// From ImageHandler
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 32
diff changeset
   105
	void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   106
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   107
private:  // Functions from base classes
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   108
    /**
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   109
     * From MAknServerAppExitObserver.
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   110
     * Handles the exit of a connected server application.
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   111
     */ 
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   112
    void HandleServerAppExit(TInt aReason);
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   113
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   114
private:  // Private functions
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   115
    void LaunchFileEmbeddedL(const TDesC& aFilename);
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   116
    
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
private:	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
   CShowInfo* iPlayingPodcast;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
   CFeedEngine* iFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
   CShowEngine* iShowEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
   CSettingsEngine *iSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
   CConnectionEngine* iConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
   RShowInfoArray iActiveShowList;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
   CFeedInfo *iActiveFeed;   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
   RFs iFsSession;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
   RArray<TPodcastIAPItem> iIapIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
   CDesCArrayFlat* iIapNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
   RArray<TPodcastIAPItem> iSNAPIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
   CDesCArrayFlat* iSNAPNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
   CCommsDatabase* iCommDB;  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
   sqlite3* iDB;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
   RCmManager iCmManager;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
   TBool iIsFirstStartup;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
   CImageHandler* iImageHandler;
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 65
diff changeset
   139
   CDocumentHandler* iDocHandler;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
#endif // PODCASTMODEL_H