engine/inc/PodcastModel.h
author Sebastian Brannstrom <sebastianb@symbian.org>
Sun, 31 Oct 2010 14:15:37 +0000
branchRCL_3
changeset 321 7a0fb290f9c6
parent 299 56d23cf60795
child 367 4b75876aa85a
permissions -rw-r--r--
Re-enabled max items parsed, because disabling this causes shows to turn up as new multiple times. This again breaks feeds that add new shows at the bottom, so we need to solve this properly.
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>
299
56d23cf60795 Fixes for issues using #define with raptor
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 133
diff changeset
    28
#include "defines.h"
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include "FeedInfo.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include "ShowInfo.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include "debug.h"
116
a2e43aa1ad11 Fixed DEF files. Tested with Qt SQLite.
teknolog
parents: 113
diff changeset
    32
#include <sqlite3.h>
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include "ImageHandler.h"
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
    34
#include <aknserverapp.h>  // MAknServerAppExitObserver
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
    35
#include <DocumentHandler.h>
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
// 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
    38
//#define DONT_SORT_SQL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
class RCmManager;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
class CFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
class CShowEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
class CSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
class CCommsDatabase;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
class CConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
class TPodcastIAPItem
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
	TUint32 iIapId;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
	TBuf<KCommsDbSvrMaxFieldLength> iServiceType;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
	TBuf<KCommsDbSvrMaxFieldLength> iBearerType;
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
/**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
 * 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
    56
 */
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
    57
class CPodcastModel : public CBase, public MImageHandlerCallback, public MAknServerAppExitObserver
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
	IMPORT_C static CPodcastModel* NewL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
	IMPORT_C ~CPodcastModel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
	IMPORT_C CFeedEngine& FeedEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
	IMPORT_C CShowEngine& ShowEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
	IMPORT_C CSettingsEngine& SettingsEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
	IMPORT_C CConnectionEngine& ConnectionEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
	IMPORT_C CShowInfo* PlayingPodcast();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
	IMPORT_C void SetPlayingPodcast(CShowInfo* aPodcast);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	IMPORT_C void PlayPausePodcastL(CShowInfo * aPodcast, TBool aPlayOnInit = EFalse);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	IMPORT_C CFeedInfo* ActiveFeedInfo();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	IMPORT_C void SetActiveFeedInfo(CFeedInfo* aFeedInfo);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
	RFs& FsSession();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	IMPORT_C RShowInfoArray& ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
	void SetActiveShowList(RShowInfoArray& aShowArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	IMPORT_C void UpdateIAPListL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	IMPORT_C void UpdateSNAPListL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	IMPORT_C CDesCArrayFlat* IAPNames();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	IMPORT_C RArray<TPodcastIAPItem>& IAPIds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	IMPORT_C CDesCArrayFlat* SNAPNames();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
	IMPORT_C RArray<TPodcastIAPItem>& SNAPIds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
	void SetProxyUsageIfNeededL(RHTTPSession& aSession);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	void GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aServerName, TUint32& aPort);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	TInt GetIapId();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	sqlite3* DB();
116
a2e43aa1ad11 Fixed DEF files. Tested with Qt SQLite.
teknolog
parents: 113
diff changeset
    90
	IMPORT_C void DropDB();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
    92
	IMPORT_C void GetShowsDownloadingL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
    93
	IMPORT_C void GetShowsByFeedL(TUint aFeedUid);
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();
116
a2e43aa1ad11 Fixed DEF files. Tested with Qt SQLite.
teknolog
parents: 113
diff changeset
   102
	void ResetDB();
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   103
	void OpenDBL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	// From ImageHandler
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   105
	void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);	
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   106
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   107
private:  // Functions from base classes
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   108
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   109
   /**
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   110
     * From MAknServerAppExitObserver.
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   111
     * Handles the exit of a connected server application.
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   112
     */ 
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   113
    void HandleServerAppExit(TInt aReason);
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   114
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   115
private:  // Private functions
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   116
    void LaunchFileEmbeddedL(const TDesC& aFilename);
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   117
    
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
private:	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
   CShowInfo* iPlayingPodcast;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
   CFeedEngine* iFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
   CShowEngine* iShowEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
   CSettingsEngine *iSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
   CConnectionEngine* iConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
   RShowInfoArray iActiveShowList;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
   CFeedInfo *iActiveFeed;   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
   RFs iFsSession;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
   RArray<TPodcastIAPItem> iIapIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
   CDesCArrayFlat* iIapNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
   RArray<TPodcastIAPItem> iSNAPIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
   CDesCArrayFlat* iSNAPNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
   CCommsDatabase* iCommDB;  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
   sqlite3* iDB;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
   RCmManager iCmManager;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
   TBool iIsFirstStartup;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
   CImageHandler* iImageHandler;
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 116
diff changeset
   140
   CDocumentHandler* iDocHandler;
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
#endif // PODCASTMODEL_H