engine/src/FeedEngine.cpp
branchRCL_3
changeset 334 a7cb97979427
parent 328 75a70f4a4f6d
child 342 9441fb8fd60d
equal deleted inserted replaced
333:c80c7fb835c2 334:a7cb97979427
    99 	{
    99 	{
   100 	}
   100 	}
   101 
   101 
   102 CFeedEngine::~CFeedEngine()
   102 CFeedEngine::~CFeedEngine()
   103 	{
   103 	{
       
   104 	DP("~CFeedEngine BEGIN");
   104 	iObservers.Close();
   105 	iObservers.Close();
   105 	
   106 	
   106 	iFeedsUpdating.Close();
   107 	iFeedsUpdating.Close();
   107 	iSortedFeeds.ResetAndDestroy();
   108 	iSortedFeeds.ResetAndDestroy();
   108 	iSearchResults.ResetAndDestroy();
   109 	iSearchResults.ResetAndDestroy();
   110 	delete iParser;
   111 	delete iParser;
   111 	delete iFeedClient;
   112 	delete iFeedClient;
   112 	delete iOpmlParser;
   113 	delete iOpmlParser;
   113 	//
   114 	//
   114 	delete iRepository;
   115 	delete iRepository;
       
   116 	DP("~CFeedEngine END");
   115 	}
   117 	}
   116 
   118 
   117 /**
   119 /**
   118  * Returns the current internal state of the feed engine4
   120  * Returns the current internal state of the feed engine4
   119  */
   121  */
   297 		}
   299 		}
   298 	}
   300 	}
   299 
   301 
   300 void CFeedEngine::NewShowL(CShowInfo& aItem)
   302 void CFeedEngine::NewShowL(CShowInfo& aItem)
   301 	{
   303 	{
   302 	DP1("NewShowL, aItem.Title()=%S", &aItem.Title());
   304 	DP1("CFeedEngine::NewShowL BEGIN, aItem.Title()=%S", &aItem.Title());
   303 	HBufC* description = HBufC::NewLC(KMaxDescriptionLength);
   305 	HBufC* description = HBufC::NewLC(KMaxDescriptionLength);
   304 	TPtr ptr(description->Des());
   306 	TPtr ptr(description->Des());
   305 	ptr.Copy(aItem.Description());
   307 	ptr.Copy(aItem.Description());
   306 	PodcastUtils::CleanHtmlL(ptr);
   308 	PodcastUtils::CleanHtmlL(ptr);
   307 
   309 
   324 		{
   326 		{
   325 		iPodcastModel.ShowEngine().AddDownloadL(aItem);
   327 		iPodcastModel.ShowEngine().AddDownloadL(aItem);
   326 		}
   328 		}
   327 	
   329 	
   328 	showsAdded++;
   330 	showsAdded++;
       
   331 	DP("CFeedEngine::NewShowL END");
   329 	}
   332 	}
   330 
   333 
   331 void CFeedEngine::GetFeedImageL(CFeedInfo *aFeedInfo)
   334 void CFeedEngine::GetFeedImageL(CFeedInfo *aFeedInfo)
   332 	{
   335 	{
   333 	DP("GetFeedImage");
   336 	DP("GetFeedImage");
   340 	relPath.Copy(aFeedInfo->Title());
   343 	relPath.Copy(aFeedInfo->Title());
   341 	relPath.Append('\\');
   344 	relPath.Append('\\');
   342 
   345 
   343 	TFileName fileName;
   346 	TFileName fileName;
   344 	PodcastUtils::FileNameFromUrl(aFeedInfo->ImageUrl(), fileName);
   347 	PodcastUtils::FileNameFromUrl(aFeedInfo->ImageUrl(), fileName);
       
   348 	fileName.Trim();
       
   349 	
       
   350 	if (fileName.Length() == 0)
       
   351 		User::Leave(KErrNotFound);
       
   352 	
   345 	relPath.Append(fileName);
   353 	relPath.Append(fileName);
   346 	PodcastUtils::EnsureProperPathName(relPath);
   354 	PodcastUtils::EnsureProperPathName(relPath);
   347 	
   355 	
   348 	// complete file path is base dir + rel path
   356 	// complete file path is base dir + rel path
   349 	filePath.Append(relPath);
   357 	filePath.Append(relPath);
   666 			if(aError == KErrNone)
   674 			if(aError == KErrNone)
   667 				{
   675 				{
   668 				// now the image has been downloaded, so we set it again in the FeedInfo to start
   676 				// now the image has been downloaded, so we set it again in the FeedInfo to start
   669 				// converting it
   677 				// converting it
   670 				HBufC *fileNameCopy = iActiveFeed->ImageFileName().AllocLC();
   678 				HBufC *fileNameCopy = iActiveFeed->ImageFileName().AllocLC();
       
   679 				DP1("fnc=%S", fileNameCopy);
   671 				TRAP_IGNORE(iActiveFeed->SetImageFileNameL(*fileNameCopy, &iPodcastModel));
   680 				TRAP_IGNORE(iActiveFeed->SetImageFileNameL(*fileNameCopy, &iPodcastModel));
   672 				CleanupStack::PopAndDestroy(fileNameCopy);
   681 				CleanupStack::PopAndDestroy(fileNameCopy);
   673 				}
   682 				}
   674 			DBUpdateFeedL(*iActiveFeed);
   683 			DBUpdateFeedL(*iActiveFeed);
   675 			NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError);
   684 			NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError);