epoc32/include/app/MVPbkContactViewBase.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 interface for contact views.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
#ifndef MVPBKCONTACTVIEWBASE_H
williamr@4
    20
#define MVPBKCONTACTVIEWBASE_H
williamr@4
    21
williamr@4
    22
// INCLUDES
williamr@4
    23
#include <e32cmn.h>
williamr@4
    24
#include <vpbkcontactview.hrh>
williamr@4
    25
#include <bamdesca.h>
williamr@4
    26
williamr@4
    27
// FORWARD DECLARATIONS
williamr@4
    28
class MVPbkContactViewObserver;
williamr@4
    29
class MVPbkViewContact;
williamr@4
    30
class MVPbkContactLink;
williamr@4
    31
class MVPbkFieldTypeList;
williamr@4
    32
class MVPbkContactBookmark;
williamr@4
    33
class MVPbkContactViewFiltering;
williamr@4
    34
williamr@4
    35
// CLASS DECLARATIONS
williamr@4
    36
williamr@4
    37
/**
williamr@4
    38
 * An common interface for different contact views.
williamr@4
    39
 * 
williamr@4
    40
 * The contact view interface has many implementations. It can be a view from
williamr@4
    41
 * a single contact store or it can be a composite of contact/group views from
williamr@4
    42
 * different stores. It's also possible that it contains folding items that
williamr@4
    43
 * are not from any store. The client defines the view structure.
williamr@4
    44
 * 
williamr@4
    45
 * The most common usage is that client uses CVPbkContactManager 
williamr@4
    46
 * for creating a contact view and defines the structure of the view.
williamr@4
    47
 * @see CVPbkContactManager::CreateContactViewLC
williamr@4
    48
 */
williamr@4
    49
class MVPbkContactViewBase
williamr@4
    50
    {
williamr@4
    51
    public:  // Destructor
williamr@4
    52
williamr@4
    53
        /**
williamr@4
    54
         * Destructor.
williamr@4
    55
         */
williamr@4
    56
        virtual ~MVPbkContactViewBase() { }
williamr@4
    57
williamr@4
    58
    public:  // New functions
williamr@4
    59
williamr@4
    60
        /**
williamr@4
    61
         * Returns type of this contact view.
williamr@4
    62
         *
williamr@4
    63
         * @return A contact view type.
williamr@4
    64
         */
williamr@4
    65
        virtual TVPbkContactViewType Type() const = 0;
williamr@4
    66
williamr@4
    67
        /**
williamr@4
    68
         * Changes sort order of the view asynchronously.
williamr@4
    69
         *
williamr@4
    70
         * Clients of this view will get an event via MVPbkContactViewObserver
williamr@4
    71
         * interface when the order has been updated. The leaf view sends
williamr@4
    72
         * a pair of events. First it sends ContactViewUnavailable and then
williamr@4
    73
         * after the order has been changed ContactViewReady. However if
williamr@4
    74
         * the view is of type EVPbkCompositeView the client doesn't necessary
williamr@4
    75
         * receive ContactViewUnavailable at all because it might be that
williamr@4
    76
         * there is always some subview ready in the composite.
williamr@4
    77
         *
williamr@4
    78
         * @param aSortOrder A new sort order for this view.
williamr@4
    79
         * @exception KErrArgument Possible reasons: a client tries to change
williamr@4
    80
         *                         a sort order of platform defined shared
williamr@4
    81
         *                         view against the platform setting.
williamr@4
    82
         * @see CVPbkSortOrder
williamr@4
    83
         */
williamr@4
    84
        virtual void ChangeSortOrderL(
williamr@4
    85
                const MVPbkFieldTypeList& aSortOrder ) = 0;
williamr@4
    86
williamr@4
    87
        /**
williamr@4
    88
         * Returns the current sort order of the view.
williamr@4
    89
         *
williamr@4
    90
         * The sort order is a sub set of master field types from
williamr@4
    91
         * CVPbkContactManager.
williamr@4
    92
         *
williamr@4
    93
         * @return The sort order of the view.
williamr@4
    94
         */
williamr@4
    95
        virtual const MVPbkFieldTypeList& SortOrder() const = 0;
williamr@4
    96
williamr@4
    97
        /**
williamr@4
    98
         * Refreshes the view contents asynchronously.
williamr@4
    99
         * 
williamr@4
   100
         * All handles to this view's contacts are invalidated.
williamr@4
   101
         * Clients of this view will get an event via MVPbkContactViewObserver
williamr@4
   102
         * interface when the view has been refreshed.
williamr@4
   103
         */
williamr@4
   104
        virtual void RefreshL() = 0;
williamr@4
   105
        
williamr@4
   106
        /**
williamr@4
   107
         * Returns the number of contacts in this view.
williamr@4
   108
         *
williamr@4
   109
         * @return The number of contacts.
williamr@4
   110
         */
williamr@4
   111
        virtual TInt ContactCountL() const = 0;
williamr@4
   112
williamr@4
   113
        /**
williamr@4
   114
         * Returns a contact in this view. 
williamr@4
   115
         *
williamr@4
   116
         * The returned reference may be invalidated when this 
williamr@4
   117
         * function is called again. For that reason clients should prefer
williamr@4
   118
         * not to save references to the contacts retrieved from this function.
williamr@4
   119
         *
williamr@4
   120
         * @param aIndex An index of the contact in this view.
williamr@4
   121
         * @return A reference to a contact in this view at aIndex.
williamr@4
   122
         * @precond aIndex >= 0
williamr@4
   123
         *              VPbkError::Panic(VPbkError::EInvalidContactIndex)
williamr@4
   124
         *              is raised if the precondition does not hold.
williamr@4
   125
         * @exception KErrArgument if aIndex >= ContactCountL()
williamr@4
   126
         */
williamr@4
   127
        virtual const MVPbkViewContact& ContactAtL(
williamr@4
   128
                TInt aIndex ) const = 0;
williamr@4
   129
williamr@4
   130
        /**
williamr@4
   131
         * Creates and returns a link that points to contact at aIndex.
williamr@4
   132
         *
williamr@4
   133
         * NOTE: If the view contact is not from any store it can return
williamr@4
   134
         *       also NULL. E.g. if the view contact is a folding 
williamr@4
   135
         *       contact view that it's not saved to any store.
williamr@4
   136
         *       The NULL is not pushed onto the cleanup stack.
williamr@4
   137
         *
williamr@4
   138
         * @param aIndex An index of the contact for which the link
williamr@4
   139
         *               is created.
williamr@4
   140
         * @return A new link object pointing to contact at aIndex or NULL if
williamr@4
   141
         *          the link can't be created (e.g. a folder).
williamr@4
   142
         * @precond aIndex >= 0
williamr@4
   143
         *          VPbkError::Panic(VPbkError::EInvalidContactIndex)
williamr@4
   144
         *          is raised if the precondition does not hold.
williamr@4
   145
         * @exception KErrArgument if aIndex >= ContactCountL()
williamr@4
   146
         */
williamr@4
   147
        virtual MVPbkContactLink* CreateLinkLC(
williamr@4
   148
                TInt aIndex ) const = 0;
williamr@4
   149
williamr@4
   150
        /**
williamr@4
   151
         * Returns The index of the aContactLink in this view.
williamr@4
   152
         *
williamr@4
   153
         * If the identifier is not found from the view then
williamr@4
   154
         * KErrNotFound is returned. If the view is not from
williamr@4
   155
         * any store (e.g. a folding view) then it will also
williamr@4
   156
         * return KErrNotFound.
williamr@4
   157
         *
williamr@4
   158
         * NOTE: the implementation of this function probably
williamr@4
   159
         *       must loop the view which means that calling
williamr@4
   160
         *       this function frequently or in a loop can
williamr@4
   161
         *       be slow when there are lots of contacts.
williamr@4
   162
         *
williamr@4
   163
         * @param aContactLink A link whose index is searched for.
williamr@4
   164
         * @return The index of the link or KErrNotFound.
williamr@4
   165
         */
williamr@4
   166
        virtual TInt IndexOfLinkL(
williamr@4
   167
                const MVPbkContactLink& aContactLink ) const = 0;
williamr@4
   168
williamr@4
   169
        /**
williamr@4
   170
         * Adds an observer to this contact view asynchronously. 
williamr@4
   171
         *
williamr@4
   172
         * The observer will be notified after it has been added
williamr@4
   173
         * to the view.
williamr@4
   174
         *
williamr@4
   175
         * @param aObserver A new observer for the view.
williamr@4
   176
         */
williamr@4
   177
        virtual void AddObserverL(
williamr@4
   178
                MVPbkContactViewObserver& aObserver ) = 0;
williamr@4
   179
williamr@4
   180
        /**
williamr@4
   181
         * Removes an observer from this contact view.
williamr@4
   182
         *
williamr@4
   183
         * This method can be called even if aObserver has not been
williamr@4
   184
         * previously added. In that case, no observers are removed.
williamr@4
   185
         *
williamr@4
   186
         * @param aObserver The observer to be removed.
williamr@4
   187
         */
williamr@4
   188
        virtual void RemoveObserver(
williamr@4
   189
                MVPbkContactViewObserver& aObserver ) = 0;
williamr@4
   190
        
williamr@4
   191
        /**
williamr@4
   192
         * Returns ETrue if this view is from a store identified 
williamr@4
   193
         * by aContactStoreUri.
williamr@4
   194
         *
williamr@4
   195
         * @param aContactStoreUri The whole URI of the contact store.
williamr@4
   196
         * @return ETrue if the view was from the given store.
williamr@4
   197
         *
williamr@4
   198
         * @see TVPbkContactStoreUriPtr::UriDes
williamr@4
   199
         */
williamr@4
   200
        virtual TBool MatchContactStore(
williamr@4
   201
                const TDesC& aContactStoreUri ) const = 0;
williamr@4
   202
        
williamr@4
   203
        /**
williamr@4
   204
         * Returns ETrue if this view is from a store domain identified 
williamr@4
   205
         * by aContactStoreDomain.
williamr@4
   206
         *
williamr@4
   207
         * @param aContactStoreDomain The domain part of the contact store URI.
williamr@4
   208
         *                            The domain can be retrieved from the 
williamr@4
   209
         *                            whole contact store URI using class 
williamr@4
   210
         *                            TVPbkContactStoreUriPtr and 
williamr@4
   211
         *                            EContactStoreUriStoreType.
williamr@4
   212
         *                            An implementation compares the
williamr@4
   213
         *                            EContactStoreUriStoreType part of 
williamr@4
   214
         *                            its own URI to aContactStoreDomain.
williamr@4
   215
         *                            
williamr@4
   216
         * @return ETrue if the view was from the same store domain.
williamr@4
   217
         * @see TVPbkContactStoreUriPtr
williamr@4
   218
         */
williamr@4
   219
        virtual TBool MatchContactStoreDomain(
williamr@4
   220
                const TDesC& aContactStoreDomain ) const = 0;
williamr@4
   221
        
williamr@4
   222
        /**
williamr@4
   223
         * Creates and returns a bookmark that points to the
williamr@4
   224
         * view contact at aIndex.
williamr@4
   225
         *
williamr@4
   226
         * @param aIndex An index of the contact in the view.
williamr@4
   227
         * @return A new bookmark to the view item.
williamr@4
   228
         * @precond aIndex >= 0
williamr@4
   229
         *          VPbkError::Panic(VPbkError::EInvalidContactIndex)
williamr@4
   230
         *          is raised if the precondition does not hold.
williamr@4
   231
         */
williamr@4
   232
        virtual MVPbkContactBookmark* CreateBookmarkLC(
williamr@4
   233
                TInt aIndex ) const = 0;
williamr@4
   234
williamr@4
   235
        /**
williamr@4
   236
         * Returns an index of the contact in the view.
williamr@4
   237
         *
williamr@4
   238
         * If the identifier is not found from the view then
williamr@4
   239
         * KErrNotFound is returned.
williamr@4
   240
         *
williamr@4
   241
         * NOTE: the implementation of this function probably
williamr@4
   242
         *       must loop the view which means that calling
williamr@4
   243
         *       this function frequently or in a loop can
williamr@4
   244
         *       be slow when there are lots of contacts.
williamr@4
   245
         *
williamr@4
   246
         * @param aContactBookmark A bookmark that identifies
williamr@4
   247
         *                         a contact in the view.
williamr@4
   248
         * @return An index of the contact in the view or KErrNotFound.
williamr@4
   249
         */
williamr@4
   250
        virtual TInt IndexOfBookmarkL(
williamr@4
   251
                const MVPbkContactBookmark& aContactBookmark ) const = 0;
williamr@4
   252
        
williamr@4
   253
        /**
williamr@4
   254
         * Returns an interface for text based contact filtering support.
williamr@4
   255
         *
williamr@4
   256
         * If the view doesn't support filtering then this returns NULL. 
williamr@4
   257
         * Filtering must be supported in all views created from a contact
williamr@4
   258
         * store. However, it's possible to implement a view that doesn't
williamr@4
   259
         * need a filtering support and therefore clients must always check
williamr@4
   260
         * the returned pointer.
williamr@4
   261
         *
williamr@4
   262
         * @return A filtering interface or NULL
williamr@4
   263
         */
williamr@4
   264
        virtual MVPbkContactViewFiltering* ViewFiltering() = 0;
williamr@4
   265
        
williamr@4
   266
        /**
williamr@4
   267
         * Returns an extension point for this interface or NULL.
williamr@4
   268
         *
williamr@4
   269
         * @param aExtensionUid no extensions defined currently.
williamr@4
   270
         * @return an extension point for this interface or NULL.
williamr@4
   271
         */
williamr@4
   272
        virtual TAny* ContactViewBaseExtension(TUid /*aExtensionUid*/) 
williamr@4
   273
                { return NULL; }
williamr@4
   274
    };
williamr@4
   275
williamr@4
   276
williamr@4
   277
#endif // MVPBKCONTACTVIEWBASE_H
williamr@4
   278
williamr@4
   279
// End of File