eventsui/eventsengine/inc/evtdbnotifier.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2008 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:  Notifier class for any change in Storage API database.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_EVTDBNOTIFIER_H
       
    20 #define C_EVTDBNOTIFIER_H
       
    21 
       
    22 // System Includes
       
    23 
       
    24 //  System Includes
       
    25 #include <e32base.h>
       
    26 
       
    27 // User Includes
       
    28 
       
    29 // User Includes
       
    30 #include "evtdbobserver.h"
       
    31 #include "evtstoragedbobserver.h"
       
    32 #include "evtstoragedomaincrkeys.h"
       
    33 
       
    34 // Forward Declarations
       
    35 class CRepository;
       
    36 
       
    37 // extern data types
       
    38 
       
    39 // global Functions
       
    40 
       
    41 // constants go here
       
    42 
       
    43 /**
       
    44  *  Class that monitors Storage Database for any change.
       
    45  *  This class requests for any change in the Stroage database. 
       
    46  *
       
    47  *  @lib evtstorage.lib
       
    48  *  @since S60 v9.1
       
    49  */
       
    50 class CEvtDbNotifier : public CActive
       
    51     {  
       
    52 public:
       
    53     /**
       
    54      * Constructs a new instance of Event Notifier.
       
    55      *
       
    56      * @return The new instance of Event Notifier.
       
    57      * @leave System wide error code if the object creation fails.         
       
    58      */
       
    59     static CEvtDbNotifier* NewL( MEvtDbObserver&    aObserver );
       
    60     
       
    61     /**
       
    62      * Constructs a new instance of Event Notifier.
       
    63      * Leaves the created instance on the cleanup stack.
       
    64      *
       
    65      * @return The new instance of Event Notifier object.
       
    66      * @leave System wide error code if the object creation fails.         
       
    67      */
       
    68     static CEvtDbNotifier* NewLC( MEvtDbObserver&    aObserver );  
       
    69     
       
    70     /**
       
    71      * Destructor
       
    72      */
       
    73     virtual ~CEvtDbNotifier ();
       
    74     
       
    75     /**
       
    76      * Observer for TDbChangeType changes in Storage Database.
       
    77      */
       
    78     void DbChangedL( );
       
    79 
       
    80 	// Inherited from CActive 
       
    81     void RunL();
       
    82     
       
    83     void DoCancel();
       
    84     
       
    85     TInt RunError( TInt aError ); 
       
    86 
       
    87 private: 
       
    88     /**
       
    89      * Handle any change to database.
       
    90      */   
       
    91     void HandleDbChangedL( );
       
    92     
       
    93     /**
       
    94      * Request to get database notifications on change.
       
    95      */   
       
    96     void StartNotification();
       
    97     
       
    98     /**
       
    99      * Default C++ Constructor.
       
   100      */
       
   101     CEvtDbNotifier( MEvtDbObserver&    aObserver ); 
       
   102 
       
   103     /**
       
   104      * Second phase of the two phase constructor.
       
   105      */
       
   106     void ConstructL();
       
   107 
       
   108 private: // data
       
   109     
       
   110     /**
       
   111      *  Reference to Observer
       
   112      * 	Does Not own
       
   113      */
       
   114     MEvtDbObserver&					iDbObserver;
       
   115     
       
   116     /**
       
   117      *  CRepository Instance
       
   118      */
       
   119     CRepository*                    iRepository;
       
   120 
       
   121     };
       
   122 
       
   123 #endif // C_EVTDBNOTIFIER_H