355 ThspsServiceCompletedMessage ChspsInstallationHandler::hspsInstallTheme( |
358 ThspsServiceCompletedMessage ChspsInstallationHandler::hspsInstallTheme( |
356 const TDesC& aManifestFileName, |
359 const TDesC& aManifestFileName, |
357 TDes8& aHeaderData) |
360 TDes8& aHeaderData) |
358 { |
361 { |
359 // Assume that the installation fails |
362 // Assume that the installation fails |
360 ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed; |
363 ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed; |
361 iResult->iXuikonError = KErrManifestFileCorrupted; |
364 iResult->iXuikonError = 0; |
362 |
365 iResult->iIntValue2 = 0; |
363 // Reset memeber variables |
366 |
364 TInt errorCode = KErrNone; |
367 TRAPD( err, DoInstallThemeL(aManifestFileName) ); |
365 TRAP( errorCode, ResetL() ); |
368 if( !err ) |
366 if ( !errorCode ) |
369 { |
367 { |
370 // correct headerdata is in iHeaderData set by CheckHeaderL() |
368 // Get manifest file path |
371 aHeaderData = iHeaderData->Des(); |
369 iThemeFilePath.Set( TParsePtrC( aManifestFileName ).DriveAndPath() ); |
372 |
370 // Check if ROM installation is requested |
373 // Set next phase |
371 iRomInstallation = EFalse; |
374 iInstallationPhase = EhspsPhaseCleanup; |
372 TParse driveParser; |
375 ret = EhspsInstallThemeSuccess; |
373 driveParser.Set( iThemeFilePath, NULL, NULL ); |
376 } |
374 TInt driveNumber; |
377 else |
375 if ( RFs::CharToDrive( driveParser.Drive()[0], driveNumber ) == KErrNone ) |
|
376 { |
|
377 if ( driveNumber == EDriveZ ) |
|
378 { |
|
379 iRomInstallation = ETrue; |
|
380 } |
|
381 } |
|
382 |
|
383 #ifdef HSPS_LOG_ACTIVE |
|
384 if ( iLogBus ) |
|
385 { |
|
386 iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme() - *** Parsing a manifest file:" ) ); |
|
387 } |
|
388 #endif |
|
389 if( BaflUtils::FileExists( iFsSession, aManifestFileName ) ) |
|
390 { |
|
391 // Parse XML from the manifest file |
|
392 TRAP( errorCode, Xml::ParseL( *iXmlParser, iFsSession, aManifestFileName )); |
|
393 } |
|
394 else |
|
395 { |
|
396 #ifdef HSPS_LOG_ACTIVE |
|
397 if ( iLogBus ) |
|
398 { |
|
399 iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme() - Manifest was not found!" ) ); |
|
400 } |
|
401 #endif |
|
402 iFileNotFound = ETrue; |
|
403 errorCode = KErrNotFound; |
|
404 } |
|
405 } |
|
406 |
|
407 if ( !errorCode && !iFileNotFound ) |
|
408 { |
|
409 // The manifest file has been read at this point and following callbacks have been executed: |
|
410 // (unless the manifest was invalid): OnContent, OnStartElement, OnEndElement |
|
411 |
|
412 // Detect installation type. |
|
413 // Performance optimization: do not check if installing from rom. |
|
414 if( !iRomInstallation ) |
|
415 { |
|
416 // Check type of installation |
|
417 TBool instancesFound = EFalse; |
|
418 TRAP( errorCode, instancesFound = IsPluginUsedInAppConfsL() ); |
|
419 if( iThemeServer.PluginInHeaderCache( TUid::Uid( iThemeUid ) ) && instancesFound ) |
|
420 { |
|
421 // Plugin should be found from cache, update notifications are |
|
422 // sent only when plugins are used by one/more app configurations |
|
423 iInstallationType = EInstallationTypeUpdate; |
|
424 } |
|
425 else |
|
426 { |
|
427 iInstallationType = EInstallationTypeNew; |
|
428 } |
|
429 } |
|
430 if ( !errorCode ) |
|
431 { |
|
432 // Check the manifest |
|
433 TRAP( errorCode, ValidateL() ); |
|
434 } |
|
435 if ( !errorCode ) |
|
436 { |
|
437 // correct headerdata is in iHeaderData set by CheckHeaderL() |
|
438 aHeaderData = iHeaderData->Des(); |
|
439 |
|
440 ret = EhspsInstallThemeSuccess; |
|
441 |
|
442 // Set next phase |
|
443 iInstallationPhase = EhspsPhaseCleanup; |
|
444 |
|
445 // number of all resources to iResult |
|
446 iResult->iIntValue2 = 0; |
|
447 } |
|
448 } |
|
449 |
|
450 if ( errorCode ) |
|
451 { |
378 { |
452 #ifdef HSPS_LOG_ACTIVE |
379 #ifdef HSPS_LOG_ACTIVE |
453 if( iLogBus ) |
380 if( iLogBus ) |
454 { |
381 { |
455 iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme(): - Installation failed with error code %d" ), |
382 iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme(): - Installation failed with error code %d" ), |
456 errorCode ); |
383 errorCode ); |
457 } |
384 } |
458 #endif |
385 #endif |
459 } |
386 } |
460 |
387 |
461 iResult->iSystemError = errorCode; |
388 iResult->iSystemError = err; |
462 return ret; |
389 return ret; |
|
390 } |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // ChspsInstallationHandler::DoInstallThemeL() |
|
394 // ----------------------------------------------------------------------------- |
|
395 void ChspsInstallationHandler::DoInstallThemeL( |
|
396 const TDesC& aManifest ) |
|
397 { |
|
398 // Reset memeber variables |
|
399 ResetL(); |
|
400 |
|
401 TParsePtrC parsePtr( aManifest ); |
|
402 |
|
403 // Store the path to the installation file |
|
404 __ASSERT_DEBUG( aManifest.Length() < KMaxFileName, User::Leave( KErrBadName ) ); |
|
405 iThemeFilePath.Copy( parsePtr.DriveAndPath() ); |
|
406 |
|
407 // If trying to install widgets from one of our private install directories |
|
408 const TPath path = parsePtr.Path(); |
|
409 if( path.Length() > KPrivateInstall().Length() |
|
410 && path.Left( KPrivateInstall().Length() ) == KPrivateInstall() ) |
|
411 { |
|
412 // Check if ROM or UDA installation was requested |
|
413 if( parsePtr.DrivePresent() ) |
|
414 { |
|
415 TInt driveNumber; |
|
416 if ( RFs::CharToDrive( parsePtr.Drive()[0], driveNumber ) == KErrNone ) |
|
417 { |
|
418 iTrustedInstallation = ( driveNumber == EDriveZ || driveNumber == EDriveC ); |
|
419 } |
|
420 } |
|
421 } |
|
422 |
|
423 if( !BaflUtils::FileExists( iFsSession, aManifest ) ) |
|
424 { |
|
425 #ifdef HSPS_LOG_ACTIVE |
|
426 if ( iLogBus ) |
|
427 { |
|
428 iLogBus->LogText( _L( "ChspsInstallationHandler::DoInstallThemeL() - *** Manifest was not found!" ) ); |
|
429 } |
|
430 #endif |
|
431 User::Leave( KErrNotFound ); |
|
432 } |
|
433 |
|
434 #ifdef HSPS_LOG_ACTIVE |
|
435 if ( iLogBus ) |
|
436 { |
|
437 iLogBus->LogText( _L( "ChspsInstallationHandler::DoInstallThemeL() - *** Parsing a manifest file" ) ); |
|
438 } |
|
439 #endif |
|
440 |
|
441 // Parse XML from the manifest file |
|
442 Xml::ParseL( *iXmlParser, iFsSession, aManifest ); |
|
443 |
|
444 // The manifest file has been read at this point and following callbacks have been executed: |
|
445 // OnContent(), OnStartElement() and OnEndElement() |
|
446 |
|
447 // Performance optimization: do not check if installing from rom. |
|
448 if( !iTrustedInstallation ) |
|
449 { |
|
450 // Check type of installation |
|
451 TBool instancesFound = IsPluginUsedInAppConfsL(); |
|
452 if( iThemeServer.PluginInHeaderCache( TUid::Uid( iThemeUid ) ) && instancesFound ) |
|
453 { |
|
454 // Plugin should be found from cache, update notifications are |
|
455 // sent only when plugins are used by one/more app configurations |
|
456 iInstallationType = EInstallationTypeUpdate; |
|
457 } |
|
458 else |
|
459 { |
|
460 iInstallationType = EInstallationTypeNew; |
|
461 } |
|
462 } |
|
463 |
|
464 // Check the parsed input |
|
465 ValidateL(); |
463 } |
466 } |
464 |
467 |
465 // ----------------------------------------------------------------------------- |
468 // ----------------------------------------------------------------------------- |
466 // ChspsInstallationHandler::GetInterfacePath() |
469 // ChspsInstallationHandler::GetInterfacePath() |
467 // ----------------------------------------------------------------------------- |
470 // ----------------------------------------------------------------------------- |
1737 if ( !iMultiInstanceFound ) |
1741 if ( !iMultiInstanceFound ) |
1738 { |
1742 { |
1739 iMultiInstance = KMultiInstanceDefaultValue; |
1743 iMultiInstance = KMultiInstanceDefaultValue; |
1740 } |
1744 } |
1741 } |
1745 } |
1742 |
1746 |
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 |
|
1790 // ----------------------------------------------------------------------------- |
1747 // ----------------------------------------------------------------------------- |
1791 // Parsing of the manifest elements. |
1748 // Parsing of the manifest elements. |
1792 // ----------------------------------------------------------------------------- |
1749 // ----------------------------------------------------------------------------- |
1793 // |
1750 // |
1794 void ChspsInstallationHandler::OnEndElementL( const RTagInfo& aElement, TInt /*aErrorCode*/ ) |
1751 void ChspsInstallationHandler::OnEndElementL( const RTagInfo& aElement, TInt /*aErrorCode*/ ) |