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