engine/src/FeedInfo.cpp
changeset 109 223f270fa7ff
parent 106 83752b9e3cb6
child 228 c553fa9dcbe5
child 311 606f4f6babf6
equal deleted inserted replaced
108:554d9980157f 109:223f270fa7ff
    50 	copy->SetDescriptionL(Description());
    50 	copy->SetDescriptionL(Description());
    51 	copy->SetImageUrlL(ImageUrl());
    51 	copy->SetImageUrlL(ImageUrl());
    52 	copy->SetLinkL(Link());
    52 	copy->SetLinkL(Link());
    53 	copy->SetBuildDate(BuildDate());
    53 	copy->SetBuildDate(BuildDate());
    54 	copy->SetLastUpdated(LastUpdated());
    54 	copy->SetLastUpdated(LastUpdated());
    55 	copy->iFeedIcon->Duplicate(iFeedIcon->Handle());
    55 	if (iFeedIcon) {
       
    56 		copy->SetFeedIcon(iFeedIcon);
       
    57 	}
    56 	copy->SetImageFileNameL(ImageFileName(), NULL);
    58 	copy->SetImageFileNameL(ImageFileName(), NULL);
    57 	if(CustomTitle())
    59 	if(CustomTitle())
    58 		{
    60 		{
    59 		copy->SetCustomTitle();
    61 		copy->SetCustomTitle();
    60 		}
    62 		}
    62 	copy->SetLastError(LastError());
    64 	copy->SetLastError(LastError());
    63 
    65 
    64 	CleanupStack::Pop(copy);
    66 	CleanupStack::Pop(copy);
    65 	return copy;
    67 	return copy;
    66 	}
    68 	}
       
    69 
    67 CFeedInfo::CFeedInfo()
    70 CFeedInfo::CFeedInfo()
    68 	{
    71 	{
    69 	iCustomTitle = EFalse;
    72 	iCustomTitle = EFalse;
    70 	}
    73 	}
    71 
    74 
    80 	delete iFeedIcon;	
    83 	delete iFeedIcon;	
    81 	}
    84 	}
    82 
    85 
    83 void CFeedInfo::ConstructL()
    86 void CFeedInfo::ConstructL()
    84 	{
    87 	{
    85 	iFeedIcon = new (ELeave) CFbsBitmap;
    88 	//iFeedIcon = new (ELeave) CFbsBitmap;
    86 	}
    89 	}
    87 
    90 
    88 EXPORT_C const TDesC& CFeedInfo::Url() const
    91 EXPORT_C const TDesC& CFeedInfo::Url() const
    89 	{
    92 	{
    90 	return iUrl ? *iUrl : KNullDesC();
    93 	return iUrl ? *iUrl : KNullDesC();
   193 	return iImageFileName ? *iImageFileName : KNullDesC();
   196 	return iImageFileName ? *iImageFileName : KNullDesC();
   194 	}
   197 	}
   195 
   198 
   196 EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName, CPodcastModel* aPodcastModel)
   199 EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName, CPodcastModel* aPodcastModel)
   197 	{
   200 	{
       
   201 	DP1("CFeedInfo::SetImageFileNameL BEGIN, aFileName=%S", &aFileName);
   198 	TFileName cacheFileName;
   202 	TFileName cacheFileName;
   199 	
   203 	
   200 	if (iImageFileName)
   204 	if (iImageFileName)
   201 		{
   205 		{
   202 		delete iImageFileName;
   206 		delete iImageFileName;
   207 	TParsePtrC parser(*iImageFileName);
   211 	TParsePtrC parser(*iImageFileName);
   208 	cacheFileName = parser.DriveAndPath();
   212 	cacheFileName = parser.DriveAndPath();
   209 	cacheFileName.Append(parser.Name());
   213 	cacheFileName.Append(parser.Name());
   210 	cacheFileName.Append(KMbmExtension());
   214 	cacheFileName.Append(KMbmExtension());
   211 	
   215 	
   212 	if( iFeedIcon->SizeInPixels() == TSize(0,0) && BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), cacheFileName) )
   216 	if (iFeedIcon) {
       
   217 		delete iFeedIcon;
       
   218 	}
       
   219 	
       
   220 	if( BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), cacheFileName) )
   213 		{
   221 		{
   214 		iFeedIcon = CEikonEnv::Static()->CreateBitmapL(cacheFileName, 0);
   222 		iFeedIcon = CEikonEnv::Static()->CreateBitmapL(cacheFileName, 0);
   215 		}
   223 		}
   216 	else if(aPodcastModel &&  BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), ImageFileName() ))
   224 	else if(aPodcastModel &&  BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), ImageFileName() ))
   217 		{
   225 		{
   218 		// If this fails, no reason to worry
   226 		// If this fails, no reason to worry
       
   227 		iFeedIcon = new CFbsBitmap();
   219 		TRAP_IGNORE(aPodcastModel->ImageHandler().LoadFileAndScaleL(FeedIcon(), ImageFileName(), TSize(64,56), *this, Uid()));
   228 		TRAP_IGNORE(aPodcastModel->ImageHandler().LoadFileAndScaleL(FeedIcon(), ImageFileName(), TSize(64,56), *this, Uid()));
   220 		}		
   229 		}	
       
   230 	DP("CFeedInfo::SetImageFileNameL END");
   221 	} 
   231 	} 
   222 
   232 
   223 EXPORT_C TBool CFeedInfo::CustomTitle() const
   233 EXPORT_C TBool CFeedInfo::CustomTitle() const
   224 	{
   234 	{
   225 	return iCustomTitle;
   235 	return iCustomTitle;