homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp
branchRCL_3
changeset 9 d0529222e3f0
parent 2 b7904b40483f
child 19 502e5d91ad42
equal deleted inserted replaced
4:1a2a00e78665 9:d0529222e3f0
  1737     if ( !iMultiInstanceFound )
  1737     if ( !iMultiInstanceFound )
  1738         {
  1738         {
  1739         iMultiInstance = KMultiInstanceDefaultValue;
  1739         iMultiInstance = KMultiInstanceDefaultValue;
  1740         }
  1740         }
  1741     }
  1741     }
  1742 
  1742  
       
  1743  // -----------------------------------------------------------------------------
       
  1744  // ChspsInstallationHandler::FindFile
       
  1745  // Eclipsing support for customization 
       
  1746  // -----------------------------------------------------------------------------
       
  1747  //
       
  1748  void ChspsInstallationHandler::FindFile(
       
  1749          const TDesC& aPath,
       
  1750          const TDesC& aFilename,         
       
  1751          TFileName& aDrivePathName )
       
  1752      {                   
       
  1753      TParsePtrC parser( aPath );
       
  1754      const TPath path = parser.Path();              
       
  1755                
       
  1756      // Find the input file, search from the user area (UDA) first, 
       
  1757      // exclude external/remote drives from the search - otherwise end-users  
       
  1758      // could introduce fixed configurations (e.g. operator locks wouldn't work)
       
  1759      TFindFile fileFinder( iFsSession );
       
  1760      fileFinder.SetFindMask( 
       
  1761          KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
       
  1762      iFsSession.SetSessionToPrivate( EDriveZ );
       
  1763      TInt err = fileFinder.FindByDir( aFilename, path );
       
  1764      iFsSession.SetSessionToPrivate( EDriveC );
       
  1765      if( !err )          
       
  1766          {         
       
  1767          // Return the path with a drive reference 
       
  1768          aDrivePathName = fileFinder.File();        
       
  1769          TParsePtrC drvParser( aDrivePathName );
       
  1770          if( !drvParser.DrivePresent() )
       
  1771              {             
       
  1772              err = KErrNotFound;
       
  1773              }
       
  1774          }
       
  1775      
       
  1776      if( err )
       
  1777          {
       
  1778          // Not found from C nor Z drives
       
  1779 #ifdef HSPS_LOG_ACTIVE  
       
  1780          if( iLogBus )
       
  1781              {
       
  1782              iLogBus->LogText( 
       
  1783                      _L( "ChspsInstallationHandler::FindFile(): - couldnt' find file '%S'" ),
       
  1784                      &aDrivePathName );
       
  1785              }
       
  1786     #endif
       
  1787          }
       
  1788      }
       
  1789  
  1743 // -----------------------------------------------------------------------------
  1790 // -----------------------------------------------------------------------------
  1744 // Parsing of the manifest elements.
  1791 // Parsing of the manifest elements.
  1745 // -----------------------------------------------------------------------------
  1792 // -----------------------------------------------------------------------------
  1746 //
  1793 //
  1747 void ChspsInstallationHandler::OnEndElementL( const RTagInfo& aElement, TInt /*aErrorCode*/ )
  1794 void ChspsInstallationHandler::OnEndElementL( const RTagInfo& aElement, TInt /*aErrorCode*/ )
  1932                 }            
  1979                 }            
  1933             }
  1980             }
  1934         }
  1981         }
  1935     else if ( localName == KFileXML )
  1982     else if ( localName == KFileXML )
  1936         {
  1983         {
  1937         delete iXmlFile;
  1984         if( iContent )
  1938         iXmlFile = NULL;
  1985             {
  1939         iXmlFile = HBufC::NewL( KMaxFileName );
  1986             // Convert from 8 to 16bit string
  1940         TPtr fileDes( iXmlFile->Des() );
  1987             HBufC* nameBuf = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *iContent );                        
  1941     
  1988             // Find full path to the file 
  1942         fileDes.Copy( iThemeFilePath );
  1989             TFileName fullName;
  1943         HBufC* data = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *iContent );
  1990             FindFile( 
  1944         fileDes.Append( *data );
  1991                 iThemeFilePath, 
  1945         delete data;
  1992                 nameBuf->Des(),
  1946         
  1993                 fullName );
  1947         if( !BaflUtils::FileExists( iFsSession, fileDes ) )
  1994             delete nameBuf;
  1948             {
  1995             nameBuf = NULL;
  1949 #ifdef HSPS_LOG_ACTIVE  
  1996             if( !fullName.Length() )
  1950             if( iLogBus )
  1997                 {
  1951                 {
  1998                 iFileNotFound = ETrue;
  1952                 iLogBus->LogText( _L( "ChspsInstallationHandler::OnEndElementL(): - XML file does not exist '%S'" ),
  1999                 iResult->iXuikonError = KErrXmlFileNotFound;
  1953                         &fileDes );
  2000                 User::Leave( KErrNotFound );
  1954                 }
  2001                 }
  1955 #endif    
  2002             delete iXmlFile;
  1956             
  2003             iXmlFile = NULL;
  1957             iFileNotFound = ETrue;
  2004             iXmlFile = fullName.AllocL();
  1958             iResult->iXuikonError = KErrXmlFileNotFound;
       
  1959             }
  2005             }
  1960         }
  2006         }
  1961     else if ( localName == KFileDTD )
  2007     else if ( localName == KFileDTD )
  1962         {
  2008         {
  1963         // Parse name of the DTD files
  2009         // Parse name of the DTD files