|
1 /* |
|
2 * Copyright (c) 2006-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: Virtual Phonebook contact copier |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CVPBKCONTACTCOPIER_H |
|
20 #define CVPBKCONTACTCOPIER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class MVPbkContactOperationBase; |
|
25 class MVPbkContactLinkArray; |
|
26 class MVPbkContactStore; |
|
27 class MVPbkBatchOperationObserver; |
|
28 class CVPbkContactManager; |
|
29 class CVPbkContactLinkArray; |
|
30 |
|
31 /** |
|
32 * Virtual Phonebook contact copier. Copies source |
|
33 * contacts to the target store according to copying rules. |
|
34 * |
|
35 * @lib VPbkEng.lib |
|
36 */ |
|
37 class CVPbkContactCopier : public CBase |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * A set of flags for copying. Fastest copy is EVPbkSimpleContactCopy. |
|
42 */ |
|
43 enum TVPbkContactCopyFlags |
|
44 { |
|
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 |
|
51 /// for the store. |
|
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 |
|
58 }; |
|
59 |
|
60 /** |
|
61 * Creates a new copier instance. Remember to open the stores first |
|
62 * before starting any copy operation. |
|
63 * |
|
64 * @param aContactManager The contact manager for getting stores. |
|
65 * @return A new instance of this class |
|
66 */ |
|
67 IMPORT_C static CVPbkContactCopier* NewL( |
|
68 CVPbkContactManager& aContactManager ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 ~CVPbkContactCopier(); |
|
74 |
|
75 /** |
|
76 * Copies a set of contacts to the target store. |
|
77 * |
|
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 |
|
86 */ |
|
87 IMPORT_C MVPbkContactOperationBase* CopyContactsL( |
|
88 TUint32 aContactCopyFlags, |
|
89 const MVPbkContactLinkArray& aSourceContactLinks, |
|
90 MVPbkContactStore* aTargetStore, |
|
91 CVPbkContactLinkArray& aCopiedContactLinks, |
|
92 MVPbkBatchOperationObserver& aObserver ); |
|
93 |
|
94 private: |
|
95 |
|
96 CVPbkContactCopier( CVPbkContactManager& aContactManager ); |
|
97 |
|
98 private: // data |
|
99 /// Ref: The contact manager for accessing stores |
|
100 CVPbkContactManager& iContactManager; |
|
101 }; |
|
102 |
|
103 #endif // CVPBKCONTACTCOPIER_H |