|
1 /* |
|
2 * Copyright (c) 2005 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: Base class for attribute list transactions |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CPEngAttributeListTransBase.h" |
|
20 #include "CPEngAttributeListItem.h" |
|
21 #include "MPEngAttributeListTransactionManager.h" |
|
22 |
|
23 #include "CPEngContactListTransactionManager.h" |
|
24 #include "CPEngContactListSettings.h" |
|
25 |
|
26 #include "MPEngXMLSerializer.h" |
|
27 #include "MPEngXMLParser.h" |
|
28 |
|
29 #include "CPEngTransactionStatus.h" |
|
30 #include "MPEngPresenceAttrManager.h" |
|
31 |
|
32 #include <e32std.h> |
|
33 #include <bamdesca.h> |
|
34 |
|
35 |
|
36 // MACROS |
|
37 // call continue if condition is fulfilled |
|
38 #define CONTINUE_IF( a )\ |
|
39 if ( a )\ |
|
40 {\ |
|
41 continue;\ |
|
42 } |
|
43 |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =============================== |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CPEngAttributeListTransBase::CPEngAttributeListTransBase() |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CPEngAttributeListTransBase::CPEngAttributeListTransBase( |
|
52 MPEngAttributeListTransactionManager& aAttrListTransManager, |
|
53 CPEngContactListTransactionManager& aCntListTransManager, |
|
54 TPEngWVCspVersion& aCSPVersion, |
|
55 TInt aOperationId ) |
|
56 : iTransactionCompleted( EFalse ), |
|
57 iAttributeListTransManager( aAttrListTransManager ), |
|
58 iCntListTransManager( aCntListTransManager ), |
|
59 iCSPVersion( aCSPVersion ), |
|
60 iOperationId( aOperationId ) |
|
61 { |
|
62 |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CPEngAttributeListTransBase::ConstructL() |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void CPEngAttributeListTransBase::ConstructL() |
|
70 { |
|
71 iTransactionStatus = CPEngTransactionStatus::NewL(); |
|
72 } |
|
73 |
|
74 |
|
75 // Destructor |
|
76 CPEngAttributeListTransBase::~CPEngAttributeListTransBase() |
|
77 { |
|
78 delete iTransactionStatus; |
|
79 } |
|
80 |
|
81 |
|
82 // ============================================================================== |
|
83 // =============From MPEngOutgoingTransactionHandler ============================ |
|
84 // ============================================================================== |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CPEngAttributeListTransBase::LastRunningTransactionHandler() |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CPEngAttributeListTransBase::LastRunningTransactionHandler() |
|
91 { |
|
92 } |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CPEngAttributeListTransBase::ProcessResponseL() |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void CPEngAttributeListTransBase::ProcessResponseL( |
|
100 const TDesC8& aResponse, |
|
101 TRequestStatus& /* aStatus */ ) |
|
102 { |
|
103 DoConsumeMessageFromServerL( aResponse ); |
|
104 iTransactionCompleted = ETrue; |
|
105 } |
|
106 |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CPEngAttributeListTransBase::CancelProcessing() |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CPEngAttributeListTransBase::CancelProcessing() |
|
113 { |
|
114 } |
|
115 |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CPEngAttributeListTransBase::NewTransactionHandlersL() |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CPEngAttributeListTransBase::NewTransactionHandlersL( |
|
122 RPointerArray<MPEngOutgoingTransactionHandler>& /* aTransactionsArray */ ) |
|
123 { |
|
124 } |
|
125 |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CPEngAttributeListTransBase::TransactionCompleted() |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 TBool CPEngAttributeListTransBase::TransactionCompleted() |
|
132 { |
|
133 return iTransactionCompleted; |
|
134 } |
|
135 |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CPEngAttributeListTransBase::TransactionResult() |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 CPEngTransactionStatus* CPEngAttributeListTransBase::TransactionResult() |
|
142 { |
|
143 CPEngTransactionStatus* temp = iTransactionStatus; |
|
144 iTransactionStatus = NULL; |
|
145 return temp; |
|
146 } |
|
147 |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CPEngAttributeListTransBase::ReleaseHandler() |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 void CPEngAttributeListTransBase::ReleaseHandler() |
|
154 { |
|
155 iTransactionCompleted = ETrue; |
|
156 } |
|
157 |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CPEngAttributeListTransBase::XMLAppendContactListsL() |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void CPEngAttributeListTransBase::XMLAppendContactListsL( |
|
164 MPEngXMLSerializer& aXmlSerializer, |
|
165 const MDesCArray& aContactLists ) |
|
166 { |
|
167 // append Contact lists one by one |
|
168 TInt count ( aContactLists.MdcaCount() ); |
|
169 for ( TInt i( 0 ) ; i < count ; i++ ) |
|
170 { |
|
171 CPEngContactListSettings* cntSettings = |
|
172 iCntListTransManager.ContactListSettingsOrNull( |
|
173 aContactLists.MdcaPoint( i ) ); |
|
174 |
|
175 CONTINUE_IF( ( !cntSettings |
|
176 || |
|
177 !( cntSettings->Property( KPEngListExistsOnServer, |
|
178 KPEngCntLstPropertyNativeCached ) ) |
|
179 ) ); |
|
180 |
|
181 TPtrC listServerName( cntSettings->ServerName() ); |
|
182 // <ContactList> |
|
183 // contact list name |
|
184 // </ContactList> |
|
185 aXmlSerializer.StartTagL( KContactList |
|
186 ).WvAddressL( listServerName |
|
187 ).EndTagL( KContactList ); |
|
188 } |
|
189 } |
|
190 |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // CPEngAttributeListTransBase::XMLAppendContactIdsL() |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 void CPEngAttributeListTransBase::XMLAppendContactIdsL( |
|
197 MPEngXMLSerializer& aXmlSerializer, |
|
198 const MDesCArray& aContactIds ) |
|
199 { |
|
200 // append WV IDs one by one |
|
201 TInt count ( aContactIds.MdcaCount() ); |
|
202 for ( TInt x( 0 ); x < count ; x++ ) |
|
203 { |
|
204 // <UserID> |
|
205 aXmlSerializer.StartTagL( KUserIDXMLTag ); |
|
206 |
|
207 aXmlSerializer.WvAddressL( aContactIds.MdcaPoint( x ) ); |
|
208 |
|
209 // </UserID> |
|
210 aXmlSerializer.EndTagL( KUserIDXMLTag ); |
|
211 } |
|
212 } |
|
213 |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CPEngAttributeListTransBase::XMLAppendDefaultFlagL() |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CPEngAttributeListTransBase::XMLAppendDefaultFlagL( |
|
220 MPEngXMLSerializer& aXmlSerializer, |
|
221 const TBool aFlag ) |
|
222 { |
|
223 // <DefaultList> |
|
224 aXmlSerializer.StartTagL( KDefaultList ); |
|
225 |
|
226 // write attribute list default flag |
|
227 aXmlSerializer.RawValueL( aFlag ? KXMLValueTrue : KXMLValueFalse ); |
|
228 |
|
229 // </DefaultList> |
|
230 aXmlSerializer.EndTagL( KDefaultList ); |
|
231 } |
|
232 |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CPEngAttributeListTransBase::CopyDesArrayL() |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 void CPEngAttributeListTransBase::CopyDesArrayL( |
|
239 const MDesC16Array& aOldDesArray, |
|
240 CDesC16Array& aNewArray ) |
|
241 { |
|
242 TInt count ( aOldDesArray.MdcaCount() ); |
|
243 for ( TInt x ( 0 ) ; x < count ; x++ ) |
|
244 { |
|
245 aNewArray.AppendL( aOldDesArray.MdcaPoint( x ) ); |
|
246 } |
|
247 } |
|
248 |
|
249 // End of File |
|
250 |