engine/src/PodcastModel.cpp
author teknolog
Wed, 10 Mar 2010 23:26:17 +0000
branchsymbian1
changeset 44 f6f9647922ba
parent 36 e010fc411ddc
child 56 c5cd47bc11ef
child 65 bcd88ba95046
permissions -rw-r--r--
Removed unused SoundEngine
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"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include <cmdestination.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <cmmanager.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <bautils.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
const TInt KDefaultGranu = 5;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
_LIT(KDBFileName, "podcatcher.sqlite");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
_LIT(KDBTemplateFileName, "podcatcher.sqlite.template");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
EXPORT_C CPodcastModel* CPodcastModel::NewL()
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
	CPodcastModel* self = new (ELeave) CPodcastModel;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
CPodcastModel::~CPodcastModel()
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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
	delete iFeedEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
	delete iSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
	delete iShowEngine;
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
	delete iIapNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
	iIapIdArray.Close();
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
	delete iSNAPNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
	iSNAPIdArray.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
	delete iCommDB;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
	sqlite3_close(iDB);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
	iFsSession.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
	iActiveShowList.ResetAndDestroy();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
	iActiveShowList.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
	delete iConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
	iCmManager.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
	delete iImageHandler;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
CPodcastModel::CPodcastModel()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
{	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
void CPodcastModel::ConstructL()
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
	DP("CPodcastModel::ConstructL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
	User::LeaveIfError(iFsSession.Connect());
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
	iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
	//iCommDB ->ShowHiddenRecords(); // magic
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
	iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	iCmManager.OpenL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	iImageHandler = CImageHandler::NewL(FsSession());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	UpdateIAPListL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	UpdateSNAPListL();
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
	iSettingsEngine = CSettingsEngine::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
	iConnectionEngine = CConnectionEngine::NewL(*this);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	iFeedEngine = CFeedEngine::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	iShowEngine = CShowEngine::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	DP("CPodcastModel::ConstructL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
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
EXPORT_C void CPodcastModel::UpdateIAPListL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	iIapNameArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	iIapIdArray.Reset();	   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	CCommsDbTableView* table = iCommDB->OpenTableLC (TPtrC (IAP)); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	TInt ret = table->GotoFirstRecord ();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
	TPodcastIAPItem IAPItem;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	TBuf <KCommsDbSvrMaxFieldLength> bufName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	while (ret == KErrNone) // There was a first record
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
		table->ReadUintL(TPtrC(COMMDB_ID), IAPItem.iIapId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
		table->ReadTextL (TPtrC(COMMDB_NAME), bufName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
		table->ReadTextL (TPtrC(IAP_BEARER_TYPE), IAPItem.iBearerType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
		table->ReadTextL (TPtrC(IAP_SERVICE_TYPE), IAPItem.iServiceType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
		iIapIdArray.Append(IAPItem);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
		iIapNameArray->AppendL(bufName); 		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
		ret = table->GotoNextRecord();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
	CleanupStack::PopAndDestroy(); // Close table
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
	}
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
EXPORT_C void CPodcastModel::UpdateSNAPListL()
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
	DP("CPodcastModel::UpdateSNAPListL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
	iSNAPNameArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
	iSNAPIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
	RCmDestination destination;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
	TPodcastIAPItem IAPItem;
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
	RArray<TUint32> destArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	CleanupClosePushL(destArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	iCmManager.AllDestinationsL(destArray);
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
	TInt cnt = destArray.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
	DP1("destArray.Count==%d", cnt);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
	for(TInt loop = 0;loop<cnt;loop++)
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
		destination = iCmManager.DestinationL (destArray[loop]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
		CleanupClosePushL(destination);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
		if(!destination.IsHidden())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
			IAPItem.iIapId = destArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
			HBufC* name = destination.NameLC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
			DP1(" destination.NameLC==%S", name);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
			iSNAPNameArray->AppendL(*name);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
			CleanupStack::PopAndDestroy(name);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
			iSNAPIdArray.Append(IAPItem);
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
		CleanupStack::PopAndDestroy();//close destination
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	CleanupStack::PopAndDestroy();// close destArray
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
	DP("CPodcastModel::UpdateSNAPListL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
}
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
EXPORT_C CDesCArrayFlat* CPodcastModel::IAPNames()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
	return iIapNameArray;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::IAPIds()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
	return iIapIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
EXPORT_C CDesCArrayFlat* CPodcastModel::SNAPNames()
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
	return iSNAPNameArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::SNAPIds()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
	return iSNAPIdArray;
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
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
RFs& CPodcastModel::FsSession()
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
	return iFsSession;
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 void CPodcastModel::SetPlayingPodcast(CShowInfo* aPodcast)
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
	iPlayingPodcast = aPodcast;
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 CShowInfo* CPodcastModel::PlayingPodcast()
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 iPlayingPodcast;
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 CFeedEngine& CPodcastModel::FeedEngine()
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 *iFeedEngine;
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 CShowEngine& CPodcastModel::ShowEngine()
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 *iShowEngine;
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
EXPORT_C CSettingsEngine& CPodcastModel::SettingsEngine()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	return *iSettingsEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
}
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
EXPORT_C CConnectionEngine& CPodcastModel::ConnectionEngine()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
	return *iConnectionEngine;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
}
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
EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
	{
44
f6f9647922ba Removed unused SoundEngine
teknolog
parents: 36
diff changeset
   211
	// TODO: interact with MPX
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	}
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
EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
	return iActiveFeed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
}
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
EXPORT_C void CPodcastModel::SetActiveFeedInfo(CFeedInfo* aFeedInfo)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
	iActiveFeed = aFeedInfo;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
}
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
EXPORT_C RShowInfoArray& CPodcastModel::ActiveShowList()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
	return iActiveShowList;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
}
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
void CPodcastModel::SetActiveShowList(RShowInfoArray& aShowArray)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
	iActiveShowList.ResetAndDestroy();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
	TInt cnt = aShowArray.Count();
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
	for(TInt loop = 0;loop < cnt; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
		iActiveShowList.Append(aShowArray[loop]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
sqlite3* CPodcastModel::DB()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
	if (iDB == NULL) {		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
		TFileName dbFileName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
		iFsSession.PrivatePath(dbFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
		dbFileName.Append(KDBFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
		DP1("DB is at %S", &dbFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
		if (!BaflUtils::FileExists(iFsSession, dbFileName)) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   249
			TFileName dbTemplate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   250
			iFsSession.PrivatePath(dbTemplate);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
			dbTemplate.Append(KDBTemplateFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
			DP1("No DB found, copying template from %S", &dbTemplate);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
			BaflUtils::CopyFile(iFsSession, dbTemplate,dbFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
			iIsFirstStartup = ETrue;
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
		TBuf8<KMaxFileName> filename8;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
		filename8.Copy(dbFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   259
		int rc = rc = sqlite3_open((const char*) filename8.PtrZ(), &iDB);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   260
		if( rc != SQLITE_OK){
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
			DP("Error loading DB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
			User::Panic(_L("Podcatcher"), 10);
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
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
	return iDB;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession)
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
	TBool useProxy = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
	HBufC* serverName = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
	TUint32 port = 0;
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
	TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
	if (err == KErrNone && useProxy)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
		CleanupStack::PushL(serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
		TBuf8<128> proxyAddr;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
		proxyAddr.Append(*serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
		proxyAddr.Append(':');
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
		proxyAddr.AppendNum(port);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   285
		RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   286
		CleanupClosePushL(prxAddr);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
		THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
		aSession.ConnectionInfo().SetPropertyL(
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
						aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
						aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   293
		aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   294
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
		CleanupStack::PopAndDestroy(&prxAddr);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
		CleanupStack::PopAndDestroy(serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   303
	TInt iapId = GetIapId();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
	CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
	TUint32 iapService;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   307
	HBufC* iapServiceType;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   308
	table->ReadUintL(TPtrC(IAP_SERVICE), iapService);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
	iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   311
	CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   312
	TInt err = proxyTableView->GotoFirstRecord();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
	if( err != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
		User::Leave(KErrNotFound);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
	proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
	if(aIsUsed)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
		HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
		proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   323
		aProxyServerName = serverName->AllocL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
		CleanupStack::PopAndDestroy(serverName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
	CleanupStack::PopAndDestroy(proxyTableView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
	CleanupStack::PopAndDestroy(iapServiceType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
	CleanupStack::PopAndDestroy(table);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
TInt CPodcastModel::GetIapId()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
	_LIT(KSetting, "IAP\\Id");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
	TUint32 iapId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
	iConnectionEngine->Connection().GetIntSetting(KSetting, iapId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
	return iapId;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   341
EXPORT_C void CPodcastModel::GetAllShowsL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
	iActiveShowList.ResetAndDestroy();
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   344
	iShowEngine->GetAllShowsL(iActiveShowList);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   347
EXPORT_C void CPodcastModel::GetNewShowsL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
	iActiveShowList.ResetAndDestroy();
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   350
	iShowEngine->GetNewShowsL(iActiveShowList);	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   353
EXPORT_C void CPodcastModel::GetShowsDownloadedL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
	iActiveShowList.ResetAndDestroy();
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   356
	iShowEngine->GetShowsDownloadedL(iActiveShowList);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   359
EXPORT_C void CPodcastModel::GetShowsDownloadingL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
	iActiveShowList.ResetAndDestroy();
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   362
	iShowEngine->GetShowsDownloadingL(iActiveShowList);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   365
EXPORT_C void CPodcastModel::GetShowsByFeedL(TUint aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
	iActiveShowList.ResetAndDestroy();
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 2
diff changeset
   368
	iShowEngine->GetShowsByFeedL(iActiveShowList, aFeedUid);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 8
diff changeset
   371
EXPORT_C void CPodcastModel::MarkSelectionPlayedL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   372
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
	for (int i=0;i<iActiveShowList.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
		if(iActiveShowList[i]->PlayState() != EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   375
			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
   376
			iShowEngine->UpdateShowL(*iActiveShowList[i]);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   380
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   381
TInt CPodcastModel::FindActiveShowByUid(TUint aUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   382
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   383
	for (int i=0;i<iActiveShowList.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
		if (iActiveShowList[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   385
			return i;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   386
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   387
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   388
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   389
	return KErrNotFound;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   390
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
EXPORT_C TBool CPodcastModel::IsFirstStartup()
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 iIsFirstStartup;
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
32
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 8
diff changeset
   398
void CPodcastModel::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   401
	}
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
EXPORT_C CImageHandler& CPodcastModel::ImageHandler()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
	return *iImageHandler;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
	}