diff -r c06c2a75bb57 -r a8538f50e2ba engine/src/FeedInfo.cpp --- a/engine/src/FeedInfo.cpp Wed Mar 31 15:36:43 2010 +0100 +++ b/engine/src/FeedInfo.cpp Wed Mar 31 16:09:11 2010 +0100 @@ -17,8 +17,13 @@ */ #include "FeedInfo.h" +#include "FeedEngine.h" +#include "PodcastModel.h" #include #include +#include +#include +_LIT(KMbmExtension, ".mbm"); EXPORT_C CFeedInfo* CFeedInfo::NewL() { @@ -47,22 +52,21 @@ copy->SetLinkL(Link()); copy->SetBuildDate(BuildDate()); copy->SetLastUpdated(LastUpdated()); + copy->iFeedIcon->Duplicate(iFeedIcon->Handle()); copy->SetImageFileNameL(ImageFileName()); - copy->iFeedIcon->Duplicate(iFeedIcon->Handle()); if(CustomTitle()) { copy->SetCustomTitle(); } copy->SetLastError(LastError()); - copy->SetFeedIconIndex(FeedIconIndex()); + CleanupStack::Pop(copy); return copy; } CFeedInfo::CFeedInfo() { iCustomTitle = EFalse; - iFeedIconIndex = -1; } EXPORT_C CFeedInfo::~CFeedInfo() @@ -191,13 +195,23 @@ EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName) { + TFileName cacheFileName; + if (iImageFileName) { delete iImageFileName; iImageFileName = NULL; } - iImageFileName = aFileName.AllocL(); - } + iImageFileName = aFileName.AllocL(); + TParsePtrC parser(*iImageFileName); + cacheFileName = parser.DriveAndPath(); + cacheFileName.Append(parser.Name()); + cacheFileName.Append(KMbmExtension()); + if( iFeedIcon->SizeInPixels() == TSize(0,0) && BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), cacheFileName) ) + { + iFeedIcon = CEikonEnv::Static()->CreateBitmapL(cacheFileName, 0); + } + } EXPORT_C TBool CFeedInfo::CustomTitle() const { @@ -229,17 +243,17 @@ iFeedIcon->Duplicate(aBitmapToClone->Handle()); } -void CFeedInfo::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/) - { +void CFeedInfo::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/, CPodcastModel& aPodcastModel) + { + if (aError == KErrNone && iImageFileName && iFeedIcon) + { + TFileName cacheFileName; + TParsePtrC parser(*iImageFileName); + cacheFileName = parser.DriveAndPath(); + cacheFileName.Append(parser.Name()); + cacheFileName.Append(KMbmExtension()); + iFeedIcon->Save(cacheFileName); + aPodcastModel.FeedEngine().NotifyFeedUpdateComplete(this->iUid, KErrNone); + } } - -EXPORT_C TInt CFeedInfo::FeedIconIndex() const - { - return iFeedIconIndex; - } - -EXPORT_C void CFeedInfo::SetFeedIconIndex(TInt aIndex) - { - iFeedIconIndex = aIndex; - }