homescreenpluginsrv/hspsmanager/tools/hspsthemeinstallercons.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2004,2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "hspsthemeinstallercons.h"
       
    20 #include <e32svr.h>
       
    21 #include <flogger.h>
       
    22 #include <f32file.h>
       
    23 #include "hspsthememanagement.h"
       
    24 #include <e32base.h>
       
    25 #include <bacline.h>
       
    26 #include <bautils.h>
       
    27 
       
    28 #include "hspsodt.h"
       
    29 #include "hspsclient.h"
       
    30 
       
    31 _LIT(KDATFileExtension,".dat");
       
    32 _LIT(KLogFile,"hspsthemeinstallercons.log");
       
    33 _LIT(KLogFolder,"hspsthemeinstallercons");
       
    34 _LIT(KLogFilePath,"c:\\logs\\hspsthemeinstallercons\\hspsthemeinstallercons.log");
       
    35 _LIT(KThemeSourcePath,"c:\\data\\installs\\test\\");
       
    36 _LIT(KDefaultInput, "install.dat");
       
    37 
       
    38 #define _WRITELOG(aDescription) RFileLogger::Write( KLogFolder,KLogFile,EFileLoggingModeOverwrite,	aDescription );   
       
    39 #define _WRITE_ERRORLOG(aErrCode) WriteErrorLog(aErrCode);   
       
    40 
       
    41 
       
    42 
       
    43 class CThemeInstaller:public CBase, public MhspsThemeManagementServiceObserver
       
    44     {
       
    45     public:
       
    46     	~CThemeInstaller();
       
    47         static CThemeInstaller* NewL(TInt aAppUid);
       
    48         static CThemeInstaller* NewLC(TInt aAppUid);
       
    49         void StartL();
       
    50 	
       
    51 	private:
       
    52     	void InstallThemeL(const TDesC& aManifestFileName);
       
    53     	void InstallFilesL(CDesCArraySeg& aManifestFile);
       
    54     	void GetFilesL(RFs& aFs, CDesCArraySeg& aFileList, const TDesC& aDirectory);
       
    55         void DeleteDirL(RFs& aFs, const TDesC& aDir);
       
    56     	void HandlehspsClientMessage(ThspsServiceCompletedMessage aMessage);
       
    57         void ConstructL(TInt aAppUid);
       
    58         void GetDirectoriesL(
       
    59         		RFs& aFs,
       
    60         		TPtrC aPath,
       
    61         		TPtrC aPluginsFile,
       
    62         		CDesCArrayFlat& aDirectoryList );
       
    63         void InstallFilesFromL( 
       
    64         		RFs& aFs,        		
       
    65         		TPtrC aDirectory );
       
    66     private:
       
    67         TBuf8<KMaxHeaderDataLength8> iHeaderData;
       
    68         TRequestStatus iStatus;
       
    69         ChspsClient *ihspsClient;
       
    70         ChspsResult* iResult;
       
    71         TInt iConvertedResourceCount;
       
    72         ChspsODT* iHeader;
       
    73         TInt iListCount;
       
    74         CDesCArraySeg* iThemeList;
       
    75         TInt iAppUid;
       
    76     };
       
    77 
       
    78 CThemeInstaller* themeinstaller;
       
    79 CActiveScheduler* scheduler;
       
    80 
       
    81 
       
    82 
       
    83 
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // E32Main
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 GLDEF_C TInt E32Main() // main function called by E32
       
    90     {
       
    91 	CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
       
    92 	TRAPD( error, startupL() ); // more initialization, then do example
       
    93 	
       
    94 	delete scheduler;
       
    95 	delete themeinstaller;
       
    96 	delete cleanup; // destroy clean-up stack
       
    97 			
       
    98 	// Forward errors to be catched with ERRORLEVEL method in batch files
       
    99 	return error; // and return
       
   100     }
       
   101     
       
   102 // -----------------------------------------------------------------------------
       
   103 // WriteErrorLog
       
   104 // 
       
   105 // Writes error to log
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void WriteErrorLog(TInt error)
       
   109     {
       
   110     if (error == ENoFilesNotFound)
       
   111         {
       
   112          _WRITELOG( _L("ERROR::Theme files not found") ); 
       
   113         }
       
   114     else if (error == EErrorDeletingDir)
       
   115         {
       
   116          _WRITELOG( _L("ERROR::Could not delete themes") ); 
       
   117         }
       
   118     else if (error == EErrorDirNotExists)
       
   119         {
       
   120          _WRITELOG( _L("ERROR::Source directory does not exist") ); 
       
   121         }
       
   122     else
       
   123         {
       
   124          _WRITELOG( _L("ERROR::Unknown error") ); 
       
   125         }
       
   126     }
       
   127  
       
   128  
       
   129 // -----------------------------------------------------------------------------
       
   130 // startup
       
   131 // 
       
   132 // 
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 void startupL()
       
   136     {    
       
   137     TInt errorCode = KErrNone;   
       
   138      
       
   139     // Start active scheduler
       
   140     scheduler = new ( ELeave ) CActiveScheduler;
       
   141     CleanupStack::PushL( scheduler );
       
   142     CActiveScheduler::Install( scheduler );
       
   143 
       
   144     TUid appuid = KUidhspsThemeInstallerCons;
       
   145     themeinstaller = CThemeInstaller::NewL( appuid.iUid );
       
   146     CleanupStack::PushL( themeinstaller );
       
   147      
       
   148     TRAP( errorCode, themeinstaller->StartL() );
       
   149     
       
   150     _WRITELOG( _L("") );
       
   151     
       
   152     if( errorCode )
       
   153         {
       
   154 	    _WRITE_ERRORLOG( errorCode );
       
   155 	    _WRITELOG( _L("Failed to start an installation!") );    
       
   156 	    }
       
   157 
       
   158 		_WRITELOG( _L("Installer done") );
       
   159     
       
   160     CleanupStack::Pop( themeinstaller );
       
   161     CleanupStack::Pop( scheduler );
       
   162      
       
   163     User::LeaveIfError( errorCode );     
       
   164     }
       
   165     
       
   166 // -----------------------------------------------------------------------------
       
   167 // CThemeInstaller::NewL()
       
   168 // 
       
   169 // 
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 CThemeInstaller* CThemeInstaller::NewL( TInt aAppUid )
       
   173     {    
       
   174     CThemeInstaller* self = NewLC( aAppUid );
       
   175     CleanupStack::Pop( self );
       
   176     return( self );    
       
   177     }
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CThemeInstaller::NewLC()
       
   181 // 
       
   182 // 
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 CThemeInstaller* CThemeInstaller::NewLC( TInt aAppUid )
       
   186     {    
       
   187     CThemeInstaller* self = new ( ELeave ) CThemeInstaller();
       
   188     CleanupStack::PushL( self );
       
   189     self->ConstructL( aAppUid );
       
   190     return self;    
       
   191     }
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // CThemeInstaller::ConstructL()
       
   195 // 
       
   196 // 
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 void CThemeInstaller::ConstructL( TInt aAppUid )
       
   200     {
       
   201     iResult = ChspsResult::NewL();
       
   202   	ihspsClient = ChspsClient::NewL( *this );
       
   203   	iHeader = NULL;
       
   204   	iListCount = 0;
       
   205   	iConvertedResourceCount = 0;
       
   206   	iAppUid = aAppUid;
       
   207   	iThemeList = NULL;  	
       
   208     }
       
   209    
       
   210 // -----------------------------------------------------------------------------
       
   211 // CThemeInstaller::~CThemeInstaller()
       
   212 // 
       
   213 // 
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 CThemeInstaller:: ~CThemeInstaller()
       
   217     {    
       
   218     delete ihspsClient;
       
   219     delete iResult;
       
   220     delete iHeader;
       
   221     delete iThemeList;   
       
   222     }
       
   223      
       
   224 // -----------------------------------------------------------------------------
       
   225 // Gets program arguments and starts the installer
       
   226 // -----------------------------------------------------------------------------
       
   227 //
       
   228 void CThemeInstaller::StartL()
       
   229     {    
       
   230     // Init
       
   231     RFs fs;           
       
   232     User::LeaveIfError( fs.Connect() );
       
   233     CleanupClosePushL( fs );
       
   234     
       
   235     // Set logging
       
   236     fs.MkDirAll( KLogFilePath );
       
   237     _WRITELOG(_L("Starting installer"));
       
   238                        
       
   239     // Check arguments
       
   240     CCommandLineArguments* args = CCommandLineArguments::NewLC();
       
   241     TInt argsCount = args->Count();
       
   242     TPtrC inputFile;    
       
   243     const TInt firstArgIndex = 2;
       
   244     if ( argsCount < firstArgIndex )
       
   245         {
       
   246         _WRITELOG(_L("Missing an argument!"));
       
   247 //        User::LeaveIfError( KErrArgument );        
       
   248         inputFile.Set( KDefaultInput );
       
   249         }
       
   250     else
       
   251         {
       
   252         inputFile.Set( args->Arg(1) );        
       
   253         }
       
   254     
       
   255     // Setup an array for directory names
       
   256     const TInt KGranularity = 10;
       
   257     CDesCArrayFlat* directoryList = new ( ELeave ) CDesCArrayFlat( KGranularity );
       
   258     CleanupStack::PushL( directoryList );
       
   259             
       
   260     // Get directory names
       
   261     GetDirectoriesL( fs, KThemeSourcePath().Ptr(), inputFile, *directoryList );        
       
   262         
       
   263     // Install manifest files from the directories
       
   264 	TInt count = directoryList->MdcaCount();
       
   265 	for( TInt i=0; i<count; i++ )
       
   266 		{				
       
   267 		TPtrC dirPtr( directoryList->MdcaPoint(i) );		
       
   268 		InstallFilesFromL( fs, dirPtr );
       
   269 		}
       
   270 	    
       
   271     CleanupStack::PopAndDestroy( 3, &fs ); // directoryList, args, Fs   
       
   272     }
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 // Installs a new configuration from the provided manifest file.
       
   276 // -----------------------------------------------------------------------------
       
   277 //
       
   278 void CThemeInstaller::InstallFilesFromL( 
       
   279 		RFs& aFs,
       
   280 		TPtrC aDirectory )
       
   281 	{
       
   282 	TInt errorCode = EErrorDirNotExists;
       
   283 	
       
   284     // Check if the dir exists
       
   285     BaflUtils baf;
       
   286     if( baf.PathExists( aFs, aDirectory ) )
       
   287         {
       
   288         errorCode = KErrNone;
       
   289         
       
   290         // Setup an array for manifests (member variable)
       
   291         if ( iThemeList )
       
   292         	{
       
   293         	delete iThemeList;
       
   294         	iThemeList = NULL;
       
   295         	}
       
   296         iThemeList = new( ELeave ) CDesCArraySeg( KArrGranularity );        
       
   297                 
       
   298         // Get manifests located at the directory
       
   299         GetFilesL( aFs, *iThemeList, aDirectory );
       
   300         if( iThemeList->Count() > 0 )
       
   301             {
       
   302             // Install first manifest
       
   303        	    InstallThemeL( iThemeList->MdcaPoint( 0 ) );       	           	    
       
   304        	 
       
   305        	    // Handle asynch messages
       
   306        	    scheduler->Start();       	    
       
   307             }
       
   308         else
       
   309             {
       
   310             errorCode = ENoFilesNotFound;
       
   311             }                   
       
   312         }
       
   313                  
       
   314     User::LeaveIfError( errorCode );
       
   315     }
       
   316      
       
   317 // -----------------------------------------------------------------------------
       
   318 // Reads directory names from the input file and appends names into the provided array
       
   319 // -----------------------------------------------------------------------------
       
   320 //
       
   321 void CThemeInstaller::GetDirectoriesL(
       
   322 		RFs& aFs,
       
   323 		TPtrC aPath,
       
   324 		TPtrC aPluginsFile,
       
   325 		CDesCArrayFlat& aDirectoryList )
       
   326 	{			
       
   327 	TFileName directoryFile;
       
   328 	directoryFile.Copy( aPath );        
       
   329 	directoryFile.Append( aPluginsFile );
       
   330 	
       
   331 	// Convert into a 8-bit descriptor
       
   332 	_LIT8(KLogPrefix, "Reading directory names from the " );
       
   333 	_LIT8(KLogSuffix, " file.." );
       
   334 	const TInt lineLength = KLogPrefix().Length() + directoryFile.Length() + KLogSuffix().Length();
       
   335 	HBufC8* line = HBufC8::NewLC(lineLength );
       
   336 	TPtr8 linePtr( line->Des() );	
       
   337 	linePtr.Append( KLogPrefix ); 	
       
   338 	linePtr.Append( directoryFile );
       
   339 	linePtr.Append( KLogSuffix );	
       
   340 	_WRITELOG( linePtr );
       
   341 	CleanupStack::PopAndDestroy( line );
       
   342 	line = NULL;
       
   343 	
       
   344 	// Check if the f exists
       
   345     BaflUtils baf;
       
   346     if( !baf.FileExists( aFs, directoryFile ) )
       
   347     	{
       
   348     	_WRITELOG(_L("File not found!"));
       
   349     	User::LeaveIfError( KErrNotFound );
       
   350     	}
       
   351 		
       
   352 	// Open a file handle
       
   353 	RFile file;
       
   354 	User::LeaveIfError( file.Open(aFs, directoryFile, EFileRead|EFileShareReadersOnly) );
       
   355 	CleanupClosePushL(file);
       
   356 	
       
   357 	// Get size of the file
       
   358     TInt fileSize;
       
   359     User::LeaveIfError( file.Size(fileSize) );
       
   360         
       
   361     // Get file content
       
   362     HBufC8* buf8 = HBufC8::NewLC( fileSize );    
       
   363     TPtr8 ptr8( buf8->Des() );
       
   364     User::LeaveIfError( file.Read(ptr8) );
       
   365     
       
   366     // Convert from a 8bit to 16bit descriptor
       
   367     HBufC16* buf16 = HBufC16::NewLC( ptr8.MaxLength() );
       
   368     TPtr16 ptr16 = buf16->Des();
       
   369     ptr16.Copy( ptr8 );
       
   370            
       
   371     // Parse directories from the string    
       
   372     TInt offset = 0;
       
   373     _LIT(KLineSeperator, "\r\n");
       
   374     _LIT(KDirectorySuffix, "\\");
       
   375     do     
       
   376     	{
       
   377     	offset = ptr16.Find( KLineSeperator );
       
   378     	TPtrC ptr;
       
   379     	if ( offset < 1 )
       
   380     		{
       
   381     		ptr.Set( ptr16 );
       
   382     		}
       
   383     	else
       
   384     		{
       
   385     		ptr.Set( ptr16.Left( offset ) );
       
   386     		}    	
       
   387     	if ( ptr.Length() )
       
   388     		{
       
   389 	    	HBufC* nameBuf = HBufC::NewLC( aPath.Length() + ptr.Length() + KDirectorySuffix().Length() );
       
   390 	    	TPtr fullPtr( nameBuf->Des() );
       
   391 	    	fullPtr.Copy( aPath );
       
   392 	    	fullPtr.Append( ptr );
       
   393 	    	fullPtr.Append( KDirectorySuffix );
       
   394 	    	aDirectoryList.AppendL( fullPtr );
       
   395 	    	CleanupStack::PopAndDestroy( nameBuf );
       
   396     		}
       
   397     	if ( offset > 0 )
       
   398     		{
       
   399     		ptr16 = ptr16.Mid( offset + KLineSeperator().Length() );
       
   400     		}
       
   401     	}
       
   402     while ( offset > 0 );    
       
   403            
       
   404     // Cleanup
       
   405     CleanupStack::PopAndDestroy( buf16 ); 
       
   406     CleanupStack::PopAndDestroy( buf8 );
       
   407     CleanupStack::PopAndDestroy( ); // file              
       
   408 	}
       
   409 
       
   410 // -----------------------------------------------------------------------------
       
   411 // Deletes theme installation path
       
   412 // -----------------------------------------------------------------------------
       
   413 //
       
   414 void CThemeInstaller::DeleteDirL( RFs& aFs, const TDesC& aDir )
       
   415     {    
       
   416     _WRITELOG( _L("Deleting existing themes") );
       
   417     
       
   418     HBufC* path = HBufC::NewLC( KMaxFileName );
       
   419     TPtr pathPtr = path->Des();
       
   420     pathPtr.Append( aDir );
       
   421     
       
   422     CFileMan* fileMan = CFileMan::NewL( aFs );
       
   423     CleanupStack::PushL( fileMan );
       
   424     TInt err = fileMan->RmDir( pathPtr );
       
   425     
       
   426     CleanupStack::PopAndDestroy( fileMan );
       
   427     CleanupStack::PopAndDestroy( path );
       
   428     
       
   429     if( err )
       
   430         {
       
   431         _WRITE_ERRORLOG( EErrorDeletingDir );  
       
   432         }  
       
   433     }
       
   434 
       
   435 // -----------------------------------------------------------------------------
       
   436 // Searches for theme files from path and adds them to list
       
   437 // -----------------------------------------------------------------------------
       
   438 //
       
   439 void CThemeInstaller::GetFilesL( RFs& aFs, CDesCArraySeg& aFileList, const TDesC& aDirectory )
       
   440     {
       
   441     CDir* dirList;
       
   442     User::LeaveIfError( aFs.GetDir( aDirectory,
       
   443                        KEntryAttMaskSupported, ESortByDate, dirList ) );
       
   444                        
       
   445     CleanupStack::PushL( dirList );                   
       
   446                        
       
   447     for( TInt i = 0; i < dirList->Count(); i++ )
       
   448         {
       
   449         if ( !( *dirList )[i].IsDir() )
       
   450             {
       
   451             HBufC* path = HBufC::NewLC( aDirectory.Length() + ( *dirList )[i].iName.Length() );
       
   452             TPtr pathPtr = path->Des();
       
   453             pathPtr.Copy( aDirectory );
       
   454             TEntry  entry = ( *dirList )[i];
       
   455             pathPtr.Append( entry.iName );                
       
   456             TParse p;
       
   457             p.Set( pathPtr, NULL, NULL );
       
   458             
       
   459             if ( p.Ext().CompareF( KDATFileExtension ) == 0 )
       
   460               	{
       
   461                 aFileList.AppendL( pathPtr );
       
   462         	    }
       
   463             
       
   464             CleanupStack::PopAndDestroy( path );  
       
   465             }
       
   466         }
       
   467     
       
   468     CleanupStack::PopAndDestroy( dirList );
       
   469     }
       
   470     
       
   471 // -----------------------------------------------------------------------------
       
   472 // Initiates installing of a confgiruation from the provided manifest file
       
   473 // -----------------------------------------------------------------------------
       
   474 //
       
   475 void CThemeInstaller::InstallThemeL( const TDesC& aManifestFileName )
       
   476     {      	
       
   477     
       
   478     TBuf<KMaxHeaderDataLength8> tmp;
       
   479     _WRITELOG(_L(""));
       
   480     tmp.Format( _L("Manifest: %S"), &aManifestFileName );
       
   481 	_WRITELOG(tmp);
       
   482     
       
   483 	if ( iHeader )
       
   484 		{
       
   485 		delete iHeader;
       
   486 		iHeader = NULL;
       
   487 		}			
       
   488 	iHeader = ChspsODT::NewL();
       
   489     
       
   490 	TParse p;
       
   491     p.Set( aManifestFileName, NULL, NULL );
       
   492     TPtrC ptr = p.NameAndExt();
       
   493     
       
   494 	ThspsServiceCompletedMessage ret = ihspsClient->hspsInstallTheme( aManifestFileName, *iHeader );
       
   495 	
       
   496 	if( ret == EhspsInstallThemeSuccess )
       
   497 		{
       
   498 		ihspsClient->GethspsResult( *iResult );
       
   499  		}
       
   500 	else if( ret == EhspsInstallPhaseSuccess )
       
   501 		{
       
   502 		ihspsClient->GethspsResult( *iResult );
       
   503 		iConvertedResourceCount = 0;
       
   504 	
       
   505   		tmp.Format( _L("Installing ..") );
       
   506   		_WRITELOG(tmp);
       
   507 		ihspsClient->hspsInstallNextPhaseL( *iHeader );
       
   508 		}
       
   509 	else if( ret == EhspsInstallThemeFailed )
       
   510     	{
       
   511     	ihspsClient->GethspsResult(*iResult);
       
   512     	TBuf<KMaxHeaderDataLength8> tmp2; 
       
   513     	TInt syserr = iResult->iSystemError;
       
   514     	TInt hspserr = iResult->iXuikonError;
       
   515     	tmp.Format(_L("Installation of \'%S\' failed. System error: %d, HSPS error: %d."), &ptr, syserr, hspserr );
       
   516     	_WRITELOG(tmp);    	    	
       
   517     	User::Leave( KErrGeneral );
       
   518     	}
       
   519     else if( ret == EhspsServiceNotSupported )
       
   520     	{
       
   521     	_WRITELOG(_L("EhspsServiceNotSupported"));
       
   522     	}
       
   523     else if( ret == EhspsServiceRequestError )
       
   524     	{
       
   525     	_WRITELOG(_L("EhspsServiceRequestError"));
       
   526     	}
       
   527     else if( ret == EhspsServiceRequestCanceled )
       
   528     	{
       
   529     	_WRITELOG(_L("EhspsServiceRequestCanceled"));
       
   530     	}
       
   531     else
       
   532     	{
       
   533     	tmp.Format(_L("Undefined response: %d"), ret); 
       
   534     	_WRITELOG(tmp);
       
   535     	}         
       
   536     } 
       
   537 
       
   538 // -----------------------------------------------------------------------------
       
   539 // CThemeInstaller::HandlehspsClientMessage()
       
   540 // 
       
   541 // Handles events received from themeserver via hspsClient
       
   542 // -----------------------------------------------------------------------------
       
   543 
       
   544 void CThemeInstaller::HandlehspsClientMessage(ThspsServiceCompletedMessage aEvent)
       
   545 	{
       
   546     TInt errorCode = KErrNone;
       
   547 	
       
   548 	TBuf<KMaxHeaderDataLength8> tmp;
       
   549 	ihspsClient->GethspsResult(*iResult);
       
   550     
       
   551     if( aEvent == EhspsInstallThemeSuccess )
       
   552 		{
       
   553    		iListCount++;
       
   554 
       
   555    		if ( iListCount < iThemeList->MdcaCount() )
       
   556 			{
       
   557 			TRAP( errorCode, InstallThemeL( iThemeList->MdcaPoint( iListCount ) ) );
       
   558 
       
   559 			if( errorCode )
       
   560 				{
       
   561 				tmp.Format( _L("InstallThemeL() failed...") );
       
   562 				_WRITELOG( tmp );
       
   563 				}
       
   564 			}
       
   565 		else
       
   566 		    {
       
   567             scheduler->Stop();
       
   568 		    }
       
   569    		}   
       
   570 	else if( aEvent == EhspsInstallPhaseSuccess )
       
   571 	    {
       
   572 	    
       
   573 		TBuf<KMaxHeaderDataLength8> tmp;
       
   574 		
       
   575 		if( iResult->iIntValue1 == EhspsPhaseCleanup )
       
   576 			{
       
   577 			tmp.Format(_L("Removing previous configuration .."));
       
   578 			}
       
   579 		else if( iResult->iIntValue1 == EhspsPhaseInstallSkeleton )
       
   580 			{
       
   581 			tmp.Format(_L("Installing a new configuration .."));
       
   582 			}		
       
   583 		else
       
   584 			{
       
   585 			tmp.Format(_L("Processing phase %d .."), iResult->iIntValue1 );
       
   586 			}
       
   587 			
       
   588 		_WRITELOG(tmp);
       
   589  		
       
   590  		} 
       
   591  	else if( aEvent == EhspsInstallThemeFailed )
       
   592 		{
       
   593 
       
   594     	TBuf<KMaxHeaderDataLength8> tmp2; 
       
   595     	TInt syserr = iResult->iSystemError;
       
   596     	TInt hspserr = iResult->iXuikonError;
       
   597     	TInt defengerr = iResult->iIntValue1;
       
   598     	TInt subcomperr = iResult->iIntValue2;
       
   599  		  tmp.Format(_L("Installation of /'%S/' failed. Sys.err: %d, hsps.err: %d, Def.eng.err: %d, subcomp.err: %d."), 
       
   600  		              &iHeader->ThemeFullName(), syserr, hspserr, defengerr, subcomperr );
       
   601  		  _WRITELOG(tmp); 		   
       
   602       scheduler->Stop();          	
       
   603    		}
       
   604   else
       
   605     	{      
       
   606       tmp.Format(_L("Unknown event received: %d"), aEvent );
       
   607 	     _WRITELOG(tmp);
       
   608 	    }
       
   609 	}
       
   610