2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: xSP contacts
19 #ifndef VPBKXSPCONTACTS_H
20 #define VPBKXSPCONTACTS_H
25 // FORWARD DECLARATIONS
26 class MVPbkContactLinkArray;
27 class CVPbkContactManager;
28 class MVPbkContactOperationBase;
29 class MVPbkStoreContact;
30 template<typename T> class MVPbkOperationResultObserver;
31 class MVPbkOperationErrorObserver;
33 class CVPbkxSPContactsImpl;
38 * A class for fetching xSP Contacts.
39 * Operations are asynchronous and accept two observers.
40 * One used to signal completion and return result.
41 * Another one used to signal an error if operation fails.
44 * A client fetch xSP contactlinks for given contact.
46 * class CxSPContactsClient :
48 * public MVPbkOperationErrorObserver,
49 * public MVPbkOperationResultObserver<MVPbkContactLinkArray*>
52 * void CxSPContactsClient::FetchxSPLinksL()
54 * ixSPManager = CVPbkxSPContacts::NewL( iContactManager );
55 * ixSPContactOperation = ixSPManager->GetxSPContactLinksL(*iContact, *this, *this);
59 * //From MVPbkOperationErrorObserver
60 * void CxSPContactsClient::VPbkOperationFailed(
61 * MVPbkContactOperationBase*,
67 * // From MVPbkOperationResultObserver
68 * void CxSPContactsClient::VPbkOperationResultCompleted(
69 * MVPbkContactOperationBase*,
70 * MVPbkContactLinkArray* aArray )
72 * TInt count = aArray->Count();
73 * for(TInt a = 0; a < count; a++)
75 * const MVPbkContactLink& link = aArray->At(a);
81 NONSHARABLE_CLASS( CVPbkxSPContacts ) : public CBase
86 * Creates the xsp contacts fetcher.
87 * @param aContactManager Contact manager which already has its stores opened.
89 IMPORT_C static CVPbkxSPContacts* NewL( CVPbkContactManager& aContactManager );
90 IMPORT_C ~CVPbkxSPContacts();
95 * Get xSP contacts as contact link array for given contact.
96 * If contact doesn't have any xSP contactlinks,
97 * empty contact link array will be returned.
98 * If aContact is NULL, KErrArgument is notified via MVPbkOperationErrorObserver.
100 * @param aContact The contact
101 * @param aResultObserver The observer that gets xsp contact links array.
102 * @param aErrorObserver The observer for error notification.
104 IMPORT_C MVPbkContactOperationBase* GetxSPContactLinksL(
105 const MVPbkStoreContact& aContact,
106 MVPbkOperationResultObserver<MVPbkContactLinkArray*>& aResultObserver,
107 MVPbkOperationErrorObserver& aErrorObserver );
109 private: // construction
113 CVPbkxSPContactsImpl* iImpl;
116 #endif //VPBKXSPCONTACTS_H