engine/src/PodcastModel.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Sun, 14 Nov 2010 13:05:37 +0000
branchRCL_3
changeset 367 4b75876aa85a
parent 341 a648d7ca5e27
child 368 b131f7696342
permissions -rw-r--r--
Added new shows list
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
#include <commdb.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#include "PodcastModel.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include "FeedEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include "SettingsEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include "ShowEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include "connectionengine.h"
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
    25
#include "podcastutils.h"
114
27f6f5827e5d Cleaned up panic handling
teknolog
parents: 113
diff changeset
    26
#include "Podcatcher.pan"
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <cmdestination.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <cmmanager.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <bautils.h>
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
    31
#include <aknserverapp.h>  // MAknServerAppExitObserver
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
    32
#include <DocumentHandler.h>
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
    33
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
const TInt KDefaultGranu = 5;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
_LIT(KDBFileName, "podcatcher.sqlite");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
_LIT(KDBTemplateFileName, "podcatcher.sqlite.template");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
EXPORT_C CPodcastModel* CPodcastModel::NewL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
	CPodcastModel* self = new (ELeave) CPodcastModel;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
	return self;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
CPodcastModel::~CPodcastModel()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
	delete iFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
	delete iSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
	delete iShowEngine;
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
	delete iIapNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
	iIapIdArray.Close();
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
	delete iSNAPNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
	iSNAPIdArray.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
	delete iCommDB;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
	sqlite3_close(iDB);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
	iFsSession.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
	iActiveShowList.ResetAndDestroy();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
	iActiveShowList.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
	delete iConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
	iCmManager.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
	delete iImageHandler;
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
    68
	delete iDocHandler;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
}
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
CPodcastModel::CPodcastModel()
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
}
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 CPodcastModel::ConstructL()
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
	DP("CPodcastModel::ConstructL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	User::LeaveIfError(iFsSession.Connect());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
126
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    82
93
bbf5c5204844 We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents: 91
diff changeset
    83
	iImageHandler = CImageHandler::NewL(FsSession(), *this);
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
    84
	iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());
126
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    85
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    86
	TRAPD(err,iCmManager.OpenL());
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    87
	DP1("iCmManager.OpenL(),err=%d;", err);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	
126
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    89
	if (err == KErrNone)
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    90
		{
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    91
		UpdateIAPListL();
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    92
		UpdateSNAPListL();
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    93
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
	iSettingsEngine = CSettingsEngine::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	iConnectionEngine = CConnectionEngine::NewL(*this);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	
126
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
    98
	TRAP(err, OpenDBL());
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
    99
	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   100
	if (err != KErrNone)
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   101
		{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   102
		ResetDB();
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   103
		
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   104
		TRAP(err, OpenDBL());
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   105
		
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   106
		if (err != KErrNone)
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   107
			{
114
27f6f5827e5d Cleaned up panic handling
teknolog
parents: 113
diff changeset
   108
			Panic(EPodcatcherPanicDB);
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   109
			}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   110
		
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   111
		}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   112
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
	iFeedEngine = CFeedEngine::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
	iShowEngine = CShowEngine::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
	DP("CPodcastModel::ConstructL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
EXPORT_C void CPodcastModel::UpdateIAPListL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	iIapNameArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
	iIapIdArray.Reset();	   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
	CCommsDbTableView* table = iCommDB->OpenTableLC (TPtrC (IAP)); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
	TInt ret = table->GotoFirstRecord ();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	TPodcastIAPItem IAPItem;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	TBuf <KCommsDbSvrMaxFieldLength> bufName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	while (ret == KErrNone) // There was a first record
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
		table->ReadUintL(TPtrC(COMMDB_ID), IAPItem.iIapId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
		table->ReadTextL (TPtrC(COMMDB_NAME), bufName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
		table->ReadTextL (TPtrC(IAP_BEARER_TYPE), IAPItem.iBearerType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
		table->ReadTextL (TPtrC(IAP_SERVICE_TYPE), IAPItem.iServiceType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
		iIapIdArray.Append(IAPItem);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
		iIapNameArray->AppendL(bufName); 		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
		ret = table->GotoNextRecord();
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
	CleanupStack::PopAndDestroy(); // Close table
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
EXPORT_C void CPodcastModel::UpdateSNAPListL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
	DP("CPodcastModel::UpdateSNAPListL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
	iSNAPNameArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	iSNAPIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
	RCmDestination destination;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	TPodcastIAPItem IAPItem;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
	RArray<TUint32> destArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
	CleanupClosePushL(destArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
	iCmManager.AllDestinationsL(destArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
	TInt cnt = destArray.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
	DP1("destArray.Count==%d", cnt);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
	for(TInt loop = 0;loop<cnt;loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
		destination = iCmManager.DestinationL (destArray[loop]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
		CleanupClosePushL(destination);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
		if(!destination.IsHidden())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
			IAPItem.iIapId = destArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
			HBufC* name = destination.NameLC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
			DP1(" destination.NameLC==%S", name);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
			iSNAPNameArray->AppendL(*name);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
			CleanupStack::PopAndDestroy(name);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
			iSNAPIdArray.Append(IAPItem);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
		CleanupStack::PopAndDestroy();//close destination
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
	CleanupStack::PopAndDestroy();// close destArray
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
	DP("CPodcastModel::UpdateSNAPListL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
EXPORT_C CDesCArrayFlat* CPodcastModel::IAPNames()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
	return iIapNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::IAPIds()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
	return iIapIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
EXPORT_C CDesCArrayFlat* CPodcastModel::SNAPNames()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
	return iSNAPNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::SNAPIds()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
	return iSNAPIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
RFs& CPodcastModel::FsSession()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
	return iFsSession;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
EXPORT_C void CPodcastModel::SetPlayingPodcast(CShowInfo* aPodcast)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
	iPlayingPodcast = aPodcast;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
EXPORT_C CShowInfo* CPodcastModel::PlayingPodcast()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	return iPlayingPodcast;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
EXPORT_C CFeedEngine& CPodcastModel::FeedEngine()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
	return *iFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
EXPORT_C CShowEngine& CPodcastModel::ShowEngine()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
	return *iShowEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
EXPORT_C CSettingsEngine& CPodcastModel::SettingsEngine()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
	return *iSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
EXPORT_C CConnectionEngine& CPodcastModel::ConnectionEngine()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
	return *iConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   235
EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool /* aPlayOnInit */) 
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
	{
134
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   237
	DP("CPodcastModel::PlayPausePodcastL BEGIN");
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   238
	TRAPD(err, LaunchFileEmbeddedL(aPodcast->FileName()));
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   239
	
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   240
	if (err == KErrNone)
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   241
		{
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   242
		aPodcast->SetPlayState(EPlayed);
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   243
		iShowEngine->UpdateShowL(*aPodcast);
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   244
		}
134
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   245
	else
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   246
		{
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   247
		User::Leave(err);
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   248
		}
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   249
	DP("CPodcastModel::PlayPausePodcastL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   250
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
	return iActiveFeed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   255
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   256
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   257
EXPORT_C void CPodcastModel::SetActiveFeedInfo(CFeedInfo* aFeedInfo)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   259
	iActiveFeed = aFeedInfo;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   260
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
EXPORT_C RShowInfoArray& CPodcastModel::ActiveShowList()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   263
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   264
	return iActiveShowList;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   265
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
void CPodcastModel::SetActiveShowList(RShowInfoArray& aShowArray)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   268
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
	iActiveShowList.ResetAndDestroy();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
	TInt cnt = aShowArray.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   272
	for(TInt loop = 0;loop < cnt; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
		iActiveShowList.Append(aShowArray[loop]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   275
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
116
a2e43aa1ad11 Fixed DEF files. Tested with Qt SQLite.
teknolog
parents: 115
diff changeset
   278
EXPORT_C void CPodcastModel::DropDB()
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   279
	{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   280
	if (iDB != NULL)
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   281
		{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   282
		sqlite3_close(iDB);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   283
		iDB = NULL;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   284
		}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   285
	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   286
	TFileName dbFileName;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   287
	dbFileName.Copy(iSettingsEngine->PrivatePath());
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   288
	dbFileName.Append(KDBFileName);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   289
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   290
	// remove the old DB file
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   291
	if (BaflUtils::FileExists(iFsSession, dbFileName))
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   292
		{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   293
		BaflUtils::DeleteFile(iFsSession, dbFileName);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   294
		}
110
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   295
	}
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   296
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   297
void CPodcastModel::ResetDB()
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   298
	{
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   299
	DP("CPodcastModel::ResetDB BEGIN");
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   300
	
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   301
	DropDB();
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   302
	
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   303
	TFileName dbFileName;
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   304
	dbFileName.Copy(iSettingsEngine->PrivatePath());
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   305
	dbFileName.Append(KDBFileName);
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   306
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   307
	// remove the old DB file
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   308
	if (BaflUtils::FileExists(iFsSession, dbFileName))
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   309
		{
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   310
		BaflUtils::DeleteFile(iFsSession, dbFileName);
403412eb5292 Added "Reset database" option in settings. Further robustness fixes for Feeds.
teknolog
parents: 109
diff changeset
   311
		}
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   312
282
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   313
#ifdef ENABLE_MPX_INTEGRATION
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   314
	// copy template to new DB
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   315
	TFileName dbTemplate;
162
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   316
	TFileName temp;
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   317
	dbTemplate.Copy(_L("z:"));
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   318
	temp.Copy(iSettingsEngine->PrivatePath());
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   319
	dbTemplate.Append(temp);
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   320
	dbTemplate.Append(KDBTemplateFileName);
282
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   321
# else
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   322
	// copy template to new DB
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   323
	TFileName dbTemplate;
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   324
	dbTemplate.Copy(iSettingsEngine->PrivatePath());
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   325
	dbTemplate.Append(KDBTemplateFileName);
cf3842290671 Fix for startup bug in Symbian 3 version; new SIS v 1.00.6
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 162
diff changeset
   326
#endif
162
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   327
	
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   328
	DP1("Copy template DB from: %S", &dbTemplate);
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   329
	DP1("Copy template DB to: %S", &dbFileName);
d15654dbe9b8 Fix for bug 3169 - Podcatching failing to open due to missing DB
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 134
diff changeset
   330
	
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   331
	BaflUtils::CopyFile(iFsSession, dbTemplate,dbFileName);
300
5902e8f443e2 Fix for DB being read only when template is copied from Z:
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 282
diff changeset
   332
	
5902e8f443e2 Fix for DB being read only when template is copied from Z:
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 282
diff changeset
   333
	// important to set this file to not be read only if copying from Z:
5902e8f443e2 Fix for DB being read only when template is copied from Z:
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 282
diff changeset
   334
	iFsSession.SetAtt(dbFileName, 0, KEntryAttReadOnly); 
5902e8f443e2 Fix for DB being read only when template is copied from Z:
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 282
diff changeset
   335
	
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   336
	iIsFirstStartup = ETrue;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   337
	DP("CPodcastModel::ResetDB END");
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   338
	}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   339
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   340
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   341
void CPodcastModel::OpenDBL()
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   342
	{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   343
	DP("CPodcastModel::OpenDBL BEGIN");
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   344
	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   345
	if (iDB != NULL)
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   346
		{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   347
		sqlite3_close(iDB);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   348
		iDB = NULL;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   349
		}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   350
	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   351
	TFileName dbFileName;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   352
	dbFileName.Copy(iSettingsEngine->PrivatePath());
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   353
	dbFileName.Append(KDBFileName);
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   354
		
109
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   355
	if (!BaflUtils::FileExists(iFsSession, dbFileName))
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   356
		{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   357
		User::Leave(KErrNotFound);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   358
		}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   359
	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   360
	if (iDB == NULL) {	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   361
		// open DB
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   362
		TBuf8<KMaxFileName> filename8;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   363
		filename8.Copy(dbFileName);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   364
		int rc = sqlite3_open((const char*) filename8.PtrZ(), &iDB);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   365
		if(rc != SQLITE_OK){
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   366
			User::Leave(KErrCorrupt);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   367
		}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   368
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   369
		// do a test query 
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   370
		sqlite3_stmt *st;
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   371
		rc = sqlite3_prepare_v2(iDB,"select count(*) from feeds" , -1, &st, (const char**) NULL);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   372
		if( rc==SQLITE_OK )
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   373
			{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   374
			Cleanup_sqlite3_finalize_PushL(st);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   375
			rc = sqlite3_step(st);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   376
					
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   377
			if (rc != SQLITE_ROW)
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   378
				{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   379
				User::Leave(KErrCorrupt);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   380
				}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   381
			CleanupStack::PopAndDestroy(); // st
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   382
			}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   383
		else
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   384
			{
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   385
			User::Leave(KErrCorrupt);
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   386
			}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   387
		}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   388
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   389
	DP("CPodcastModel::OpenDBL END");	
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   390
	}
223f270fa7ff Significantly improved database robustness
teknolog
parents: 96
diff changeset
   391
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
sqlite3* CPodcastModel::DB()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   394
	return iDB;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   395
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
	TBool useProxy = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
	HBufC* serverName = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   401
	TUint32 port = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   402
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
	TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
	if (err == KErrNone && useProxy)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
		CleanupStack::PushL(serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
		TBuf8<128> proxyAddr;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
		proxyAddr.Append(*serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   409
		proxyAddr.Append(':');
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   410
		proxyAddr.AppendNum(port);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   411
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
		RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
		CleanupClosePushL(prxAddr);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
		THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
		aSession.ConnectionInfo().SetPropertyL(
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
						aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
						aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
		aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
		CleanupStack::PopAndDestroy(&prxAddr);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
		CleanupStack::PopAndDestroy(serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   428
void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   429
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   430
	TInt iapId = GetIapId();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   431
	CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   432
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   433
	TUint32 iapService;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
	HBufC* iapServiceType;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
	table->ReadUintL(TPtrC(IAP_SERVICE), iapService);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
	iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
	CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
	TInt err = proxyTableView->GotoFirstRecord();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
	if( err != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442
		User::Leave(KErrNotFound);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   444
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   445
	proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   446
	if(aIsUsed)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   447
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
		HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   449
		proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   450
		aProxyServerName = serverName->AllocL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
		CleanupStack::PopAndDestroy(serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
	CleanupStack::PopAndDestroy(proxyTableView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
	CleanupStack::PopAndDestroy(iapServiceType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   456
	CleanupStack::PopAndDestroy(table);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   457
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
TInt CPodcastModel::GetIapId()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   460
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
	_LIT(KSetting, "IAP\\Id");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
	TUint32 iapId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   463
	iConnectionEngine->Connection().GetIntSetting(KSetting, iapId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
	return iapId;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   467
EXPORT_C void CPodcastModel::GetShowsDownloadingL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   468
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   469
	iActiveShowList.ResetAndDestroy();
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   470
	iShowEngine->GetShowsDownloadingL(iActiveShowList);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   473
EXPORT_C void CPodcastModel::GetShowsByFeedL(TUint aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
	iActiveShowList.ResetAndDestroy();
126
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 118
diff changeset
   476
	iShowEngine->DeleteOldShowsByFeedL(aFeedUid);
118
b03018fb3418 Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents: 116
diff changeset
   477
	iShowEngine->CheckForDeletedShows(aFeedUid);
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   478
	iShowEngine->GetShowsByFeedL(iActiveShowList, aFeedUid);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   481
EXPORT_C void CPodcastModel::GetNewShowsL()
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   482
	{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   483
	iActiveShowList.ResetAndDestroy();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   484
	iShowEngine->GetNewShowsL(iActiveShowList);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   485
	}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 341
diff changeset
   486
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 8
diff changeset
   487
EXPORT_C void CPodcastModel::MarkSelectionPlayedL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
	for (int i=0;i<iActiveShowList.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
		if(iActiveShowList[i]->PlayState() != EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   491
			iActiveShowList[i]->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 8
diff changeset
   492
			iShowEngine->UpdateShowL(*iActiveShowList[i]);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
TInt CPodcastModel::FindActiveShowByUid(TUint aUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   498
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   499
	for (int i=0;i<iActiveShowList.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   500
		if (iActiveShowList[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
			return i;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   502
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   503
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   505
	return KErrNotFound;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   506
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
EXPORT_C TBool CPodcastModel::IsFirstStartup()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
	return iIsFirstStartup;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
93
bbf5c5204844 We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents: 91
diff changeset
   514
void CPodcastModel::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/, CPodcastModel& /*aPodcastModel*/)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   516
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   517
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   518
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   519
EXPORT_C CImageHandler& CPodcastModel::ImageHandler()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
	return *iImageHandler;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
	}
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   523
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   524
void CPodcastModel::LaunchFileEmbeddedL(const TDesC& aFilename)
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   525
    {
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   526
    //Set the exit observer so HandleServerAppExit will be called
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   527
    iDocHandler->SetExitObserver(this);   
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   528
 
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   529
    TDataType emptyDataType = TDataType();
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   530
    //Open a file embedded
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   531
    iDocHandler->OpenFileEmbeddedL(aFilename, emptyDataType);             
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   532
    }
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   533
 
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   534
void CPodcastModel::HandleServerAppExit(TInt aReason)
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   535
    {
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   536
    //Handle closing the handler application
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   537
    MAknServerAppExitObserver::HandleServerAppExit(aReason);
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   538
    }
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   539