messagingappbase/ncnlist/inc/CNcnCRRepositoryHandler.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004 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:   Defines class CNcnCRRepositoryHandler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef NCNCRREPOSITORYHANDLER_H
       
    21 #define NCNCRREPOSITORYHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <cenrepnotifyhandler.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MNcnCRRepositoryHandlerCallback;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  Observes the value of the CenRep key changes withing a repository.
       
    34 */
       
    35 class CNcnCRRepositoryHandler :
       
    36     public CBase,
       
    37     public MCenRepNotifyHandlerCallback
       
    38     {
       
    39     private:  // Constructors and destructor
       
    40 
       
    41         /**
       
    42         * C++ default constructor.
       
    43         * @param aRepository The repository to handle.
       
    44         * @param aKeyType Key type.
       
    45         * @param aId Id of the key.
       
    46         */
       
    47         CNcnCRRepositoryHandler(
       
    48             MNcnCRRepositoryHandlerCallback& aCallback,
       
    49             CRepository& aRepository,
       
    50             CCenRepNotifyHandler::TCenRepKeyType aKeyType,
       
    51             TUint32 aId );
       
    52 
       
    53     public:  // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         */
       
    58         static CNcnCRRepositoryHandler* NewL(
       
    59             MNcnCRRepositoryHandlerCallback& aCallback,
       
    60             CRepository& aRepository,
       
    61             CCenRepNotifyHandler::TCenRepKeyType aKeyType,
       
    62             TUint32 aId );
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         virtual ~CNcnCRRepositoryHandler();
       
    68 
       
    69     public: // From MCenRepNotifyHandlerCallback
       
    70         void HandleNotifyInt(TUint32 aId, TInt aNewValue);
       
    71         void HandleNotifyReal(TUint32 aId, TReal aNewValue);    
       
    72         void HandleNotifyString(TUint32 aId, const TDesC16& aNewValue);
       
    73         void HandleNotifyBinary(TUint32 aId, const TDesC8& aNewValue);
       
    74         void HandleNotifyGeneric(TUint32 aId);
       
    75         void HandleNotifyError(TUint32 aId, TInt aError, CCenRepNotifyHandler* aHandler);
       
    76 
       
    77     public:  // Other public methods
       
    78         /**
       
    79          * Starts listening the repository for specified key changes.
       
    80          */
       
    81         void StartListeningL();
       
    82 
       
    83         /**
       
    84          * Stops the listening.
       
    85          */
       
    86         void StopListening();
       
    87 
       
    88     protected: // Data
       
    89 
       
    90         // Callback reference
       
    91         MNcnCRRepositoryHandlerCallback& iCallback;
       
    92 
       
    93         // CenRep repository reference
       
    94         CRepository& iRepository;
       
    95         
       
    96         // Notify handler for repository key, owned
       
    97         CCenRepNotifyHandler* iNotifyHandler;
       
    98         
       
    99         // Key type
       
   100         CCenRepNotifyHandler::TCenRepKeyType iKeyType;
       
   101         
       
   102         // Id of the key
       
   103         TUint32 iId;
       
   104     };
       
   105 
       
   106 #endif    // NCNCRREPOSITORYHANDLER_H
       
   107 
       
   108 // End of File