|
1 /* |
|
2 * Copyright (c) 2008 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: Converting CPbkContactItem to MVPbkStoreContact |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBKXRCLCONTACTCONVERTER_H |
|
20 #define CPBKXRCLCONTACTCONVERTER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <MVPbkContactStoreObserver.h> |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 #include "fsccontactactionservicedefines.h" // rfscstorecontactlist |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CBCardEngine; |
|
31 class CPbkContactEngine; |
|
32 class MVPbkContactStore; |
|
33 class CVPbkVCardEng; |
|
34 class MVPbkStoreContact; |
|
35 class CVPbkContactManager; |
|
36 class RWriteStream; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * CPbkxRclContactConverter |
|
42 * Convert contact to MVPbkStoreContact objects. |
|
43 * |
|
44 */ |
|
45 |
|
46 NONSHARABLE_CLASS( CPbkxRclContactConverter ): public CBase, public MVPbkSingleContactOperationObserver |
|
47 { |
|
48 public: |
|
49 // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 ~CPbkxRclContactConverter(); |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 static CPbkxRclContactConverter* NewL( |
|
60 CPbkContactEngine& aContactEngine, |
|
61 CVPbkContactManager& aContactManager, |
|
62 MVPbkContactStore& aContactStore ); |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 */ |
|
67 static CPbkxRclContactConverter* NewLC( |
|
68 CPbkContactEngine& aContactEngine, |
|
69 CVPbkContactManager& aContactManager, |
|
70 MVPbkContactStore& aContactStore ); |
|
71 |
|
72 /** |
|
73 * Convert contact to MVPbkStoreContact |
|
74 * MVPbkStoreContact is stored to RFscStoreContactList. |
|
75 * |
|
76 * @param aContactItem Contact item to convert |
|
77 * @param aConvertedContact Reference to list where result is stored. |
|
78 * Calling client is responsible to delete MVPbkStoreContact object. |
|
79 */ |
|
80 void ConvertContactL( |
|
81 CPbkContactItem& aContactItem, |
|
82 RFscStoreContactList& aConvertedContact ); |
|
83 |
|
84 /** |
|
85 * Convert contact to MVPbkStoreContact |
|
86 * end export it to stream as VCard |
|
87 * |
|
88 * @param aContactItem Contact item to convert |
|
89 * @param stream to save VCard |
|
90 * |
|
91 */ |
|
92 void ConvertAndExportContactL( |
|
93 CPbkContactItem& aContactItem, |
|
94 RWriteStream& aStream ); |
|
95 |
|
96 // from base class MVPbkSingleContactOperationObserver |
|
97 void VPbkSingleContactOperationComplete( |
|
98 MVPbkContactOperationBase& aOperation, |
|
99 MVPbkStoreContact* aContact ); |
|
100 |
|
101 void VPbkSingleContactOperationFailed( |
|
102 MVPbkContactOperationBase& aOperation, TInt aError ); |
|
103 |
|
104 private: |
|
105 |
|
106 /** |
|
107 * Constructor for performing 1st stage construction |
|
108 */ |
|
109 CPbkxRclContactConverter(CPbkContactEngine& aContactEngine, |
|
110 CVPbkContactManager& aContactManager, |
|
111 MVPbkContactStore& aContactStore ); |
|
112 |
|
113 /** |
|
114 * Default constructor for performing 2nd stage construction |
|
115 */ |
|
116 void ConstructL(); |
|
117 |
|
118 // DATA |
|
119 /** |
|
120 * Reference to CPbkContactEngine |
|
121 */ |
|
122 CPbkContactEngine& iContactEngine; |
|
123 /** |
|
124 * Old vCard engine. |
|
125 * Own. |
|
126 */ |
|
127 CBCardEngine* iCardEngine; |
|
128 /** |
|
129 * Reference to CPbkContactEngine |
|
130 */ |
|
131 CVPbkContactManager& iContactManager; |
|
132 /** |
|
133 * New Virtual Phonebook vCard engine. |
|
134 * Own. |
|
135 */ |
|
136 CVPbkVCardEng* iVPbkCardEngine; |
|
137 /** |
|
138 * Active scheduler waiter |
|
139 * Own. |
|
140 */ |
|
141 CActiveSchedulerWait* iWait; |
|
142 /** |
|
143 * Reference to MVPbkContactStore |
|
144 */ |
|
145 MVPbkContactStore& iContactStore; |
|
146 /** |
|
147 * Last error from Operation execution |
|
148 */ |
|
149 TInt iLastError; |
|
150 }; |
|
151 |
|
152 #endif // CPBKXRCLCONTACTCONVERTER_H |