cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp
branchRCL_3
changeset 26 0a9e01492035
parent 8 2e6c4614c58e
--- a/cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp	Tue May 11 16:35:05 2010 +0300
+++ b/cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugincontainer.cpp	Tue May 25 13:08:02 2010 +0300
@@ -386,14 +386,26 @@
     {
     CGSPluginInterface* plugin = NULL;
 
-    // 1) Decrease index with the count
-    TInt index = iListBox->CurrentItemIndex() - iGeneralItemCount;
+    // Plugins are in list box after general menu items.
+    TInt listBoxIndex = iListBox->CurrentItemIndex() - iGeneralItemCount;
     
-    // 2) Check that new index is in range of plugins
-    if ( index >= 0 && index < iPluginArray->Count() )
+    // Pick the correct plugin: Skip the invisible plugin array items.
+    TInt i = 0;
+    TInt invisibleItems = 0;
+    CGSPluginInterface* tmpPlugin;
+    while ( i <= listBoxIndex + invisibleItems )
         {
-        // 3) Get correct plugin
-        plugin = iPluginArray->operator[]( index );
+        tmpPlugin = iPluginArray->operator[]( i );
+        if ( tmpPlugin->Visible() == EFalse )
+            {
+            invisibleItems++;
+            }
+        else if ( i == listBoxIndex + invisibleItems )
+            {
+            plugin = tmpPlugin;
+            break; // Correct plugin found.
+            }
+        i++;
         }
 
     // Leave if not found