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