messagingfw/alwaysonline/AlwaysOnlineManager/src/AlwaysOnlineManager.cpp
branchRCL_3
changeset 24 002ade1da91c
parent 11 33d4877f7b9f
equal deleted inserted replaced
23:d51193d814ea 24:002ade1da91c
   787     
   787     
   788     if ( ParseProgressL( aProgress, id, command, result ) )
   788     if ( ParseProgressL( aProgress, id, command, result ) )
   789         {
   789         {
   790         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : plugin: 0x%x", id);
   790         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : plugin: 0x%x", id);
   791         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : command: %d", command);
   791         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : command: %d", command);
   792         KAOMANAGER_LOGGER_WRITE_FORMAT8("CAlwaysOnlineManager::HandleOpCompletionL() : result: %S", &result);
   792         KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::HandleOpCompletionL() : result: %S", &result);
   793         
   793         
   794         switch ( static_cast<TManagerServerCommands>( command ) )
   794         switch ( static_cast<TManagerServerCommands>( command ) )
   795             {
   795             {
   796             case EAOManagerSuicideQuery:
   796             case EAOManagerSuicideQuery:
   797                 if ( result.Match( KStopPlugin ) > KErrNotFound )
   797                 if ( result.Match( KStopPlugin ) > KErrNotFound )
   952 
   952 
   953 // ----------------------------------------------------------------------------
   953 // ----------------------------------------------------------------------------
   954 // CAlwaysOnlineManager::StopPluginL
   954 // CAlwaysOnlineManager::StopPluginL
   955 // ----------------------------------------------------------------------------
   955 // ----------------------------------------------------------------------------
   956 //
   956 //
   957 void CAlwaysOnlineManager::StopPluginL(
   957 void CAlwaysOnlineManager::StopPluginL( const TUid& aPluginImplementationUid )
   958     const TUid& aPlugin )
       
   959     {
   958     {
   960     KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::StopPluginL");
   959     KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::StopPluginL");
   961     
   960     
   962     // Find the plugin and send stop command.
   961     // Find the plugin and send stop command.
   963     if ( iPluginArray->Count() )
   962     for ( TInt i = 0; i < iPluginArray->Count(); i++ )
   964         {
   963         {
   965         // Get correct plugin from 
   964         TUid id = ( iPluginArray->At( i ) )->InstanceUid();
   966         for ( TInt i = 0; i < iPluginArray->Count(); i++ )
   965 
   967             {
   966         // Stop plugin if it has matching implemention UID.
   968             TUid id = ( iPluginArray->At( i ) )->InstanceUid();
   967         // Will stop all plugin instances with matching implementation.
   969 
   968         if ( REComSession::GetImplementationUidL(id) == aPluginImplementationUid )
   970             // Is it this plugin?                
   969             {
   971             if ( id == aPlugin )
   970             KAOMANAGER_LOGGER_WRITE_FORMAT(
   972                 {
   971                 "CAlwaysOnlineManager::StopPluginL() Calling stop to plugin: 0x%x", 
   973                 KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::StopPluginL() Calling stop to plugin: 0x%x", aPlugin);
   972                 id );
   974                 TBuf8<1> dummyParam;
   973             TBuf8<1> dummyParam;
   975                 InvokeCommandHandlerL( 
   974             InvokeCommandHandlerL( 
   976                     static_cast<TManagerServerCommands>( EAOManagerPluginStop ), 
   975                 static_cast<TManagerServerCommands>( EAOManagerPluginStop ), 
   977                     dummyParam, 
   976                 dummyParam, 
   978                     i );    
   977                 i );    
   979                 }
   978             }
   980             }
   979         }
   981         }
       
   982         
       
   983     KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::StopPluginL");
   980     KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::StopPluginL");
   984     }
   981     }
   985 
   982 
   986 // ----------------------------------------------------------------------------
   983 // ----------------------------------------------------------------------------
   987 // CAlwaysOnlineManager::DisablePlugin
   984 // CAlwaysOnlineManager::DisablePlugin
   988 // ----------------------------------------------------------------------------
   985 // ----------------------------------------------------------------------------
   989 //
   986 //
   990 void CAlwaysOnlineManager::DisablePlugin( const TUid& aPlugin )
   987 void CAlwaysOnlineManager::DisablePlugin( const TUid& aPluginInstanceUid )
   991     {
   988     {
   992     KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::DisablePlugin");
   989     KAOMANAGER_LOGGER_FN1("CAlwaysOnlineManager::DisablePlugin");
   993     
   990     
   994     // Delete the plugin and mark it disabled.
   991     // Delete the plugin and mark it disabled.
   995     if ( iPluginArray->Count() )
   992     for ( TInt i = 0; i < iPluginArray->Count(); i++ )
   996         {
   993         {
   997         // Get correct plugin from 
   994         TUid id = ( iPluginArray->At( i ) )->InstanceUid();
   998         for ( TInt i = 0; i < iPluginArray->Count(); i++ )
   995         
   999             {
   996         // Delete plugin if it has matching instance UID.
  1000             TUid id = ( iPluginArray->At( i ) )->InstanceUid();
   997         if ( id == aPluginInstanceUid )
  1001             
   998             {
  1002             // Is it this plugin?
   999             KAOMANAGER_LOGGER_WRITE_FORMAT(
  1003             if ( id == aPlugin )
  1000                 "CAlwaysOnlineManager::DisablePlugin() Deleting plugin from array: 0x%x", 
  1004                 {
  1001                 aPluginInstanceUid);
  1005                 KAOMANAGER_LOGGER_WRITE_FORMAT("CAlwaysOnlineManager::DisablePlugin() Deleting plugin from array: 0x%x", aPlugin);
  1002             // Delete object
  1006                 // Delete object
  1003             delete iPluginArray->At( i );
  1007                 delete iPluginArray->At( i );
  1004             // Delete element
  1008                 // Delete element
  1005             iPluginArray->Delete( i );
  1009                 iPluginArray->Delete( i );
  1006             }
  1010                 }
  1007         }
  1011             }
  1008     // Set this plugin as disabled.
  1012             // Set this plugin as disabled.
  1009     iCenRepControl->SetPluginStatus( aPluginInstanceUid, ETrue );
  1013             iCenRepControl->SetPluginStatus( aPlugin, ETrue );
  1010     
  1014             
  1011     // Refresh the list of disabled plugins UIDs.
  1015             // Refresh the list of disabled plugins UIDs.
  1012     iCenRepControl->UpdateDisabledPluginsUids( *iDisabledPluginUidsArray );
  1016             iCenRepControl->UpdateDisabledPluginsUids( 
  1013     
  1017                 *iDisabledPluginUidsArray );
       
  1018         }
       
  1019     
  1014     
  1020     KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::DisablePlugin");
  1015     KAOMANAGER_LOGGER_FN2("CAlwaysOnlineManager::DisablePlugin");
  1021     }
  1016     }
  1022 
  1017 
  1023 // ----------------------------------------------------------------------------
  1018 // ----------------------------------------------------------------------------