diff -r 6cadd6867c17 -r 67f2ed48ad91 homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp --- a/homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp Wed Sep 15 12:32:36 2010 +0300 +++ b/homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp Wed Oct 13 14:53:46 2010 +0300 @@ -319,7 +319,6 @@ CleanupStack::PopAndDestroy(headerdata); ThspsRepositoryInfo info( EhspsODTActivated ); - info.iAppUid = odt->RootUid(); iDefinitionRepository.RegisterNotification( info ); } } @@ -1866,7 +1865,7 @@ TInt pluginCount = pluginsNode->ChildNodes().Length(); for( TInt pluginIndex=0; pluginIndex < pluginCount; pluginIndex++ ) { - nodeArray.AppendL( (ChspsDomNode*)pluginsNode->ChildNodes().Item( pluginIndex ) ); + nodeArray.Append( (ChspsDomNode*)pluginsNode->ChildNodes().Item( pluginIndex ) ); } // Remove the nodes and related resources @@ -3210,8 +3209,7 @@ if( !( aSetMask.Flags() & EhspsThemeStatusLicenceeDefault ) ) { RArray notifParams; - CleanupClosePushL( notifParams ); - + if( !iDefinitionRepository.Locked() ) { iDefinitionRepository.Lock(); @@ -3223,11 +3221,14 @@ TInt error( KErrNone ); if ( aSetMask.ConfigurationType() != EhspsAppConfiguration ) { - TRAP( error, RemovePluginConfFromRepositoryL( aSetMask, notifParams ) ); + // Fix plugin instances and get notifications from valid cases + TRAP( error, RemovePluginFromAppConfsL( aSetMask, notifParams ) ); } - else + + if( !error ) { - TRAP( error, RemoveAppConfFromRepositoryL( aSetMask, notifParams ) ); + // Remove the actual plugin from file system + TRAP( error, RemoveThemeL( aSetMask ) ); } if( !error ) @@ -3256,7 +3257,7 @@ } } - CleanupStack::PopAndDestroy( ¬ifParams ); + notifParams.Close(); } return ret; @@ -3271,7 +3272,7 @@ RArray& aNotificationParams ) { __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); - + // Loop application configurations const TInt count = iHeaderListCache.Count(); for ( TInt i = 0; i < count; i++ ) @@ -3359,7 +3360,7 @@ lastNotification, aOdt.ThemeFullName(), (TLanguage)( aOdt.OdtLanguage() ) ); - aNotificationParams.AppendL(info); + aNotificationParams.Append(info); } #ifdef HSPS_LOG_ACTIVE if( iLogBus ) @@ -3389,59 +3390,18 @@ ETrue, aOdt.ThemeFullName(), (TLanguage)( aOdt.OdtLanguage() ) ); - aNotificationParams.AppendL(info); + aNotificationParams.Append(info); } } + pluginIds.Close(); CleanupStack::PopAndDestroy( 2, appOdt ); // appOdt, pluginIds appOdt = NULL; } // app configuration } // header loop - } - -// ----------------------------------------------------------------------------- -// RemoveAppConfFromRepositoryL -// ----------------------------------------------------------------------------- -// -void ChspsMaintenanceHandler::RemoveAppConfFromRepositoryL( - const ChspsODT& aOdt, - RArray& /* aNotificationParams */ ) - { - __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); - - ChspsODT* activeAppConf = ChspsODT::NewL(); - CleanupStack::PushL( activeAppConf ); - iThemeServer.GetActivateAppConfigurationL( aOdt.RootUid(), *activeAppConf ); - if ( aOdt.ThemeUid() == activeAppConf->ThemeUid() ) - { - // Active application configuration removed - ActivateDefaultAppConfL( aOdt, *activeAppConf ); - } - - CleanupStack::PopAndDestroy( activeAppConf ); - - // Remove the actual application configuration from file system - RemoveThemeL( aOdt ); - - } - -// ----------------------------------------------------------------------------- -// RemovePluginConfFromRepositoryL -// ----------------------------------------------------------------------------- -// -void ChspsMaintenanceHandler::RemovePluginConfFromRepositoryL( - const ChspsODT& aOdt, - RArray& aNotificationParams ) - { - __ASSERT_DEBUG( aOdt.ThemeUid(), User::Leave( KErrArgument ) ); - - // Fix plugin instances and get notifications from valid cases - RemovePluginFromAppConfsL( aOdt, aNotificationParams ); - - // Remove the actual plugin configuration from file system - RemoveThemeL( aOdt ); + } // ----------------------------------------------------------------------------- @@ -3555,8 +3515,7 @@ User::LeaveIfError( iDefinitionRepository.GetOdtL( *odt ) ); RArray notifParams; - CleanupClosePushL( notifParams ); - + TRAP( errorCode, UpdatePluginFromAppConfsL( *odt, notifParams )); if( errorCode ) @@ -3581,8 +3540,8 @@ } } + notifParams.Close(); - CleanupStack::PopAndDestroy( ¬ifParams ); CleanupStack::PopAndDestroy( odt ); } @@ -3658,7 +3617,7 @@ status, aOdt.ThemeFullName(), (TLanguage)( aOdt.OdtLanguage() ) ); - aNotificationParams.AppendL(info); + aNotificationParams.Append(info); } } @@ -3666,6 +3625,7 @@ CleanupStack::PopAndDestroy( odt ); } } + } } // ----------------------------------------------------------------------------- @@ -4547,8 +4507,28 @@ // If active application configuration is not "LicenceeRestorable" if ( !(aHeader->Flags() & EhspsThemeStatusLicenceeRestorable) ) { - // Try to activate default configuation - ActivateDefaultAppConfL( *aHeader, aOdt ); + // Try to activate a configuation with the LicenceeRestorable status + ChspsODT* searchMask = ChspsODT::NewL(); + CleanupStack::PushL( searchMask ); + searchMask->SetRootUid( aHeader->RootUid() ); + searchMask->SetFamily( aHeader->Family() ); + searchMask->SetFlags( EhspsThemeStatusLicenceeRestorable ); + TInt pos( 0 ); + iThemeServer.GetConfigurationHeader( *searchMask, aHeader, pos ); + if ( aHeader ) + { + // Activate licensee restorable configuration + iThemeServer.ActivateThemeL( *aHeader, aOdt ); + ThspsRepositoryInfo info( EhspsODTActivated ); + iDefinitionRepository.RegisterNotification( info ); + } + else + { + // Licensee restorable configuration not found. There must be + // at least one licensee restorable configuration per application + User::Leave( KErrNotFound ); + } + CleanupStack::PopAndDestroy( searchMask ); } else { @@ -4558,39 +4538,6 @@ } // ----------------------------------------------------------------------------- -// ChspsMaintenanceHandler::ActivateDefaultAppConfL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void ChspsMaintenanceHandler::ActivateDefaultAppConfL( - const ChspsODT& aHeader, - ChspsODT& aOdt ) - { - ChspsODT* searchMask = ChspsODT::NewL(); - CleanupStack::PushL( searchMask ); - searchMask->SetRootUid( aHeader.RootUid() ); - searchMask->SetFamily( aHeader.Family() ); - searchMask->SetFlags( EhspsThemeStatusLicenceeRestorable ); - - ChspsODT* defaultAppConf( NULL ); - TInt pos( 0 ); - iThemeServer.GetConfigurationHeader( *searchMask, defaultAppConf, pos ); - if ( defaultAppConf ) - { - // Activate licensee restorable configuration - iThemeServer.ActivateThemeL( *defaultAppConf, aOdt ); - } - else - { - // Licensee restorable configuration not found. There must be - // at least one licensee restorable configuration per application - User::Leave( KErrNotFound ); - } - - CleanupStack::PopAndDestroy( searchMask ); - } - -// ----------------------------------------------------------------------------- // ChspsMaintenanceHandler::AddErrorConfigurationL() // ----------------------------------------------------------------------------- // @@ -4894,12 +4841,8 @@ ChspsDomAttribute* attr = static_cast( attrList.FindByName( KConfigurationAttrLocking ) ); if( attr ) - { - if( attr->Value().CompareF( KConfLockingLocked ) == 0 || - attr->Value().CompareF( KConfLockingPermanent ) == 0 ) - { - isLocked = ETrue; - } + { + isLocked = ( attr->Value().CompareF( KConfLockingLocked ) == 0 ); } return isLocked; @@ -4963,7 +4906,7 @@ if( !isLocked || foundLocked ) { // Mark for removal - nodeArray.AppendL( pluginNode ); + nodeArray.Append( pluginNode ); } else {