filemanager/App/src/CFileManagerFileListContainer.cpp
branchRCL_3
changeset 42 f5c50b8af68c
parent 39 65326cf895ed
child 52 40fb776cbfb3
equal deleted inserted replaced
39:65326cf895ed 42:f5c50b8af68c
   216         {
   216         {
   217         menuBar = enabledView->MenuBar();
   217         menuBar = enabledView->MenuBar();
   218         }
   218         }
   219     switch( aKeyEvent.iCode )
   219     switch( aKeyEvent.iCode )
   220         {
   220         {
   221         case EKeyEnter: // FALLTHROUH
       
   222         case EKeyOK:
       
   223             {
       
   224             if ( ( menuBar != NULL ) && menuBar->ItemSpecificCommandsEnabled() )
       
   225                 {
       
   226                 iAppUi->ProcessCommandL( EFileManagerSelectionKey );
       
   227                 response = EKeyWasConsumed;
       
   228                 }
       
   229             break;
       
   230             }
       
   231         case EKeyDelete:    // FALLTHROUGH
   221         case EKeyDelete:    // FALLTHROUGH
   232         case EKeyBackspace:
   222         case EKeyBackspace:
   233             {
   223             {
   234             if ( ( menuBar != NULL ) && menuBar->ItemSpecificCommandsEnabled() )
   224             TBool allowDelete ( ETrue );
       
   225 
       
   226             // If there are some items marked, 
       
   227             // delete will be executed on the marked items.
       
   228             if ( ListBoxSelectionIndexesCount() <= 0 )
       
   229                 {
       
   230                 // If no item is marked,
       
   231                 // first check whether there is any highlighted item.
       
   232                 if ( menuBar && menuBar->ItemSpecificCommandsEnabled() )
       
   233                     {
       
   234                     TInt index = SearchFieldToListIndex( ListBoxCurrentItemIndex() );
       
   235                     // Do not allow deleting folder while marking mode is activated.
       
   236                     if ( IsMarkingModeActivated() &&
       
   237                         iDocument->Engine().IsFolder( index ) ) 
       
   238                         {
       
   239                         allowDelete = EFalse;
       
   240                         } 
       
   241                     }
       
   242                 else
       
   243                     {
       
   244                     // Do not allow deleting any item without highlight if no item is marked
       
   245                     allowDelete = EFalse;
       
   246                     }
       
   247                 }
       
   248             
       
   249             if ( allowDelete )
   235                 {
   250                 {
   236                 iAppUi->ProcessCommandL( EFileManagerDelete );
   251                 iAppUi->ProcessCommandL( EFileManagerDelete );
       
   252                 // Marking mode is exited automatically only when command has
       
   253                 // been selected from the options menu or stylus popup menu.
       
   254                 // Therefore, deactivate marking mode manually in case exiting marking 
       
   255                 // mode is required after a key event is processed.
       
   256 
       
   257                 if ( IsMarkingModeActivated() && ExitMarkingMode() )
       
   258                     {
       
   259                     SetMarkingMode( EFalse );
       
   260                     }
   237                 response = EKeyWasConsumed;
   261                 response = EKeyWasConsumed;
   238                 }
   262                 }
   239             break;
   263             break;
   240             }
   264             }
   241         case EKeyLeftArrow: // FALLTHROUGH
   265         case EKeyLeftArrow: // FALLTHROUGH
   311     // Inform user about OOM, suppress other errors
   335     // Inform user about OOM, suppress other errors
   312     TInt err( iDocument->LastError() );
   336     TInt err( iDocument->LastError() );
   313     if ( err == KErrNoMemory )
   337     if ( err == KErrNoMemory )
   314         {
   338         {
   315         ControlEnv()->HandleError( KErrNoMemory );
   339         ControlEnv()->HandleError( KErrNoMemory );
   316         }
       
   317     }
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 // CFileManagerFileListContainer::HandleControlEventL
       
   321 // From MCoeControlObserver, called by current listbox
       
   322 // -----------------------------------------------------------------------------
       
   323 // 
       
   324 void CFileManagerFileListContainer::HandleControlEventL(
       
   325         CCoeControl* /* aControl*/, TCoeEvent aEventType )
       
   326     {
       
   327     if ( aEventType == EEventStateChanged )
       
   328         {
       
   329         iAppUi->ProcessCommandL( EFileManagerCheckMark ); // Inform change
       
   330         }
   340         }
   331     }
   341     }
   332 
   342 
   333 //-----------------------------------------------------------------------------
   343 //-----------------------------------------------------------------------------
   334 // CFileManagerFileListContainer::CItemDrawer::CItemDrawer
   344 // CFileManagerFileListContainer::CItemDrawer::CItemDrawer
   806         {
   816         {
   807         return EKeyWasNotConsumed;
   817         return EKeyWasNotConsumed;
   808         }
   818         }
   809     // Open search field on alpha digit        
   819     // Open search field on alpha digit        
   810     TBool isVisible( iSearchField->IsVisible() );
   820     TBool isVisible( iSearchField->IsVisible() );
       
   821     // Do not allow activate find pane while marking model is already
       
   822     // activated
   811     if ( !isVisible &&
   823     if ( !isVisible &&
   812          aType == EEventKeyDown &&
   824          aType == EEventKeyDown &&
   813          aKeyEvent.iScanCode )
   825          aKeyEvent.iScanCode != 0 &&
       
   826          !IsMarkingModeActivated() )
   814         {
   827         {
   815         TChar ch( aKeyEvent.iScanCode );
   828         TChar ch( aKeyEvent.iScanCode );
   816         if ( ch.IsAlphaDigit() )
   829         if ( ch.IsAlphaDigit() )
   817             {
   830             {
   818             EnableSearchFieldL( ETrue );
   831             EnableSearchFieldL( ETrue );
   887        {
   900        {
   888        return 0;
   901        return 0;
   889        }
   902        }
   890     return SearchFieldToListIndex( aIndex );
   903     return SearchFieldToListIndex( aIndex );
   891     }
   904     }
   892 //  End of File  
   905 
       
   906 //  End of File