filebrowser/src/FBFileListView.cpp
branchRCL_3
changeset 22 fad26422216a
parent 0 d6fe6244b863
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <aknViewAppUi.h>
       
    21 #include <avkon.hrh>
       
    22 #include <apgtask.h>
       
    23 #include <aknmessagequerydialog.h> 
       
    24 #include <remconinterfaceselector.h>
       
    25 #include <remconcoreapitarget.h>
       
    26 
       
    27 #include <filebrowser.rsg>
       
    28 #include "FB.hrh"
       
    29 #include "FBFileListView.h"
       
    30 #include "FBFileListContainer.h"
       
    31 #include "FBDocument.h" 
       
    32 #include "FBModel.h"
       
    33 #include "FBFileUtils.h"
       
    34 
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // ---------------------------------------------------------
       
    39 // CFileBrowserFileListView::ConstructL(const TRect& aRect)
       
    40 // EPOC two-phased constructor
       
    41 // ---------------------------------------------------------
       
    42 //
       
    43 void CFileBrowserFileListView::ConstructL()
       
    44     {
       
    45     BaseConstructL( R_FILEBROWSER_VIEW_FILELIST );
       
    46     iModel = static_cast<CFileBrowserDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
       
    47     
       
    48     iRemConSelector = CRemConInterfaceSelector::NewL();
       
    49     iRemConTarget = CRemConCoreApiTarget::NewL(*iRemConSelector, *this);
       
    50     iRemConSelector->OpenTargetL();
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------
       
    54 // CFileBrowserFileListView::~CFileBrowserFileListView()
       
    55 // ?implementation_description
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 CFileBrowserFileListView::~CFileBrowserFileListView()
       
    59     {
       
    60     delete iRemConSelector;
       
    61 
       
    62     if ( iContainer )
       
    63         {
       
    64         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    65         }
       
    66 
       
    67     delete iContainer;
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------
       
    71 // TUid CFileBrowserFileListView::Id()
       
    72 // ?implementation_description
       
    73 // ---------------------------------------------------------
       
    74 //
       
    75 TUid CFileBrowserFileListView::Id() const
       
    76     {
       
    77     return KFileListViewUID;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------
       
    81 // TUid CFileBrowserFileListView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
    82 // ?implementation_description
       
    83 // ---------------------------------------------------------
       
    84 //
       
    85 
       
    86 void CFileBrowserFileListView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
    87     {
       
    88     TBool emptyListBox = iContainer->ListBoxNumberOfVisibleItems() == 0;
       
    89     TBool driveListActive = iModel->FileUtils()->IsDriveListViewActive();
       
    90     TBool normalModeActive = iModel->FileUtils()->IsNormalModeActive();
       
    91     TBool currentDriveReadOnly = iModel->FileUtils()->IsCurrentDriveReadOnly();
       
    92     TBool currentItemDirectory = iModel->FileUtils()->IsCurrentItemDirectory();
       
    93     TBool listBoxSelections = iContainer->ListBoxSelectionIndexesCount() == 0;
       
    94     TBool emptyClipBoard = iModel->FileUtils()->ClipBoardList()->Count() == 0;
       
    95     TBool showSnapShot = iModel->FileUtils()->DriveSnapShotPossible();
       
    96     
       
    97     TBool hideEditMenu(EFalse);
       
    98     if (driveListActive)
       
    99         {
       
   100         if (!showSnapShot || emptyListBox && emptyClipBoard)
       
   101             hideEditMenu = ETrue;    
       
   102         else
       
   103             hideEditMenu = EFalse;
       
   104         }
       
   105     else
       
   106         {
       
   107         if (emptyListBox && emptyClipBoard)
       
   108             hideEditMenu = ETrue;    
       
   109         else
       
   110             hideEditMenu = EFalse;
       
   111         }
       
   112     
       
   113 
       
   114     if (aResourceId == R_FILEBROWSER_VIEW_FILELIST_MENU)
       
   115 	    {
       
   116         aMenuPane->SetItemDimmed(EFileBrowserCmdEdit, hideEditMenu);
       
   117         aMenuPane->SetItemDimmed(EFileBrowserCmdDiskAdmin, !driveListActive);
       
   118 	    }    
       
   119 
       
   120     else if (aResourceId == R_FILEBROWSER_FILE_SUBMENU)
       
   121 	    {
       
   122         aMenuPane->SetItemDimmed(EFileBrowserCmdFileBack, driveListActive);
       
   123         aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, emptyListBox || driveListActive || currentItemDirectory);
       
   124         aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpenDrive, emptyListBox || !driveListActive);
       
   125         aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpenDirectory, emptyListBox || driveListActive || !currentItemDirectory);
       
   126         aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive);
       
   127         aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive);
       
   128         aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, emptyListBox || driveListActive || currentItemDirectory);
       
   129         aMenuPane->SetItemDimmed(EFileBrowserCmdFileNew, driveListActive || currentDriveReadOnly);
       
   130         aMenuPane->SetItemDimmed(EFileBrowserCmdFileDelete, emptyListBox || driveListActive || currentDriveReadOnly);
       
   131         aMenuPane->SetItemDimmed(EFileBrowserCmdFileRename, emptyListBox || driveListActive || currentDriveReadOnly || !listBoxSelections);
       
   132         aMenuPane->SetItemDimmed(EFileBrowserCmdFileTouch, emptyListBox || driveListActive || currentDriveReadOnly);
       
   133         aMenuPane->SetItemDimmed(EFileBrowserCmdFileProperties, emptyListBox || !listBoxSelections);
       
   134         aMenuPane->SetItemDimmed(EFileBrowserCmdFileChecksums, emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive);
       
   135         aMenuPane->SetItemDimmed(EFileBrowserCmdFileSetAttributes, emptyListBox || driveListActive || currentDriveReadOnly);
       
   136         aMenuPane->SetItemDimmed(EFileBrowserCmdFileCompress, currentDriveReadOnly || emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive);
       
   137         aMenuPane->SetItemDimmed(EFileBrowserCmdFileDecompress, currentDriveReadOnly || emptyListBox || !listBoxSelections || currentItemDirectory || driveListActive);
       
   138 	    }
       
   139     
       
   140     else if (aResourceId == R_FILEBROWSER_EDIT_SUBMENU)
       
   141 	    {
       
   142         TBool currentSelected = iContainer->ListBox()->View()->ItemIsSelected(iContainer->ListBox()->View()->CurrentItemIndex());
       
   143         TBool allSelected = iContainer->ListBox()->SelectionIndexes()->Count() == iContainer->ListBox()->Model()->NumberOfItems();
       
   144         TBool noneSelected = iContainer->ListBox()->SelectionIndexes()->Count() == 0;
       
   145         
       
   146         aMenuPane->SetItemDimmed(EFileBrowserCmdSnapShot, !driveListActive);
       
   147         aMenuPane->SetItemDimmed(EFileBrowserCmdEditCut, driveListActive || currentDriveReadOnly || emptyListBox);
       
   148         aMenuPane->SetItemDimmed(EFileBrowserCmdEditCopy, driveListActive || emptyListBox);
       
   149         aMenuPane->SetItemDimmed(EFileBrowserCmdEditPaste, driveListActive || emptyClipBoard || currentDriveReadOnly);
       
   150         aMenuPane->SetItemDimmed(EFileBrowserCmdEditCopyToFolder, driveListActive || emptyListBox);
       
   151         aMenuPane->SetItemDimmed(EFileBrowserCmdEditMoveToFolder, driveListActive || currentDriveReadOnly || emptyListBox);
       
   152         aMenuPane->SetItemDimmed(EFileBrowserCmdEditSelect, driveListActive || currentSelected || emptyListBox);
       
   153         aMenuPane->SetItemDimmed(EFileBrowserCmdEditUnselect, driveListActive || !currentSelected || emptyListBox);
       
   154         aMenuPane->SetItemDimmed(EFileBrowserCmdEditSelectAll, driveListActive || allSelected || emptyListBox);
       
   155         aMenuPane->SetItemDimmed(EFileBrowserCmdEditUnselectAll, driveListActive || noneSelected || emptyListBox);
       
   156 	    }
       
   157 
       
   158 	else if (aResourceId == R_FILEBROWSER_VIEW_SUBMENU)
       
   159 	    {
       
   160         aMenuPane->SetItemDimmed(EFileBrowserCmdViewSort, !normalModeActive || driveListActive || emptyListBox);
       
   161         aMenuPane->SetItemDimmed(EFileBrowserCmdViewOrder, !normalModeActive || driveListActive || emptyListBox);
       
   162         aMenuPane->SetItemDimmed(EFileBrowserCmdViewRefresh, !normalModeActive);
       
   163         aMenuPane->SetItemDimmed(EFileBrowserCmdViewFilterEntries, emptyListBox);
       
   164 	    }
       
   165 
       
   166 	else if (aResourceId == R_FILEBROWSER_VIEW_SORT_SUBMENU)
       
   167 	    {
       
   168         aMenuPane->SetItemButtonState(iModel->FileUtils()->SortMode(), EEikMenuItemSymbolOn);
       
   169 	    }
       
   170 
       
   171 	else if (aResourceId == R_FILEBROWSER_VIEW_ORDER_SUBMENU)
       
   172 	    {
       
   173         aMenuPane->SetItemButtonState(iModel->FileUtils()->OrderMode(), EEikMenuItemSymbolOn);
       
   174 	    }
       
   175 
       
   176 	else if (aResourceId == R_FILEBROWSER_TOOLS_SUBMENU)
       
   177 	    {
       
   178 	    TBool noLocalCon = !iModel->FileUtils()->FileExists(KIRAppPath) && !iModel->FileUtils()->FileExists(KBTAppPath) && !iModel->FileUtils()->FileExists(KUSBAppPath);
       
   179 	    
       
   180         aMenuPane->SetItemDimmed(EFileBrowserCmdToolsDisableExtErrors, !iModel->FileUtils()->FileExists(KErrRdPath));
       
   181         aMenuPane->SetItemDimmed(EFileBrowserCmdToolsEnableExtErrors, iModel->FileUtils()->FileExists(KErrRdPath));
       
   182         aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivity, noLocalCon);
       
   183 	    }
       
   184 
       
   185 	else if (aResourceId == R_FILEBROWSER_TOOLS_LOCALCONNECTIVITY_SUBMENU)
       
   186 	    {
       
   187         aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivityActivateInfrared, !iModel->FileUtils()->FileExists(KIRAppPath));
       
   188         aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivityLaunchBTUI, !iModel->FileUtils()->FileExists(KBTAppPath));
       
   189         aMenuPane->SetItemDimmed(EFileBrowserCmdToolsLocalConnectivityLaunchUSBUI, !iModel->FileUtils()->FileExists(KUSBAppPath));
       
   190 	    }	    
       
   191     else
       
   192         {
       
   193         AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
       
   194         }
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------
       
   198 // CFileBrowserFileListView::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct)
       
   199 // Used to handle multimedia keys
       
   200 // ---------------------------------------------------------
       
   201 //
       
   202 
       
   203 void CFileBrowserFileListView::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction /*aButtonAct*/)
       
   204     {
       
   205     switch(aOperationId)
       
   206         {
       
   207         case ERemConCoreApiVolumeUp:
       
   208             {
       
   209             // simulate a keyevent, so that it can be handled as all other key events
       
   210             TKeyEvent keyEvent;
       
   211             keyEvent.iCode = EKeyIncVolume;
       
   212             keyEvent.iScanCode = 0;
       
   213             keyEvent.iModifiers = 0;
       
   214             keyEvent.iRepeats = 0;
       
   215             
       
   216             //TRAP_IGNORE( iContainer->OfferKeyEventL(keyEvent, EEventKey) );
       
   217             
       
   218             //RWsSession& wsSession=iCoeEnv->WsSession();
       
   219             //wsSession.SimulateKeyEvent(keyEvent);
       
   220             //wsSession.Flush();
       
   221 
       
   222             iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyDown);
       
   223             iCoeEnv->SimulateKeyEventL(keyEvent,EEventKey);
       
   224             iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyUp);
       
   225             
       
   226             break;
       
   227             }
       
   228         case ERemConCoreApiVolumeDown:
       
   229             {
       
   230             // simulate a keyevent, so that it can be handled as all other key events
       
   231             TKeyEvent keyEvent;
       
   232             keyEvent.iCode = EKeyDecVolume;
       
   233             keyEvent.iScanCode = 0;
       
   234             keyEvent.iModifiers = 0;
       
   235             keyEvent.iRepeats = 0;
       
   236                         
       
   237             //TRAP_IGNORE( iContainer->OfferKeyEventL(keyEvent, EEventKey) );
       
   238             
       
   239             //RWsSession& wsSession=iCoeEnv->WsSession();
       
   240             //wsSession.SimulateKeyEvent(keyEvent);
       
   241             //wsSession.Flush();
       
   242             
       
   243             iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyDown);
       
   244             iCoeEnv->SimulateKeyEventL(keyEvent,EEventKey);
       
   245             iCoeEnv->SimulateKeyEventL(keyEvent,EEventKeyUp);
       
   246             
       
   247             break;
       
   248             }
       
   249         }
       
   250     }
       
   251 
       
   252   
       
   253 // ---------------------------------------------------------
       
   254 // CFileBrowserFileListView::HandleCommandL(TInt aCommand)
       
   255 // ?implementation_description
       
   256 // ---------------------------------------------------------
       
   257 //
       
   258 void CFileBrowserFileListView::HandleCommandL(TInt aCommand)
       
   259     {   
       
   260     switch ( aCommand )
       
   261         {
       
   262 
       
   263         case EFileBrowserCmdFileBack:
       
   264             {
       
   265             iModel->FileUtils()->MoveUpOneLevelL();
       
   266             break;
       
   267             }
       
   268                     
       
   269         case EFileBrowserCmdFileOpenApparc:
       
   270             {
       
   271             iModel->FileUtils()->OpenWithApparcL();
       
   272             break;
       
   273             }
       
   274 
       
   275         case EFileBrowserCmdFileOpenDocHandlerEmbed:
       
   276             {
       
   277             iModel->FileUtils()->OpenWithDocHandlerL(ETrue);
       
   278             break;
       
   279             }
       
   280 
       
   281         case EFileBrowserCmdFileOpenDocHandlerStandAlone:
       
   282             {
       
   283             iModel->FileUtils()->OpenWithDocHandlerL(EFalse);
       
   284             break;
       
   285             }
       
   286 
       
   287         case EFileBrowserCmdFileOpenFileService:
       
   288             {
       
   289             iModel->FileUtils()->OpenWithFileServiceL();
       
   290             break;
       
   291             }
       
   292             
       
   293         case EFileBrowserCmdFileOpenDrive:
       
   294         case EFileBrowserCmdFileOpenDirectory:
       
   295             {
       
   296             iModel->FileUtils()->MoveDownToDirectoryL();
       
   297             break;
       
   298             }
       
   299 
       
   300         case EFileBrowserCmdFileViewText:
       
   301         case EFileBrowserCmdFileViewHex:
       
   302         case EFileBrowserCmdFileEditText:
       
   303         case EFileBrowserCmdFileEditHex:
       
   304             {
       
   305             iModel->FileUtils()->FileEditorL(aCommand);
       
   306             break;
       
   307             }
       
   308 
       
   309         case EFileBrowserCmdFileSearch:
       
   310             {
       
   311             iModel->FileListContainer()->HideToolbar();
       
   312             iModel->FileUtils()->SearchL();
       
   313             break;
       
   314             }
       
   315 
       
   316         case EFileBrowserCmdFileSendTo:
       
   317             {
       
   318             iModel->FileUtils()->SendToL();
       
   319             break;
       
   320             }
       
   321 
       
   322         case EFileBrowserCmdFileNewFile:
       
   323             {
       
   324             iModel->FileUtils()->NewFileL();
       
   325             break;
       
   326             }
       
   327 
       
   328         case EFileBrowserCmdFileNewDirectory:
       
   329             {
       
   330             iModel->FileUtils()->NewDirectoryL();
       
   331             break;
       
   332             }
       
   333 
       
   334         case EFileBrowserCmdFileDelete:
       
   335             {
       
   336             iModel->FileUtils()->DeleteL();
       
   337             break;
       
   338             }
       
   339 
       
   340         case EFileBrowserCmdFileRename:
       
   341             {
       
   342             iModel->FileUtils()->RenameL();
       
   343             break;
       
   344             }
       
   345 
       
   346         case EFileBrowserCmdFileTouch:
       
   347             {
       
   348             iModel->FileUtils()->TouchL();
       
   349             break;
       
   350             }
       
   351 
       
   352         case EFileBrowserCmdFileProperties:
       
   353             {
       
   354             iModel->FileUtils()->PropertiesL();
       
   355             break;
       
   356             }
       
   357 
       
   358         case EFileBrowserCmdFileChecksumsMD5:
       
   359         case EFileBrowserCmdFileChecksumsMD2:
       
   360         case EFileBrowserCmdFileChecksumsSHA1:
       
   361             {
       
   362             iModel->FileUtils()->ShowFileCheckSumsL(aCommand);
       
   363             break;
       
   364             }
       
   365             
       
   366         case EFileBrowserCmdFileSetAttributes:
       
   367             {
       
   368             iModel->FileListContainer()->HideToolbar();
       
   369             iModel->FileUtils()->SetAttributesL();
       
   370             break;
       
   371             }
       
   372 
       
   373         case EFileBrowserCmdFileCompress:
       
   374             {
       
   375             iModel->FileUtils()->CompressL();
       
   376             break;
       
   377             }
       
   378 
       
   379         case EFileBrowserCmdFileDecompress:
       
   380             {
       
   381             iModel->FileUtils()->DecompressL();
       
   382             break;
       
   383             }
       
   384 ///        
       
   385         case EFileBrowserCmdSnapShot:
       
   386             {
       
   387             iModel->FileUtils()->DriveSnapShotL();
       
   388             break;
       
   389             }
       
   390             
       
   391         case EFileBrowserCmdEditCut:
       
   392             {
       
   393             iModel->FileUtils()->ClipboardCutL();
       
   394             break;
       
   395             }
       
   396 
       
   397         case EFileBrowserCmdEditCopy:
       
   398             {
       
   399             iModel->FileUtils()->ClipboardCopyL();
       
   400             break;
       
   401             }
       
   402 
       
   403         case EFileBrowserCmdEditPaste:
       
   404             {
       
   405             iModel->FileUtils()->ClipboardPasteL();
       
   406             break;
       
   407             }
       
   408 
       
   409         case EFileBrowserCmdEditCopyToFolder:
       
   410             {
       
   411             iModel->FileUtils()->CopyToFolderL();
       
   412             break;
       
   413             }
       
   414 
       
   415         case EFileBrowserCmdEditMoveToFolder:
       
   416             {
       
   417             iModel->FileUtils()->CopyToFolderL(ETrue);
       
   418             break;
       
   419             }            
       
   420 
       
   421         case EFileBrowserCmdEditSelect:
       
   422             {
       
   423             iModel->FileListContainer()->UpdateToolbar();
       
   424             AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdMark, iContainer->ListBox() );
       
   425             break;
       
   426             }
       
   427 
       
   428         case EFileBrowserCmdEditUnselect:
       
   429             {
       
   430             iModel->FileListContainer()->UpdateToolbar();
       
   431             AknSelectionService::HandleMarkableListProcessCommandL( EAknCmdUnmark, iContainer->ListBox() );
       
   432             break;
       
   433             }
       
   434 
       
   435         case EFileBrowserCmdEditSelectAll:
       
   436             {
       
   437             iModel->FileListContainer()->UpdateToolbar();
       
   438             AknSelectionService::HandleMarkableListProcessCommandL( EAknMarkAll, iContainer->ListBox() );
       
   439             break;
       
   440             }
       
   441             
       
   442         case EFileBrowserCmdEditUnselectAll:
       
   443             {
       
   444             iModel->FileListContainer()->UpdateToolbar();
       
   445             AknSelectionService::HandleMarkableListProcessCommandL( EAknUnmarkAll, iContainer->ListBox() );
       
   446             break;
       
   447             }
       
   448 ///
       
   449         case EFileBrowserCmdViewSortByName:
       
   450         case EFileBrowserCmdViewSortByExtension:
       
   451         case EFileBrowserCmdViewSortByDate:
       
   452         case EFileBrowserCmdViewSortBySize:
       
   453             {
       
   454             iModel->FileUtils()->SetSortModeL(aCommand);
       
   455             break;
       
   456             }
       
   457 
       
   458         case EFileBrowserCmdViewOrderAscending:
       
   459         case EFileBrowserCmdViewOrderDescending:
       
   460             {
       
   461             iModel->FileUtils()->SetOrderModeL(aCommand);
       
   462             break;
       
   463             }
       
   464 	
       
   465         case EFileBrowserCmdViewFilterEntries:
       
   466             {
       
   467             iContainer->EnableSearchFieldL();
       
   468             break;
       
   469             }
       
   470 
       
   471         case EFileBrowserCmdViewRefresh:
       
   472             {
       
   473             iModel->FileUtils()->RefreshViewL();
       
   474             break;
       
   475             }
       
   476 ///
       
   477         case EFileBrowserCmdDiskAdminSetDrivePassword:
       
   478             {
       
   479             iModel->FileUtils()->SetDrivePasswordL();
       
   480             break;
       
   481             }
       
   482 
       
   483         case EFileBrowserCmdDiskAdminUnlockDrive:
       
   484             {
       
   485             iModel->FileUtils()->UnlockDriveL();
       
   486             break;
       
   487             }
       
   488 
       
   489         case EFileBrowserCmdDiskAdminClearDrivePassword:
       
   490             {
       
   491             iModel->FileUtils()->ClearDrivePasswordL();
       
   492             break;
       
   493             }
       
   494 
       
   495         case EFileBrowserCmdDiskAdminEraseDrivePassword:
       
   496             {
       
   497             iModel->FileUtils()->EraseDrivePasswordL();
       
   498             break;
       
   499             }
       
   500 
       
   501         case EFileBrowserCmdDiskAdminFormatDrive:
       
   502             {
       
   503             iModel->FileUtils()->FormatDriveL(EFalse);
       
   504             break;
       
   505             }
       
   506 
       
   507         case EFileBrowserCmdDiskAdminQuickFormatDrive:
       
   508             {
       
   509             iModel->FileUtils()->FormatDriveL(ETrue);
       
   510             break;
       
   511             }
       
   512 
       
   513         case EFileBrowserCmdDiskAdminCheckDisk:
       
   514             {
       
   515             iModel->FileUtils()->CheckDiskL();
       
   516             break;
       
   517             }
       
   518 
       
   519         case EFileBrowserCmdDiskAdminScanDrive:
       
   520             {
       
   521             iModel->FileUtils()->ScanDriveL();
       
   522             break;
       
   523             }
       
   524 
       
   525         case EFileBrowserCmdDiskAdminSetDriveName:
       
   526             {
       
   527             iModel->FileUtils()->SetDriveNameL();
       
   528             break;
       
   529             }
       
   530 
       
   531         case EFileBrowserCmdDiskAdminSetDriveVolumeLabel:
       
   532             {
       
   533             iModel->FileUtils()->SetDriveVolumeLabelL();
       
   534             break;
       
   535             }
       
   536 
       
   537         case EFileBrowserCmdDiskAdminEjectDrive:
       
   538             {
       
   539             iModel->FileUtils()->EjectDriveL();
       
   540             break;
       
   541             }
       
   542             
       
   543         case EFileBrowserCmdDiskAdminDismountFileSystem:
       
   544             {
       
   545             iModel->FileUtils()->DismountFileSystemL();
       
   546             break;
       
   547             }
       
   548             
       
   549         case EFileBrowserCmdDiskAdminEraseMBR:
       
   550             {
       
   551             iModel->FileUtils()->EraseMBRL();
       
   552             break;
       
   553             }
       
   554             
       
   555         case EFileBrowserCmdDiskAdminDrivePartition:
       
   556             {
       
   557             iModel->FileUtils()->PartitionDriveL();
       
   558             break;
       
   559             }
       
   560 
       
   561 ///
       
   562         case EFileBrowserCmdToolsAllFiles:
       
   563             {
       
   564             iModel->FileUtils()->WriteAllFilesL();
       
   565             break;
       
   566             }
       
   567 
       
   568         case EFileBrowserCmdToolsAvkonIconCacheEnable:
       
   569             {
       
   570             iModel->FileUtils()->EnableAvkonIconCacheL(ETrue);
       
   571             break;
       
   572             }
       
   573 
       
   574         case EFileBrowserCmdToolsAvkonIconCacheDisable:
       
   575             {
       
   576             iModel->FileUtils()->EnableAvkonIconCacheL(EFalse);
       
   577             break;
       
   578             }
       
   579 
       
   580         case EFileBrowserCmdToolsEditDataTypes:
       
   581             {
       
   582             iModel->FileUtils()->EditDataTypesL();
       
   583             break;
       
   584             }
       
   585                         
       
   586         case EFileBrowserCmdToolsDisableExtErrors:
       
   587             {
       
   588             iModel->FileUtils()->SetErrRdL(EFalse);
       
   589             break;
       
   590             }
       
   591 
       
   592         case EFileBrowserCmdToolsEnableExtErrors:
       
   593             {
       
   594             iModel->FileUtils()->SetErrRdL(ETrue);
       
   595             break;
       
   596             }
       
   597 
       
   598         case EFileBrowserCmdToolsErrorSimulateLeave:
       
   599             {
       
   600             iModel->FileUtils()->SimulateLeaveL();
       
   601             break;
       
   602             }
       
   603 
       
   604         case EFileBrowserCmdToolsErrorSimulatePanic:
       
   605             {
       
   606             iModel->FileUtils()->SimulatePanicL();
       
   607             break;
       
   608             }
       
   609         
       
   610        case EFileBrowserCmdToolsErrorSimulateException:
       
   611             {
       
   612             iModel->FileUtils()->SimulateExceptionL();
       
   613             break;
       
   614             }
       
   615                             
       
   616         case EFileBrowserCmdToolsLocalConnectivityActivateInfrared:
       
   617             {
       
   618             iModel->FileUtils()->LaunchProgramL(KIRAppPath);
       
   619             break;
       
   620             }
       
   621 
       
   622         case EFileBrowserCmdToolsLocalConnectivityLaunchBTUI:
       
   623             {
       
   624             iModel->FileUtils()->LaunchProgramL(KBTAppPath);
       
   625             break;
       
   626             }
       
   627 
       
   628         case EFileBrowserCmdToolsLocalConnectivityLaunchUSBUI:
       
   629             {
       
   630             iModel->FileUtils()->LaunchProgramL(KUSBAppPath);
       
   631             break;
       
   632             }
       
   633 
       
   634         case EFileBrowserCmdToolsInstalledApps:
       
   635             {
       
   636             iModel->FileUtils()->WriteAllAppsL();
       
   637             break;
       
   638             }
       
   639 
       
   640         case EFileBrowserCmdToolsOpenFiles:
       
   641             {
       
   642             iModel->FileUtils()->ListOpenFilesL();
       
   643             break;
       
   644             }
       
   645 
       
   646         case EFileBrowserCmdToolsSetDebugMask:
       
   647             {
       
   648             iModel->FileUtils()->SetDebugMaskL();
       
   649             break;
       
   650             }
       
   651             
       
   652         case EFileBrowserCmdToolsMsgAttachmentsInbox:
       
   653         case EFileBrowserCmdToolsMsgAttachmentsDrafts:
       
   654         case EFileBrowserCmdToolsMsgAttachmentsSentItems:
       
   655         case EFileBrowserCmdToolsMsgAttachmentsOutbox:
       
   656             {
       
   657             iModel->FileUtils()->ListMessageAttachmentsL(aCommand);
       
   658             break;
       
   659             }
       
   660 
       
   661         case EFileBrowserCmdToolsMsgStoreWalk:
       
   662             {
       
   663             iModel->FileUtils()->WriteMsgStoreWalkL();
       
   664             break;
       
   665             }
       
   666 
       
   667         case EFileBrowserCmdToolsMemoryInfo:
       
   668             {
       
   669             iModel->FileUtils()->MemoryInfoPopupL();
       
   670             break;
       
   671             }
       
   672 
       
   673         case EFileBrowserCmdToolsSecureBackupStartBackup:
       
   674         case EFileBrowserCmdToolsSecureBackupStartRestore:
       
   675         case EFileBrowserCmdToolsSecureBackupStop:
       
   676             {
       
   677             iModel->FileUtils()->SecureBackupL(aCommand);
       
   678             break;
       
   679             }
       
   680 
       
   681 ///
       
   682         case EFileBrowserCmdSettings:
       
   683             {
       
   684             if (iModel->LaunchSettingsDialogL() == EAknCmdExit)
       
   685                 AppUi()->HandleCommandL( EEikCmdExit );
       
   686             break;
       
   687             }
       
   688 
       
   689         case EFileBrowserCmdAbout:
       
   690             {
       
   691 	        CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
       
   692             dialog->ExecuteLD(R_FILEBROWSER_ABOUT_DIALOG);
       
   693             }
       
   694             break;
       
   695  
       
   696          case EAknSoftkeyCancel:
       
   697             {
       
   698             iContainer->DisableSearchFieldL();
       
   699             break;
       
   700             }
       
   701                    
       
   702         case EAknSoftkeyExit:
       
   703             {
       
   704             AppUi()->HandleCommandL( EEikCmdExit );
       
   705             break;
       
   706             }
       
   707 
       
   708         default:
       
   709             {
       
   710             AppUi()->HandleCommandL( aCommand );
       
   711             break;
       
   712             }
       
   713         }
       
   714     }
       
   715 
       
   716 // ---------------------------------------------------------
       
   717 // CFileBrowserFileListView::HandleClientRectChange()
       
   718 // ---------------------------------------------------------
       
   719 //
       
   720 void CFileBrowserFileListView::HandleClientRectChange()
       
   721     {
       
   722     if ( iContainer )
       
   723         {
       
   724         iContainer->SetRect( ClientRect() );
       
   725         }
       
   726     }
       
   727 
       
   728 // ---------------------------------------------------------
       
   729 // CFileBrowserFileListView::DoActivateL(...)
       
   730 // ?implementation_description
       
   731 // ---------------------------------------------------------
       
   732 //
       
   733 void CFileBrowserFileListView::DoActivateL(
       
   734    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   735    const TDesC8& /*aCustomMessage*/)
       
   736     {
       
   737     if (!iContainer)
       
   738         {
       
   739         iContainer = new (ELeave) CFileBrowserFileListContainer;
       
   740         iContainer->SetMopParent(this);
       
   741         iContainer->ConstructL( ClientRect() );
       
   742         AppUi()->AddToStackL( *this, iContainer );
       
   743         } 
       
   744    }
       
   745 
       
   746 // ---------------------------------------------------------
       
   747 // CFileBrowserFileListView::HandleCommandL(TInt aCommand)
       
   748 // ?implementation_description
       
   749 // ---------------------------------------------------------
       
   750 //
       
   751 void CFileBrowserFileListView::DoDeactivate()
       
   752     {
       
   753     if ( iContainer )
       
   754         {
       
   755         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   756         }
       
   757     
       
   758     delete iContainer;
       
   759     iContainer = NULL;
       
   760     }
       
   761 
       
   762 // End of File
       
   763