filemanager/Engine/inc/CFileManagerEngine.h
branchRCL_3
changeset 20 491b3ed49290
parent 19 95243422089a
child 21 65326cf895ed
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
     1 /*
       
     2 * Copyright (c) 2002-2008 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:  Main class of the File Manager Engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CFILEMANAGERENGINE_H
       
    21 #define CFILEMANAGERENGINE_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <badesca.h>
       
    26 #include <f32file.h>
       
    27 #include <AknServerApp.h>
       
    28 #include "MFileManagerProcessObserver.h"
       
    29 #include "FileManagerEngine.hrh"
       
    30 #include "TFileManagerDriveInfo.h"
       
    31 #include "CFileManagerRestoreSettings.h"
       
    32 
       
    33 // CONSTANTS
       
    34 // File Manager engine spcific error codes
       
    35 // defined numbers should be far away from system wide error code numbers
       
    36 const TInt KErrFmgrSeveralFilesInUse    = -4500;
       
    37 const TInt KErrFmgrDefaultFolder        = -4501;
       
    38 const TInt KErrFmgrNotSupportedRemotely = -4502;
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CGflmNavigatorModel;
       
    42 class CFileManagerItemProperties;
       
    43 class CFileManagerActiveDelete;
       
    44 class CFileManagerActiveSize;
       
    45 class CFileManagerActiveExecute;
       
    46 class CFileManagerRefresher;
       
    47 class CFileManagerFileSystemEvent;
       
    48 class CFileManagerUtils;
       
    49 //class CMGXFileManager;
       
    50 class CFileManagerItemFilter;
       
    51 class CFileManagerRemovableDriveHandler;
       
    52 class CFileManagerRemoteDriveHandler;
       
    53 class CFileManagerDocHandler;
       
    54 class CFileManagerBackupSettings;
       
    55 class CFileManagerRestoreSettings;
       
    56 class CFileManagerActiveRename;
       
    57 class CFileManagerFeatureManager;
       
    58 class MAknServerAppExitObserver;
       
    59 
       
    60 
       
    61 // CLASS DECLARATION
       
    62 /**
       
    63 *  This class implements the main functionalities of File Manager Engine
       
    64 *
       
    65 *  @lib FileManagerEngine.lib
       
    66 *  @since 2.0
       
    67 */
       
    68 NONSHARABLE_CLASS(CFileManagerEngine) : public CBase
       
    69     {
       
    70 
       
    71     public:
       
    72 
       
    73         // Engine state
       
    74         enum TState
       
    75             {
       
    76             ENavigation = 0, // For using navigation list model
       
    77             ESearch // For using search list model
       
    78             };
       
    79 
       
    80         // Sort method
       
    81         enum TSortMethod
       
    82             {
       
    83             EByName = 0,
       
    84             EByType,
       
    85             EMostRecentFirst,
       
    86             ELargestFirst,
       
    87             EByMatch
       
    88             };
       
    89 
       
    90     public:
       
    91         /**
       
    92         * Two-phased constructor.
       
    93         * @param aFs Shareable file server session, see RFs::ShareProtected()
       
    94         * @return Pointer to a CFileManagerEngine instance
       
    95         */
       
    96         IMPORT_C static CFileManagerEngine* NewL( RFs& aFs );
       
    97 
       
    98         /**
       
    99         * Destructor.
       
   100         */
       
   101         IMPORT_C ~CFileManagerEngine();
       
   102 
       
   103     public: // Interface
       
   104     
       
   105         /**
       
   106         * Set currently viewed memory
       
   107         * @since 2.0
       
   108         * @param aMemory The memory type
       
   109         * @return system wide error code
       
   110         */
       
   111         IMPORT_C TInt SetMemoryL( TFileManagerMemory aMemory );
       
   112 
       
   113         /**
       
   114         * Returns the currently viewed memory
       
   115         * @since 2.0
       
   116         * @return TFileManagerMemory, the memory type
       
   117         */
       
   118         IMPORT_C TFileManagerMemory Memory() const;
       
   119 
       
   120         /**
       
   121         * Returns selected views item in array, which ListBox can show
       
   122         * @since 2.0
       
   123         * @return Array of formatted strings of current view
       
   124         */
       
   125         IMPORT_C MDesCArray* FileList() const;
       
   126 
       
   127         /**
       
   128         * Engine signals events with this observer
       
   129         * @since 2.0
       
   130         * @param aObserver The process observer or NULL, ownership is not transferred
       
   131         */
       
   132         IMPORT_C void SetObserver( MFileManagerProcessObserver* aObserver );
       
   133 
       
   134         /**
       
   135         * Returns full path of the current directory
       
   136         * @since 2.0
       
   137         * @return Full path of current directory
       
   138         */
       
   139         IMPORT_C TPtrC CurrentDirectory() const;
       
   140 
       
   141         /**
       
   142         * Returns localized name of the current directory
       
   143         * @since 2.0
       
   144         * @return Full path of current directory
       
   145         */
       
   146         IMPORT_C TPtrC LocalizedNameOfCurrentDirectory() const;
       
   147 
       
   148         /**
       
   149         * This backsteps the navigator to previously visible folder
       
   150         * @since 2.0
       
   151         */
       
   152         IMPORT_C void BackstepL();
       
   153 
       
   154         /**
       
   155         * Returns the type of given item index in CFileManagerItemProperties bitmask
       
   156         * @since 2.0
       
   157         * @param aIndex The index to current view index.
       
   158         * @return CFileManagerItemProperties bitmask
       
   159         */
       
   160         IMPORT_C TUint32 FileTypeL( const TInt aIndex ) const;
       
   161 
       
   162         /**
       
   163         * Returns the type of given item index in CFileManagerItemProperties bitmask
       
   164         * @since 2.0
       
   165         * @param aFullPath  Full path to item which type is needed..
       
   166         * @return CFileManagerItemProperties bitmask
       
   167         */
       
   168         IMPORT_C TUint32 FileTypeL( const TDesC& aFullPath ) const;
       
   169 
       
   170         /**
       
   171         * Delete file(s) or folder, caller should delete the returned object.
       
   172         * @since 2.0
       
   173         * @param aIndexList List of indexes from current directory which is going to be deleted
       
   174         * @return pointer to newly created CFileManagerActiveDelete object
       
   175         */
       
   176         IMPORT_C CFileManagerActiveDelete* CreateActiveDeleteL(
       
   177             CArrayFixFlat< TInt >& aIndexList );
       
   178 
       
   179         /**
       
   180         * Creates a new folder
       
   181         * @since 2.0
       
   182         * @param aFolderName Name of the new folder which is created current directory
       
   183         */
       
   184         IMPORT_C void NewFolderL( const TDesC& aFolderName );
       
   185 
       
   186         /**
       
   187         * Set the current item name
       
   188         * @since 5.0
       
   189         * @param aFileName File name to be set
       
   190         */
       
   191         IMPORT_C void SetCurrentItemName( const TDesC& aFileName );
       
   192         
       
   193         /**
       
   194         * Rename the file or folder.
       
   195         * @since 3.2
       
   196         * @param aIndex index of the file or folder from current directory 
       
   197         * @param aNewFileName name where that file or folder name is changed
       
   198         * @return System wide error code
       
   199         */
       
   200         IMPORT_C void RenameL( const TInt aIndex, const TDesC& aNewFileName );
       
   201 
       
   202         /**
       
   203         * Opens the file or folder
       
   204         * @since 2.0
       
   205         * @param aIndex from the current directory list
       
   206         */
       
   207         IMPORT_C void OpenL( const TInt aIndex );
       
   208 
       
   209         /**
       
   210         * Returns the depth of the current folder
       
   211         * @since 2.0
       
   212         * @return Current depth in folder tree, 0 is root, 1 one folder down
       
   213         */
       
   214         IMPORT_C TInt FolderLevel();
       
   215 
       
   216         /**
       
   217         * Checks from current directory, if the name is found
       
   218         * @since 2.0
       
   219         * @param aString Name which is matched with current directory files and folders
       
   220         * @return ETrue if exists
       
   221         *         EFalse if not exists in current directory
       
   222         */
       
   223         IMPORT_C TBool IsNameFoundL(const TDesC& aString);
       
   224 
       
   225         /**
       
   226         * returns number of the current drive.
       
   227         * @since 2.0
       
   228         * @returns TDriveNumber type, or KErrNotFound if no current drive set
       
   229         */
       
   230         IMPORT_C TInt CurrentDrive();
       
   231 
       
   232         /**
       
   233         * returns info class of the item
       
   234         * @since 2.0
       
   235         * @param aIndex to current directory item
       
   236         * @return class which contains all necessary data for info box, receiver must delete it
       
   237         */
       
   238         IMPORT_C CFileManagerItemProperties* GetItemInfoL( const TInt aIndex );
       
   239 
       
   240         /**
       
   241         * returns info about MMC status
       
   242         * @since 2.0
       
   243         * @return class which contains all necessary data for MMC status
       
   244         */
       
   245         IMPORT_C TFileManagerDriveInfo GetMMCInfoL() const;
       
   246 
       
   247         /**
       
   248         * Sets the state of the engine
       
   249         * @since 2.0
       
   250         * @param aState TState, the state type
       
   251         */
       
   252         IMPORT_C void SetState( TState aState );
       
   253 
       
   254         /**
       
   255         * Gets the state of the engine
       
   256         * @since 2.0
       
   257         * @return TState, the state type
       
   258         */
       
   259         IMPORT_C CFileManagerEngine::TState State() const;
       
   260 
       
   261         /**
       
   262         * Updates the current view
       
   263         * @since 2.0
       
   264         */
       
   265         IMPORT_C void RefreshDirectory();
       
   266 
       
   267         /**
       
   268         * Returns string which was used for finding items
       
   269         * @since 2.0
       
   270         * @return Ref to string 
       
   271         */
       
   272         IMPORT_C TPtrC SearchString() const;
       
   273 
       
   274         /**
       
   275         * Is given file name valid
       
   276         * @since 2.0
       
   277         * @param aDriveAndPath root path
       
   278         * @param aName name of the file
       
   279         * @param aIsFolder ETrue folder and EFalse file name
       
   280         * @return ETrue if file name is valid
       
   281         */
       
   282         IMPORT_C TBool IsValidName(
       
   283             const TDesC& aDriveAndPath,
       
   284             const TDesC& aName,
       
   285             TBool aIsFolder ) const;
       
   286 
       
   287         /**
       
   288         * Check that if given file name contains illegal characters
       
   289         * @since 2.0
       
   290         * @param aName name of the file
       
   291         * @return ETrue if file name is valid
       
   292         */
       
   293         IMPORT_C TBool IllegalChars( const TDesC& aName ) const;
       
   294 
       
   295         /**
       
   296         * Check that there is enough memory to do specific operation
       
   297         * @since 2.0
       
   298         * @param aToFolder Target memory
       
   299         * @param aSize Space needed bytes
       
   300         * @param aOperation Move or Copy
       
   301         * @return ETrue if there is enough space for operation
       
   302         */
       
   303         IMPORT_C TBool EnoughSpaceL(
       
   304             const TDesC& aToFolder,
       
   305             TInt64 aSize,
       
   306             MFileManagerProcessObserver::TFileManagerProcess aOperation ) const;
       
   307 
       
   308         /**
       
   309         * Sets the file system event on or off
       
   310         * @since 2.0
       
   311         * @param aSet   ETrue sets file system event
       
   312         *               EFalse turns events off
       
   313         */
       
   314         IMPORT_C void FileSystemEvent( TBool aEventOn );
       
   315 
       
   316         /**
       
   317         * Returns the current focus index if rename, copy/move or new folder
       
   318         * operation has happened
       
   319         * @since 2.0
       
   320         * @return   index to current focused item, 
       
   321         *           KErrNotFound if not found
       
   322         */
       
   323         IMPORT_C TInt CurrentIndex();
       
   324 
       
   325         /**
       
   326         * returns the file name with full path which is behind given index
       
   327         * @since 2.0
       
   328         * @param aIndex to current directory item
       
   329         * @return HBufC buffer which caller must release after usage
       
   330         */
       
   331         IMPORT_C HBufC* IndexToFullPathL( const TInt aIndex) const; 
       
   332 
       
   333         /**
       
   334         * returns the file name with full path which is behind given index
       
   335         * @since 3.2
       
   336         * @param aIndex to current directory item
       
   337         * @return HBufC buffer which caller must release after usage
       
   338         */
       
   339         IMPORT_C HBufC* IndexToFullPathLC( const TInt aIndex ) const;
       
   340 
       
   341         /**
       
   342         * Checks given item that can it be deleted.
       
   343         * @since 2.0
       
   344         * @param aFullPath full path to item which is checked
       
   345         * @returns ETrue if item can be deleted, EFalse if not
       
   346         */
       
   347         TBool CanDelete( const TDesC& aFullPath ) const;
       
   348 
       
   349         /**
       
   350         * returns localized name of the given item
       
   351         * @since 2.0
       
   352         * @param aFullPath full path to item which is checked
       
   353         * @returns TDesC reference to localized name
       
   354         */
       
   355         IMPORT_C TPtrC LocalizedName( const TDesC& aFullPath ) const;
       
   356 
       
   357         /**
       
   358         * returns the count of files in folder
       
   359         * @since 2.0
       
   360         * @return count of files in folder
       
   361         */
       
   362         IMPORT_C TInt FilesInFolderL();
       
   363 
       
   364         /**
       
   365         * Cancels the refresh operation
       
   366         * @since 2.0
       
   367         * @return   ETrue if refresh process is cancelled, 
       
   368         *           EFalse if there wasn't any refresh process ongoing
       
   369         */
       
   370         IMPORT_C TBool CancelRefresh();
       
   371 
       
   372         /**
       
   373         * Checks given index is it folder, this call is very quick
       
   374         * because it uses icon information to retrieve item type
       
   375         * @since 2.0
       
   376         * @param aIndex index to item 
       
   377         * @return   ETrue item behind the index is folder 
       
   378         *           EFalse item behind the index is not folder
       
   379         */
       
   380         IMPORT_C TBool IsFolder( const TInt aIndex ) const;
       
   381 
       
   382         /**
       
   383         * Asynchronous notifies about drive added or changed
       
   384         * @since 5.2
       
   385         * @param aPtr Pointer to an instance of this class
       
   386         * @return 0
       
   387         */
       
   388         static TInt DriveAddedOrChangeAsyncL( TAny* aPtr );
       
   389 
       
   390         /**
       
   391         * Notifies about drive added or changed
       
   392         * @since 3.1
       
   393         */
       
   394         void DriveAddedOrChangedL();
       
   395 
       
   396         /**
       
   397         * Notifies about folder content changed
       
   398         * @since 3.2
       
   399         */
       
   400         void FolderContentChangedL();
       
   401 
       
   402         /**
       
   403         * Resolves the icon id of the given item index
       
   404         * @since 2.7
       
   405         * @param aIndex index to item 
       
   406         * @return   Icon id of the item behind the index
       
   407         *           
       
   408         */
       
   409         IMPORT_C TInt IconIdL( const TInt aIndex ) const;
       
   410 
       
   411         /**
       
   412         * Checks is given folder system folder
       
   413         * @since 3.1
       
   414         * @param aFull Full path to item
       
   415         * @return ETrue if folder is system folder, EFalse if not
       
   416         */
       
   417         IMPORT_C TBool IsSystemFolder( const TDesC& aFullPath ) const;
       
   418 
       
   419         /**
       
   420         * Gets current drive name
       
   421         * @since 3.2
       
   422         * @return Drive name
       
   423         */
       
   424         IMPORT_C TPtrC CurrentDriveName();
       
   425 
       
   426         /**
       
   427          * Renames the current drive
       
   428          * @since 3.1
       
   429          * @param aDrive Drive number EDriveA...EDriveZ
       
   430          * @param aName The new name
       
   431          * @return System wide error code
       
   432          */
       
   433         IMPORT_C TInt RenameDrive(
       
   434             const TInt aDrive, const TDesC& aName );
       
   435 
       
   436         /**
       
   437          * Retrieves current drive information
       
   438          * @param aInfo A reference to a TFileManagerDriveInfo object
       
   439          */
       
   440         IMPORT_C void GetDriveInfoL( TFileManagerDriveInfo& aInfo );
       
   441 
       
   442         /**
       
   443          * Sets password on current drive
       
   444          * @since 3.1
       
   445          * @param aDrive Drive number EDriveA...EDriveZ
       
   446          * @param aOld The old password
       
   447          * @param aNew The new password
       
   448          * @return System wide error code
       
   449          */
       
   450         IMPORT_C TInt SetDrivePassword(
       
   451             const TInt aDrive,
       
   452             const TMediaPassword& aOld,
       
   453             const TMediaPassword& aNew );
       
   454 
       
   455         /**
       
   456          * Removes password from current drive
       
   457          * @since 3.1
       
   458          * @param aDrive Drive number EDriveA...EDriveZ
       
   459          * @param aPwd The current password
       
   460          * @return System wide error code
       
   461          */
       
   462         IMPORT_C TInt RemoveDrivePassword(
       
   463             const TInt aDrive,
       
   464             const TMediaPassword& aPwd );
       
   465 
       
   466         /**
       
   467          * Unlocks the current drive
       
   468          * @since 3.1
       
   469          * @param aDrive Drive number EDriveA...EDriveZ
       
   470          * @param aPwd The current password
       
   471          * @return System wide error code
       
   472          */
       
   473         IMPORT_C TInt UnlockDrive(
       
   474             const TInt aDrive,
       
   475             const TMediaPassword& aPwd );
       
   476 
       
   477        /**
       
   478          * Starts format process
       
   479          * @since 3.1
       
   480          * @param aDrive Drive number EDriveA...EDriveZ
       
   481          */
       
   482         IMPORT_C void StartFormatProcessL( const TInt aDrive );
       
   483 
       
   484        /**
       
   485          * Starts eject process
       
   486          * @since 3.2
       
   487          * @param aDrive Drive number EDriveA...EDriveZ
       
   488          */
       
   489         IMPORT_C void StartEjectProcessL( const TInt aDrive );
       
   490 
       
   491         /**
       
   492          * Initiates backup or restore process
       
   493          * @since 3.1
       
   494          * @param aProcess The process to start:
       
   495          *                 EBackupProcess or ERestoreProcess
       
   496          */
       
   497         IMPORT_C void StartBackupProcessL(
       
   498             MFileManagerProcessObserver::TFileManagerProcess aProcess );
       
   499 
       
   500         /**
       
   501          * Cancels ongoing process
       
   502          * @since 3.1
       
   503          * @param aProcess The process to cancel
       
   504          */
       
   505         IMPORT_C void CancelProcess(
       
   506             MFileManagerProcessObserver::TFileManagerProcess aProcess );
       
   507 
       
   508         /**
       
   509          * Get drive state
       
   510          * @since 3.1
       
   511          * @param aState For TFileManagerDriveInfo::TDriveState bits
       
   512          * @param aPath Only drive letter is used
       
   513          * @return System wide error code
       
   514          */
       
   515         IMPORT_C TInt DriveState( TUint32& aState, const TDesC& aPath ) const;
       
   516 
       
   517         /**
       
   518          * Get drive state
       
   519          * @since 3.1
       
   520          * @param aState For TFileManagerDriveInfo::TDriveState bits
       
   521          * @param aDrive
       
   522          * @return System wide error code
       
   523          */
       
   524         IMPORT_C TInt DriveState( TUint32& aState, const TInt aDrive ) const;
       
   525 
       
   526         /**
       
   527          * Determine if given file must be protected (kept on the device)
       
   528          * @since 3.1
       
   529          * @param aFullPath Full path to item
       
   530          * @param aIsProtected The protection status
       
   531          * @return System wide error code
       
   532          */
       
   533         IMPORT_C TInt IsDistributableFile( const TDesC& aFullPath,
       
   534                                            TBool& aIsProtected ) const;
       
   535 
       
   536         /**
       
   537          * Connects or disconnects remote drive
       
   538          * @since 3.1
       
   539          * @param aDrive Drive number EDriveA...EDriveZ
       
   540          * @param aConnect ETrue when connecting, EFalse when disconnecting
       
   541          * @return System wide error code
       
   542          */
       
   543         IMPORT_C TInt SetRemoteDriveConnection(
       
   544             const TInt aDrive, TBool aConnect );
       
   545 
       
   546         /**
       
   547          * Deletes the remote drive settings from remote storage framework
       
   548          * @since 3.1
       
   549          * @param aDrive Drive number EDriveA...EDriveZ
       
   550          * @return System wide error code
       
   551          */
       
   552         IMPORT_C TInt DeleteRemoteDrive( const TInt aDrive );
       
   553 
       
   554         /**
       
   555          * Gets drive root directory
       
   556          * @since 3.1
       
   557          * @param aDrive Drive number EDriveA...EDriveZ
       
   558          * @return Reference to root directory string
       
   559          */
       
   560         IMPORT_C TPtrC DriveRootDirectory( const TInt aDrive ) const;
       
   561 
       
   562         /**
       
   563          * Gets backup settings
       
   564          * @since 3.1
       
   565          * @return Reference to backup settings.
       
   566          */
       
   567         IMPORT_C CFileManagerBackupSettings& BackupSettingsL();
       
   568 
       
   569         /**
       
   570          * Gets restore settings
       
   571          * @since 3.1
       
   572          * @return Reference to restore settings.
       
   573          */
       
   574         IMPORT_C CFileManagerRestoreSettings& RestoreSettingsL();
       
   575 
       
   576         /**
       
   577          * Gets drive name
       
   578          * @since 3.1
       
   579          * @param aDrive Drive that name is required
       
   580          * @return Reference to drive name.
       
   581          */
       
   582         IMPORT_C TPtrC DriveName( const TInt aDrive );
       
   583 
       
   584         /**
       
   585          * Gets drive info
       
   586          * @since 3.1
       
   587          * @param aDrive Drive that info is required
       
   588          * @param aInfo For storing drive info
       
   589          */
       
   590         IMPORT_C void GetDriveInfoL(
       
   591             const TInt aDrive, TFileManagerDriveInfo& aInfo ) const;
       
   592 
       
   593         /**
       
   594          * Gets restore info array
       
   595          * @since 3.1
       
   596          * @param aArray For storing restore info
       
   597          * @param aDrive For getting info from specific drive
       
   598          */
       
   599         IMPORT_C void GetRestoreInfoArrayL(
       
   600             RArray< CFileManagerRestoreSettings::TInfo >& aArray,
       
   601             const TInt aDrive = KErrNotFound ) const;
       
   602 
       
   603         /**
       
   604          * Checks if any ejectable drive is present
       
   605          * @since 3.1
       
   606          * @return ETrue if present, otherwise EFalse
       
   607          */
       
   608         IMPORT_C TBool AnyEjectableDrivePresent() const;
       
   609 
       
   610         /**
       
   611          * Ensures that contents of a directory are up to date
       
   612          * including remote drives when current view is updated
       
   613          * @since 3.1
       
   614          */
       
   615         IMPORT_C void ForcedRefreshDirectory();
       
   616 
       
   617         /**
       
   618          * Calculates the total size of given items
       
   619          * @since 3.2
       
   620          * @param aIndexList List of indexes from current directory
       
   621          * @return Total size
       
   622          */
       
   623         IMPORT_C TInt64 GetFileSizesL(
       
   624             const CArrayFixFlat< TInt >& aIndexList );
       
   625 
       
   626         /**
       
   627          * Gets navigation level, the depth of backstep stack
       
   628          * @since 3.2
       
   629          * @return The navigation level
       
   630          */
       
   631         IMPORT_C TInt NavigationLevel() const;
       
   632 
       
   633         /**
       
   634         * Gets drive name and letter as combined formatted text.
       
   635         * @since 5.0
       
   636         * @param aDrive Drive number EDriveA...EDriveZ
       
   637         * @param aTextIdForDefaultName TextId of default name format string
       
   638         * @param aTextIdForName TextId of name format string
       
   639         * @return Text containing drive letter and name
       
   640         */
       
   641         IMPORT_C HBufC* GetFormattedDriveNameLC(
       
   642             const TInt aDrive,
       
   643             const TInt aTextIdForDefaultName,
       
   644             const TInt aTextIdForName = 0 ) const;
       
   645 
       
   646         /**
       
   647         * Returns info class of the item
       
   648         * @since 5.0
       
   649         * @param aIndex to current directory item
       
   650         * @return class which contains all necessary data for info box, receiver must delete it
       
   651         */
       
   652         IMPORT_C CFileManagerItemProperties* GetItemInfoLC( const TInt aIndex );
       
   653 
       
   654         /**
       
   655         * Sets search string.
       
   656         * @since 3.2
       
   657         * @param aSearchString Search string
       
   658         */
       
   659         IMPORT_C void SetSearchStringL( const TDesC& aSearchString );
       
   660 
       
   661         /**
       
   662         * Sets search folder.
       
   663         * @since 3.2
       
   664         * @param aSearchString Search folder
       
   665         */
       
   666         IMPORT_C void SetSearchFolderL( const TDesC& aSearchFolder );
       
   667 
       
   668         /**
       
   669         * Sets the directory with backsteps.
       
   670         * @since 3.2
       
   671         * @param aDirectory New current directory
       
   672         */
       
   673         IMPORT_C void SetDirectoryWithBackstepsL( const TDesC& aDirectory );
       
   674 
       
   675         /**
       
   676         * Stores current navigation index.
       
   677         * @since 3.2
       
   678         * @param aIndex The index to current view index.
       
   679         */
       
   680         IMPORT_C void SetCurrentIndex( const TInt aIndex );
       
   681 
       
   682         /**
       
   683         * Sets the sort method of the engine
       
   684         * @since 5.0
       
   685         * @param aSortMethod TSortMethod, the sort method type
       
   686         */
       
   687         IMPORT_C void SetSortMethod( TSortMethod aSortMethod );
       
   688 
       
   689         /**
       
   690         * Gets the sort method of the engine
       
   691         * @since 5.0
       
   692         * @return TSortMethod, the sort method type
       
   693         */
       
   694         IMPORT_C CFileManagerEngine::TSortMethod SortMethod() const;
       
   695 
       
   696         /**
       
   697         * Re-sorts the current view
       
   698         * @since 5.0
       
   699         */
       
   700         IMPORT_C void RefreshSort();
       
   701 
       
   702         /**
       
   703         * Gets the feature manager
       
   704         * @since 3.2
       
   705         */
       
   706         IMPORT_C CFileManagerFeatureManager& FeatureManager() const;
       
   707         
       
   708         /**
       
   709         * Set server application exit observer
       
   710         * @Param aObserver The ServerAppExit observer or NULL, ownership is not transferred
       
   711         */
       
   712         IMPORT_C void SetAppExitOb( MAknServerAppExitObserver* aObserver );
       
   713         
       
   714         /**
       
   715         * Deletes the backup archives selected using
       
   716         * CFileManagerRestoreSettings::SetSelection() method.
       
   717         * @since 5.0
       
   718         */
       
   719         IMPORT_C void DeleteBackupsL();
       
   720         
       
   721 		/**
       
   722         * Check if a drive is mounted
       
   723         * @Param aDrive The target drive to check
       
   724 		* @Return TBool to indicate check result
       
   725         * @since 5.2
       
   726         */
       
   727         IMPORT_C TBool IsDriverMounted( TInt aDrive );
       
   728         
       
   729     public:
       
   730     	
       
   731         /**
       
   732         * Set whether the file is a sis file
       
   733         * @Param aSisFile file is or not a sis file
       
   734         */
       
   735         void SetSisFile( TBool aSisFile );
       
   736         
       
   737         /*
       
   738         * Notice the ServerAppExit event
       
   739         * @Param aReason the reason of the server application exit
       
   740         */
       
   741         void NoticeServerAppExit( TInt aReason );
       
   742         
       
   743         /**
       
   744         * Sets embedded app status
       
   745         * @param aStatus ETrue if embedded app on, EFalse if not
       
   746         */
       
   747         void EmbeddedAppStatus( TBool aStatus );
       
   748 
       
   749         /* MFileManagerWaitNote */
       
   750         void ShowWaitDialogL( MAknBackgroundProcess& aProcess );
       
   751 
       
   752         //CMGXFileManager& MGXFileManagerL();
       
   753 
       
   754         RFs& Fs() const;
       
   755 
       
   756         TBool HasAppRemoteDriveSupport( TUid aUid );
       
   757 
       
   758         TBool IsRemoteDriveConnected( const TInt aDrive  ) const;
       
   759 
       
   760         TBool BackupFileExistsL( const TInt aDrive  ) const;
       
   761 
       
   762         // Ensures that drive info is refreshed on next update
       
   763         void ClearDriveInfo();
       
   764 
       
   765         // Cancels ongoing transfer
       
   766         void CancelTransfer( const TDesC& aFullPath );
       
   767 
       
   768         /**
       
   769         * Gets the latest backup time
       
   770         * @since 5.0
       
   771         * @param aBackupTime Stores the latest backup time
       
   772         * @return System wide error code
       
   773         */
       
   774         TInt LatestBackupTime( TTime& aBackupTime );
       
   775 
       
   776     private:
       
   777         /**
       
   778         * C++ default constructor.
       
   779         */
       
   780         CFileManagerEngine( RFs& aFs );
       
   781 
       
   782         /**
       
   783         * By default Symbian 2nd phase constructor is private.
       
   784         */
       
   785         void ConstructL();
       
   786 
       
   787         // Adds current dir fullpath to given name, returns HBufC buffer which must be released
       
   788         HBufC* AddFullPathLC( const TDesC& aName, const TBool aIsFolder );
       
   789 
       
   790         // Sets file system event watcher for given path
       
   791         void SetFileSystemEventL( const TDesC& aFullPath = KNullDesC );
       
   792 
       
   793         // For checking mount state
       
   794         TInt CheckDriveMountL( TInt aDrive ) const;
       
   795 
       
   796         // For getting drive info
       
   797         void GetDriveInfoL(
       
   798             const TDesC& aPath, TFileManagerDriveInfo& aInfo ) const;
       
   799 
       
   800         // Opens file
       
   801         void OpenFileL( const TDesC& aFullPath );
       
   802 
       
   803         // Opens directory
       
   804         void OpenDirectoryL( const TDesC& aFullPath );
       
   805 
       
   806         // Checks is current drive available
       
   807         TBool CurrentDriveAvailable();
       
   808 
       
   809         /**
       
   810         * Start asynchronous disk event notification timer
       
   811         * @since 5.2
       
   812         */
       
   813         void StartDiskEventNotifyTimerAsyncL();
       
   814 
       
   815         /**
       
   816         * Stop asynchronous disk event notification timer
       
   817         * @since 5.2
       
   818         */
       
   819         void StopDiskEventNotifyTimerAsync();
       
   820 
       
   821     private:
       
   822 
       
   823         // Own: General File List Model is used via this object.
       
   824         CGflmNavigatorModel*        iNavigator;
       
   825 
       
   826         // Ref: For file operations
       
   827         RFs&                        iFs;
       
   828 
       
   829         // Normal or search state 
       
   830         TState                      iState;
       
   831 
       
   832         // Own: String which was used in latest search
       
   833         HBufC*                      iSearchString;
       
   834 
       
   835         // Own: String which is used for search process
       
   836         HBufC*                      iSearchProcessString;
       
   837 
       
   838         // Own: AO for async GFLM refresh operation
       
   839         CFileManagerRefresher*      iRefresher;
       
   840 
       
   841         // Ref: Handle to current observer
       
   842         MFileManagerProcessObserver* iProcessObserver;
       
   843 
       
   844         // Own: Handles file system events
       
   845         CFileManagerFileSystemEvent* iFileSystemEvent;
       
   846 
       
   847         // item name of current index, used to search current index
       
   848         TFileName                   iCurrentItemName;
       
   849 
       
   850         // Own: Folder size calculation
       
   851         CFileManagerActiveSize*     iActiveSize;
       
   852 
       
   853         // Own: Checks drive notifications
       
   854         CFileManagerFileSystemEvent* iDiskEvent;
       
   855 
       
   856         // Own: Indicates if embedded application is on
       
   857         TBool iEmbeddedApplicationOn;
       
   858 
       
   859         // Own: MG2 update notification object
       
   860         //CMGXFileManager*            iMgxFileManager;
       
   861 
       
   862         // Own: Compines services of couple classes
       
   863         CFileManagerUtils*          iUtils;
       
   864 
       
   865         // Own: Used for item filtering
       
   866         CFileManagerItemFilter* iItemFilter;
       
   867 
       
   868         // Own: Used for handling memory card etc functinalities
       
   869         CFileManagerRemovableDriveHandler* iRemovableDrvHandler;
       
   870 
       
   871         // Own: Used for handling remote drive functinalities
       
   872         CFileManagerRemoteDriveHandler* iRemoteDrvHandler;
       
   873 
       
   874         // Own: Used for opening files
       
   875         CFileManagerDocHandler* iDocHandler;
       
   876 
       
   877         // Own: Used for backup settings
       
   878         CFileManagerBackupSettings* iBackupSettings;
       
   879 
       
   880         // Own: Used for restore settings
       
   881         CFileManagerRestoreSettings* iRestoreSettings;
       
   882 
       
   883         // Own: Indicates last drive available status
       
   884         TBool iLastDriveAvailable;
       
   885 
       
   886         // Own: Stores current drive info
       
   887         TFileManagerDriveInfo iCurrentDriveInfo;
       
   888 
       
   889         // Own: Indicates if current drive info is refreshed
       
   890         TBool iCurrentDriveInfoRefreshed;
       
   891 
       
   892         // Own: Indicates if wait dialog is on
       
   893         TBool iWaitDialogOn;
       
   894 
       
   895         // Own: Stores drive name
       
   896         HBufC* iDriveName;
       
   897 
       
   898         // Own: Navigation indices
       
   899         RArray< TInt > iNavigationIndices;
       
   900 
       
   901         // Own: Used for rename
       
   902         CFileManagerActiveRename* iActiveRename;
       
   903 
       
   904         // Own: Used for storing search folder
       
   905         HBufC* iSearchFolder;
       
   906 
       
   907         // Own: Indicates file system event status
       
   908         TBool iFileSystemEventEnabled;
       
   909 
       
   910         // Own: Indicates if drive added or changed update is postponed
       
   911         TBool iDriveAddedOrChangedPostponed;
       
   912 
       
   913         // Own: Manages runtime variated features
       
   914         CFileManagerFeatureManager* iFeatureManager;
       
   915         
       
   916         // Ref: Handle to current ServerAppExit observer
       
   917         MAknServerAppExitObserver* iObserver;
       
   918         
       
   919         //Own: Whether the file was a sis type
       
   920         TBool iSisFile;
       
   921 
       
   922         //Own: postpone disk event notification while disk refresh is ongoing
       
   923         CPeriodic* iDelayedDiskEventNotify;
       
   924     };
       
   925 
       
   926 #endif      // CFILEMANAGERENGINE_H
       
   927             
       
   928 // End of File