gsprofilesrv_plat/profiles_engine_api/inc/CProfileChangeNotifyHandler.h
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     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:  Profile change notify handler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CPROFILECHANGENOTIFYHANDLER_H__
       
    21 #define __CPROFILECHANGENOTIFYHANDLER_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CRepository;
       
    29 
       
    30 class MProfileChangeObserver;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  Profile change notify handler.
       
    36 *  How to use:
       
    37 *  class CMyClass : public CBase, public MProfileChangeObserver
       
    38 *      {
       
    39 *      ...
       
    40 *      virtual void HandleActiveProfileEventL(
       
    41 *              TProfileEvent aProfileEvent, TInt aProfileId );
       
    42 *      ...
       
    43 *      private:    // data
       
    44 *          CProfileChangeNotifyHandler* iHandler;
       
    45 *
       
    46 *      }
       
    47 *  void CMyClass::ConstructL()
       
    48 *      {
       
    49 *      iHandler = CProfileChangeNotifyHandler::NewL( this );
       
    50 *      }
       
    51 *
       
    52 *  void CMyClass::HandleActiveProfileEventL(
       
    53 *              TProfileEvent aProfileEvent,
       
    54 *              TInt aProfileId )
       
    55 *      {
       
    56 *      // handle event
       
    57 *      }
       
    58 *
       
    59 *  @lib ProfileEng.lib
       
    60 *  @since 2.0
       
    61 */
       
    62 
       
    63 NONSHARABLE_CLASS(CProfileChangeNotifyHandler) : public CBase
       
    64     {
       
    65     private: // class definitions
       
    66 
       
    67         NONSHARABLE_CLASS(CProfilePSObserver) : public CActive
       
    68             {
       
    69             public:  // constructor and destructor
       
    70                 CProfilePSObserver( TUint32 aPSKey );
       
    71                 ~CProfilePSObserver(); 
       
    72 
       
    73             public: // New functions:
       
    74 
       
    75                 /**
       
    76                  * Requests notifications from P&S of KProEngActiveProfile-
       
    77                  * Modified value changes.
       
    78                  */
       
    79                 void RequestNotificationL();
       
    80 
       
    81             private: // Functions from base classes
       
    82 
       
    83                 /**
       
    84                  * From CActive.
       
    85                  */
       
    86                 void RunL();
       
    87                 void DoCancel();
       
    88 
       
    89             public: // Data:
       
    90 
       
    91                 // The P&S key to observe
       
    92                 TUint32 iPSKey;
       
    93 
       
    94                 // Ref:
       
    95                 CRepository* iCenRep;
       
    96 
       
    97                 // Own:
       
    98                 RProperty iProperty;
       
    99 
       
   100                 // Ref: Active profile change observer
       
   101                 MProfileChangeObserver* iProfileChangeObserver;
       
   102 
       
   103                 TBool iAttached;
       
   104 
       
   105             };
       
   106 
       
   107     public:  // Constructors and destructor
       
   108 
       
   109         /**
       
   110         * Two-phased constructor.
       
   111         * @param aProfileChangeObserver Profile change observer.
       
   112         */
       
   113         IMPORT_C static CProfileChangeNotifyHandler* NewL(
       
   114             MProfileChangeObserver* aProfileChangeObserver );
       
   115 
       
   116         /**
       
   117         * Destructor.
       
   118         */
       
   119         virtual ~CProfileChangeNotifyHandler();
       
   120 
       
   121     private:
       
   122 
       
   123         /**
       
   124         * C++ default constructor.
       
   125         * @param aProfileChangeObserver Profile change observer.
       
   126         */
       
   127         CProfileChangeNotifyHandler(
       
   128             MProfileChangeObserver* aProfileChangeObserver );
       
   129 
       
   130         /**
       
   131         * By default Symbian 2nd phase constructor is private.
       
   132         */
       
   133         void ConstructL();
       
   134 
       
   135     private:    // Data
       
   136 
       
   137         // Ref: Active profile change observer
       
   138         MProfileChangeObserver* iProfileChangeObserver;
       
   139 
       
   140         // Own:
       
   141         CProfilePSObserver* iActiveProfileObserver;
       
   142 
       
   143         // Own:
       
   144         CProfilePSObserver* iPSObserver;
       
   145 
       
   146         // Own:
       
   147         CRepository* iRepository;
       
   148     };
       
   149 
       
   150 #endif      //  __CPROFILECHANGENOTIFYHANDLER_H__
       
   151 
       
   152 // End of File