diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfolderscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfolderscanner.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Scans folders for media files +* +*/ + + +#ifndef CMPXFOLDERSCANNER_H +#define CMPXFOLDERSCANNER_H + +#include +#include +#include + +// FORWARD DECLARATIONS +class MMPXFileAdditionObserver; +class MMPXFileScanStateObserver; + +/** + * CMPXFolderScanner + * + * Scans a particular drive for files + * + * @lib mpxfilehandler + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXFolderScanner ) : public CActive + { + +public: + + /** + * Two-phased constructor + * @param aObserver file addition observer + * @param aStateObserver scanning state observer + * @param aFs file session + */ + static CMPXFolderScanner* NewL( MMPXFileAdditionObserver& aObserver, + MMPXFileScanStateObserver& aStateObs, + RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXFolderScanner(); + + /** + * Scan a particular drive for files + * @param aDrive the drive to scan + */ + void ScanL( RArray& aDrive ); + +protected: // From Base Class + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: // New Functions + + /** + * Continues the scanning procedure + * @return ETrue if it is done, EFalse if there is more work to do + */ + TBool DoScanL(); + + /** + * Setup the object to scan the next drive + * @return ETrue if there are more folders to scan + * EFalse if the scanning process is complete + */ + TBool SetupNextDriveToScanL(); + + /** + * Handles what to do when scanning is done + * @param aErr error to return to the client + */ + void DoScanCompleteL( TInt aErr ); + +private: + + /** + * Private constructor + * @param aObserver file addition observer + * @param aStateObserver scanning state observer + * @param aFs file session + */ + CMPXFolderScanner( MMPXFileAdditionObserver& aObserver, + MMPXFileScanStateObserver& aStateObs, + RFs& aFs ); + + /** + * 2nd Phase constructor + */ + void ConstructL(); + +private: // data + + MMPXFileAdditionObserver& iObserver; + MMPXFileScanStateObserver& iStateObserver; + + RFs& iFs; // Not owned + + // Droves or folders that we want to scan + RArray iDrivesToScan; + + // Flag to indicate if we are scanning or not + TBool iScanning; + + // Scanner objects + CDirScan* iDirScan; + CDir* iDir; + TInt iCount; + }; + +#endif // CMPXFOLDERSCANNER_H