engine/src/FeedEngine.cpp
branchsymbian1
changeset 336 3d6c1417e8bd
parent 244 d6c20128dad5
child 340 37610dda6102
equal deleted inserted replaced
296:80f1da5ac28b 336:3d6c1417e8bd
    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  */
   171 			isOfflineProfile = ETrue;
   173 			isOfflineProfile = ETrue;
   172 			}
   174 			}
   173 	    }
   175 	    }
   174 	//
   176 	//
   175 	iAutoUpdatedInitiator = aAutoUpdate;
   177 	iAutoUpdatedInitiator = aAutoUpdate;
   176 	if ((iFeedsUpdating.Count() > 0) || (isOfflineProfile && aAutoUpdate))
   178 	if ((iFeedsUpdating.Count() > 0) || (isOfflineProfile && aAutoUpdate)) 
   177 		{
   179 		{
   178 		DP("Cancelling update");
   180 		DP("Cancelling update");
   179 		iFeedClient->Stop();
   181 		iFeedClient->Stop();
   180 		iFeedsUpdating.Reset();
   182 		iFeedsUpdating.Reset();
   181 		return;
   183 		return;
   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);
   980 				feedInfo->SetImageFileNameL(imagefile, &iPodcastModel);
   988 				feedInfo->SetImageFileNameL(imagefile, &iPodcastModel);
   981 				}
   989 				}
   982 			
   990 			
   983 			const void *linkz = sqlite3_column_text16(st, 5);
   991 			const void *linkz = sqlite3_column_text16(st, 5);
   984 			TPtrC16 link((const TUint16*)linkz);
   992 			TPtrC16 link((const TUint16*)linkz);
   985 			feedInfo->SetDescriptionL(link);
   993 			feedInfo->SetLinkL(link);
   986 					
   994 					
   987 			sqlite3_int64 built = sqlite3_column_int64(st, 6);
   995 			sqlite3_int64 built = sqlite3_column_int64(st, 6);
   988 			TTime buildtime(built);
   996 			TTime buildtime(built);
   989 			feedInfo->SetBuildDate(buildtime);
   997 			feedInfo->SetBuildDate(buildtime);
   990 
   998 
  1054 			TPtrC16 image((const TUint16*)imagez);
  1062 			TPtrC16 image((const TUint16*)imagez);
  1055 			feedInfo->SetImageUrlL(image);
  1063 			feedInfo->SetImageUrlL(image);
  1056 
  1064 
  1057 			const void *imagefilez = sqlite3_column_text16(st, 4);
  1065 			const void *imagefilez = sqlite3_column_text16(st, 4);
  1058 			TPtrC16 imagefile((const TUint16*)imagefilez);
  1066 			TPtrC16 imagefile((const TUint16*)imagefilez);
  1059 			feedInfo->SetDescriptionL(imagefile);
  1067 			feedInfo->SetImageFileNameL(imagefile, &iPodcastModel);
  1060 			
  1068 			
  1061 			const void *linkz = sqlite3_column_text16(st, 5);
  1069 			const void *linkz = sqlite3_column_text16(st, 5);
  1062 			TPtrC16 link((const TUint16*)linkz);
  1070 			TPtrC16 link((const TUint16*)linkz);
  1063 			feedInfo->SetDescriptionL(link);
  1071 			feedInfo->SetLinkL(link);
  1064 					
  1072 					
  1065 			sqlite3_int64 built = sqlite3_column_int64(st, 6);
  1073 			sqlite3_int64 built = sqlite3_column_int64(st, 6);
  1066 			TTime buildtime(built);
  1074 			TTime buildtime(built);
  1067 			feedInfo->SetBuildDate(buildtime);
  1075 			feedInfo->SetBuildDate(buildtime);
  1068 
  1076