homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmmain.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  Main class in the Memory manager component
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CMMMMAIN_H
       
    20 #define C_CMMMMAIN_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h> // CDesCArray
       
    24 #include <f32file.h> // RFs
       
    25 #include "cmcommon.h" // TCmListItemStatus
       
    26 
       
    27 // Forward declarations
       
    28 class MCmMmObserver;
       
    29 class MMPXHarvesterUtility;
       
    30 class CCmMmQuotaListener;
       
    31 class CCmMmShrinker;
       
    32 class CCmDmMain;
       
    33 class MMPXCollectionHelper;
       
    34 
       
    35 /**
       
    36  *  CCmMmMain class
       
    37  *  Memory manager
       
    38  *
       
    39  *  @lib cmmemorymanager.lib
       
    40  *  @since S60 v3.0
       
    41  */
       
    42 class CCmMmMain : public CBase
       
    43     {
       
    44 
       
    45 public: // Symbian constructors and C++ destructor
       
    46 
       
    47     /**
       
    48      * Creates new CCmMmMain class
       
    49      *
       
    50      * @since S60 v3.0
       
    51      * @param aDbManager
       
    52      * @return pointer to CCmMmMain object
       
    53      */
       
    54     IMPORT_C static CCmMmMain* NewL( CCmDmMain& aDbManager );
       
    55 
       
    56     /**
       
    57      * Creates new CCmMmMain class and leaves the instance
       
    58      * in the cleanup stack
       
    59      *
       
    60      * @since S60 v3.0
       
    61      * @param aDbManager
       
    62      * @return  pointer to CCmMmMain object
       
    63      */
       
    64     IMPORT_C static CCmMmMain* NewLC( CCmDmMain& aDbManager );
       
    65 
       
    66     /**
       
    67      * @since S60 v3.0
       
    68      *
       
    69      * C++ destructor
       
    70      */
       
    71     IMPORT_C virtual ~CCmMmMain();
       
    72 
       
    73 public: // New methods
       
    74 
       
    75     /**
       
    76      * Cancels deletion and shrinking
       
    77      *
       
    78      * @since S60 3.0
       
    79      */
       
    80     IMPORT_C void Cancel();
       
    81 
       
    82     /**
       
    83      * Deletes files from array
       
    84      *
       
    85      * @since S60 3.0
       
    86      * @param aFiles
       
    87      */
       
    88     IMPORT_C void DeleteFilesL( CDesCArray& aFiles );
       
    89 
       
    90     /**
       
    91      * Sets observer
       
    92      *
       
    93      * @since S60 3.0
       
    94      * @param aObserver
       
    95      */
       
    96     IMPORT_C void SetObserver( MCmMmObserver& aObserver );
       
    97 
       
    98     /**
       
    99      * Sets quotalistener on/off
       
   100      *
       
   101      * @since S60 3.0
       
   102      * @param aState
       
   103      */
       
   104     IMPORT_C void SetQuotaListenerStateL( TBool aState );
       
   105 
       
   106     /**
       
   107      * Shrinks files from array
       
   108      *
       
   109      * @since S60 3.0
       
   110      * @param aFiles
       
   111      */
       
   112     IMPORT_C void ShrinkImagesL( CDesCArray& aFiles );
       
   113 
       
   114     /**
       
   115      * Tells MMC state
       
   116      *
       
   117      * @since S60 3.0
       
   118      * @param aFileServer
       
   119      * @param aDriveNumber
       
   120      * @return ETrue if Drive is usable and else EFalse
       
   121      */
       
   122     static TBool CCmMmMain::DriveState( 
       
   123         const RFs& aFileServer, 
       
   124         TInt aDriveNumber );
       
   125 
       
   126 private: // Constructors
       
   127 
       
   128     /**
       
   129      * C++ constructor
       
   130      *
       
   131      * @since S60 3.0
       
   132      * @param aObserver
       
   133      */
       
   134     CCmMmMain( CCmDmMain& aDbManager );
       
   135 
       
   136     /**
       
   137      * Second-phase constructor
       
   138      *
       
   139      * @since S60 3.0
       
   140      */
       
   141     void ConstructL();
       
   142 
       
   143 private: // New methods
       
   144 
       
   145     /**
       
   146      * Static callback method for deletion
       
   147      *
       
   148      * @since S60 3.0
       
   149      * @param aMm
       
   150      */
       
   151     static TInt BackgroundDeleteL( TAny* aMm );
       
   152 
       
   153     /**
       
   154      * Deletes files in background
       
   155      *
       
   156      * @since S60 3.0
       
   157      * @return ETrue if Drive is usable and else EFalse
       
   158      */
       
   159     TInt DoBackgroundDeleteL();
       
   160 
       
   161     /**
       
   162      * Delete the collection hepler
       
   163      *
       
   164      * @since S60 3.0
       
   165      */
       
   166     void CloseMpxCollectionHelper();
       
   167 
       
   168 private: // data
       
   169     TInt                                iDeleteIndex;
       
   170     RFs                                 iFileSession;
       
   171     TBool                               iQuotaListenerState;            
       
   172     CCmDmMain&                          iDbManager;
       
   173     CIdle*                              iDeleter;               // owned
       
   174     CDesCArray*                         iFilesToDelete;         // owned
       
   175     CDesCArray*                         iFilesToShrink;         // owned   
       
   176     MMPXHarvesterUtility*               iHarvester;             // owned
       
   177     MCmMmObserver*                      iObserver;              // now owned
       
   178     CCmMmShrinker*                      iShrinker;              // owned
       
   179     RPointerArray<CCmMmQuotaListener>   iQuotaListeners;        // owned
       
   180     MMPXCollectionHelper*               iMpxCollectionHelper;   // owned
       
   181 
       
   182     };
       
   183 
       
   184 #endif // C_CMMMMAIN_H