uifw/EikStd/coctlsrc/EIKLBX.CPP
branchRCL_3
changeset 51 fcdfafb36fe7
parent 50 a1caeb42b3a3
child 55 aecbbf00d063
--- a/uifw/EikStd/coctlsrc/EIKLBX.CPP	Thu Jul 15 18:56:19 2010 +0300
+++ b/uifw/EikStd/coctlsrc/EIKLBX.CPP	Thu Aug 19 10:11:06 2010 +0300
@@ -1046,9 +1046,10 @@
     if ( aExtensionId == MAknMarkingCollection::TYPE )
         {
         a0 = static_cast<MAknMarkingCollection*>( this );
-        }
-
-    return KErrNone;
+        return KErrNone;
+        }
+
+    return KErrNotFound;
     }
 
 
@@ -1115,7 +1116,7 @@
         if ( index >= 0 && 
                 !iListBox.iItemDrawer->Properties( index ).IsSelectionHidden() )
             {
-            iListBox.View()->SelectItemL( iListBox.CurrentItemIndex() );
+            iListBox.View()->SelectItemL( index );
             }
         }
     _AKNTRACE_FUNC_EXIT;
@@ -1129,16 +1130,11 @@
 void CListBoxExt::MarkAllL()
     {
     _AKNTRACE_FUNC_ENTER;
-
-    if ( iListBox.MarkingMode() )
-        {       
-        for ( TInt i = 0; i < iListBox.Model()->NumberOfItems(); ++i )
-            {
-            if ( !iListBox.iItemDrawer->Properties( i ).IsSelectionHidden() )
-                {
-                iListBox.View()->SelectItemL( i );
-                }
-            }
+    
+    if ( iListBox.MarkingMode() && 
+            iListBox.Model()->NumberOfItems() > 0 )
+        {               
+        iListBox.View()->SelectAllL( ETrue );   
         }
     _AKNTRACE_FUNC_EXIT;
     }
@@ -1190,7 +1186,6 @@
     iLongTappedItem = iLastDownTappedItem;
     iLastDownTappedItem = KErrNotFound;
     iItemActionMenu->ShowMenuL( aPenEventScreenLocation, 0 );
-    IgnorePointerEventsUntilUp();
     iOldWinPos = iListBox.DrawableWindow()->OrdinalPosition();
     _AKNTRACE_FUNC_EXIT;
     }
@@ -3421,9 +3416,13 @@
     iView->ClearFlags(CListBoxView::EItemCountModified);
 
 
-    if ( iListBoxExt && iListBoxExt->iLongTappedItem != KErrNotFound )
-        {
-        iListBoxExt->EnableHighlight( EFalse );
+    if ( iListBoxExt->iItemActionMenu &&
+         iListBoxExt->iLongTappedItem != KErrNotFound )
+        {
+        // Item action menu is being shown and it needs to be closed when
+        // items are added or removed to the list array, otherwise the
+        // item specific commands may be targeted to the wrong item. 
+        iListBoxExt->iItemActionMenu->HideMenu();
         }
 
     FireItemChange();
@@ -3508,7 +3507,7 @@
     {
     _AKNTRACE_FUNC_ENTER;
     __ASSERT_DEBUG( iView, Panic( EEikPanicListBoxNoView ) );
-    //fix the bug EGGO-7SQA4S and EVSG-7TD9WZ     
+
     TInt curItemIndex = iView->CurrentItemIndex();
     if(curItemIndex >= 0 && curItemIndex < iModel->NumberOfItems() )
       {
@@ -3516,8 +3515,7 @@
       iView->SetTopItemIndex( newTopItemIndex );
       }
     iView->SetFlags(CListBoxView::EItemCountModified);
-    // following breaks lists in square layout, not needed in SERIES60?
-    //iView->CalcDataWidth();
+
     iView->CalcBottomItemIndex();
     UpdateScrollBarsL();
     UpdateScrollBarThumbs();
@@ -3527,7 +3525,7 @@
     FireItemChange();
     
     if ( iListBoxExt )
-        {    
+        {
         iListBoxExt->CheckScrollBarVisibility();
         // Physics engine world size needs to be updated here, otherwise aknphysics 
         // cone observer may block pointer events on new items. this can happen 
@@ -3536,7 +3534,17 @@
             {
             iListBoxExt->InitPhysicsL();
             }
-        }     
+        
+        if ( iListBoxExt->iItemActionMenu &&
+             iListBoxExt->iLongTappedItem != KErrNotFound )
+            {
+            // Item action menu is being shown and it needs to be closed when
+            // items are added or removed to the list array, otherwise the
+            // item specific commands may be targeted to the wrong item. 
+            iListBoxExt->iItemActionMenu->HideMenu();
+            }
+        }
+
     _AKNTRACE_FUNC_EXIT;
     }
 
@@ -5157,7 +5165,8 @@
             _AKNTRACE("TPointerEvent::EButton1Down");
             // For drag outside listbox
             iListBoxExt->iIsDownOnItem = pointerIsOverAnItem;
-            iListBoxExt->iLastPoint = pointerPos;
+            iListBoxExt->iLastPoint = pointerPos;            
+			iListBoxExt->iLongTappedItem = KErrNotFound;
 
             // update index of the last down tapped item
             iListBoxExt->iLastDownTappedItem = itemIndex;
@@ -6889,8 +6898,12 @@
 
     TBool blockEvent = EFalse;
     
-    TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) && !iListBoxExt->iScrollingDisabled );
-
+    // If tap down in listbox area, kinetic scrolling is enabled and style popup menu is not shown,
+    // drag event is sent to listbox.
+    TBool allowDragEvent( ( iListBoxFlags & ELeftDownInViewRect ) 
+            && !iListBoxExt->iScrollingDisabled 
+            && ( iListBoxExt->iSingleClickEnabled 
+                    && iListBoxExt->iLongTappedItem == KErrNotFound ) );
     
     switch ( aPointerEvent.iType )
         {