uiservicetab/vimpstui/src/cvimpstuimenuextension.cpp
branchRCL_3
changeset 14 9fdee5e1da30
parent 0 5e5d6b214f4f
child 20 6b620215f837
equal deleted inserted replaced
13:796276a1bdcc 14:9fdee5e1da30
    20 #include <eikenv.h>
    20 #include <eikenv.h>
    21 #include <coeaui.h>
    21 #include <coeaui.h>
    22 #include <coemain.h>
    22 #include <coemain.h>
    23 #include <barsread.h>
    23 #include <barsread.h>
    24 #include <eikmenup.h>
    24 #include <eikmenup.h>
    25 #include    "vimpstdebugprint.h" 
    25 #include "uiservicetabtracer.h"
    26 
       
    27 
    26 
    28 #include "cvimpstuimenuextension.h"
    27 #include "cvimpstuimenuextension.h"
    29 #include "ccommandinfo.h"
    28 #include "ccommandinfo.h"
    30 
    29 
    31 #include "servicetabmenucommandinfo.hrh"
    30 #include "servicetabmenucommandinfo.hrh"
    38 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    39 // 
    38 // 
    40 CVIMPSTUIMenuExtension::CVIMPSTUIMenuExtension( )
    39 CVIMPSTUIMenuExtension::CVIMPSTUIMenuExtension( )
    41 : iNewCommands( EServiceTabMenuExtensionFirstFreeCommand )
    40 : iNewCommands( EServiceTabMenuExtensionFirstFreeCommand )
    42     {
    41     {
    43     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::CVIMPSTUIMenuExtension");
    42 	TRACER_AUTO;
    44     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::CVIMPSTUIMenuExtension");
       
    45     }
    43     }
    46 
    44 
    47 // ---------------------------------------------------------------------------
    45 // ---------------------------------------------------------------------------
    48 // CVIMPSTUIMenuExtension::ConstructL
    46 // CVIMPSTUIMenuExtension::ConstructL
    49 // ---------------------------------------------------------------------------
    47 // ---------------------------------------------------------------------------
    50 // 
    48 // 
    51 void CVIMPSTUIMenuExtension::ConstructL()
    49 void CVIMPSTUIMenuExtension::ConstructL()
    52     {   
    50     {   
    53     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::ConstructL");
    51 	TRACER_AUTO;
    54     LoadPluginL( ); 
    52     LoadPluginL( ); 
    55     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::ConstructL");
    53     
    56 
    54 
    57     }
    55     }
    58 
    56 
    59 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    60 // CVIMPSTUIMenuExtension::NewL
    58 // CVIMPSTUIMenuExtension::NewL
    61 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    62 // 
    60 // 
    63 CVIMPSTUIMenuExtension* CVIMPSTUIMenuExtension::NewL( )
    61 CVIMPSTUIMenuExtension* CVIMPSTUIMenuExtension::NewL( )
    64     { 
    62     { 
    65     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::NewL");
    63 	TRACER_AUTO;
    66     CVIMPSTUIMenuExtension* self = NewLC(  );
    64     CVIMPSTUIMenuExtension* self = NewLC(  );
    67     CleanupStack::Pop(self);
    65     CleanupStack::Pop(self);
    68     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::NewL");
    66     
    69     return self;
    67     return self;
    70     }
    68     }
    71 
    69 
    72 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    73 // CVIMPSTUIMenuExtension::NewLC
    71 // CVIMPSTUIMenuExtension::NewLC
    74 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    75 // 
    73 // 
    76 CVIMPSTUIMenuExtension* CVIMPSTUIMenuExtension::NewLC()
    74 CVIMPSTUIMenuExtension* CVIMPSTUIMenuExtension::NewLC()
    77     {
    75     {
    78     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::NewL");
    76 	TRACER_AUTO;
    79     CVIMPSTUIMenuExtension* self =
    77     CVIMPSTUIMenuExtension* self =
    80         new (ELeave) CVIMPSTUIMenuExtension(  );
    78         new (ELeave) CVIMPSTUIMenuExtension(  );
    81     CleanupStack::PushL( self );
    79     CleanupStack::PushL( self );
    82     self->ConstructL();
    80     self->ConstructL();
    83     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::NewL");
    81     
    84     return self;
    82     return self;
    85     }
    83     }
    86 
    84 
    87 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    88 // CVIMPSTUIMenuExtension::~CVIMPSTUIMenuExtension
    86 // CVIMPSTUIMenuExtension::~CVIMPSTUIMenuExtension
    89 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
    90 // 
    88 // 
    91 CVIMPSTUIMenuExtension::~CVIMPSTUIMenuExtension()
    89 CVIMPSTUIMenuExtension::~CVIMPSTUIMenuExtension()
    92     {   
    90     {   
    93     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::~CVIMPSTUIMenuExtension");
    91 	TRACER_AUTO;
    94     iCommandIdMap.ResetAndDestroy();
    92     iCommandIdMap.ResetAndDestroy();
    95     //iCommandIdMap.Close();
    93     //iCommandIdMap.Close();
    96     // Reset and destroy the contents of the owned arrays,
    94     // Reset and destroy the contents of the owned arrays,
    97     // this will delete the plugins.
    95     // this will delete the plugins.
    98     iPlugins.ResetAndDestroy();
    96     iPlugins.ResetAndDestroy();
   100     
    98     
   101     iAIWCommandMap.ResetAndDestroy();
    99     iAIWCommandMap.ResetAndDestroy();
   102     
   100     
   103     // Close the ECOM interface
   101     // Close the ECOM interface
   104     REComSession::FinalClose();
   102     REComSession::FinalClose();
   105     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::~CVIMPSTUIMenuExtension");
   103     
   106     }
   104     }
   107  
   105  
   108 // ----------------------------------------------------------------------------
   106 // ----------------------------------------------------------------------------
   109 // CVIMPSTUIMenuExtension::LoadPluginL
   107 // CVIMPSTUIMenuExtension::LoadPluginL
   110 // Loads all plugins
   108 // Loads all plugins
   111 // (other items were commented in a header).
   109 // (other items were commented in a header).
   112 // ----------------------------------------------------------------------------
   110 // ----------------------------------------------------------------------------
   113 //
   111 //
   114 void CVIMPSTUIMenuExtension::LoadPluginL( )
   112 void CVIMPSTUIMenuExtension::LoadPluginL( )
   115     {
   113     {
   116     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::LoadPluginL");
   114 	TRACER_AUTO;
   117     // plugininfo array, Owned
   115     // plugininfo array, Owned
   118     RImplInfoPtrArray pluginInfo;
   116     RImplInfoPtrArray pluginInfo;
   119     iPlugins.ResetAndDestroy();
   117     iPlugins.ResetAndDestroy();
   120     REComSession::ListImplementationsL( KMenuCustomisationInterfaceUid,pluginInfo );
   118     REComSession::ListImplementationsL( KMenuCustomisationInterfaceUid,pluginInfo );
   121     TInt pluginCount = pluginInfo.Count();
   119     TInt pluginCount = pluginInfo.Count();
   122     CHAT_DP( D_CHAT_LIT("CVIMPSTUIMenuExtension::LoadPluginL -->plugincount: %d" ),pluginCount );      
   120     TRACE("plugincount: %d" ,pluginCount );      
   123 
   121 
   124     for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
   122     for ( TInt pluginIndex(0); pluginIndex < pluginCount; ++pluginIndex )
   125         {
   123         {
   126         CHAT_DP( D_CHAT_LIT("Inside for loop" ) );      
   124         TRACE("Inside for loop"  );      
   127         TUid pluginUid = pluginInfo[pluginIndex]->ImplementationUid();
   125         TUid pluginUid = pluginInfo[pluginIndex]->ImplementationUid();
   128         CHAT_DP( D_CHAT_LIT("CVIMPSTUIMenuExtension::LoadPluginL -->ImplementationUid: %u" ),pluginUid.iUid );
   126         TRACE("ImplementationUid: %u" ,pluginUid.iUid );
   129         // Creates the plugin and transfers ownership of the services
   127         // Creates the plugin and transfers ownership of the services
   130         // object to the plugin.
   128         // object to the plugin.
   131         CMenuExtension* plugin = NULL;
   129         CMenuExtension* plugin = NULL;
   132         TRAPD(error, plugin = CMenuExtension::CreateImplementationL( pluginUid ));
   130         TRAPD(error, plugin = CMenuExtension::CreateImplementationL( pluginUid ));
   133         
   131         
   134         if(KErrNone != error)
   132         if(KErrNone != error)
   135             {
   133             {
   136             // handle the error here.
   134             // handle the error here.
   137             CHAT_DP( D_CHAT_LIT("error loading the plugin error: %d" ),error ); 
   135         TRACE("error loading the plugin error: %d" ,error ); 
   138             }
   136             }
   139         else
   137         else
   140             {
   138             {
   141             CHAT_DP( D_CHAT_LIT("plugin loaded sucessfully" ) ); 
   139         TRACE("plugin loaded sucessfully"  ); 
   142             //if its here its sure that plugin is not null;
   140             //if its here its sure that plugin is not null;
   143             CleanupStack::PushL( plugin);
   141             CleanupStack::PushL( plugin);
   144             
   142             
   145             CHAT_DP( D_CHAT_LIT("before mapcommandl" ) ); 
   143             TRACE("before mapcommandl"  ); 
   146             //map the plugin commands to servicetab commands,
   144             //map the plugin commands to servicetab commands,
   147             //assings the command maintained in the commandpool,
   145             //assings the command maintained in the commandpool,
   148             //for more details see 
   146             //for more details see 
   149             MapCommandL(*plugin,pluginUid.iUid);
   147             MapCommandL(*plugin,pluginUid.iUid);
   150             CHAT_DP( D_CHAT_LIT("after mapcommandl" ) ); 
   148             TRACE("after mapcommandl"  ); 
   151             
   149             
   152             //add the plugin to the array
   150             //add the plugin to the array
   153             CPluginInfo* newPlugin = new ( ELeave ) CVIMPSTUIMenuExtension::CPluginInfo( plugin, pluginUid);    
   151             CPluginInfo* newPlugin = new ( ELeave ) CVIMPSTUIMenuExtension::CPluginInfo( plugin, pluginUid);    
   154             CleanupStack::PushL( newPlugin );
   152             CleanupStack::PushL( newPlugin );
   155             iPlugins.AppendL( newPlugin );
   153             iPlugins.AppendL( newPlugin );
   159            }
   157            }
   160         
   158         
   161         }
   159         }
   162     pluginInfo.ResetAndDestroy();
   160     pluginInfo.ResetAndDestroy();
   163     pluginInfo.Close();
   161     pluginInfo.Close();
   164     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::LoadPluginL");
   162     
   165 
   163 
   166     }
   164     }
   167 
   165 
   168 
   166 
   169 // ----------------------------------------------------------------------------
   167 // ----------------------------------------------------------------------------
   171 // Generates the list of active plugins
   169 // Generates the list of active plugins
   172 // ----------------------------------------------------------------------------
   170 // ----------------------------------------------------------------------------
   173 //
   171 //
   174 void CVIMPSTUIMenuExtension::OfferMenuPaneToPlugins(TInt aPreviousId, CEikMenuPane& aMenuPane,TUint aServiceId)
   172 void CVIMPSTUIMenuExtension::OfferMenuPaneToPlugins(TInt aPreviousId, CEikMenuPane& aMenuPane,TUint aServiceId)
   175     {
   173     {
   176     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::OfferMenuPaneToPlugins");
   174 	TRACER_AUTO;
   177     CHAT_DP( D_CHAT_LIT("CVIMPSTUIMenuExtension::OfferMenuPaneToPlugins --> aServiceId : %u" ), aServiceId ); 
   175 	TRACE(" aServiceId : %u" , aServiceId ); 
   178 
   176 
   179     iMenuPane = &aMenuPane;
   177     iMenuPane = &aMenuPane;
   180     // Get the number of  plugins
   178     // Get the number of  plugins
   181     const TInt count = iPlugins.Count();
   179     const TInt count = iPlugins.Count();
   182     CHAT_DP( D_CHAT_LIT("CVIMPSTUIMenuExtension::OfferMenuPaneToPlugins --> count : %d" ), count ); 
   180     TRACE(" count : %d" , count ); 
   183     // Loop though all the command handlers, If DynInitMenuPaneL leaves for one plugin, a plugin
   181     // Loop though all the command handlers, If DynInitMenuPaneL leaves for one plugin, a plugin
   184     // error message will be displayed and the loop will continue with
   182     // error message will be displayed and the loop will continue with
   185     // the next command handler. If none of the plugins leave, there will
   183     // the next command handler. If none of the plugins leave, there will
   186     // be only one TRAP used.
   184     // be only one TRAP used.
   187     for ( TInt index = 0; index < count; ++index )
   185     for ( TInt index = 0; index < count; ++index )
   188         {
   186         {
   189         CHAT_DP( D_CHAT_LIT("inside for loop" ) ); 
   187     TRACE("inside for loop"  ); 
   190         //trap is required if one plugin leaves then it should continue with other plugins.
   188         //trap is required if one plugin leaves then it should continue with other plugins.
   191         TRAPD(error,iPlugins[index]->Plugin().DynInitMenuPaneL( aPreviousId,
   189         TRAPD(error,iPlugins[index]->Plugin().DynInitMenuPaneL( aPreviousId,
   192                                                              aMenuPane,aServiceId,*this ));
   190                                                              aMenuPane,aServiceId,*this ));
   193         if(KErrNone != error)
   191         if(KErrNone != error)
   194             {
   192             {
   195             //display the appropriate error note for leaving;
   193             //display the appropriate error note for leaving;
   196             CHAT_DP( D_CHAT_LIT("error by one of plugind dyninitmenupanel" ) ); 
   194         TRACE("error by one of plugind dyninitmenupanel"  ); 
   197             }
   195             }
   198       
   196       
   199         }
   197         }
   200     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::OfferMenuPaneToPlugins");
       
   201 
   198 
   202     }
   199     }
   203 // ----------------------------------------------------------------------------
   200 // ----------------------------------------------------------------------------
   204 // CVIMPSTUIMenuExtension::OfferHandleCommandToPluginsL
   201 // CVIMPSTUIMenuExtension::OfferHandleCommandToPluginsL
   205 // Generates the list of active plugins
   202 // Generates the list of active plugins
   206 // ----------------------------------------------------------------------------
   203 // ----------------------------------------------------------------------------
   207 //
   204 //
   208 TBool CVIMPSTUIMenuExtension::OfferHandleCommandToPlugins(TInt aCommandId)
   205 TBool CVIMPSTUIMenuExtension::OfferHandleCommandToPlugins(TInt aCommandId)
   209     {
   206     {
   210     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::OfferHandleCommandToPlugins");
   207 	TRACER_AUTO;
   211 
   208 
   212      //Get the number of plugins loaded
   209      //Get the number of plugins loaded
   213      const TInt count = iPlugins.Count();
   210      const TInt count = iPlugins.Count();
   214      CHAT_DP( D_CHAT_LIT("CVIMPSTUIMenuExtension::OfferHandleCommandToPlugins -->count : %d" ),count ); 
   211      TRACE("count : %d" ,count ); 
   215 
   212 
   216      TBool retval = EFalse;
   213      TBool retval = EFalse;
   217      // Loop though all the command handlers, 
   214      // Loop though all the command handlers, 
   218      // If HandleCommandL leaves for one plugin, a plugin
   215      // If HandleCommandL leaves for one plugin, a plugin
   219      // error message will be displayed and the loop will continue with
   216      // error message will be displayed and the loop will continue with
   226          if ( KErrNone != error )
   223          if ( KErrNone != error )
   227              {
   224              {
   228              // Report a problem with plugin.
   225              // Report a problem with plugin.
   229              }
   226              }
   230          }
   227          }
   231      CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::OfferHandleCommandToPlugins");
   228      
   232 
   229 
   233      return retval;
   230      return retval;
   234     }
   231     }
   235 
   232 
   236 // ----------------------------------------------------------------------------
   233 // ----------------------------------------------------------------------------
   243                                     CMenuExtension* aPlugin,
   240                                     CMenuExtension* aPlugin,
   244                                     TUid aPluginUid )
   241                                     TUid aPluginUid )
   245     : iPlugin( aPlugin ),
   242     : iPlugin( aPlugin ),
   246       iPluginUid( aPluginUid )
   243       iPluginUid( aPluginUid )
   247     {
   244     {
   248     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::CPluginInfo::CPluginInfo");
   245 	TRACER_AUTO;
   249     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::CPluginInfo::CPluginInfo");
       
   250 
   246 
   251     }
   247     }
   252 // ----------------------------------------------------------------------------
   248 // ----------------------------------------------------------------------------
   253 // CVIMPSTUIMenuExtension::CPluginInfo::~CPluginInfo(
   249 // CVIMPSTUIMenuExtension::CPluginInfo::~CPluginInfo(
   254 // C++ destructor
   250 // C++ destructor
   255 // (other items were commented in a header).
   251 // (other items were commented in a header).
   256 // ----------------------------------------------------------------------------
   252 // ----------------------------------------------------------------------------
   257 //
   253 //
   258 CVIMPSTUIMenuExtension::CPluginInfo::~CPluginInfo() 
   254 CVIMPSTUIMenuExtension::CPluginInfo::~CPluginInfo() 
   259     {
   255     {
   260      CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::LoadPluginL");
   256 	TRACER_AUTO;
   261      delete iPlugin;
   257      delete iPlugin;
   262      CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::LoadPluginL");
   258      
   263     }
   259     }
   264     
   260     
   265 // ----------------------------------------------------------------------------
   261 // ----------------------------------------------------------------------------
   266 // CVIMPSTUIMenuExtension::CPluginInfo::Plugin
   262 // CVIMPSTUIMenuExtension::CPluginInfo::Plugin
   267 // returns a reference to the plugin
   263 // returns a reference to the plugin
   268 // (other items were commented in a header).
   264 // (other items were commented in a header).
   269 // ----------------------------------------------------------------------------
   265 // ----------------------------------------------------------------------------
   270 //
   266 //
   271 CMenuExtension& CVIMPSTUIMenuExtension::CPluginInfo::Plugin()
   267 CMenuExtension& CVIMPSTUIMenuExtension::CPluginInfo::Plugin()
   272     {
   268     {
   273     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::CPluginInfo::Plugin");
   269 	TRACER_AUTO;
   274     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::CPluginInfo::Plugin");
       
   275      return *iPlugin;
   270      return *iPlugin;
   276     }
   271     }
   277 
   272 
   278 
   273 
   279 // ----------------------------------------------------------------------------
   274 // ----------------------------------------------------------------------------
   281 // (other items were commented in a header).
   276 // (other items were commented in a header).
   282 // ----------------------------------------------------------------------------
   277 // ----------------------------------------------------------------------------
   283 // 
   278 // 
   284 void CVIMPSTUIMenuExtension::MapCommandL( CMenuExtension& aMenuExtension, TInt32  aPluginId )
   279 void CVIMPSTUIMenuExtension::MapCommandL( CMenuExtension& aMenuExtension, TInt32  aPluginId )
   285     { 
   280     { 
   286     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::MapCommandL");
   281 	TRACER_AUTO;
   287 
   282 
   288     TInt res = aMenuExtension.CommandInfoResource();
   283     TInt res = aMenuExtension.CommandInfoResource();
   289     if( res != KErrNotFound )
   284     if( res != KErrNotFound )
   290         {
   285         {
   291         TResourceReader reader;
   286         TResourceReader reader;
   302             }
   297             }
   303         CleanupStack::PopAndDestroy(); // reader                        
   298         CleanupStack::PopAndDestroy(); // reader                        
   304         aMenuExtension.RegisterCommandMapper( *this );
   299         aMenuExtension.RegisterCommandMapper( *this );
   305        
   300        
   306         }
   301         }
   307     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::MapCommandL");
   302    
   308                             
   303                             
   309     }
   304     }
   310 // ----------------------------------------------------------------------------
   305 // ----------------------------------------------------------------------------
   311 // CVIMPSTUIMenuExtension::GetNewCommand
   306 // CVIMPSTUIMenuExtension::GetNewCommand
   312 // from MComandMapper
   307 // from MComandMapper
   314 //
   309 //
   315 
   310 
   316 TInt CVIMPSTUIMenuExtension::GetOldCommand( TInt32 aPluginId, TInt aNewCommand,
   311 TInt CVIMPSTUIMenuExtension::GetOldCommand( TInt32 aPluginId, TInt aNewCommand,
   317                                     TInt& aOldCommand ) const
   312                                     TInt& aOldCommand ) const
   318     {
   313     {
   319     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::GetOldCommand");
   314 	TRACER_AUTO;
   320 
   315 
   321     TInt mapCount = iCommandIdMap.Count();
   316     TInt mapCount = iCommandIdMap.Count();
   322     TInt err( KErrNotFound );
   317     TInt err( KErrNotFound );
   323     //TODO:: optimize searching.
   318     //TODO:: optimize searching.
   324     for( TInt i = 0; i < mapCount && err; i++ )
   319     for( TInt i = 0; i < mapCount && err; i++ )
   329             aOldCommand = info->OldCommandId();
   324             aOldCommand = info->OldCommandId();
   330             err = KErrNone;
   325             err = KErrNone;
   331             break;
   326             break;
   332             }
   327             }
   333         }  
   328         }  
   334     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::GetOldCommand");
   329     
   335 
   330 
   336     return err;
   331     return err;
   337     }
   332     }
   338 // ----------------------------------------------------------------------------
   333 // ----------------------------------------------------------------------------
   339 // CVIMPSTUIMenuExtension::GetNewCommand
   334 // CVIMPSTUIMenuExtension::GetNewCommand
   342 //
   337 //
   343     
   338     
   344 TInt CVIMPSTUIMenuExtension::GetNewCommand( TInt32 aPluginId, TInt aOldCommand,
   339 TInt CVIMPSTUIMenuExtension::GetNewCommand( TInt32 aPluginId, TInt aOldCommand,
   345                                     TInt& aNewCommand ) const
   340                                     TInt& aNewCommand ) const
   346     {
   341     {
   347     CHAT_DP_FUNC_ENTER("CVIMPSTUIMenuExtension::GetNewCommand");
   342 	TRACER_AUTO;
   348 
   343 
   349     TInt mapCount = iCommandIdMap.Count();
   344     TInt mapCount = iCommandIdMap.Count();
   350     TInt err( KErrNotFound );
   345     TInt err( KErrNotFound );
   351     //TODO:: optimize searching.
   346     //TODO:: optimize searching.
   352     for( TInt i = 0; i < mapCount && err; i++ )
   347     for( TInt i = 0; i < mapCount && err; i++ )
   357             aNewCommand = info->NewCommandId();
   352             aNewCommand = info->NewCommandId();
   358             err = KErrNone;
   353             err = KErrNone;
   359             break;
   354             break;
   360             }
   355             }
   361         }   
   356         }   
   362     CHAT_DP_FUNC_DONE("CVIMPSTUIMenuExtension::GetNewCommand");
   357    
   363 
   358 
   364     return err; 
   359     return err; 
   365     }
   360     }
   366 // ----------------------------------------------------------------------------
   361 // ----------------------------------------------------------------------------
   367 // CVIMPSTUIMenuExtension::AddToAIWCommandMap
   362 // CVIMPSTUIMenuExtension::AddToAIWCommandMap
   368 // ----------------------------------------------------------------------------
   363 // ----------------------------------------------------------------------------
   369 //
   364 //
   370 void CVIMPSTUIMenuExtension::AddToAIWCommandMap(TInt aOriginalCommand, TInt aNewCommand)
   365 void CVIMPSTUIMenuExtension::AddToAIWCommandMap(TInt aOriginalCommand, TInt aNewCommand)
   371     {
   366     {
       
   367 	TRACER_AUTO;
   372     TAIWCommandMapTableItem *item = new TAIWCommandMapTableItem();
   368     TAIWCommandMapTableItem *item = new TAIWCommandMapTableItem();
   373     item->iOriginalCmd = aOriginalCommand;
   369     item->iOriginalCmd = aOriginalCommand;
   374     item->iNewCmd = aNewCommand;
   370     item->iNewCmd = aNewCommand;
   375     iAIWCommandMap.Append(item);
   371     iAIWCommandMap.Append(item);
   376     }
   372     }
   378 // CVIMPSTUIMenuExtension::GetNewAIWCommand
   374 // CVIMPSTUIMenuExtension::GetNewAIWCommand
   379 // ----------------------------------------------------------------------------
   375 // ----------------------------------------------------------------------------
   380 //
   376 //
   381 TInt CVIMPSTUIMenuExtension::GetNewAIWCommand(TInt aOriginalCommand)
   377 TInt CVIMPSTUIMenuExtension::GetNewAIWCommand(TInt aOriginalCommand)
   382     {
   378     {
       
   379 	TRACER_AUTO;
   383     TInt count = iAIWCommandMap.Count();
   380     TInt count = iAIWCommandMap.Count();
   384     for( TInt i=0 ; i<count ; i++ )
   381     for( TInt i=0 ; i<count ; i++ )
   385         {
   382         {
   386         if(iAIWCommandMap[i]->iOriginalCmd == aOriginalCommand)
   383         if(iAIWCommandMap[i]->iOriginalCmd == aOriginalCommand)
   387             {
   384             {
   403 // CVIMPSTUIMenuExtension::SetAIWItemDimmed
   400 // CVIMPSTUIMenuExtension::SetAIWItemDimmed
   404 // ----------------------------------------------------------------------------
   401 // ----------------------------------------------------------------------------
   405 //
   402 //
   406 void CVIMPSTUIMenuExtension::SetAIWItemDimmed(TInt aCommand, TBool aHide)
   403 void CVIMPSTUIMenuExtension::SetAIWItemDimmed(TInt aCommand, TBool aHide)
   407     {
   404     {
       
   405 	TRACER_AUTO;
   408     TInt cmd = GetNewAIWCommand(aCommand);
   406     TInt cmd = GetNewAIWCommand(aCommand);
   409     if(cmd != KErrNotFound)
   407     if(cmd != KErrNotFound)
   410         iMenuPane->SetItemDimmed(cmd,aHide);
   408         iMenuPane->SetItemDimmed(cmd,aHide);
   411     }
   409     }
   412 
   410