epoc32/include/app/MVPbkContactStoreObserver.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/MVPbkContactStoreObserver.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,163 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  An observer interface for contact store events
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef MVPBKCONTACTSTOREOBSERVER_H
    1.23 +#define MVPBKCONTACTSTOREOBSERVER_H
    1.24 +
    1.25 +
    1.26 +// INCLUDES
    1.27 +#include <e32std.h>
    1.28 +
    1.29 +// FORWARD DECLARATIONS
    1.30 +class MVPbkContactStore;
    1.31 +class MVPbkContactLink;
    1.32 +
    1.33 +// CLASS DECLARATIONS
    1.34 +
    1.35 +/**
    1.36 + * A class for a contact store event.
    1.37 + *
    1.38 + * The contact store event contains the type of the event and
    1.39 + * possibly a contact link to a changed contact.
    1.40 + */
    1.41 +class TVPbkContactStoreEvent
    1.42 +    {
    1.43 +    public: // Types
    1.44 +        /**
    1.45 +         * The type of the event
    1.46 +         */
    1.47 +        enum TVPbkContactStoreEventType
    1.48 +            {
    1.49 +            /// No event occured
    1.50 +            ENullEvent,
    1.51 +            /// A contact has been added to the contact store
    1.52 +            EContactAdded,
    1.53 +            /// A contact has been deleted from the contact store
    1.54 +            EContactDeleted,
    1.55 +            /// An existing contact in the contact store has been changed
    1.56 +            EContactChanged,
    1.57 +            /// A contact group has been added to the contact store
    1.58 +            EGroupAdded,
    1.59 +            /// A contact group has been deleted from the contact store
    1.60 +            EGroupDeleted,
    1.61 +            /// An existing contact group in the contact store has been changed
    1.62 +            EGroupChanged,
    1.63 +            /// Contact store backup is beginning
    1.64 +            EStoreBackupBeginning,
    1.65 +            /// Contact store restore is beginning
    1.66 +            EStoreRestoreBeginning,
    1.67 +            /// Contact store backup or restore is completed
    1.68 +            EStoreBackupRestoreCompleted,
    1.69 +            /// There has been some unknown changes in the contact store
    1.70 +            EUnknownChanges
    1.71 +            };
    1.72 +
    1.73 +    public: // Interface
    1.74 +        /**
    1.75 +         * Constructor
    1.76 +         *
    1.77 +         * @param aEventType The type of the contact store event
    1.78 +         * @param aContactLink The identifier of the changed contact or NULL.
    1.79 +         *                     The link is not owned by this class.
    1.80 +         */
    1.81 +        TVPbkContactStoreEvent(
    1.82 +                TVPbkContactStoreEventType aEventType, 
    1.83 +                MVPbkContactLink* aContactLink);
    1.84 +
    1.85 +    public: // Contact store event data
    1.86 +        /// Own: Type of the event that has happened
    1.87 +        TVPbkContactStoreEventType iEventType;
    1.88 +        /// Ref: Link to the contact that is accociated with the event or NULL. 
    1.89 +        ///      The link is valid only during HandleStoreEventL function call
    1.90 +        ///      and client can not take the ownership of the instance.
    1.91 +        //       Client must clone the link if it needs it later.
    1.92 +        MVPbkContactLink* iContactLink;
    1.93 +        ///Own: Spare for future extension
    1.94 +        TAny* iSpare;
    1.95 +        ///Own: Spare for future extension
    1.96 +        TAny* iSpare2;
    1.97 +    };
    1.98 +
    1.99 +inline TVPbkContactStoreEvent::TVPbkContactStoreEvent(
   1.100 +        TVPbkContactStoreEventType aEventType, 
   1.101 +        MVPbkContactLink* aContactLink) :
   1.102 +    iEventType(aEventType),
   1.103 +    iContactLink(aContactLink)
   1.104 +    {
   1.105 +    }
   1.106 +
   1.107 +/**
   1.108 + * An observer interface for contact store events
   1.109 + *
   1.110 + * The client of the contact store must implement this interface. The contact
   1.111 + * store informs client about its state using this interface. The client is
   1.112 + * also able to get store events about changes in the store content.
   1.113 + */
   1.114 +class MVPbkContactStoreObserver
   1.115 +    {
   1.116 +    public:  // New functions
   1.117 +        /**
   1.118 +         * Called when a contact store is ready to use.
   1.119 +         *
   1.120 +         * @param aContactStore The store that is ready.
   1.121 +         */
   1.122 +        virtual void StoreReady(MVPbkContactStore& aContactStore) =0;
   1.123 +
   1.124 +        /**
   1.125 +         * Called when a contact store becomes unavailable.
   1.126 +         *
   1.127 +         * Client may inspect the reason of the unavailability and decide
   1.128 +         * whether or not it will keep the store opened (ie. listen to 
   1.129 +         * the store events).
   1.130 +         *
   1.131 +         * @param aContactStore The store that became unavailable.
   1.132 +         * @param aReason The reason why the store is unavailable.
   1.133 +         *                This is one of the system wide error codes.
   1.134 +         */
   1.135 +        virtual void StoreUnavailable(MVPbkContactStore& aContactStore, 
   1.136 +                TInt aReason) =0;
   1.137 +
   1.138 +        /**
   1.139 +         * Called when changes occur in the contact store.
   1.140 +         *
   1.141 +         * @see TVPbkContactStoreEvent
   1.142 +         * @param aContactStore A store whose event it is.
   1.143 +         * @param aStoreEvent The event that has occurred.
   1.144 +         */
   1.145 +        virtual void HandleStoreEventL(
   1.146 +                MVPbkContactStore& aContactStore, 
   1.147 +                TVPbkContactStoreEvent aStoreEvent) =0;
   1.148 +
   1.149 +        /**
   1.150 +         * Returns an extension point for this interface or NULL.
   1.151 +         *
   1.152 +         * @param aExtensionUid no extensions defined currently.
   1.153 +         * @return an extension point for this interface or NULL.
   1.154 +         */
   1.155 +        virtual TAny* ContactStoreObserverExtension(TUid /*aExtensionUid*/) 
   1.156 +                { return NULL; }
   1.157 +
   1.158 +    protected:  // Destructor
   1.159 +        virtual ~MVPbkContactStoreObserver() { }
   1.160 +
   1.161 +    };
   1.162 +
   1.163 +
   1.164 +#endif  // MVPBKCONTACTSTOREOBSERVER_H
   1.165 +
   1.166 +//End of file