homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp
branchRCL_3
changeset 27 2c7f27287390
parent 25 9e077f9a342c
equal deleted inserted replaced
25:9e077f9a342c 27:2c7f27287390
   161 // -----------------------------------------------------------------------------
   161 // -----------------------------------------------------------------------------
   162 // Destructor
   162 // Destructor
   163 // -----------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   164 //
   164 //
   165 ChspsInstallationHandler::~ChspsInstallationHandler()
   165 ChspsInstallationHandler::~ChspsInstallationHandler()
   166     {        
   166     {
   167     iFsSession.Close();
       
   168     delete iXmlParser;
   167     delete iXmlParser;
   169     delete iOdt;
   168     delete iOdt;
   170     delete iDtdFile;
   169     delete iDtdFile;
   171     delete iHeaderData;
   170     delete iHeaderData;
   172     delete iThemeFullName;
   171     delete iThemeFullName;
   194     if ( iDefEngine )
   193     if ( iDefEngine )
   195         {
   194         {
   196         delete iDefEngine;
   195         delete iDefEngine;
   197         }
   196         }
   198 
   197 
   199     REComSession::FinalClose(); 
   198     iFsSession.Close();
   200 
   199     REComSession::FinalClose();
   201     }
   200     }
   202     
   201     
   203     
   202     
   204     
   203     
   205     
   204     
   208 // Symbian 2nd phase constructor can leave.
   207 // Symbian 2nd phase constructor can leave.
   209 // -----------------------------------------------------------------------------
   208 // -----------------------------------------------------------------------------
   210 //
   209 //
   211 void ChspsInstallationHandler::ConstructL()
   210 void ChspsInstallationHandler::ConstructL()
   212     {
   211     {
       
   212     User::LeaveIfError( iFsSession.Connect() );
       
   213 
   213     _LIT8(KMimeType, "text/xml");
   214     _LIT8(KMimeType, "text/xml");
   214     MContentHandler* contentHandler = this;
   215     MContentHandler* contentHandler = this;
   215     iXmlParser = Xml::CParser::NewL( KMimeType, *contentHandler );
   216     iXmlParser = Xml::CParser::NewL( KMimeType, *contentHandler );
   216     
   217     
   217      iDefEngine = ChspsDefinitionEngineInterface::NewL(KhspsDefinitionEngine);
   218      iDefEngine = ChspsDefinitionEngineInterface::NewL(KhspsDefinitionEngine);
   218          
   219          
   219     iOdt = ChspsODT::NewL();
   220     iOdt = ChspsODT::NewL();
   220     iResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity ); 
   221     iResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity ); 
   221     iTempLocalizedResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity );
   222     iTempLocalizedResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity );
   222     User::LeaveIfError( iFsSession.Connect() );    
   223     
   223     iResult = ChspsResult::NewL();
   224     iResult = ChspsResult::NewL();
   224      
   225     iXmlFile = KNullDesC().AllocL();
   225     iMultiInstanceFound = EFalse;
   226     
   226     
   227     iMultiInstanceFound = EFalse;    
   227     }
   228     }
   228 
   229 
   229 // -----------------------------------------------------------------------------
   230 // -----------------------------------------------------------------------------
   230 // ChspsInstallationHandler::ServiceInstallThemeL
   231 // ChspsInstallationHandler::ServiceInstallThemeL
   231 // Starts the actual installation in ChspsInstallationHandler.
   232 // Starts the actual installation in ChspsInstallationHandler.
   953     CleanupStack::PopAndDestroy( themeShortName );
   954     CleanupStack::PopAndDestroy( themeShortName );
   954     CleanupStack::PopAndDestroy( themeFullName );
   955     CleanupStack::PopAndDestroy( themeFullName );
   955     
   956     
   956     iOdt->SetConfigurationType( iConfigurationType );
   957     iOdt->SetConfigurationType( iConfigurationType );
   957     iOdt->SetFlags( iThemeStatus );   
   958     iOdt->SetFlags( iThemeStatus );   
   958 
   959     
       
   960     // Check that there is only one restorable application configuration 
       
   961     // for a client in a device family     
       
   962     if( iOdt->Flags() & EhspsThemeStatusLicenceeRestorable
       
   963         && iConfigurationType == EhspsAppConfiguration )
       
   964         {               
       
   965         ChspsODT* searchMask = ChspsODT::NewL();
       
   966         CleanupStack::PushL( searchMask );                
       
   967         searchMask->SetRootUid( iOdt->RootUid() );        
       
   968         searchMask->SetFlags( EhspsThemeStatusLicenceeRestorable );
       
   969         
       
   970         TInt pos( 0 );
       
   971         ChspsODT* header = NULL;
       
   972         iThemeServer.GetConfigurationHeader( *searchMask, header, pos );
       
   973         while( header )
       
   974             {
       
   975             // If another plugin has already been installed with the restorable status 
       
   976             if( header->Family() & iOdt->Family() 
       
   977                     && header->ThemeUid() != iOdt->ThemeUid() )
       
   978                 {
       
   979                 // Unset the restorable bit
       
   980                 TUint flags = iOdt->Flags();                
       
   981                 flags &= ~EhspsThemeStatusLicenceeRestorable;
       
   982                 iOdt->SetFlags( flags );
       
   983 #ifdef HSPS_LOG_ACTIVE  
       
   984                 if( iLogBus )
       
   985                     {
       
   986                     iLogBus->LogText( _L( "ChspsInstallationHandler::CheckHeaderL(): - too many restorable plugins were found!" ) );
       
   987                     }
       
   988 #endif                
       
   989                 break;
       
   990                 }
       
   991             
       
   992             // Get next application configuration header
       
   993             pos++;
       
   994             iThemeServer.GetConfigurationHeader( *searchMask, header, pos );
       
   995             }
       
   996         
       
   997         header = NULL;
       
   998         CleanupStack::PopAndDestroy();
       
   999         }
       
  1000     
   959     // If configuration file is missing
  1001     // If configuration file is missing
   960     if( !iXmlFile ) 
  1002     if( !iXmlFile ) 
   961         {
  1003         {
   962 #ifdef HSPS_LOG_ACTIVE  
  1004 #ifdef HSPS_LOG_ACTIVE  
   963         if( iLogBus )
  1005         if( iLogBus )