Add so image conversion is done in feedinfo if image already exist.
authorLars Persson <lars.persson@embeddev.se>
Wed, 31 Mar 2010 18:09:02 +0200
changeset 97 b52f6033af15
parent 94 8d36b7608232
child 98 523e04129df6
Add so image conversion is done in feedinfo if image already exist. Check in feedengine if image exist from previous database(files might exist, even though the db is corrupt.
application/src/PodcastAppui.cpp
engine/BWINS/podcastengineu.def
engine/inc/FeedInfo.h
engine/src/FeedEngine.cpp
engine/src/FeedInfo.cpp
--- a/application/src/PodcastAppui.cpp	Wed Mar 31 16:06:20 2010 +0200
+++ b/application/src/PodcastAppui.cpp	Wed Mar 31 18:09:02 2010 +0200
@@ -127,8 +127,8 @@
             }
         case EEikCmdExit:
         	{
-			TApaTask task(CEikonEnv::Static()->WsSession());
-			task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
+			TApaTask task(iEikonEnv->WsSession());
+			task.SetWgId(iEikonEnv->RootWin().Identifier());
 			task.SendToBackground(); 
 			break;
         	}
--- a/engine/BWINS/podcastengineu.def	Wed Mar 31 16:06:20 2010 +0200
+++ b/engine/BWINS/podcastengineu.def	Wed Mar 31 18:09:02 2010 +0200
@@ -121,54 +121,55 @@
 	?SetFeedIcon@CFeedInfo@@QAEXPAVCFbsBitmap@@@Z @ 120 NONAME ; void CFeedInfo::SetFeedIcon(class CFbsBitmap *)
 	?SetFeedUid@CShowInfo@@QAEXI@Z @ 121 NONAME ; void CShowInfo::SetFeedUid(unsigned int)
 	?SetFileNameL@CShowInfo@@QAEXABVTDesC16@@@Z @ 122 NONAME ; void CShowInfo::SetFileNameL(class TDesC16 const &)
-	?SetImageFileNameL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 123 NONAME ; void CFeedInfo::SetImageFileNameL(class TDesC16 const &)
-	?SetImageUrlL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 124 NONAME ; void CFeedInfo::SetImageUrlL(class TDesC16 const &)
-	?SetLastError@CFeedInfo@@QAEXH@Z @ 125 NONAME ; void CFeedInfo::SetLastError(int)
-	?SetLastError@CShowInfo@@QAEXH@Z @ 126 NONAME ; void CShowInfo::SetLastError(int)
-	?SetLastUpdated@CFeedInfo@@QAEXVTTime@@@Z @ 127 NONAME ; void CFeedInfo::SetLastUpdated(class TTime)
-	?SetLinkL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 128 NONAME ; void CFeedInfo::SetLinkL(class TDesC16 const &)
-	?SetPlayState@CShowInfo@@QAEXW4TPlayState@@@Z @ 129 NONAME ; void CShowInfo::SetPlayState(enum TPlayState)
-	?SetPlayTime@CShowInfo@@QAEXI@Z @ 130 NONAME ; void CShowInfo::SetPlayTime(unsigned int)
-	?SetPlayingPodcast@CPodcastModel@@QAEXPAVCShowInfo@@@Z @ 131 NONAME ; void CPodcastModel::SetPlayingPodcast(class CShowInfo *)
-	?SetPosition@CShowInfo@@QAEXVTTimeIntervalMicroSeconds@@@Z @ 132 NONAME ; void CShowInfo::SetPosition(class TTimeIntervalMicroSeconds)
-	?SetPosition@CSoundEngine@@QAEXI@Z @ 133 NONAME ; void CSoundEngine::SetPosition(unsigned int)
-	?SetPubDate@CShowInfo@@QAEXVTTime@@@Z @ 134 NONAME ; void CShowInfo::SetPubDate(class TTime)
-	?SetShowSize@CShowInfo@@QAEXI@Z @ 135 NONAME ; void CShowInfo::SetShowSize(unsigned int)
-	?SetShowType@CShowInfo@@QAEXW4TShowType@@@Z @ 136 NONAME ; void CShowInfo::SetShowType(enum TShowType)
-	?SetSpecificIAP@CSettingsEngine@@QAEXH@Z @ 137 NONAME ; void CSettingsEngine::SetSpecificIAP(int)
-	?SetTitleL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 138 NONAME ; void CFeedInfo::SetTitleL(class TDesC16 const &)
-	?SetTitleL@CShowInfo@@QAEXABVTDesC16@@@Z @ 139 NONAME ; void CShowInfo::SetTitleL(class TDesC16 const &)
-	?SetTrackNo@CShowInfo@@QAEXI@Z @ 140 NONAME ; void CShowInfo::SetTrackNo(unsigned int)
-	?SetUid@CShowInfo@@QAEXI@Z @ 141 NONAME ; void CShowInfo::SetUid(unsigned int)
-	?SetUpdateAutomatically@CSettingsEngine@@QAEXW4TAutoUpdateSetting@@@Z @ 142 NONAME ; void CSettingsEngine::SetUpdateAutomatically(enum TAutoUpdateSetting)
-	?SetUpdateFeedInterval@CSettingsEngine@@QAEXH@Z @ 143 NONAME ; void CSettingsEngine::SetUpdateFeedInterval(int)
-	?SetUpdateFeedTime@CSettingsEngine@@QAEXVTTime@@@Z @ 144 NONAME ; void CSettingsEngine::SetUpdateFeedTime(class TTime)
-	?SetUrlL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 145 NONAME ; void CFeedInfo::SetUrlL(class TDesC16 const &)
-	?SetUrlL@CShowInfo@@QAEXABVTDesC16@@@Z @ 146 NONAME ; void CShowInfo::SetUrlL(class TDesC16 const &)
-	?SettingsEngine@CPodcastModel@@QAEAAVCSettingsEngine@@XZ @ 147 NONAME ; class CSettingsEngine & CPodcastModel::SettingsEngine(void)
-	?ShowDownloading@CShowEngine@@QAEPAVCShowInfo@@XZ @ 148 NONAME ; class CShowInfo * CShowEngine::ShowDownloading(void)
-	?ShowEngine@CPodcastModel@@QAEAAVCShowEngine@@XZ @ 149 NONAME ; class CShowEngine & CPodcastModel::ShowEngine(void)
-	?ShowSize@CShowInfo@@QBEIXZ @ 150 NONAME ; unsigned int CShowInfo::ShowSize(void) const
-	?ShowType@CShowInfo@@QBE?AW4TShowType@@XZ @ 151 NONAME ; enum TShowType CShowInfo::ShowType(void) const
-	?SoundEngine@CPodcastModel@@QAEAAVCSoundEngine@@XZ @ 152 NONAME ; class CSoundEngine & CPodcastModel::SoundEngine(void)
-	?SpecificIAP@CSettingsEngine@@QAEHXZ @ 153 NONAME ; int CSettingsEngine::SpecificIAP(void)
-	?State@CSoundEngine@@QAE?AW4TSoundEngineState@@XZ @ 154 NONAME ; enum TSoundEngineState CSoundEngine::State(void)
-	?Stop@CSoundEngine@@QAEXH@Z @ 155 NONAME ; void CSoundEngine::Stop(int)
-	?SuspendDownloads@CShowEngine@@QAEXXZ @ 156 NONAME ; void CShowEngine::SuspendDownloads(void)
-	?Title@CFeedInfo@@QBEABVTDesC16@@XZ @ 157 NONAME ; class TDesC16 const & CFeedInfo::Title(void) const
-	?Title@CShowInfo@@QBEABVTDesC16@@XZ @ 158 NONAME ; class TDesC16 const & CShowInfo::Title(void) const
-	?TrackNo@CShowInfo@@QBEIXZ @ 159 NONAME ; unsigned int CShowInfo::TrackNo(void) const
-	?Uid@CFeedInfo@@QBEIXZ @ 160 NONAME ; unsigned int CFeedInfo::Uid(void) const
-	?Uid@CShowInfo@@QBEIXZ @ 161 NONAME ; unsigned int CShowInfo::Uid(void) const
-	?UpdateAllFeedsL@CFeedEngine@@QAEXH@Z @ 162 NONAME ; void CFeedEngine::UpdateAllFeedsL(int)
-	?UpdateAutomatically@CSettingsEngine@@QAE?AW4TAutoUpdateSetting@@XZ @ 163 NONAME ; enum TAutoUpdateSetting CSettingsEngine::UpdateAutomatically(void)
-	?UpdateFeed@CFeedEngine@@QAEXPAVCFeedInfo@@@Z @ 164 NONAME ; void CFeedEngine::UpdateFeed(class CFeedInfo *)
-	?UpdateFeedInterval@CSettingsEngine@@QAEHXZ @ 165 NONAME ; int CSettingsEngine::UpdateFeedInterval(void)
-	?UpdateFeedL@CFeedEngine@@QAEHI@Z @ 166 NONAME ; int CFeedEngine::UpdateFeedL(unsigned int)
-	?UpdateFeedTime@CSettingsEngine@@QAE?AVTTime@@XZ @ 167 NONAME ; class TTime CSettingsEngine::UpdateFeedTime(void)
-	?UpdateIAPListL@CPodcastModel@@QAEXXZ @ 168 NONAME ; void CPodcastModel::UpdateIAPListL(void)
-	?UpdateSNAPListL@CPodcastModel@@QAEXXZ @ 169 NONAME ; void CPodcastModel::UpdateSNAPListL(void)
-	?UpdateShow@CShowEngine@@QAEXAAVCShowInfo@@@Z @ 170 NONAME ; void CShowEngine::UpdateShow(class CShowInfo &)
-	?Url@CFeedInfo@@QBEABVTDesC16@@XZ @ 171 NONAME ; class TDesC16 const & CFeedInfo::Url(void) const
-	?NewL@CImageHandler@@SAPAV1@AAVRFs@@AAVCPodcastModel@@@Z @ 172 NONAME ; class CImageHandler * CImageHandler::NewL(class RFs &, class CPodcastModel &)
-	?NewLC@CImageHandler@@SAPAV1@AAVRFs@@AAVCPodcastModel@@@Z @ 173 NONAME ; class CImageHandler * CImageHandler::NewLC(class RFs &, class CPodcastModel &)
+	?NewL@CImageHandler@@SAPAV1@AAVRFs@@AAVCPodcastModel@@@Z @ 123 NONAME ; class CImageHandler * CImageHandler::NewL(class RFs &, class CPodcastModel &)
+	?NewLC@CImageHandler@@SAPAV1@AAVRFs@@AAVCPodcastModel@@@Z @ 124 NONAME ; class CImageHandler * CImageHandler::NewLC(class RFs &, class CPodcastModel &)
+	?SetImageFileNameL@CFeedInfo@@QAEXABVTDesC16@@PAVCPodcastModel@@@Z @ 125 NONAME ; void CFeedInfo::SetImageFileNameL(class TDesC16 const &, class CPodcastModel *)
+	?SetImageUrlL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 126 NONAME ; void CFeedInfo::SetImageUrlL(class TDesC16 const &)
+	?SetLastError@CFeedInfo@@QAEXH@Z @ 127 NONAME ; void CFeedInfo::SetLastError(int)
+	?SetLastError@CShowInfo@@QAEXH@Z @ 128 NONAME ; void CShowInfo::SetLastError(int)
+	?SetLastUpdated@CFeedInfo@@QAEXVTTime@@@Z @ 129 NONAME ; void CFeedInfo::SetLastUpdated(class TTime)
+	?SetLinkL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 130 NONAME ; void CFeedInfo::SetLinkL(class TDesC16 const &)
+	?SetPlayState@CShowInfo@@QAEXW4TPlayState@@@Z @ 131 NONAME ; void CShowInfo::SetPlayState(enum TPlayState)
+	?SetPlayTime@CShowInfo@@QAEXI@Z @ 132 NONAME ; void CShowInfo::SetPlayTime(unsigned int)
+	?SetPlayingPodcast@CPodcastModel@@QAEXPAVCShowInfo@@@Z @ 133 NONAME ; void CPodcastModel::SetPlayingPodcast(class CShowInfo *)
+	?SetPosition@CShowInfo@@QAEXVTTimeIntervalMicroSeconds@@@Z @ 134 NONAME ; void CShowInfo::SetPosition(class TTimeIntervalMicroSeconds)
+	?SetPosition@CSoundEngine@@QAEXI@Z @ 135 NONAME ; void CSoundEngine::SetPosition(unsigned int)
+	?SetPubDate@CShowInfo@@QAEXVTTime@@@Z @ 136 NONAME ; void CShowInfo::SetPubDate(class TTime)
+	?SetShowSize@CShowInfo@@QAEXI@Z @ 137 NONAME ; void CShowInfo::SetShowSize(unsigned int)
+	?SetShowType@CShowInfo@@QAEXW4TShowType@@@Z @ 138 NONAME ; void CShowInfo::SetShowType(enum TShowType)
+	?SetSpecificIAP@CSettingsEngine@@QAEXH@Z @ 139 NONAME ; void CSettingsEngine::SetSpecificIAP(int)
+	?SetTitleL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 140 NONAME ; void CFeedInfo::SetTitleL(class TDesC16 const &)
+	?SetTitleL@CShowInfo@@QAEXABVTDesC16@@@Z @ 141 NONAME ; void CShowInfo::SetTitleL(class TDesC16 const &)
+	?SetTrackNo@CShowInfo@@QAEXI@Z @ 142 NONAME ; void CShowInfo::SetTrackNo(unsigned int)
+	?SetUid@CShowInfo@@QAEXI@Z @ 143 NONAME ; void CShowInfo::SetUid(unsigned int)
+	?SetUpdateAutomatically@CSettingsEngine@@QAEXW4TAutoUpdateSetting@@@Z @ 144 NONAME ; void CSettingsEngine::SetUpdateAutomatically(enum TAutoUpdateSetting)
+	?SetUpdateFeedInterval@CSettingsEngine@@QAEXH@Z @ 145 NONAME ; void CSettingsEngine::SetUpdateFeedInterval(int)
+	?SetUpdateFeedTime@CSettingsEngine@@QAEXVTTime@@@Z @ 146 NONAME ; void CSettingsEngine::SetUpdateFeedTime(class TTime)
+	?SetUrlL@CFeedInfo@@QAEXABVTDesC16@@@Z @ 147 NONAME ; void CFeedInfo::SetUrlL(class TDesC16 const &)
+	?SetUrlL@CShowInfo@@QAEXABVTDesC16@@@Z @ 148 NONAME ; void CShowInfo::SetUrlL(class TDesC16 const &)
+	?SettingsEngine@CPodcastModel@@QAEAAVCSettingsEngine@@XZ @ 149 NONAME ; class CSettingsEngine & CPodcastModel::SettingsEngine(void)
+	?ShowDownloading@CShowEngine@@QAEPAVCShowInfo@@XZ @ 150 NONAME ; class CShowInfo * CShowEngine::ShowDownloading(void)
+	?ShowEngine@CPodcastModel@@QAEAAVCShowEngine@@XZ @ 151 NONAME ; class CShowEngine & CPodcastModel::ShowEngine(void)
+	?ShowSize@CShowInfo@@QBEIXZ @ 152 NONAME ; unsigned int CShowInfo::ShowSize(void) const
+	?ShowType@CShowInfo@@QBE?AW4TShowType@@XZ @ 153 NONAME ; enum TShowType CShowInfo::ShowType(void) const
+	?SoundEngine@CPodcastModel@@QAEAAVCSoundEngine@@XZ @ 154 NONAME ; class CSoundEngine & CPodcastModel::SoundEngine(void)
+	?SpecificIAP@CSettingsEngine@@QAEHXZ @ 155 NONAME ; int CSettingsEngine::SpecificIAP(void)
+	?State@CSoundEngine@@QAE?AW4TSoundEngineState@@XZ @ 156 NONAME ; enum TSoundEngineState CSoundEngine::State(void)
+	?Stop@CSoundEngine@@QAEXH@Z @ 157 NONAME ; void CSoundEngine::Stop(int)
+	?SuspendDownloads@CShowEngine@@QAEXXZ @ 158 NONAME ; void CShowEngine::SuspendDownloads(void)
+	?Title@CFeedInfo@@QBEABVTDesC16@@XZ @ 159 NONAME ; class TDesC16 const & CFeedInfo::Title(void) const
+	?Title@CShowInfo@@QBEABVTDesC16@@XZ @ 160 NONAME ; class TDesC16 const & CShowInfo::Title(void) const
+	?TrackNo@CShowInfo@@QBEIXZ @ 161 NONAME ; unsigned int CShowInfo::TrackNo(void) const
+	?Uid@CFeedInfo@@QBEIXZ @ 162 NONAME ; unsigned int CFeedInfo::Uid(void) const
+	?Uid@CShowInfo@@QBEIXZ @ 163 NONAME ; unsigned int CShowInfo::Uid(void) const
+	?UpdateAllFeedsL@CFeedEngine@@QAEXH@Z @ 164 NONAME ; void CFeedEngine::UpdateAllFeedsL(int)
+	?UpdateAutomatically@CSettingsEngine@@QAE?AW4TAutoUpdateSetting@@XZ @ 165 NONAME ; enum TAutoUpdateSetting CSettingsEngine::UpdateAutomatically(void)
+	?UpdateFeed@CFeedEngine@@QAEXPAVCFeedInfo@@@Z @ 166 NONAME ; void CFeedEngine::UpdateFeed(class CFeedInfo *)
+	?UpdateFeedInterval@CSettingsEngine@@QAEHXZ @ 167 NONAME ; int CSettingsEngine::UpdateFeedInterval(void)
+	?UpdateFeedL@CFeedEngine@@QAEHI@Z @ 168 NONAME ; int CFeedEngine::UpdateFeedL(unsigned int)
+	?UpdateFeedTime@CSettingsEngine@@QAE?AVTTime@@XZ @ 169 NONAME ; class TTime CSettingsEngine::UpdateFeedTime(void)
+	?UpdateIAPListL@CPodcastModel@@QAEXXZ @ 170 NONAME ; void CPodcastModel::UpdateIAPListL(void)
+	?UpdateSNAPListL@CPodcastModel@@QAEXXZ @ 171 NONAME ; void CPodcastModel::UpdateSNAPListL(void)
+	?UpdateShow@CShowEngine@@QAEXAAVCShowInfo@@@Z @ 172 NONAME ; void CShowEngine::UpdateShow(class CShowInfo &)
+	?Url@CFeedInfo@@QBEABVTDesC16@@XZ @ 173 NONAME ; class TDesC16 const & CFeedInfo::Url(void) const
+
--- a/engine/inc/FeedInfo.h	Wed Mar 31 16:06:20 2010 +0200
+++ b/engine/inc/FeedInfo.h	Wed Mar 31 18:09:02 2010 +0200
@@ -60,7 +60,7 @@
 		IMPORT_C TUint Uid() const;
 
 		IMPORT_C const TDesC& ImageFileName() const;
-		IMPORT_C void SetImageFileNameL(const TDesC &aFileName);
+		IMPORT_C void SetImageFileNameL(const TDesC &aFileName, CPodcastModel* aPodcastModel);
 			
 		IMPORT_C void SetCustomTitle();
 		IMPORT_C TBool CustomTitle() const;
--- a/engine/src/FeedEngine.cpp	Wed Mar 31 16:06:20 2010 +0200
+++ b/engine/src/FeedEngine.cpp	Wed Mar 31 18:09:02 2010 +0200
@@ -277,11 +277,18 @@
 	
 	// complete file path is base dir + rel path
 	filePath.Append(relPath);
-	aFeedInfo->SetImageFileNameL(filePath);
-
-	if(iFeedClient->GetL(aFeedInfo->ImageUrl(), filePath, ETrue))
+	// This file might exist in the podcast directory already so check this first
+	if(BaflUtils::FileExists(iPodcastModel.FsSession(), filePath))
 		{
-			iClientState = EUpdatingImage;
+			aFeedInfo->SetImageFileNameL(filePath, &iPodcastModel);
+		}
+	else
+		{
+			aFeedInfo->SetImageFileNameL(filePath, NULL);
+			if(iFeedClient->GetL(aFeedInfo->ImageUrl(), filePath, ETrue))
+			{
+				iClientState = EUpdatingImage;
+			}
 		}
 	}
 
@@ -926,7 +933,7 @@
 
 			const void *imagefilez = sqlite3_column_text16(st, 4);
 			TPtrC16 imagefile((const TUint16*)imagefilez);
-			feedInfo->SetImageFileNameL(imagefile);
+			feedInfo->SetImageFileNameL(imagefile, &iPodcastModel);
 						
 			const void *linkz = sqlite3_column_text16(st, 5);
 			TPtrC16 link((const TUint16*)linkz);
--- a/engine/src/FeedInfo.cpp	Wed Mar 31 16:06:20 2010 +0200
+++ b/engine/src/FeedInfo.cpp	Wed Mar 31 18:09:02 2010 +0200
@@ -53,7 +53,7 @@
 	copy->SetBuildDate(BuildDate());
 	copy->SetLastUpdated(LastUpdated());
 	copy->iFeedIcon->Duplicate(iFeedIcon->Handle());
-	copy->SetImageFileNameL(ImageFileName());
+	copy->SetImageFileNameL(ImageFileName(), NULL);
 	if(CustomTitle())
 		{
 		copy->SetCustomTitle();
@@ -193,7 +193,7 @@
 	return iImageFileName ? *iImageFileName : KNullDesC();
 	}
 
-EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName)
+EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName, CPodcastModel* aPodcastModel)
 	{
 	TFileName cacheFileName;
 	
@@ -202,15 +202,22 @@
 		delete iImageFileName;
 		iImageFileName = NULL;
 		}
+	
 	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);
-		}	
+		}
+	else if(aPodcastModel &&  BaflUtils::FileExists(CEikonEnv::Static()->FsSession(), ImageFileName() ))
+		{
+		// If this fails, no reason to worry
+		TRAP_IGNORE(aPodcastModel->ImageHandler().LoadFileAndScaleL(FeedIcon(), ImageFileName(), TSize(64,56), *this, Uid()));
+		}		
 	} 
 
 EXPORT_C TBool CFeedInfo::CustomTitle() const