uifw/AvKon/aknhlist/src/akntreelistphysicshandler.cpp
branchRCL_3
changeset 3 8ca85d2f0db7
parent 0 2f259fa3e83a
child 6 9f56a4e1b8ab
--- a/uifw/AvKon/aknhlist/src/akntreelistphysicshandler.cpp	Tue Feb 02 01:00:49 2010 +0200
+++ b/uifw/AvKon/aknhlist/src/akntreelistphysicshandler.cpp	Fri Feb 19 23:04:46 2010 +0200
@@ -113,6 +113,38 @@
         _AKNTRACE_FUNC_EXIT;
 	    return;
         }
+     
+    TBool listEmpty = iTree->VisibleItemCount() > 0 ? EFalse : ETrue;
+    TBool eventSent = EFalse;
+    
+    // empty area events
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Up
+             && PointerOnEmptyArea( aPointerEvent.iPosition ) )
+        {
+        if ( listEmpty )
+            {
+            // no items, empty list was clicked
+            iTreeListView->ReportTreeListEvent( 
+                        MAknTreeListObserver::EEmptyListClicked,
+                        KAknTreeIIDNone );
+            eventSent = ETrue;
+            }
+        else if ( iDownOnEmptyArea )
+            {
+            // items exist, empty list area was clicked
+            iTreeListView->ReportTreeListEvent( 
+                        MAknTreeListObserver::EEmptyAreaClicked,
+                        KAknTreeIIDNone );
+            eventSent = ETrue;
+            }
+        }
+    
+    if ( listEmpty || eventSent )
+        {
+        // return always if list is empty or if empty area event was sent
+        _AKNTRACE_FUNC_EXIT;
+        return;
+        }   
     
     // Panning/flicking logic    
 
@@ -160,8 +192,8 @@
             {
             iTree->EnableMarquee( EFalse );
             }
-           
-        iEmptyAreaClicked = EmptyAreaClicked( aPointerEvent.iPosition ); 
+            
+        iDownOnEmptyArea = PointerOnEmptyArea( aPointerEvent.iPosition );
         }
     
     // EDrag    
@@ -181,8 +213,9 @@
                 }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
 
-            iPanningActivated = ETrue;
-            iEmptyAreaClicked = EFalse;        
+            iPanningActivated = ETrue;   
+            iDownOnEmptyArea = EFalse;
+  
             
             iHighlightTimer->Cancel();
             iItemToBeFocused = NULL;
@@ -321,23 +354,7 @@
             {
             iTreeListView->SelectItem( iItemToBeSelected );
             iItemToBeSelected = NULL;
-            }
-
-        if ( iItemToBeSelected == NULL && iEmptyAreaClicked )
-            {
-            if ( iTree->VisibleItemCount() > 0 )
-                {
-                iTreeListView->ReportTreeListEvent( 
-                            MAknTreeListObserver::EEmptyAreaClicked,
-                            KAknTreeIIDNone );
-                }
-            else
-                {
-                iTreeListView->ReportTreeListEvent( 
-                            MAknTreeListObserver::EEmptyListClicked,
-                            KAknTreeIIDNone );                
-                }
-            }       
+            }      
         }
     
     // Item handling logic    
@@ -1136,11 +1153,11 @@
 
 
 // ---------------------------------------------------------------------------
-// CAknTreeListPhysicsHandler::EmptyAreaClicked
+// CAknTreeListPhysicsHandler::PointerOnEmptyArea
 // ---------------------------------------------------------------------------
 //
-TBool CAknTreeListPhysicsHandler::EmptyAreaClicked( TPoint aPosition )
-    { 
+TBool CAknTreeListPhysicsHandler::PointerOnEmptyArea( TPoint aPosition )
+    {        
     if ( aPosition.iY <= WorldHeight() )
         {
         return EFalse;