instantmessagesalert/inc/cimalertpropertyobserver.h
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Publish & Subscribe property change observer
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CIMALERTPROPERTYOBSERVER_H
       
    19 #define CIMALERTPROPERTYOBSERVER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>        // CActive
       
    23 #include <e32property.h>    // RProperty
       
    24 
       
    25 #include "mimalertpropertynotificationobserver.h"
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31 *  Implementation of the Publish & Subscribe property change observer
       
    32 *
       
    33 *  @lib MGXMediaFileAPI.lib
       
    34 *  @since 2.6
       
    35 */
       
    36 NONSHARABLE_CLASS(CIMAlertPropertyObserver) : public CActive
       
    37     {
       
    38     public:  // Constructors and destructor
       
    39 
       
    40         /**
       
    41         * Two-phased constructor.
       
    42         * @param aObserver Observer to be informed when observed 
       
    43         *                  property changes
       
    44         */
       
    45         static CIMAlertPropertyObserver* NewL( 
       
    46                 MIMAlertPropertyNotificationObserver& aObserver );
       
    47 
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         virtual ~CIMAlertPropertyObserver();
       
    52 
       
    53     public:     // New functions
       
    54 
       
    55         /**
       
    56         * Starts observing the given key for any changes
       
    57         * Notifies the observer when the property changes
       
    58         * @since 2.6
       
    59         * @param aCategory, Category of the observed property
       
    60         * @param aKey, Observed property
       
    61         */
       
    62         void ObservePropertyChangeL( TUid aCategory, TUint aKey );
       
    63 
       
    64         /**
       
    65         * Stops observing the key given with call ObserverPropertyChangeL
       
    66         */
       
    67         void CancelObserve( );
       
    68 
       
    69         /**
       
    70         * Gets the uid this observer is observing
       
    71         * @return the category
       
    72         */
       
    73         TUid Category();
       
    74 
       
    75         /**
       
    76         * Gets the uid this observer is observing
       
    77         * @return the key
       
    78         */
       
    79         TUint Key();
       
    80 
       
    81 
       
    82     protected:  // Functions from base classes
       
    83 
       
    84         /**
       
    85         * From CActive
       
    86         */
       
    87         void RunL();
       
    88 
       
    89         /**
       
    90         * From CActive
       
    91         */
       
    92         void DoCancel();
       
    93 
       
    94     private:
       
    95 
       
    96         /**
       
    97         * C++ default constructor.
       
    98         */
       
    99         CIMAlertPropertyObserver( MIMAlertPropertyNotificationObserver& aObserver );
       
   100 
       
   101 
       
   102     private:    // Data
       
   103 
       
   104         // Owns: Observed property
       
   105         RProperty iProperty;
       
   106 
       
   107         // Observer to be informed when property changes
       
   108         MIMAlertPropertyNotificationObserver& iObserver;
       
   109 
       
   110 		// the category this observer is attached to
       
   111 		TUid iCategory;
       
   112 		// the key this observer is attached to
       
   113 		TUint iKey;
       
   114 
       
   115     };
       
   116 
       
   117 #endif      // CIMALERTPROPERTYOBSERVER_H
       
   118 
       
   119 // End of File