epoc32/include/app/MVPbkContactStoreObserver.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2004-2007 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:  An observer interface for contact store events
    15 *
    16 */
    17 
    18 
    19 #ifndef MVPBKCONTACTSTOREOBSERVER_H
    20 #define MVPBKCONTACTSTOREOBSERVER_H
    21 
    22 
    23 // INCLUDES
    24 #include <e32std.h>
    25 
    26 // FORWARD DECLARATIONS
    27 class MVPbkContactStore;
    28 class MVPbkContactLink;
    29 
    30 // CLASS DECLARATIONS
    31 
    32 /**
    33  * A class for a contact store event.
    34  *
    35  * The contact store event contains the type of the event and
    36  * possibly a contact link to a changed contact.
    37  */
    38 class TVPbkContactStoreEvent
    39     {
    40     public: // Types
    41         /**
    42          * The type of the event
    43          */
    44         enum TVPbkContactStoreEventType
    45             {
    46             /// No event occured
    47             ENullEvent,
    48             /// A contact has been added to the contact store
    49             EContactAdded,
    50             /// A contact has been deleted from the contact store
    51             EContactDeleted,
    52             /// An existing contact in the contact store has been changed
    53             EContactChanged,
    54             /// A contact group has been added to the contact store
    55             EGroupAdded,
    56             /// A contact group has been deleted from the contact store
    57             EGroupDeleted,
    58             /// An existing contact group in the contact store has been changed
    59             EGroupChanged,
    60             /// Contact store backup is beginning
    61             EStoreBackupBeginning,
    62             /// Contact store restore is beginning
    63             EStoreRestoreBeginning,
    64             /// Contact store backup or restore is completed
    65             EStoreBackupRestoreCompleted,
    66             /// There has been some unknown changes in the contact store
    67             EUnknownChanges
    68             };
    69 
    70     public: // Interface
    71         /**
    72          * Constructor
    73          *
    74          * @param aEventType The type of the contact store event
    75          * @param aContactLink The identifier of the changed contact or NULL.
    76          *                     The link is not owned by this class.
    77          */
    78         TVPbkContactStoreEvent(
    79                 TVPbkContactStoreEventType aEventType, 
    80                 MVPbkContactLink* aContactLink);
    81 
    82     public: // Contact store event data
    83         /// Own: Type of the event that has happened
    84         TVPbkContactStoreEventType iEventType;
    85         /// Ref: Link to the contact that is accociated with the event or NULL. 
    86         ///      The link is valid only during HandleStoreEventL function call
    87         ///      and client can not take the ownership of the instance.
    88         //       Client must clone the link if it needs it later.
    89         MVPbkContactLink* iContactLink;
    90         ///Own: Spare for future extension
    91         TAny* iSpare;
    92         ///Own: Spare for future extension
    93         TAny* iSpare2;
    94     };
    95 
    96 inline TVPbkContactStoreEvent::TVPbkContactStoreEvent(
    97         TVPbkContactStoreEventType aEventType, 
    98         MVPbkContactLink* aContactLink) :
    99     iEventType(aEventType),
   100     iContactLink(aContactLink)
   101     {
   102     }
   103 
   104 /**
   105  * An observer interface for contact store events
   106  *
   107  * The client of the contact store must implement this interface. The contact
   108  * store informs client about its state using this interface. The client is
   109  * also able to get store events about changes in the store content.
   110  */
   111 class MVPbkContactStoreObserver
   112     {
   113     public:  // New functions
   114         /**
   115          * Called when a contact store is ready to use.
   116          *
   117          * @param aContactStore The store that is ready.
   118          */
   119         virtual void StoreReady(MVPbkContactStore& aContactStore) =0;
   120 
   121         /**
   122          * Called when a contact store becomes unavailable.
   123          *
   124          * Client may inspect the reason of the unavailability and decide
   125          * whether or not it will keep the store opened (ie. listen to 
   126          * the store events).
   127          *
   128          * @param aContactStore The store that became unavailable.
   129          * @param aReason The reason why the store is unavailable.
   130          *                This is one of the system wide error codes.
   131          */
   132         virtual void StoreUnavailable(MVPbkContactStore& aContactStore, 
   133                 TInt aReason) =0;
   134 
   135         /**
   136          * Called when changes occur in the contact store.
   137          *
   138          * @see TVPbkContactStoreEvent
   139          * @param aContactStore A store whose event it is.
   140          * @param aStoreEvent The event that has occurred.
   141          */
   142         virtual void HandleStoreEventL(
   143                 MVPbkContactStore& aContactStore, 
   144                 TVPbkContactStoreEvent aStoreEvent) =0;
   145 
   146         /**
   147          * Returns an extension point for this interface or NULL.
   148          *
   149          * @param aExtensionUid no extensions defined currently.
   150          * @return an extension point for this interface or NULL.
   151          */
   152         virtual TAny* ContactStoreObserverExtension(TUid /*aExtensionUid*/) 
   153                 { return NULL; }
   154 
   155     protected:  // Destructor
   156         virtual ~MVPbkContactStoreObserver() { }
   157 
   158     };
   159 
   160 
   161 #endif  // MVPBKCONTACTSTOREOBSERVER_H
   162 
   163 //End of file