appinstaller/AppMngr2/inc/appmngr2filerecognizer.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2008 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:   Recognizes files to get corresponding MIME types
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_APPMNGR2FILERECOGNIZER_H
       
    20 #define C_APPMNGR2FILERECOGNIZER_H
       
    21 
       
    22 #include <e32base.h>                    // CActive
       
    23 
       
    24 class CAppMngr2RecognizedFile;
       
    25 class CDir;
       
    26 class RFs;
       
    27 
       
    28 
       
    29 class CAppMngr2FileRecognizer : public CActive
       
    30     {
       
    31 public:     // constructor and destructor
       
    32     static CAppMngr2FileRecognizer* NewL( RFs& aFs );
       
    33     ~CAppMngr2FileRecognizer();
       
    34 
       
    35 public:     // new functions
       
    36     /**
       
    37      * Gets the data (MIME) type for files in a specified directory.
       
    38      * Works like RApaLsSession::RecognizeFilesL() except that can be used to
       
    39      * recognize files in private directories too (with AllFiles capability).
       
    40      * @param aPath  A valid path. Note that the path must end with a backslash. 
       
    41      * @param aStatus  A request status object. 
       
    42      */
       
    43     void RecognizeFilesL( const TDesC& aPath, TRequestStatus& aStatus );
       
    44     
       
    45     /**
       
    46      * Cancels ongoing file recognition.
       
    47      */
       
    48     void CancelRecognizeFiles();
       
    49     
       
    50     /**
       
    51      * Returns file recognition results in array. Items can be removed
       
    52      * from the array. Next call to RecognizeFilesL() resets the array.
       
    53      * @return RPointerArray<CAppMngr2RecognizedFile>&  Recognized files
       
    54      */
       
    55     RPointerArray<CAppMngr2RecognizedFile>& Results();
       
    56     
       
    57 protected:  // from CActive
       
    58     void DoCancel();
       
    59     void RunL();
       
    60     TInt RunError( TInt aError );
       
    61     
       
    62 private:    // new functions
       
    63     CAppMngr2FileRecognizer( RFs& aFs );
       
    64     void RecognizeNextFileL();
       
    65 
       
    66 private:    // data
       
    67     RFs& iFs;
       
    68     TRequestStatus* iDirStatus;
       
    69     HBufC* iDirPath;
       
    70     CDir* iDirEntries;
       
    71     TInt iIndex;
       
    72     RPointerArray<CAppMngr2RecognizedFile> iResultArray;
       
    73     enum TState
       
    74         {
       
    75         EIdle,
       
    76         ERecognizing
       
    77         } iState;
       
    78     };
       
    79 
       
    80 #endif  // C_APPMNGR2FILERECOGNIZER_H
       
    81