mmappcomponents/harvester/filehandler/inc/mpxfolderscanner.h
changeset 61 3b098142db83
parent 0 a2952bb97e68
equal deleted inserted replaced
57:f4fd77a452f2 61:3b098142db83
    97     * Handles what to do when scanning is done
    97     * Handles what to do when scanning is done
    98     * @param aErr error to return to the client
    98     * @param aErr error to return to the client
    99     */
    99     */
   100     void DoScanCompleteL( TInt aErr );
   100     void DoScanCompleteL( TInt aErr );
   101 
   101 
       
   102     /**
       
   103     * Execute asynchronous reading RDir
       
   104     */
       
   105     void ReadDirEntry();
       
   106 
   102 private:
   107 private:
   103 
   108 
   104     /**
   109     /**
   105     * Private constructor
   110     * Private constructor
   106     * @param aObserver file addition observer
   111     * @param aObserver file addition observer
   116     */
   121     */
   117     void ConstructL();
   122     void ConstructL();
   118 
   123 
   119 private: // data
   124 private: // data
   120 
   125 
       
   126     /**
       
   127      * An entry delegates a scanning folder
       
   128      */
       
   129     class CDirQueueEntry : public CBase
       
   130         {
       
   131         public:
       
   132 
       
   133             /**
       
   134              * Push a scanning folder into a directory queue
       
   135              * @param aDirQueue directory queue
       
   136              * @param aDirEntry entry delegates a scanning folder
       
   137              */
       
   138             static void PushL( RPointerArray< CDirQueueEntry >& aDirQueue,
       
   139                                CDirQueueEntry* aDirEntry );
       
   140 
       
   141             /**
       
   142              * Pop and destroy a scanning folder from a directory queue
       
   143              * @param aDirQueue directory queue
       
   144              */
       
   145             static void PopAndDestroy( RPointerArray< CDirQueueEntry >& aDirQueue );
       
   146 
       
   147             /**
       
   148              * Two-phased constructor
       
   149              * @param aFullPath full path of this folder
       
   150              */
       
   151             static CDirQueueEntry* NewL( const TDesC& aFullPath );
       
   152 
       
   153             /**
       
   154              * Virtual destructor
       
   155              */
       
   156             virtual ~CDirQueueEntry();
       
   157 
       
   158             /**
       
   159              * Get next entry of this folder
       
   160              * @return next entry of this folder,
       
   161              *         NULL if no next entry
       
   162              */
       
   163             const TEntry* NextEntry();
       
   164 
       
   165             /**
       
   166              * Reset the position of the EntryArray
       
   167              */
       
   168             void ResetPosition();
       
   169 
       
   170         private:
       
   171 
       
   172             /**
       
   173              * Private constructor
       
   174              */
       
   175             CDirQueueEntry();
       
   176 
       
   177             /**
       
   178              * 2nd phase constructor
       
   179              * @param full path of this folder
       
   180              */
       
   181             void ConstructL( const TDesC& aFullPath );
       
   182 
       
   183         public: //data
       
   184 
       
   185             /**
       
   186              * Full path of this folder
       
   187              * Owned
       
   188              */
       
   189             HBufC* iFullPath;
       
   190 
       
   191             /**
       
   192              * Current position of EntryArray
       
   193              */
       
   194             TInt iPos;
       
   195 
       
   196             /**
       
   197              * RDir object of this folder
       
   198              * Owned
       
   199              */
       
   200             RDir iDir;
       
   201 
       
   202             /**
       
   203              * EntryArray of this folder
       
   204              */
       
   205             TEntryArray iEntryArray;
       
   206         };
       
   207 
   121     MMPXFileAdditionObserver&     iObserver; 
   208     MMPXFileAdditionObserver&     iObserver; 
   122     MMPXFileScanStateObserver&    iStateObserver; 
   209     MMPXFileScanStateObserver&    iStateObserver; 
   123     
   210     
   124     RFs&  iFs; // Not owned
   211     RFs&  iFs; // Not owned
   125     
   212     
   128     
   215     
   129     // Flag to indicate if we are scanning or not
   216     // Flag to indicate if we are scanning or not
   130     TBool                         iScanning;
   217     TBool                         iScanning;
   131     
   218     
   132     // Scanner objects
   219     // Scanner objects
   133     CDirScan*                     iDirScan;
   220     RPointerArray< CDirQueueEntry > iDirQueue; // Owned
   134     CDir*                         iDir;
   221     CDirQueueEntry*                 iCurDirQueueEntry; // Not Owned
   135     TInt                          iCount;
   222     HBufC*                          iCurFullPath; // Not Owned
   136     };
   223     };
   137 
   224 
   138 #endif // CMPXFOLDERSCANNER_H
   225 #endif // CMPXFOLDERSCANNER_H