2 * Copyright (c) 2006-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: Virtual Phonebook contact copier
19 #ifndef CVPBKCONTACTCOPIER_H
20 #define CVPBKCONTACTCOPIER_H
24 class MVPbkContactOperationBase;
25 class MVPbkContactLinkArray;
26 class MVPbkContactStore;
27 class MVPbkBatchOperationObserver;
28 class CVPbkContactManager;
29 class CVPbkContactLinkArray;
32 * Virtual Phonebook contact copier. Copies source
33 * contacts to the target store according to copying rules.
37 class CVPbkContactCopier : public CBase
41 * A set of flags for copying. Fastest copy is EVPbkSimpleContactCopy.
43 enum TVPbkContactCopyFlags
45 /// Copies a field if the target store supports the field type.
46 /// Does not perform additional checks.
47 EVPbkSimpleContactCopy = 0,
48 /// Uses a store specific copy policy if found for the target store.
49 /// Can do e.g field type conversion between source and target field
50 /// types. Falls back to simple copy if the copy policy was not found
52 EVPbkUseStoreSpecificCopyPolicy = 0x01,
53 /// Finds duplicates before saving a contact if there is a copy policy
54 /// for the store that can handle the possible merge of
55 /// new and existing contact data. Falls back to simple copy if
56 /// the copy policy was not found for the store.
57 EVPbkUsePlatformSpecificDuplicatePolicy = 0x02
61 * Creates a new copier instance. Remember to open the stores first
62 * before starting any copy operation.
64 * @param aContactManager The contact manager for getting stores.
65 * @return A new instance of this class
67 IMPORT_C static CVPbkContactCopier* NewL(
68 CVPbkContactManager& aContactManager );
73 ~CVPbkContactCopier();
76 * Copies a set of contacts to the target store.
78 * @param aContactCopyFlags A set of TVPbkContactCopyFlags
79 * @param aSourceContactLinks Source contact links
80 * @param aTargetStore Target of the copy operation.
81 * If NULL this behaves like duplicate.
82 * @param aCopiedContactLinks The results of the copy. Copied contacts
83 * are added to this array.
84 * @param aObserver An observer for asynchronous operation
85 * @return A copy contact operation
87 IMPORT_C MVPbkContactOperationBase* CopyContactsL(
88 TUint32 aContactCopyFlags,
89 const MVPbkContactLinkArray& aSourceContactLinks,
90 MVPbkContactStore* aTargetStore,
91 CVPbkContactLinkArray& aCopiedContactLinks,
92 MVPbkBatchOperationObserver& aObserver );
96 CVPbkContactCopier( CVPbkContactManager& aContactManager );
99 /// Ref: The contact manager for accessing stores
100 CVPbkContactManager& iContactManager;
103 #endif // CVPBKCONTACTCOPIER_H