browserutilities/webutils/src/CUserAgent.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
    13 *
    13 *
    14 * Description:  Implementation of class CUserAgent.
    14 * Description:  Implementation of class CUserAgent.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 // INCLUDE FILES
    18 // INCLUDE FILES
    20 #include <e32std.h>
    19 #include <e32std.h>
    21 #include <f32file.h>
    20 #include <f32file.h>
    22 #include <eikenv.h>
    21 #include <eikenv.h>
    23 
    22 
    24 #include <Browser_platform_variant.hrh>
    23 #include <browser_platform_variant.hrh>
    25 #include "WebUtilsCommon.h"
    24 #include "webUtilsCommon.h"
    26 #include "CUserAgent.h"
    25 #include <cuseragent.h>
    27 #include "WebUtilsLogger.h"
    26 #include "WebUtilsLogger.h"
    28 
    27 
    29 #include "WebUtilsInternalCRKeys.h"
    28 #include <webutilsinternalcrkeys.h>
    30 
       
    31 
    29 
    32 #define KPlaceHolderMozillaVer		_L("Mozilla/5.0")
    30 #define KPlaceHolderMozillaVer		_L("Mozilla/5.0")
    33 #define KPlaceHolderComponent		_L("AppleWebKit/525 (KHTML, like Gecko) Version/3.0")
    31 #define KPlaceHolderComponent		_L("AppleWebKit/525 (KHTML, like Gecko) Version/3.0")
    34 #define KPlaceHolderBrowserName		_L("BrowserNG")
    32 #define KPlaceHolderBrowserName		_L("BrowserNG")
    35 
    33 
   690 {
   688 {
   691 
   689 
   692     TInt ret(0);
   690     TInt ret(0);
   693     TBuf<64> BrowserVersionMajor(0);
   691     TBuf<64> BrowserVersionMajor(0);
   694     TBuf<64> BrowserVersionMinor(0);
   692     TBuf<64> BrowserVersionMinor(0);
   695     TBuf<64> BrowserVersionSVNRev(0);
   693     TBuf<64> BrowserVersionFeatureRev(0);
       
   694     TBuf<64> BrowserVersionPatchRev(0);
   696     
   695     
   697 	iBrowserVersionStr = HBufC::NewL(KMaxBrowserVersionStringLength);
   696 	iBrowserVersionStr = HBufC::NewL(KMaxBrowserVersionStringLength);
   698 	
   697 	
   699 	TPtr BrowserVersionPtr = iBrowserVersionStr->Des();
   698 	TPtr BrowserVersionPtr = iBrowserVersionStr->Des();
   700 
   699 
   701    
   700    
   702     ret = iRepository->Get(KWebUtilsBrowserVersionMajor, BrowserVersionMajor);
   701     ret = iRepository->Get(KWebUtilsBrowserVersionMajor, BrowserVersionMajor);
   703     if(ret == KErrNone)
   702     if(ret == KErrNone)
   704     	{   
   703       {   
   705 	    ret = iRepository->Get(KWebUtilsBrowserVersionMinor, BrowserVersionMinor);
   704         ret = iRepository->Get(KWebUtilsBrowserVersionMinor, BrowserVersionMinor);
   706 	    if(ret == KErrNone)
   705         if(ret == KErrNone)
   707 	    	{
   706          {
   708 			    ret = iRepository->Get(KWebUtilsBrowserVersionSVNRev, BrowserVersionSVNRev);
   707           ret = iRepository->Get(KWebUtilsBrowserVersionFeatureRev, BrowserVersionFeatureRev);
   709 			    if(ret == KErrNone)
   708           if(ret == KErrNone)
   710 			    {
   709             {
   711 			   	BrowserVersionPtr.Append(BrowserVersionMajor);
   710              ret = iRepository->Get(KWebUtilsBrowserVersionPatchRev, BrowserVersionPatchRev);
   712     			BrowserVersionPtr.Append(KPlaceHolderPeriod);    
   711              if(ret == KErrNone)
   713     	       	BrowserVersionPtr.Append(BrowserVersionMinor);  	
   712                {
   714     			BrowserVersionPtr.Append(KPlaceHolderPeriod);  
   713                 BrowserVersionPtr.Append(BrowserVersionMajor);
   715     	    	BrowserVersionPtr.Append(BrowserVersionSVNRev); 	;	   		
   714                 BrowserVersionPtr.Append(KPlaceHolderPeriod);    
   716 			    }
   715                 BrowserVersionPtr.Append(BrowserVersionMinor);  	
   717 	    	}
   716                 BrowserVersionPtr.Append(KPlaceHolderPeriod);  
   718 	    }
   717                 BrowserVersionPtr.Append(BrowserVersionFeatureRev);
       
   718                 //Incase of Feature releases we do not show Patch number.
       
   719                 //Therefore, if the patch version is 0 or empty then we do not show the content
       
   720                 if( (BrowserVersionPatchRev.CompareF(_L("0")) == 0)
       
   721                     || (BrowserVersionPatchRev.CompareF(KNullDesC) == 0))
       
   722                  {
       
   723                   //Do Nothing 
       
   724                  }
       
   725                  else
       
   726                  {
       
   727                   BrowserVersionPtr.Append(KPlaceHolderPeriod);  
       
   728                   BrowserVersionPtr.Append(BrowserVersionPatchRev);
       
   729                  }
       
   730                 }	   		
       
   731               }
       
   732             }
       
   733            }
   719 	    
   734 	    
   720 	if(ret != KErrNone)
   735 	if(ret != KErrNone)
   721 	{		
   736 	{		
   722 		LOG_WRITE("Error: Reading default Browser Version from cenrep failed!");
   737 		LOG_WRITE("Error: Reading default Browser Version from cenrep failed!");
   723 		LOG_LEAVEFN("CUserAgent::BrowserVersion()");
   738 		LOG_LEAVEFN("CUserAgent::BrowserVersion()");