taskswitcher/contextengine/hgctxutils/inc/hgcenreplistener.h
changeset 4 4d54b72983ae
parent 3 fb3763350a08
child 5 c743ef5928ba
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
     1 /*
       
     2 * ===========================================================================
       
     3 *  Name        : HgCenrepListener.h
       
     4 *  Part of     : Hg
       
     5 *  Description : Class to get notifications about changes to a cenrep key
       
     6 *
       
     7 *  Copyright © 2008 Nokia Corporation.
       
     8 *  This material, including documentation and any related 
       
     9 *  computer programs, is protected by copyright controlled by 
       
    10 *  Nokia Corporation. All rights are reserved. Copying, 
       
    11 *  including reproducing, storing, adapting or translating, any 
       
    12 *  or all of this material requires the prior written consent of 
       
    13 *  Nokia Corporation. This material also contains confidential 
       
    14 *  information which may not be disclosed to others without the 
       
    15 *  prior written consent of Nokia Corporation.
       
    16 * ===========================================================================
       
    17 */
       
    18 
       
    19 #ifndef __CENREPLISTENER_H__
       
    20 #define __CENREPLISTENER_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CRepository;
       
    25 
       
    26 /**
       
    27  * Observer interface for getting notifications about a cenrep key change.
       
    28  */
       
    29 class MHgCenrepChangeObserver
       
    30     {
       
    31 public:
       
    32     virtual void CenrepChanged( TUint32 aKey, TInt aNewValue ) = 0;
       
    33     };
       
    34 
       
    35 /**
       
    36  * Class to get notifications about changes to a cenrep key.
       
    37  */
       
    38 NONSHARABLE_CLASS( CHgCenrepListener ) : public CActive
       
    39     {
       
    40 public:
       
    41     /**
       
    42      * Fist step constructor
       
    43      */
       
    44     IMPORT_C static CHgCenrepListener* NewL(const TUid& aRep, TUint32 aKey,
       
    45                                             MHgCenrepChangeObserver& aObserver);
       
    46     
       
    47     /**
       
    48      * Fist step constructor
       
    49      */
       
    50     IMPORT_C static CHgCenrepListener* NewLC(const TUid& aRep, TUint32 aKey,
       
    51                                              MHgCenrepChangeObserver& aObserver);
       
    52     
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     IMPORT_C ~CHgCenrepListener();
       
    57     
       
    58     /**
       
    59      * Returns the current value of the watched key.
       
    60      */
       
    61     IMPORT_C TInt Value();
       
    62     
       
    63 private:
       
    64     /**
       
    65      * Constructor.
       
    66      * Starts listening for the key.
       
    67      */
       
    68     CHgCenrepListener(TUint32 aKey,
       
    69         MHgCenrepChangeObserver& aObserver );
       
    70     
       
    71     /**
       
    72      * Second step constructor 
       
    73      */
       
    74     void ConstructL(const TUid& aRep);
       
    75     
       
    76     void DoCancel();
       
    77     void RunL(); 
       
    78     TInt RunError( TInt aError );
       
    79     
       
    80     MHgCenrepChangeObserver& iObserver;
       
    81     CRepository* iRep;
       
    82     TUint32 iKey;
       
    83     };
       
    84     
       
    85 #endif