browserui/browser/FavouritesSrc/BrowserFaviconHandler.cpp
branchRCL_3
changeset 60 b149f0820e5a
parent 31 868cceedabd3
equal deleted inserted replaced
58:aead3f7e1bb0 60:b149f0820e5a
   119 	// Construct Favicon Engine
   119 	// Construct Favicon Engine
   120 	iBmpScaler = CBrowserFaviconScaler::NewL(*this);
   120 	iBmpScaler = CBrowserFaviconScaler::NewL(*this);
   121 	}
   121 	}
   122 
   122 
   123 // ----------------------------------------------------------------------------
   123 // ----------------------------------------------------------------------------
       
   124 // CBrowserFaviconHandler::RequestFavicons()
       
   125 // ----------------------------------------------------------------------------
       
   126 //      
       
   127 void CBrowserFaviconHandler::RequestFavicons( CFavouritesItemList* aFavItems )
       
   128     {
       
   129     TInt count = aFavItems->Count();
       
   130     while(count)
       
   131         {            
       
   132             CFavouritesItem& item = *aFavItems->At( count - 1); // index starts from 0
       
   133             CGulIcon *favIcon = NULL;           
       
   134                         
       
   135             // Request Favicon from Engine  - there should be new API for request, but no har to use it
       
   136             if ( item.Url().Length() )
       
   137                 iFavicon = iApiProvider.BrCtlInterface().GetBitmapData(item.Url(), TBrCtlDefs::EBitmapFavicon );
       
   138 
       
   139             if ( favIcon )
       
   140                 {                
       
   141                 delete iFavicon;
       
   142                 iFavicon = NULL;
       
   143                 }
       
   144             count--;
       
   145         }
       
   146     }
       
   147 
       
   148 // ----------------------------------------------------------------------------
   124 // CBrowserFaviconHandler::StartGetFaviconsL()
   149 // CBrowserFaviconHandler::StartGetFaviconsL()
   125 // ----------------------------------------------------------------------------
   150 // ----------------------------------------------------------------------------
   126 //		
   151 //		
   127 void CBrowserFaviconHandler::StartGetFaviconsL( CFavouritesItemList* aFavItems )
   152 void CBrowserFaviconHandler::StartGetFaviconsL( CFavouritesItemList* aFavItems )
   128 	{
   153 	{
   160 	    // Step through the item array until we find a favicon, or reach the end
   185 	    // Step through the item array until we find a favicon, or reach the end
   161 		do
   186 		do
   162 			{
   187 			{
   163 			iWasLastItemFavicon = EFalse;
   188 			iWasLastItemFavicon = EFalse;
   164 			
   189 			
   165 			CFavouritesItem& item = *iFavItems->At( iFavItemsCurrentIndex );
   190 			CFavouritesItem& item = *iFavItems->At( iFavItemsCurrentIndex );			
   166 			HBufC* url = HBufC::NewLC( item.Url().Length() );
       
   167 			url->Des().Copy( item.Url() );
       
   168 			
       
   169 			if ( iFavicon )
   191 			if ( iFavicon )
   170 				{
   192 				{
   171 				// Make sure ongoing scaling is cancelled (if any)
   193 				// Make sure ongoing scaling is cancelled (if any)
   172 				Cancel();
   194 				Cancel();
   173 				iBmpScaler->Cancel();
   195 				iBmpScaler->Cancel();
   177 				}
   199 				}
   178 						
   200 						
   179 			// Get Favicon from Engine
   201 			// Get Favicon from Engine
   180 			if ( item.Url().Length() )
   202 			if ( item.Url().Length() )
   181 				{
   203 				{
   182 				iFavicon = iApiProvider.BrCtlInterface().GetBitmapData( 
   204 				iFavicon = iApiProvider.BrCtlInterface().GetBitmapData(item.Url(), TBrCtlDefs::EBitmapFavicon );
   183 										*url, TBrCtlDefs::EBitmapFavicon );
       
   184 				}
   205 				}
   185             CleanupStack::PopAndDestroy();//url
   206 
   186 			// Asynchronously scales the favicon and stores it in an array
   207 			// Asynchronously scales the favicon and stores it in an array
   187 			if ( iFavicon )
   208 			if ( iFavicon )
   188 				{
   209 				{
   189 				iWasLastItemFavicon = ETrue;	
   210 				iWasLastItemFavicon = ETrue;	
   190 				RescaleFaviconL();
   211 				RescaleFaviconL();