filemanager/App/src/CFileManagerFileListContainer.cpp
branchRCL_3
changeset 22 f5c50b8af68c
parent 21 65326cf895ed
--- a/filemanager/App/src/CFileManagerFileListContainer.cpp	Wed Sep 01 12:31:07 2010 +0100
+++ b/filemanager/App/src/CFileManagerFileListContainer.cpp	Tue Sep 14 20:57:31 2010 +0300
@@ -218,22 +218,46 @@
         }
     switch( aKeyEvent.iCode )
         {
-        case EKeyEnter: // FALLTHROUH
-        case EKeyOK:
-            {
-            if ( ( menuBar != NULL ) && menuBar->ItemSpecificCommandsEnabled() )
-                {
-                iAppUi->ProcessCommandL( EFileManagerSelectionKey );
-                response = EKeyWasConsumed;
-                }
-            break;
-            }
         case EKeyDelete:    // FALLTHROUGH
         case EKeyBackspace:
             {
-            if ( ( menuBar != NULL ) && menuBar->ItemSpecificCommandsEnabled() )
+            TBool allowDelete ( ETrue );
+
+            // If there are some items marked, 
+            // delete will be executed on the marked items.
+            if ( ListBoxSelectionIndexesCount() <= 0 )
+                {
+                // If no item is marked,
+                // first check whether there is any highlighted item.
+                if ( menuBar && menuBar->ItemSpecificCommandsEnabled() )
+                    {
+                    TInt index = SearchFieldToListIndex( ListBoxCurrentItemIndex() );
+                    // Do not allow deleting folder while marking mode is activated.
+                    if ( IsMarkingModeActivated() &&
+                        iDocument->Engine().IsFolder( index ) ) 
+                        {
+                        allowDelete = EFalse;
+                        } 
+                    }
+                else
+                    {
+                    // Do not allow deleting any item without highlight if no item is marked
+                    allowDelete = EFalse;
+                    }
+                }
+            
+            if ( allowDelete )
                 {
                 iAppUi->ProcessCommandL( EFileManagerDelete );
+                // Marking mode is exited automatically only when command has
+                // been selected from the options menu or stylus popup menu.
+                // Therefore, deactivate marking mode manually in case exiting marking 
+                // mode is required after a key event is processed.
+
+                if ( IsMarkingModeActivated() && ExitMarkingMode() )
+                    {
+                    SetMarkingMode( EFalse );
+                    }
                 response = EKeyWasConsumed;
                 }
             break;
@@ -316,20 +340,6 @@
         }
     }
 
-// -----------------------------------------------------------------------------
-// CFileManagerFileListContainer::HandleControlEventL
-// From MCoeControlObserver, called by current listbox
-// -----------------------------------------------------------------------------
-// 
-void CFileManagerFileListContainer::HandleControlEventL(
-        CCoeControl* /* aControl*/, TCoeEvent aEventType )
-    {
-    if ( aEventType == EEventStateChanged )
-        {
-        iAppUi->ProcessCommandL( EFileManagerCheckMark ); // Inform change
-        }
-    }
-
 //-----------------------------------------------------------------------------
 // CFileManagerFileListContainer::CItemDrawer::CItemDrawer
 //-----------------------------------------------------------------------------
@@ -808,9 +818,12 @@
         }
     // Open search field on alpha digit        
     TBool isVisible( iSearchField->IsVisible() );
+    // Do not allow activate find pane while marking model is already
+    // activated
     if ( !isVisible &&
          aType == EEventKeyDown &&
-         aKeyEvent.iScanCode )
+         aKeyEvent.iScanCode != 0 &&
+         !IsMarkingModeActivated() )
         {
         TChar ch( aKeyEvent.iScanCode );
         if ( ch.IsAlphaDigit() )
@@ -889,4 +902,5 @@
        }
     return SearchFieldToListIndex( aIndex );
     }
-//  End of File  
+
+//  End of File