317 CleanupStack::PushL(headerdata); |
317 CleanupStack::PushL(headerdata); |
318 messagePtr.WriteL(2,headerdata->Des(),0); |
318 messagePtr.WriteL(2,headerdata->Des(),0); |
319 CleanupStack::PopAndDestroy(headerdata); |
319 CleanupStack::PopAndDestroy(headerdata); |
320 |
320 |
321 ThspsRepositoryInfo info( EhspsODTActivated ); |
321 ThspsRepositoryInfo info( EhspsODTActivated ); |
|
322 info.iAppUid = odt->RootUid(); |
322 iDefinitionRepository.RegisterNotification( info ); |
323 iDefinitionRepository.RegisterNotification( info ); |
323 } |
324 } |
324 } |
325 } |
325 iDefinitionRepository.Unlock(); |
326 iDefinitionRepository.Unlock(); |
326 CleanupStack::Pop(&iDefinitionRepository); |
327 CleanupStack::Pop(&iDefinitionRepository); |
3207 ThspsServiceCompletedMessage ret( EhspsRemoveThemeFailed ); |
3208 ThspsServiceCompletedMessage ret( EhspsRemoveThemeFailed ); |
3208 |
3209 |
3209 if( !( aSetMask.Flags() & EhspsThemeStatusLicenceeDefault ) ) |
3210 if( !( aSetMask.Flags() & EhspsThemeStatusLicenceeDefault ) ) |
3210 { |
3211 { |
3211 RArray<ThspsRepositoryInfo> notifParams; |
3212 RArray<ThspsRepositoryInfo> notifParams; |
3212 |
3213 CleanupClosePushL( notifParams ); |
|
3214 |
3213 if( !iDefinitionRepository.Locked() ) |
3215 if( !iDefinitionRepository.Locked() ) |
3214 { |
3216 { |
3215 iDefinitionRepository.Lock(); |
3217 iDefinitionRepository.Lock(); |
3216 |
3218 |
3217 // In case of error. repository is unlocked |
3219 // In case of error. repository is unlocked |
3219 |
3221 |
3220 // Check what is being being uninstalled |
3222 // Check what is being being uninstalled |
3221 TInt error( KErrNone ); |
3223 TInt error( KErrNone ); |
3222 if ( aSetMask.ConfigurationType() != EhspsAppConfiguration ) |
3224 if ( aSetMask.ConfigurationType() != EhspsAppConfiguration ) |
3223 { |
3225 { |
3224 // Fix plugin instances and get notifications from valid cases |
3226 TRAP( error, RemovePluginConfFromRepositoryL( aSetMask, notifParams ) ); |
3225 TRAP( error, RemovePluginFromAppConfsL( aSetMask, notifParams ) ); |
|
3226 } |
3227 } |
3227 |
3228 else |
3228 if( !error ) |
3229 { |
3229 { |
3230 TRAP( error, RemoveAppConfFromRepositoryL( aSetMask, notifParams ) ); |
3230 // Remove the actual plugin from file system |
|
3231 TRAP( error, RemoveThemeL( aSetMask ) ); |
|
3232 } |
3231 } |
3233 |
3232 |
3234 if( !error ) |
3233 if( !error ) |
3235 { |
3234 { |
3236 // Remove header from the cache |
3235 // Remove header from the cache |
3270 void ChspsMaintenanceHandler::RemovePluginFromAppConfsL( |
3269 void ChspsMaintenanceHandler::RemovePluginFromAppConfsL( |
3271 const ChspsODT& aOdt, |
3270 const ChspsODT& aOdt, |
3272 RArray<ThspsRepositoryInfo>& aNotificationParams ) |
3271 RArray<ThspsRepositoryInfo>& aNotificationParams ) |
3273 { |
3272 { |
3274 __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); |
3273 __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); |
3275 |
3274 |
3276 // Loop application configurations |
3275 // Loop application configurations |
3277 const TInt count = iHeaderListCache.Count(); |
3276 const TInt count = iHeaderListCache.Count(); |
3278 for ( TInt i = 0; i < count; i++ ) |
3277 for ( TInt i = 0; i < count; i++ ) |
3279 { |
3278 { |
3280 ChspsODT* header = iHeaderListCache.At(i); |
3279 ChspsODT* header = iHeaderListCache.At(i); |
3388 aOdt.ThemeUid(), |
3387 aOdt.ThemeUid(), |
3389 0, |
3388 0, |
3390 ETrue, |
3389 ETrue, |
3391 aOdt.ThemeFullName(), |
3390 aOdt.ThemeFullName(), |
3392 (TLanguage)( aOdt.OdtLanguage() ) ); |
3391 (TLanguage)( aOdt.OdtLanguage() ) ); |
3393 aNotificationParams.Append(info); |
3392 aNotificationParams.AppendL(info); |
3394 } |
3393 } |
3395 } |
3394 } |
3396 |
3395 |
3397 pluginIds.Close(); |
|
3398 CleanupStack::PopAndDestroy( 2, appOdt ); // appOdt, pluginIds |
3396 CleanupStack::PopAndDestroy( 2, appOdt ); // appOdt, pluginIds |
3399 appOdt = NULL; |
3397 appOdt = NULL; |
3400 |
3398 |
3401 } // app configuration |
3399 } // app configuration |
3402 |
3400 |
3403 } // header loop |
3401 } // header loop |
3404 |
3402 } |
|
3403 |
|
3404 // ----------------------------------------------------------------------------- |
|
3405 // RemoveAppConfFromRepositoryL |
|
3406 // ----------------------------------------------------------------------------- |
|
3407 // |
|
3408 void ChspsMaintenanceHandler::RemoveAppConfFromRepositoryL( |
|
3409 const ChspsODT& aOdt, |
|
3410 RArray<ThspsRepositoryInfo>& /* aNotificationParams */ ) |
|
3411 { |
|
3412 __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); |
|
3413 |
|
3414 ChspsODT* activeAppConf = ChspsODT::NewL(); |
|
3415 CleanupStack::PushL( activeAppConf ); |
|
3416 iThemeServer.GetActivateAppConfigurationL( aOdt.RootUid(), *activeAppConf ); |
|
3417 if ( aOdt.ThemeUid() == activeAppConf->ThemeUid() ) |
|
3418 { |
|
3419 // Active application configuration removed |
|
3420 ActivateDefaultAppConfL( aOdt, *activeAppConf ); |
|
3421 } |
|
3422 |
|
3423 CleanupStack::PopAndDestroy( activeAppConf ); |
|
3424 |
|
3425 // Remove the actual application configuration from file system |
|
3426 RemoveThemeL( aOdt ); |
|
3427 |
|
3428 } |
|
3429 |
|
3430 // ----------------------------------------------------------------------------- |
|
3431 // RemovePluginConfFromRepositoryL |
|
3432 // ----------------------------------------------------------------------------- |
|
3433 // |
|
3434 void ChspsMaintenanceHandler::RemovePluginConfFromRepositoryL( |
|
3435 const ChspsODT& aOdt, |
|
3436 RArray<ThspsRepositoryInfo>& aNotificationParams ) |
|
3437 { |
|
3438 __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); |
|
3439 |
|
3440 // Fix plugin instances and get notifications from valid cases |
|
3441 RemovePluginFromAppConfsL( aOdt, aNotificationParams ); |
|
3442 |
|
3443 // Remove the actual plugin configuration from file system |
|
3444 RemoveThemeL( aOdt ); |
3405 } |
3445 } |
3406 |
3446 |
3407 // ----------------------------------------------------------------------------- |
3447 // ----------------------------------------------------------------------------- |
3408 // ChspsMaintenanceHandler::InvalidateUninstalledPluginInstancesL |
3448 // ChspsMaintenanceHandler::InvalidateUninstalledPluginInstancesL |
3409 // ----------------------------------------------------------------------------- |
3449 // ----------------------------------------------------------------------------- |
3513 odt->SetFlags( aOdt.Flags() ); |
3553 odt->SetFlags( aOdt.Flags() ); |
3514 odt->SetMultiInstance( aOdt.MultiInstance() ); |
3554 odt->SetMultiInstance( aOdt.MultiInstance() ); |
3515 User::LeaveIfError( iDefinitionRepository.GetOdtL( *odt ) ); |
3555 User::LeaveIfError( iDefinitionRepository.GetOdtL( *odt ) ); |
3516 |
3556 |
3517 RArray<ThspsRepositoryInfo> notifParams; |
3557 RArray<ThspsRepositoryInfo> notifParams; |
3518 |
3558 CleanupClosePushL( notifParams ); |
|
3559 |
3519 TRAP( errorCode, UpdatePluginFromAppConfsL( *odt, notifParams )); |
3560 TRAP( errorCode, UpdatePluginFromAppConfsL( *odt, notifParams )); |
3520 |
3561 |
3521 if( errorCode ) |
3562 if( errorCode ) |
3522 { |
3563 { |
3523 ret = EhspsUpdatePluginFailed; |
3564 ret = EhspsUpdatePluginFailed; |
3615 aOdt.ThemeUid(), |
3656 aOdt.ThemeUid(), |
3616 pluginIds[i], |
3657 pluginIds[i], |
3617 status, |
3658 status, |
3618 aOdt.ThemeFullName(), |
3659 aOdt.ThemeFullName(), |
3619 (TLanguage)( aOdt.OdtLanguage() ) ); |
3660 (TLanguage)( aOdt.OdtLanguage() ) ); |
3620 aNotificationParams.Append(info); |
3661 aNotificationParams.AppendL(info); |
3621 } |
3662 } |
3622 } |
3663 } |
3623 |
3664 |
3624 CleanupStack::PopAndDestroy(); // pluginIds. |
3665 CleanupStack::PopAndDestroy(); // pluginIds. |
3625 CleanupStack::PopAndDestroy( odt ); |
3666 CleanupStack::PopAndDestroy( odt ); |
3626 } |
3667 } |
3627 } |
3668 } |
3628 |
|
3629 } |
3669 } |
3630 } |
3670 } |
3631 // ----------------------------------------------------------------------------- |
3671 // ----------------------------------------------------------------------------- |
3632 // ChspsMaintenanceHandler::UpdatePluginConfigurationL |
3672 // ChspsMaintenanceHandler::UpdatePluginConfigurationL |
3633 // Not supported |
3673 // Not supported |
4505 ChspsODT& aOdt) |
4545 ChspsODT& aOdt) |
4506 { |
4546 { |
4507 // If active application configuration is not "LicenceeRestorable" |
4547 // If active application configuration is not "LicenceeRestorable" |
4508 if ( !(aHeader->Flags() & EhspsThemeStatusLicenceeRestorable) ) |
4548 if ( !(aHeader->Flags() & EhspsThemeStatusLicenceeRestorable) ) |
4509 { |
4549 { |
4510 // Try to activate a configuation with the LicenceeRestorable status |
4550 // Try to activate default configuation |
4511 ChspsODT* searchMask = ChspsODT::NewL(); |
4551 ActivateDefaultAppConfL( *aHeader, aOdt ); |
4512 CleanupStack::PushL( searchMask ); |
|
4513 searchMask->SetRootUid( aHeader->RootUid() ); |
|
4514 searchMask->SetFamily( aHeader->Family() ); |
|
4515 searchMask->SetFlags( EhspsThemeStatusLicenceeRestorable ); |
|
4516 TInt pos( 0 ); |
|
4517 iThemeServer.GetConfigurationHeader( *searchMask, aHeader, pos ); |
|
4518 if ( aHeader ) |
|
4519 { |
|
4520 // Activate licensee restorable configuration |
|
4521 iThemeServer.ActivateThemeL( *aHeader, aOdt ); |
|
4522 ThspsRepositoryInfo info( EhspsODTActivated ); |
|
4523 iDefinitionRepository.RegisterNotification( info ); |
|
4524 } |
|
4525 else |
|
4526 { |
|
4527 // Licensee restorable configuration not found. There must be |
|
4528 // at least one licensee restorable configuration per application |
|
4529 User::Leave( KErrNotFound ); |
|
4530 } |
|
4531 CleanupStack::PopAndDestroy( searchMask ); |
|
4532 } |
4552 } |
4533 else |
4553 else |
4534 { |
4554 { |
4535 // Reinstall the application configuration from ROM |
4555 // Reinstall the application configuration from ROM |
4536 iThemeServer.ReinstallConfL( aHeader->RootUid(), aHeader->ThemeUid() ); |
4556 iThemeServer.ReinstallConfL( aHeader->RootUid(), aHeader->ThemeUid() ); |
4537 } |
4557 } |
|
4558 } |
|
4559 |
|
4560 // ----------------------------------------------------------------------------- |
|
4561 // ChspsMaintenanceHandler::ActivateDefaultAppConfL |
|
4562 // (other items were commented in a header). |
|
4563 // ----------------------------------------------------------------------------- |
|
4564 // |
|
4565 void ChspsMaintenanceHandler::ActivateDefaultAppConfL( |
|
4566 const ChspsODT& aHeader, |
|
4567 ChspsODT& aOdt ) |
|
4568 { |
|
4569 ChspsODT* searchMask = ChspsODT::NewL(); |
|
4570 CleanupStack::PushL( searchMask ); |
|
4571 searchMask->SetRootUid( aHeader.RootUid() ); |
|
4572 searchMask->SetFamily( aHeader.Family() ); |
|
4573 searchMask->SetFlags( EhspsThemeStatusLicenceeRestorable ); |
|
4574 |
|
4575 ChspsODT* defaultAppConf( NULL ); |
|
4576 TInt pos( 0 ); |
|
4577 iThemeServer.GetConfigurationHeader( *searchMask, defaultAppConf, pos ); |
|
4578 if ( defaultAppConf ) |
|
4579 { |
|
4580 // Activate licensee restorable configuration |
|
4581 iThemeServer.ActivateThemeL( *defaultAppConf, aOdt ); |
|
4582 } |
|
4583 else |
|
4584 { |
|
4585 // Licensee restorable configuration not found. There must be |
|
4586 // at least one licensee restorable configuration per application |
|
4587 User::Leave( KErrNotFound ); |
|
4588 } |
|
4589 |
|
4590 CleanupStack::PopAndDestroy( searchMask ); |
4538 } |
4591 } |
4539 |
4592 |
4540 // ----------------------------------------------------------------------------- |
4593 // ----------------------------------------------------------------------------- |
4541 // ChspsMaintenanceHandler::AddErrorConfigurationL() |
4594 // ChspsMaintenanceHandler::AddErrorConfigurationL() |
4542 // ----------------------------------------------------------------------------- |
4595 // ----------------------------------------------------------------------------- |