harvesterplugins/file/inc/cfolderrenamedharvester.h
changeset 0 ccd0fd43f247
child 2 208a4ba3894c
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 CFOLDERRENAMEDHARVESTER_H
       
    20 #define CFOLDERRENAMEDHARVESTER_H
       
    21 
       
    22 //  INCLUDES 
       
    23 #include <e32base.h>
       
    24 
       
    25 class CFilePlugin;
       
    26 
       
    27 class CFolderRenamedItem : public CBase
       
    28 	{
       
    29 public:
       
    30 	static CFolderRenamedItem * NewL ( const TDesC &aOldName, const TDesC &aNewName );
       
    31 
       
    32 	virtual ~CFolderRenamedItem();
       
    33 
       
    34 	const TDesC& OldName();
       
    35 	const TDesC& NewName();
       
    36 
       
    37 private:
       
    38 	CFolderRenamedItem();
       
    39 	void ConstructL( const TDesC &aOldName, const TDesC &aNewName );
       
    40 
       
    41 private:
       
    42 	HBufC *iOldName;
       
    43 	HBufC *iNewName;
       
    44 	};
       
    45 
       
    46 class CFolderRenamedHarvester : public CActive
       
    47     {
       
    48     public:
       
    49 
       
    50     	enum TFileHarvesterState
       
    51     		{
       
    52     		EFolderRenamedIdleState,
       
    53     		EFolderRenamedStartHarvest,
       
    54     		EFolderRenamedGetFileId
       
    55     		};
       
    56 
       
    57         /**
       
    58         * Construction
       
    59         * @return Harvester image plugin
       
    60         */
       
    61         static CFolderRenamedHarvester* NewL(CFilePlugin& aFilePlugin, RFs& aFs);
       
    62 
       
    63         /**
       
    64         * Destruction
       
    65         */
       
    66         virtual ~CFolderRenamedHarvester();
       
    67 
       
    68         /**
       
    69         * Start harvesting File items
       
    70         * @return ETrue, if ready.
       
    71         */
       
    72         TBool StartL( const TFileName& aOldDirectoryName, const TFileName& aNewDirectoryName );
       
    73 
       
    74     private:  //From CActive
       
    75 
       
    76 	    /**
       
    77 	     * From CACtive.
       
    78 	     */
       
    79         void DoCancel();
       
    80 
       
    81         /**
       
    82 	     * From CACtive.
       
    83          */
       
    84         void RunL();
       
    85 
       
    86         /**
       
    87 	     * From CACtive.
       
    88 	     * @param aError Leave code from RunL()
       
    89 	     * @return Error code, KErrNone if error was handled successfully.
       
    90          */
       
    91         TInt RunError( TInt aError );
       
    92 
       
    93     private:
       
    94 
       
    95         /**
       
    96         * Private constructor
       
    97         */    
       
    98     	CFolderRenamedHarvester( CFilePlugin& aFilePlugin, RFs& aFs );
       
    99 
       
   100         /**
       
   101         * 2nd phase construction
       
   102         */    
       
   103         void ConstructL();
       
   104 
       
   105         /**
       
   106         * Get next messaging folder 
       
   107         */
       
   108         void GetNextFolderL();
       
   109 
       
   110         /**
       
   111         * Get File identifier
       
   112         */ 
       
   113         void GetFileIdL();
       
   114 
       
   115         /**
       
   116         * Checks if harvesting is ready or not.
       
   117         * @return ETrue, if ready.
       
   118         */
       
   119         void SetNextRequest( TFileHarvesterState aState );
       
   120 
       
   121     private:
       
   122         // File plugin for observing
       
   123         CFilePlugin& iFilePlugin; 
       
   124 
       
   125         // File harvester state.
       
   126         TFileHarvesterState iHarvestState;
       
   127 
       
   128         // RFs
       
   129         RFs& iFs;
       
   130         CDir* iDir;
       
   131         CDirScan* iDirscan;
       
   132         TInt iCurrentIndex;
       
   133         TInt iStepNumber;
       
   134 
       
   135         TFileName iOldFolderName;
       
   136         TFileName iNewFolderName;
       
   137         RPointerArray <CFolderRenamedItem> iRenamedFolders;
       
   138     };
       
   139 
       
   140 #endif // CFOLDERRENAMEDHARVESTER_H
       
   141 
       
   142 // End of File