| author | teknolog | 
| Sun, 04 Apr 2010 16:23:10 +0100 | |
| changeset 110 | 403412eb5292 | 
| parent 109 | 223f270fa7ff | 
| child 113 | 50345a6ad0c3 | 
| permissions | -rw-r--r-- | 
| 2 | 1 | /* | 
| 2 | * Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB | |
| 3 | * | |
| 4 | * All rights reserved. | |
| 5 | * This component and the accompanying materials are made available | |
| 6 | * under the terms of the License "Eclipse Public License v1.0" | |
| 7 | * which accompanies this distribution, and is available | |
| 8 | * at the URL "http://www.eclipse.org/legal/epl-v10.html". | |
| 9 | * | |
| 10 | * Initial Contributors: | |
| 11 | * EmbedDev AB - initial contribution. | |
| 12 | * | |
| 13 | * Contributors: | |
| 14 | * | |
| 15 | * Description: | |
| 16 | * | |
| 17 | */ | |
| 18 | ||
| 19 | #include <commdb.h> | |
| 20 | #include "PodcastModel.h" | |
| 21 | #include "FeedEngine.h" | |
| 22 | #include "SettingsEngine.h" | |
| 23 | #include "ShowEngine.h" | |
| 24 | #include "connectionengine.h" | |
| 109 | 25 | #include "podcastutils.h" | 
| 2 | 26 | |
| 27 | #include <cmdestination.h> | |
| 28 | #include <cmmanager.h> | |
| 29 | #include <bautils.h> | |
| 30 | ||
| 31 | const TInt KDefaultGranu = 5; | |
| 32 | _LIT(KDBFileName, "podcatcher.sqlite"); | |
| 33 | _LIT(KDBTemplateFileName, "podcatcher.sqlite.template"); | |
| 34 | ||
| 35 | EXPORT_C CPodcastModel* CPodcastModel::NewL() | |
| 36 | {
 | |
| 37 | CPodcastModel* self = new (ELeave) CPodcastModel; | |
| 38 | CleanupStack::PushL(self); | |
| 39 | self->ConstructL(); | |
| 40 | CleanupStack::Pop(self); | |
| 41 | return self; | |
| 42 | } | |
| 43 | ||
| 44 | CPodcastModel::~CPodcastModel() | |
| 45 | {
 | |
| 46 | ||
| 47 | delete iFeedEngine; | |
| 48 | delete iSettingsEngine; | |
| 49 | delete iShowEngine; | |
| 50 | ||
| 51 | delete iIapNameArray; | |
| 52 | iIapIdArray.Close(); | |
| 53 | ||
| 54 | delete iSNAPNameArray; | |
| 55 | iSNAPIdArray.Close(); | |
| 56 | delete iCommDB; | |
| 57 | sqlite3_close(iDB); | |
| 58 | iFsSession.Close(); | |
| 59 | iActiveShowList.ResetAndDestroy(); | |
| 60 | iActiveShowList.Close(); | |
| 61 | delete iConnectionEngine; | |
| 62 | iCmManager.Close(); | |
| 63 | delete iImageHandler; | |
| 64 | } | |
| 65 | ||
| 66 | CPodcastModel::CPodcastModel() | |
| 67 | {	
 | |
| 68 | } | |
| 69 | ||
| 70 | void CPodcastModel::ConstructL() | |
| 71 | {
 | |
| 72 | 	DP("CPodcastModel::ConstructL BEGIN");
 | |
| 73 | User::LeaveIfError(iFsSession.Connect()); | |
| 74 | ||
| 75 | iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified); | |
| 76 | //iCommDB ->ShowHiddenRecords(); // magic | |
| 77 | iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); | |
| 78 | iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); | |
| 79 | iCmManager.OpenL(); | |
| 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: 
91diff
changeset | 80 | iImageHandler = CImageHandler::NewL(FsSession(), *this); | 
| 2 | 81 | |
| 82 | UpdateIAPListL(); | |
| 83 | UpdateSNAPListL(); | |
| 84 | ||
| 85 | iSettingsEngine = CSettingsEngine::NewL(*this); | |
| 86 | iConnectionEngine = CConnectionEngine::NewL(*this); | |
| 87 | ||
| 109 | 88 | TRAPD(err, OpenDBL()); | 
| 89 | ||
| 90 | if (err != KErrNone) | |
| 91 | 		{
 | |
| 92 | ResetDB(); | |
| 93 | ||
| 94 | TRAP(err, OpenDBL()); | |
| 95 | ||
| 96 | if (err != KErrNone) | |
| 97 | 			{
 | |
| 98 | 			User::Panic(_L("Podcatcher"), 1);
 | |
| 99 | } | |
| 100 | ||
| 101 | } | |
| 102 | ||
| 2 | 103 | iFeedEngine = CFeedEngine::NewL(*this); | 
| 104 | iShowEngine = CShowEngine::NewL(*this); | |
| 105 | ||
| 106 | 	DP("CPodcastModel::ConstructL END");
 | |
| 107 | } | |
| 108 | ||
| 109 | ||
| 110 | ||
| 111 | EXPORT_C void CPodcastModel::UpdateIAPListL() | |
| 112 | 	{
 | |
| 113 | iIapNameArray->Reset(); | |
| 114 | iIapIdArray.Reset(); | |
| 115 | ||
| 116 | CCommsDbTableView* table = iCommDB->OpenTableLC (TPtrC (IAP)); | |
| 117 | TInt ret = table->GotoFirstRecord (); | |
| 118 | TPodcastIAPItem IAPItem; | |
| 119 | TBuf <KCommsDbSvrMaxFieldLength> bufName; | |
| 120 | while (ret == KErrNone) // There was a first record | |
| 121 | 		{
 | |
| 122 | table->ReadUintL(TPtrC(COMMDB_ID), IAPItem.iIapId); | |
| 123 | table->ReadTextL (TPtrC(COMMDB_NAME), bufName); | |
| 124 | table->ReadTextL (TPtrC(IAP_BEARER_TYPE), IAPItem.iBearerType); | |
| 125 | table->ReadTextL (TPtrC(IAP_SERVICE_TYPE), IAPItem.iServiceType); | |
| 126 | ||
| 127 | iIapIdArray.Append(IAPItem); | |
| 128 | iIapNameArray->AppendL(bufName); | |
| 129 | ret = table->GotoNextRecord(); | |
| 130 | } | |
| 131 | CleanupStack::PopAndDestroy(); // Close table | |
| 132 | } | |
| 133 | ||
| 134 | EXPORT_C void CPodcastModel::UpdateSNAPListL() | |
| 135 | {
 | |
| 136 | 	DP("CPodcastModel::UpdateSNAPListL BEGIN");
 | |
| 137 | iSNAPNameArray->Reset(); | |
| 138 | iSNAPIdArray.Reset(); | |
| 139 | ||
| 140 | RCmDestination destination; | |
| 141 | TPodcastIAPItem IAPItem; | |
| 142 | ||
| 143 | RArray<TUint32> destArray; | |
| 144 | CleanupClosePushL(destArray); | |
| 145 | iCmManager.AllDestinationsL(destArray); | |
| 146 | ||
| 147 | TInt cnt = destArray.Count(); | |
| 148 | 	DP1("destArray.Count==%d", cnt);
 | |
| 149 | for(TInt loop = 0;loop<cnt;loop++) | |
| 150 | 		{
 | |
| 151 | destination = iCmManager.DestinationL (destArray[loop]); | |
| 152 | CleanupClosePushL(destination); | |
| 153 | if(!destination.IsHidden()) | |
| 154 | 			{
 | |
| 155 | IAPItem.iIapId = destArray[loop]; | |
| 156 | HBufC* name = destination.NameLC(); | |
| 157 | 			DP1(" destination.NameLC==%S", name);
 | |
| 158 | iSNAPNameArray->AppendL(*name); | |
| 159 | CleanupStack::PopAndDestroy(name); | |
| 160 | iSNAPIdArray.Append(IAPItem); | |
| 161 | } | |
| 162 | CleanupStack::PopAndDestroy();//close destination | |
| 163 | } | |
| 164 | CleanupStack::PopAndDestroy();// close destArray | |
| 165 | ||
| 166 | 	DP("CPodcastModel::UpdateSNAPListL END");
 | |
| 167 | } | |
| 168 | ||
| 169 | EXPORT_C CDesCArrayFlat* CPodcastModel::IAPNames() | |
| 170 | {
 | |
| 171 | return iIapNameArray; | |
| 172 | } | |
| 173 | ||
| 174 | EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::IAPIds() | |
| 175 | {
 | |
| 176 | return iIapIdArray; | |
| 177 | } | |
| 178 | ||
| 179 | EXPORT_C CDesCArrayFlat* CPodcastModel::SNAPNames() | |
| 180 | {
 | |
| 181 | return iSNAPNameArray; | |
| 182 | } | |
| 183 | ||
| 184 | EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::SNAPIds() | |
| 185 | {
 | |
| 186 | return iSNAPIdArray; | |
| 187 | } | |
| 188 | ||
| 189 | ||
| 190 | RFs& CPodcastModel::FsSession() | |
| 191 | 	{
 | |
| 192 | return iFsSession; | |
| 193 | } | |
| 194 | ||
| 195 | EXPORT_C void CPodcastModel::SetPlayingPodcast(CShowInfo* aPodcast) | |
| 196 | {
 | |
| 197 | iPlayingPodcast = aPodcast; | |
| 198 | } | |
| 199 | ||
| 200 | EXPORT_C CShowInfo* CPodcastModel::PlayingPodcast() | |
| 201 | {
 | |
| 202 | return iPlayingPodcast; | |
| 203 | } | |
| 204 | ||
| 205 | EXPORT_C CFeedEngine& CPodcastModel::FeedEngine() | |
| 206 | {
 | |
| 207 | return *iFeedEngine; | |
| 208 | } | |
| 209 | ||
| 210 | EXPORT_C CShowEngine& CPodcastModel::ShowEngine() | |
| 211 | {
 | |
| 212 | return *iShowEngine; | |
| 213 | } | |
| 214 | ||
| 215 | EXPORT_C CSettingsEngine& CPodcastModel::SettingsEngine() | |
| 216 | {
 | |
| 217 | return *iSettingsEngine; | |
| 218 | } | |
| 219 | ||
| 220 | EXPORT_C CConnectionEngine& CPodcastModel::ConnectionEngine() | |
| 221 | {
 | |
| 222 | return *iConnectionEngine; | |
| 223 | } | |
| 224 | ||
| 225 | EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit) | |
| 226 | 	{
 | |
| 44 | 227 | // TODO: interact with MPX | 
| 2 | 228 | } | 
| 229 | ||
| 230 | EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo() | |
| 231 | {
 | |
| 232 | return iActiveFeed; | |
| 233 | } | |
| 234 | ||
| 235 | EXPORT_C void CPodcastModel::SetActiveFeedInfo(CFeedInfo* aFeedInfo) | |
| 236 | {
 | |
| 237 | iActiveFeed = aFeedInfo; | |
| 238 | } | |
| 239 | ||
| 240 | EXPORT_C RShowInfoArray& CPodcastModel::ActiveShowList() | |
| 241 | {
 | |
| 242 | return iActiveShowList; | |
| 243 | } | |
| 244 | ||
| 245 | void CPodcastModel::SetActiveShowList(RShowInfoArray& aShowArray) | |
| 246 | {
 | |
| 247 | iActiveShowList.ResetAndDestroy(); | |
| 248 | TInt cnt = aShowArray.Count(); | |
| 249 | ||
| 250 | for(TInt loop = 0;loop < cnt; loop++) | |
| 251 | 	{
 | |
| 252 | iActiveShowList.Append(aShowArray[loop]); | |
| 253 | } | |
| 254 | } | |
| 255 | ||
| 110 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 256 | void CPodcastModel::DropDB() | 
| 109 | 257 | 	{
 | 
| 258 | if (iDB != NULL) | |
| 259 | 		{
 | |
| 260 | sqlite3_close(iDB); | |
| 261 | iDB = NULL; | |
| 262 | } | |
| 263 | ||
| 264 | TFileName dbFileName; | |
| 265 | dbFileName.Copy(iSettingsEngine->PrivatePath()); | |
| 266 | dbFileName.Append(KDBFileName); | |
| 267 | ||
| 268 | // remove the old DB file | |
| 269 | if (BaflUtils::FileExists(iFsSession, dbFileName)) | |
| 270 | 		{
 | |
| 271 | BaflUtils::DeleteFile(iFsSession, dbFileName); | |
| 272 | } | |
| 110 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 273 | } | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 274 | |
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 275 | void CPodcastModel::ResetDB() | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 276 | 	{
 | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 277 | 	DP("CPodcastModel::ResetDB BEGIN");
 | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 278 | |
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 279 | DropDB(); | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 280 | |
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 281 | TFileName dbFileName; | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 282 | dbFileName.Copy(iSettingsEngine->PrivatePath()); | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 283 | dbFileName.Append(KDBFileName); | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 284 | |
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 285 | // remove the old DB file | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 286 | if (BaflUtils::FileExists(iFsSession, dbFileName)) | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 287 | 		{
 | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 288 | BaflUtils::DeleteFile(iFsSession, dbFileName); | 
| 
403412eb5292
Added "Reset database" option in settings. Further robustness fixes for Feeds.
 teknolog parents: 
109diff
changeset | 289 | } | 
| 109 | 290 | |
| 291 | // copy template to new DB | |
| 292 | TFileName dbTemplate; | |
| 293 | dbTemplate.Copy(iSettingsEngine->PrivatePath()); | |
| 294 | dbTemplate.Append(KDBTemplateFileName); | |
| 295 | ||
| 296 | BaflUtils::CopyFile(iFsSession, dbTemplate,dbFileName); | |
| 297 | iIsFirstStartup = ETrue; | |
| 298 | 	DP("CPodcastModel::ResetDB END");
 | |
| 299 | } | |
| 300 | ||
| 301 | ||
| 302 | void CPodcastModel::OpenDBL() | |
| 303 | 	{
 | |
| 304 | 	DP("CPodcastModel::OpenDBL BEGIN");
 | |
| 305 | ||
| 306 | if (iDB != NULL) | |
| 307 | 		{
 | |
| 308 | sqlite3_close(iDB); | |
| 309 | iDB = NULL; | |
| 310 | } | |
| 311 | ||
| 312 | TFileName dbFileName; | |
| 313 | dbFileName.Copy(iSettingsEngine->PrivatePath()); | |
| 314 | dbFileName.Append(KDBFileName); | |
| 315 | ||
| 316 | if (!BaflUtils::FileExists(iFsSession, dbFileName)) | |
| 317 | 		{
 | |
| 318 | User::Leave(KErrNotFound); | |
| 319 | } | |
| 320 | ||
| 321 | 	if (iDB == NULL) {	
 | |
| 322 | // open DB | |
| 323 | TBuf8<KMaxFileName> filename8; | |
| 324 | filename8.Copy(dbFileName); | |
| 325 | int rc = sqlite3_open((const char*) filename8.PtrZ(), &iDB); | |
| 326 | 		if(rc != SQLITE_OK){
 | |
| 327 | User::Leave(KErrCorrupt); | |
| 328 | } | |
| 329 | ||
| 330 | // do a test query | |
| 331 | sqlite3_stmt *st; | |
| 332 | rc = sqlite3_prepare_v2(iDB,"select count(*) from feeds" , -1, &st, (const char**) NULL); | |
| 333 | if( rc==SQLITE_OK ) | |
| 334 | 			{
 | |
| 335 | Cleanup_sqlite3_finalize_PushL(st); | |
| 336 | rc = sqlite3_step(st); | |
| 337 | ||
| 338 | if (rc != SQLITE_ROW) | |
| 339 | 				{
 | |
| 340 | User::Leave(KErrCorrupt); | |
| 341 | } | |
| 342 | CleanupStack::PopAndDestroy(); // st | |
| 343 | } | |
| 344 | else | |
| 345 | 			{
 | |
| 346 | User::Leave(KErrCorrupt); | |
| 347 | } | |
| 348 | } | |
| 349 | ||
| 350 | 	DP("CPodcastModel::OpenDBL END");	
 | |
| 351 | } | |
| 352 | ||
| 2 | 353 | sqlite3* CPodcastModel::DB() | 
| 354 | {
 | |
| 355 | return iDB; | |
| 356 | } | |
| 357 | ||
| 358 | void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession) | |
| 359 | 	{
 | |
| 360 | TBool useProxy = EFalse; | |
| 361 | HBufC* serverName = NULL; | |
| 362 | TUint32 port = 0; | |
| 363 | ||
| 364 | TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port)); | |
| 365 | if (err == KErrNone && useProxy) | |
| 366 | 		{
 | |
| 367 | CleanupStack::PushL(serverName); | |
| 368 | TBuf8<128> proxyAddr; | |
| 369 | proxyAddr.Append(*serverName); | |
| 370 | 		proxyAddr.Append(':');
 | |
| 371 | proxyAddr.AppendNum(port); | |
| 372 | ||
| 373 | RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr); | |
| 374 | CleanupClosePushL(prxAddr); | |
| 375 | THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); | |
| 376 | ||
| 377 | aSession.ConnectionInfo().SetPropertyL( | |
| 378 | aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), | |
| 379 | aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); | |
| 380 | ||
| 381 | aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); | |
| 382 | ||
| 383 | CleanupStack::PopAndDestroy(&prxAddr); | |
| 384 | CleanupStack::PopAndDestroy(serverName); | |
| 385 | } | |
| 386 | } | |
| 387 | ||
| 388 | ||
| 389 | void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort) | |
| 390 | 	{
 | |
| 391 | TInt iapId = GetIapId(); | |
| 392 | CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId); | |
| 393 | ||
| 394 | TUint32 iapService; | |
| 395 | HBufC* iapServiceType; | |
| 396 | table->ReadUintL(TPtrC(IAP_SERVICE), iapService); | |
| 397 | iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE)); | |
| 398 | ||
| 399 | CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType); | |
| 400 | TInt err = proxyTableView->GotoFirstRecord(); | |
| 401 | if( err != KErrNone) | |
| 402 | 		{
 | |
| 403 | User::Leave(KErrNotFound); | |
| 404 | } | |
| 405 | ||
| 406 | proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed); | |
| 407 | if(aIsUsed) | |
| 408 | 		{
 | |
| 409 | HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME)); | |
| 410 | proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort); | |
| 411 | aProxyServerName = serverName->AllocL(); | |
| 412 | CleanupStack::PopAndDestroy(serverName); | |
| 413 | } | |
| 414 | ||
| 415 | CleanupStack::PopAndDestroy(proxyTableView); | |
| 416 | CleanupStack::PopAndDestroy(iapServiceType); | |
| 417 | CleanupStack::PopAndDestroy(table); | |
| 418 | } | |
| 419 | ||
| 420 | ||
| 421 | TInt CPodcastModel::GetIapId() | |
| 422 | 	{
 | |
| 423 | _LIT(KSetting, "IAP\\Id"); | |
| 424 | TUint32 iapId = 0; | |
| 425 | iConnectionEngine->Connection().GetIntSetting(KSetting, iapId); | |
| 426 | return iapId; | |
| 427 | } | |
| 428 | ||
| 8 | 429 | EXPORT_C void CPodcastModel::GetAllShowsL() | 
| 2 | 430 | 	{
 | 
| 431 | iActiveShowList.ResetAndDestroy(); | |
| 8 | 432 | iShowEngine->GetAllShowsL(iActiveShowList); | 
| 2 | 433 | } | 
| 434 | ||
| 8 | 435 | EXPORT_C void CPodcastModel::GetNewShowsL() | 
| 2 | 436 | 	{
 | 
| 437 | iActiveShowList.ResetAndDestroy(); | |
| 8 | 438 | iShowEngine->GetNewShowsL(iActiveShowList); | 
| 2 | 439 | } | 
| 440 | ||
| 8 | 441 | EXPORT_C void CPodcastModel::GetShowsDownloadedL() | 
| 2 | 442 | 	{
 | 
| 443 | iActiveShowList.ResetAndDestroy(); | |
| 8 | 444 | iShowEngine->GetShowsDownloadedL(iActiveShowList); | 
| 2 | 445 | } | 
| 446 | ||
| 8 | 447 | EXPORT_C void CPodcastModel::GetShowsDownloadingL() | 
| 2 | 448 | 	{
 | 
| 449 | iActiveShowList.ResetAndDestroy(); | |
| 8 | 450 | iShowEngine->GetShowsDownloadingL(iActiveShowList); | 
| 2 | 451 | } | 
| 452 | ||
| 8 | 453 | EXPORT_C void CPodcastModel::GetShowsByFeedL(TUint aFeedUid) | 
| 2 | 454 | 	{
 | 
| 455 | iActiveShowList.ResetAndDestroy(); | |
| 8 | 456 | iShowEngine->GetShowsByFeedL(iActiveShowList, aFeedUid); | 
| 2 | 457 | } | 
| 458 | ||
| 35 
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
 Brendan Donegan <brendand@symbian.org> parents: 
8diff
changeset | 459 | EXPORT_C void CPodcastModel::MarkSelectionPlayedL() | 
| 2 | 460 | 	{
 | 
| 461 | 	for (int i=0;i<iActiveShowList.Count();i++) {
 | |
| 462 | 		if(iActiveShowList[i]->PlayState() != EPlayed) {
 | |
| 463 | iActiveShowList[i]->SetPlayState(EPlayed); | |
| 35 
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
 Brendan Donegan <brendand@symbian.org> parents: 
8diff
changeset | 464 | iShowEngine->UpdateShowL(*iActiveShowList[i]); | 
| 2 | 465 | } | 
| 466 | } | |
| 467 | } | |
| 468 | ||
| 469 | TInt CPodcastModel::FindActiveShowByUid(TUint aUid) | |
| 470 | 	{
 | |
| 471 | 	for (int i=0;i<iActiveShowList.Count();i++) {
 | |
| 472 | 		if (iActiveShowList[i]->Uid() == aUid) {
 | |
| 473 | return i; | |
| 474 | } | |
| 475 | } | |
| 476 | ||
| 477 | return KErrNotFound; | |
| 478 | } | |
| 479 | ||
| 480 | EXPORT_C TBool CPodcastModel::IsFirstStartup() | |
| 481 | 	{
 | |
| 482 | return iIsFirstStartup; | |
| 483 | } | |
| 484 | ||
| 485 | ||
| 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: 
91diff
changeset | 486 | void CPodcastModel::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/, CPodcastModel& /*aPodcastModel*/) | 
| 2 | 487 | 	{
 | 
| 488 | ||
| 489 | } | |
| 490 | ||
| 491 | EXPORT_C CImageHandler& CPodcastModel::ImageHandler() | |
| 492 | 	{
 | |
| 493 | return *iImageHandler; | |
| 494 | } |