phonebookui/Phonebook/Engine/inc/CPbkDefaultCompressionStrategy.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *      Interface for Phonebook database compression strategy.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CPBKDEFAULTCOMPRESSIONSTRATEGY_H__
       
    21 #define __CPBKDEFAULTCOMPRESSIONSTRATEGY_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <cntdb.h>      // for MContactUiCompactObserver
       
    25 #include "MPbkCompressionStrategy.h"
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30  * Default Phonebook database compression strategy.
       
    31  */
       
    32 NONSHARABLE_CLASS(CPbkDefaultCompressionStrategy) :
       
    33         public CBase,
       
    34         public MPbkCompressionStrategy,
       
    35         private MContactDbObserver,
       
    36         private MContactUiCompactObserver
       
    37     {
       
    38     public:
       
    39         /**
       
    40          * Creates a new instance of this class.
       
    41          *
       
    42          * @param aDb       contact database whose compression to manage.
       
    43          * @param aDbDrive  the drive aDb is on. This parameter is needed 
       
    44          *                  because the drive cannot be retrieved from 
       
    45          *                  CContactDatabase once it is opened.
       
    46          * @param aFs       Open file system handle. 
       
    47          */
       
    48         static CPbkDefaultCompressionStrategy* NewL
       
    49             (CContactDatabase& aDb, TDriveNumber aDbDrive, RFs& aFs);
       
    50 
       
    51         /**
       
    52          * Destructor.
       
    53          */
       
    54         ~CPbkDefaultCompressionStrategy();
       
    55 
       
    56     public: // from MPbkCompressionStrategy
       
    57         void SetCompressUi(MPbkCompressUi* aCompressUi);
       
    58         TBool CheckCompress();
       
    59         TBool IsCompressionEnabled();
       
    60         void CompressL();
       
    61         void CancelCompress();
       
    62         void Release();
       
    63 
       
    64     private:  // from MContactDbObserver
       
    65     	void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
       
    66 
       
    67     private:  // from MContactUiCompactObserver
       
    68 	    void Step(TInt aStep);
       
    69 	    void HandleError(TInt aError);
       
    70 
       
    71     private:  // Implementation
       
    72         CPbkDefaultCompressionStrategy
       
    73             (CContactDatabase& aDb, TDriveNumber aDbDrive, RFs& aFs);
       
    74         void ConstructL();
       
    75         void DoCompressL();
       
    76         TBool FileSpaceLowOnDbDrive() const;
       
    77         class CCompressionTimer;
       
    78         friend class CCompressionTimer;
       
    79         class CDiskSpaceWatcher;
       
    80 
       
    81     private:  // Data
       
    82         /// Ref: contact database whose compression to manage
       
    83         CContactDatabase& iDb;
       
    84         /// Own: drive the contact database is on
       
    85         TDriveNumber iDbDrive;
       
    86         /// Own: File server connection
       
    87         mutable RFs iFs;
       
    88         /// Own: contact database change notifier
       
    89         CContactChangeNotifier* iDbChangeNotifier;
       
    90         // Own: compression timer
       
    91         CCompressionTimer* iCompressionTimer;
       
    92         /// Own: disk space watcher
       
    93         CDiskSpaceWatcher* iDiskSpaceWatcher;
       
    94         /// Own: executing database compression object
       
    95         CContactActiveCompress* iCompressor;
       
    96         /// Ref: compress UI
       
    97         MPbkCompressUi* iCompressUi;
       
    98     };
       
    99 
       
   100 
       
   101 #endif // __CPBKDEFAULTCOMPRESSIONSTRATEGY_H__
       
   102 
       
   103 
       
   104 // End of File