cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp
branchRCL_3
changeset 26 0a9e01492035
parent 8 2e6c4614c58e
equal deleted inserted replaced
24:c45d4fe2ff0a 26:0a9e01492035
   384 //
   384 //
   385 CGSPluginInterface* CGSConnSettingsPluginContainer::SelectedPluginL()
   385 CGSPluginInterface* CGSConnSettingsPluginContainer::SelectedPluginL()
   386     {
   386     {
   387     CGSPluginInterface* plugin = NULL;
   387     CGSPluginInterface* plugin = NULL;
   388 
   388 
   389     // 1) Decrease index with the count
   389     // Plugins are in list box after general menu items.
   390     TInt index = iListBox->CurrentItemIndex() - iGeneralItemCount;
   390     TInt listBoxIndex = iListBox->CurrentItemIndex() - iGeneralItemCount;
   391     
   391     
   392     // 2) Check that new index is in range of plugins
   392     // Pick the correct plugin: Skip the invisible plugin array items.
   393     if ( index >= 0 && index < iPluginArray->Count() )
   393     TInt i = 0;
   394         {
   394     TInt invisibleItems = 0;
   395         // 3) Get correct plugin
   395     CGSPluginInterface* tmpPlugin;
   396         plugin = iPluginArray->operator[]( index );
   396     while ( i <= listBoxIndex + invisibleItems )
       
   397         {
       
   398         tmpPlugin = iPluginArray->operator[]( i );
       
   399         if ( tmpPlugin->Visible() == EFalse )
       
   400             {
       
   401             invisibleItems++;
       
   402             }
       
   403         else if ( i == listBoxIndex + invisibleItems )
       
   404             {
       
   405             plugin = tmpPlugin;
       
   406             break; // Correct plugin found.
       
   407             }
       
   408         i++;
   397         }
   409         }
   398 
   410 
   399     // Leave if not found
   411     // Leave if not found
   400     if ( !plugin )
   412     if ( !plugin )
   401         {
   413         {