diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengdirectoryscanner.cpp --- a/filesystemuis/memscaneng/serversrc/msengdirectoryscanner.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -/* -* 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: -* Scan directories -* -*/ - - -// SYSTEM INCLUDES -#include - -// USER INCLUDES -#include "msengdirectoryscanner.h" - - -// CONSTANTS -_LIT(KMsengPathDelimiter, "\\"); - - -// ================= MEMBER FUNCTIONS ======================================== - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::CMsengDirectoryScanner() -// -// Default C++ constructor -// --------------------------------------------------------------------------- -CMsengDirectoryScanner::CMsengDirectoryScanner( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession ) -: CMsengScannerBase(aObserver, aScanArray, aFsSession) - { - } - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::~CMsengDirectoryScanner() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengDirectoryScanner::~CMsengDirectoryScanner() - { - delete iDirectoryList; - delete iScanner; - } - - - - - - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::ScanL() -// -// -// --------------------------------------------------------------------------- -void CMsengDirectoryScanner::ScanL(const CDesCArray& aRootDirs) - { - if (iDirectoryList) - { - iDirectoryList->Reset(); - } - else - { - iDirectoryList = new(ELeave) CDesCArraySeg(KDirectoryListGranularity); - } - if (!iScanner) - { - iScanner = CDirScan::NewL(FsSession()); - } - // Copy existing directories over - const TInt count = iNumberOfRootDirectories = aRootDirs.Count(); - for(TInt i=0; iAppendL(aRootDirs[i]); -#ifdef __SHOW_RDEBUG_PRINT_ - TPtrC dir = aRootDirs[i]; - RDebug::Print(_L("Root directory: %S"), &dir); -#endif // __SHOW_RDEBUG_PRINT_ - } - else - { - iNumberOfRootDirectories--; - } - } - - // Start the scan going - CompleteRequest(); - } - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::PerformStepL() -// -// -// --------------------------------------------------------------------------- -CMsengScannerBase::TStepResult CMsengDirectoryScanner::PerformStepL() - { - TStepResult result = ECompleteRequest; - RFs& fsSession = FsSession(); - - // Expand the root directories to a full list of - // subdirectories - if (iState == EExpandingRootDirs) - { - if (iCurrentIndex >= iNumberOfRootDirectories) - { - // Finished scanning for the subdirectories. - // Reset the current index so that we pass all the directories - // (including the root paths) to the subclasses. - iCurrentIndex = 0; - iState = EScanningSubDirs; - } - else - { - const TPtrC pFolder(iDirectoryList->MdcaPoint(iCurrentIndex++)); - - // Do the recursive scanning: First set scan data. - iScanner->SetScanDataL( - pFolder, - KEntryAttDir|KEntryAttMatchExclusive, - ESortNone, - CDirScan::EScanDownTree - ); - - // Add all the located subdirectories to the array - iState = EParsingExpandedList; - } - } - else if (iState == EParsingExpandedList) - { - CDir* list = NULL; - iScanner->NextL(list); - - if (list) - { - CleanupStack::PushL(list); - - const TPtrC pFullPath(iScanner->FullPath()); - TFileName file; - - const TInt count = list->Count(); - for(TInt i=0; iCount()) - { - const TPtrC pFolder(iDirectoryList->MdcaPoint(iCurrentIndex)); - const TScanDirectoryResult scanDirectoryResult = - ScanDirectoryL(pFolder, fsSession); - - // Check whether we continue with this directory next time - if (scanDirectoryResult == EContinueToNextDirectory) - { - iCurrentIndex++; - } - } - else - { - // All directories scanned now - result = EScanComplete; - } - } - - // Return the response back to the base scanner - return result; - } - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::AppendDirectoryL() -// -// -// --------------------------------------------------------------------------- -void CMsengDirectoryScanner::AppendDirectoryL(const TDesC& aDirectory) - { - // Append the directory to the directory list, - // unless it is listed as excluded directory - if( IsSpecialDir(aDirectory) || !IsExcludedDir(aDirectory) ) - { - iDirectoryList->AppendL(aDirectory); - } - else - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("Dir is excluded! %S"), &aDirectory); -#endif // __SHOW_RDEBUG_PRINT_ - } - } - -// End of File