phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp
branchRCL_3
changeset 58 d4f567ce2e7c
parent 39 a6539d1e8e43
child 64 c1e8ba0c2b16
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp	Thu Jul 15 18:22:55 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp	Thu Aug 19 09:41:07 2010 +0300
@@ -1130,9 +1130,21 @@
 void CPbk2NamesListFilteredState::CmdItemVisibilityChanged( TInt aCmdItemId, TBool aVisible ) 
     {
     TInt cmdItemIndex = FindCommand(aCmdItemId);
-    TRAP_IGNORE( HandleCommandEventL(
+    TInt cmdListBoxIndex = EnabledCommandCount();
+    if( aVisible )
+        {
+        cmdListBoxIndex--;
+        }
+    // Update the HiddenSelection property of the command items.
+    TListItemProperties prop( iListBox.ItemDrawer()->Properties(cmdListBoxIndex) );
+    prop.SetHiddenSelection(aVisible);
+    TRAP_IGNORE(        
+        iListBox.ItemDrawer()->SetPropertiesL(cmdListBoxIndex, prop);
+    
+        HandleCommandEventL(
                 (aVisible ? EItemAdded : EItemRemoved),
-                 cmdItemIndex) );		
+                 cmdItemIndex);
+        );		
     }
 
 // --------------------------------------------------------------------------
@@ -1217,4 +1229,21 @@
         }
     }
 
+// --------------------------------------------------------------------------
+// CPbk2NamesListFilteredState::EnabledCommandCount
+// --------------------------------------------------------------------------
+//  
+TInt CPbk2NamesListFilteredState::EnabledCommandCount() const
+    {
+    TInt result = 0;
+    for ( TInt i = 0; i < iCommandItems.Count(); ++i )
+        {
+        if(iCommandItems[i]->IsEnabled())
+            {
+            result++;
+            }
+        }
+    return result;    
+    }
+
 //  End of File