harvesterplugins/file/inc/cfileharvester.h
changeset 0 ccd0fd43f247
child 18 1edf350003c5
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 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 #ifndef CFILEHARVESTER_H
       
    20 #define CFILEHARVESTER_H
       
    21 
       
    22 //  INCLUDES 
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "cfileplugin.h"
       
    27 
       
    28 class CFilePlugin;
       
    29 
       
    30 class CFileHarvester : public CActive
       
    31     {
       
    32     public:
       
    33     
       
    34     	enum TFileHarvesterState
       
    35     		{
       
    36     		EHarvesterIdleState,
       
    37     		EHarvesterStartHarvest,
       
    38     		EHarvesterGetFileId
       
    39     		};
       
    40 
       
    41         /**
       
    42         * Construction
       
    43         * @return Harvester image plugin
       
    44         */
       
    45         static CFileHarvester* NewL(CFilePlugin& aFilePlugin, RFs& aFs);
       
    46 
       
    47         /**
       
    48         * Destruction
       
    49         */
       
    50         virtual ~CFileHarvester();
       
    51                 
       
    52         /**
       
    53         * Start harvesting File items
       
    54         * @param aDriveNumber drive to start harvesting
       
    55         */
       
    56         void StartL( const TDriveNumber aDriveNumber );
       
    57 
       
    58         /**
       
    59         * Add ignore paths
       
    60         * @param aDriveNumber drive to add the ignore paths
       
    61         */
       
    62         void AddIgnorePathsL( const TDriveNumber aDriveNumber );
       
    63 
       
    64         /**
       
    65         * Remove ignore paths
       
    66         * @param aDriveNumber drive to remove the paths from
       
    67         */
       
    68         void RemoveIgnorePaths( const TDriveNumber aDriveNumber );
       
    69 
       
    70     private:  //From CActive
       
    71 
       
    72 	    /**
       
    73 	     * From CACtive.
       
    74 	     */
       
    75         void DoCancel();
       
    76 
       
    77         /**
       
    78 	     * From CACtive.
       
    79          */
       
    80         void RunL();
       
    81 
       
    82         /**
       
    83 	     * From CACtive.
       
    84 	     * @param aError Leave code from RunL()
       
    85 	     * @return Error code, KErrNone if error was handled successfully.
       
    86          */
       
    87         TInt RunError( TInt aError );
       
    88     
       
    89     private:
       
    90 
       
    91         /**
       
    92         * Private constructor
       
    93         */    
       
    94         CFileHarvester( CFilePlugin& aFilePlugin, RFs& aFs );
       
    95         
       
    96         /**
       
    97         * 2nd phase construction
       
    98         */    
       
    99         void ConstructL();
       
   100         
       
   101         /**
       
   102         * Get next messaging folder 
       
   103         */
       
   104         void GetNextFolderL();
       
   105         
       
   106         /**
       
   107         * Get File identifier
       
   108         */ 
       
   109         void GetFileIdL();
       
   110         
       
   111         /**
       
   112         * Checks if harvesting is ready or not.
       
   113         * @return ETrue, if ready.
       
   114         */
       
   115         void SetNextRequest( TFileHarvesterState aState );
       
   116 
       
   117         TInt AddIgnorePathL( const TFileName& aIgnorePath );
       
   118 
       
   119         TInt RemoveIgnorePath( const TFileName& aIgnorePath );
       
   120 
       
   121         TBool CheckPath( const TFileName& aFileName );
       
   122 
       
   123     private:
       
   124         // File plugin for observing
       
   125         CFilePlugin& iFilePlugin; 
       
   126         
       
   127         // File harvester state.
       
   128         TFileHarvesterState iHarvestState;
       
   129         
       
   130         // RFs
       
   131         RFs& iFs;
       
   132 
       
   133         // The drive being harvested now
       
   134         TDriveNumber iCurrentHarvestDrive;
       
   135 
       
   136         CDir* iDir;
       
   137         CDirScan* iDirscan;
       
   138         TInt iCurrentIndex;
       
   139         TInt iStepNumber;
       
   140         RPointerArray<TFileName> iIgnorePaths;
       
   141     };
       
   142 
       
   143 #endif // CFILEHARVESTER_H
       
   144 
       
   145 // End of File