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