|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 server application server message |
|
15 * : data retriever. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "TPbk2ServerMessageDataRetriever.h" |
|
21 |
|
22 // Phonebook 2 |
|
23 #include <Pbk2InternalUID.h> |
|
24 #include <Pbk2IPCPackage.h> |
|
25 #include <Pbk2MimeTypeHandler.h> |
|
26 #include <CPbk2StoreConfiguration.h> |
|
27 #include <Pbk2UIControls.rsg> |
|
28 |
|
29 // Virtual Phonebook |
|
30 #include <CVPbkContactManager.h> |
|
31 #include <CVPbkContactStoreUriArray.h> |
|
32 #include <CVPbkContactLinkArray.h> |
|
33 #include <CVPbkFieldTypeSelector.h> |
|
34 #include <MVPbkContactLink.h> |
|
35 #include <MVPbkContactStore.h> |
|
36 #include <MVPbkContactStoreProperties.h> |
|
37 |
|
38 // System includes |
|
39 #include <s32mem.h> |
|
40 #include <barsread.h> |
|
41 #include <AiwContactSelectionDataTypes.h> |
|
42 #include <AiwContactAssignDataTypes.h> |
|
43 |
|
44 using namespace AiwContactAssign; |
|
45 |
|
46 /// Unnamed namespace for local definitions |
|
47 namespace { |
|
48 |
|
49 // RMessage IPC-argument slot order and positions |
|
50 const TInt KConfigurationPackageSlot( 0 ); |
|
51 const TInt KDataPackageSlot( 1 ); |
|
52 const TInt KAttributeDataSlot( 1 ); |
|
53 const TInt KAssignInstructionsSlot( 2 ); |
|
54 const TInt KFetchInstructionsSlot( 1 ); |
|
55 |
|
56 // Data package positions |
|
57 const TInt KMimeTypePosition( 0 ); |
|
58 const TInt KDataBufferPosition( 1 ); |
|
59 const TInt KIndexBufferPosition( 2 ); |
|
60 |
|
61 // Configuration package positions |
|
62 const TInt KStoreUrisPosition( 0 ); |
|
63 const TInt KPreselectedContactsPosition( 1 ); |
|
64 const TInt KAddressSelectFilterBuffer( 2 ); |
|
65 const TInt KContactViewFilterBuffer( 3 ); |
|
66 const TInt KTitlePaneTextPosition( 4 ); |
|
67 const TInt KDefaultPrioritiesPosition( 2 ); |
|
68 const TInt KOrientationType( 5 ); |
|
69 |
|
70 |
|
71 _LIT(KPanicText, "TPbk2ServerMessageDataRetriever"); |
|
72 |
|
73 enum TPanicCode |
|
74 { |
|
75 EInvalidFetchType = 1 |
|
76 }; |
|
77 |
|
78 /** |
|
79 * Goes through link array and adds missing store URIs to URI array. |
|
80 * |
|
81 * @param aStoreUriArray Array of store URIs. |
|
82 * @param aContactLinks Contact link array. |
|
83 */ |
|
84 void AddStoreUrisFromContactLinksL |
|
85 ( CVPbkContactStoreUriArray& aStoreUriArray, |
|
86 MVPbkContactLinkArray& aContactLinks ) |
|
87 { |
|
88 TInt count = aContactLinks.Count(); |
|
89 |
|
90 for ( TInt i = 0; i < count; ++i ) |
|
91 { |
|
92 const MVPbkContactLink& contactLink = aContactLinks.At(i); |
|
93 const TVPbkContactStoreUriPtr& storeUri = |
|
94 contactLink.ContactStore().StoreProperties().Uri(); |
|
95 if ( !aStoreUriArray.IsIncluded( storeUri ) ) |
|
96 { |
|
97 aStoreUriArray.AppendL( storeUri ); |
|
98 } |
|
99 } |
|
100 } |
|
101 |
|
102 |
|
103 } /// namespace |
|
104 |
|
105 |
|
106 // -------------------------------------------------------------------------- |
|
107 // TPbk2ServerMessageDataRetriever::TPbk2ServerMessageDataRetriever |
|
108 // -------------------------------------------------------------------------- |
|
109 // |
|
110 TPbk2ServerMessageDataRetriever::TPbk2ServerMessageDataRetriever() |
|
111 { |
|
112 } |
|
113 |
|
114 // -------------------------------------------------------------------------- |
|
115 // CPbk2ContactAttributeAssigner::GetContactStoreUriArrayL |
|
116 // -------------------------------------------------------------------------- |
|
117 // |
|
118 CVPbkContactStoreUriArray* |
|
119 TPbk2ServerMessageDataRetriever::GetContactStoreUriArrayL |
|
120 ( const RMessage2& aMessage, |
|
121 const CPbk2StoreConfiguration& aStoreConfiguration, |
|
122 MVPbkContactLinkArray* aPreselectedLinks, |
|
123 TBool& aCurrentConfiguration ) const |
|
124 { |
|
125 CVPbkContactStoreUriArray* storeUriArray = NULL; |
|
126 aCurrentConfiguration = EFalse; |
|
127 |
|
128 if ( aPreselectedLinks && aPreselectedLinks->Count() > 0 ) |
|
129 { |
|
130 // Stores in contact links are enough |
|
131 storeUriArray = CVPbkContactStoreUriArray::NewL(); |
|
132 CleanupStack::PushL( storeUriArray ); |
|
133 AddStoreUrisFromContactLinksL( *storeUriArray, *aPreselectedLinks ); |
|
134 CleanupStack::Pop( storeUriArray ); |
|
135 } |
|
136 |
|
137 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
138 if ( !storeUriArray && length > 0 ) |
|
139 { |
|
140 HBufC8* configuration = HBufC8::NewLC( length ); |
|
141 TPtr8 ptr = configuration->Des(); |
|
142 aMessage.ReadL( KConfigurationPackageSlot, ptr, KStoreUrisPosition ); |
|
143 RDesReadStream readStream( ptr ); |
|
144 readStream.PushL(); |
|
145 |
|
146 // Store URIs |
|
147 HBufC8* storeUriBuffer = NULL; |
|
148 Pbk2IPCPackage::InternalizeL( storeUriBuffer, readStream ); |
|
149 if ( storeUriBuffer ) |
|
150 { |
|
151 CleanupStack::PushL( storeUriBuffer ); |
|
152 TPtr8 storeUriPtr = storeUriBuffer->Des(); |
|
153 |
|
154 storeUriArray = CVPbkContactStoreUriArray::NewLC( storeUriPtr ); |
|
155 |
|
156 CleanupStack::Pop(); // storeUriArray |
|
157 CleanupStack::PopAndDestroy( storeUriBuffer ); |
|
158 } |
|
159 |
|
160 CleanupStack::PopAndDestroy( &readStream ); |
|
161 CleanupStack::PopAndDestroy( configuration ); |
|
162 } |
|
163 |
|
164 if ( !storeUriArray ) |
|
165 { |
|
166 storeUriArray = aStoreConfiguration.CurrentConfigurationL(); |
|
167 aCurrentConfiguration = ETrue; |
|
168 } |
|
169 |
|
170 return storeUriArray; |
|
171 } |
|
172 |
|
173 // -------------------------------------------------------------------------- |
|
174 // CPbk2ContactAttributeAssigner::GetPreselectedContactLinksL |
|
175 // -------------------------------------------------------------------------- |
|
176 // |
|
177 MVPbkContactLinkArray* |
|
178 TPbk2ServerMessageDataRetriever::GetPreselectedContactLinksL |
|
179 ( const RMessage2& aMessage, |
|
180 const CVPbkContactManager& aContactManager ) const |
|
181 { |
|
182 MVPbkContactLinkArray* preselectedContacts = NULL; |
|
183 |
|
184 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
185 if ( length > 0 ) |
|
186 { |
|
187 HBufC8* configuration = HBufC8::NewLC( length ); |
|
188 TPtr8 ptr = configuration->Des(); |
|
189 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
190 RDesReadStream readStream( ptr ); |
|
191 readStream.PushL(); |
|
192 HBufC8* packedLinksBuffer = NULL; |
|
193 Pbk2IPCPackage::InternalizeL |
|
194 ( packedLinksBuffer, readStream, KPreselectedContactsPosition ); |
|
195 if ( packedLinksBuffer ) |
|
196 { |
|
197 CleanupStack::PushL( packedLinksBuffer ); |
|
198 TPtr8 packedLinksPtr = packedLinksBuffer->Des(); |
|
199 preselectedContacts = aContactManager.CreateLinksLC( packedLinksPtr ); |
|
200 CleanupStack::Pop(); // preselectedContacts |
|
201 CleanupStack::PopAndDestroy( packedLinksBuffer ); |
|
202 } |
|
203 |
|
204 CleanupStack::PopAndDestroy( &readStream ); |
|
205 CleanupStack::PopAndDestroy( configuration ); |
|
206 } |
|
207 |
|
208 if ( !preselectedContacts ) |
|
209 { |
|
210 preselectedContacts = CVPbkContactLinkArray::NewL(); |
|
211 } |
|
212 |
|
213 return preselectedContacts; |
|
214 } |
|
215 |
|
216 // -------------------------------------------------------------------------- |
|
217 // TPbk2ServerMessageDataRetriever::GetAddressSelectFilterL |
|
218 // -------------------------------------------------------------------------- |
|
219 // |
|
220 CVPbkFieldTypeSelector* |
|
221 TPbk2ServerMessageDataRetriever::GetAddressSelectFilterL |
|
222 ( const RMessage2& aMessage, |
|
223 const MVPbkFieldTypeList& aFieldTypeList ) const |
|
224 { |
|
225 CVPbkFieldTypeSelector* selector = NULL; |
|
226 |
|
227 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
228 if ( length > 0 ) |
|
229 { |
|
230 HBufC8* configuration = HBufC8::NewLC( length ); |
|
231 TPtr8 ptr = configuration->Des(); |
|
232 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
233 RDesReadStream readStream( ptr ); |
|
234 readStream.PushL(); |
|
235 |
|
236 HBufC8* addressSelectFilterBuffer = NULL; |
|
237 Pbk2IPCPackage::InternalizeL |
|
238 ( addressSelectFilterBuffer, readStream, |
|
239 KAddressSelectFilterBuffer ); |
|
240 |
|
241 if ( addressSelectFilterBuffer ) |
|
242 { |
|
243 CleanupStack::PushL( addressSelectFilterBuffer ); |
|
244 |
|
245 TResourceReader reader; |
|
246 reader.SetBuffer( addressSelectFilterBuffer ); |
|
247 selector = CVPbkFieldTypeSelector::NewL |
|
248 ( reader, aFieldTypeList ); |
|
249 |
|
250 CleanupStack::PopAndDestroy( addressSelectFilterBuffer ); |
|
251 } |
|
252 |
|
253 CleanupStack::PopAndDestroy( &readStream ); |
|
254 CleanupStack::PopAndDestroy( configuration ); |
|
255 } |
|
256 |
|
257 return selector; |
|
258 } |
|
259 |
|
260 // -------------------------------------------------------------------------- |
|
261 // TPbk2ServerMessageDataRetriever::GetAddressSelectFilterBufferL |
|
262 // -------------------------------------------------------------------------- |
|
263 // |
|
264 HBufC8* TPbk2ServerMessageDataRetriever::GetAddressSelectFilterBufferL |
|
265 ( const RMessage2& aMessage ) const |
|
266 { |
|
267 HBufC8* addressSelectFilterBuffer = NULL; |
|
268 |
|
269 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
270 if ( length > 0 ) |
|
271 { |
|
272 HBufC8* configuration = HBufC8::NewLC( length ); |
|
273 TPtr8 ptr = configuration->Des(); |
|
274 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
275 RDesReadStream readStream( ptr ); |
|
276 readStream.PushL(); |
|
277 |
|
278 Pbk2IPCPackage::InternalizeL |
|
279 ( addressSelectFilterBuffer, readStream, |
|
280 KAddressSelectFilterBuffer ); |
|
281 |
|
282 CleanupStack::PopAndDestroy( &readStream ); |
|
283 CleanupStack::PopAndDestroy( configuration ); |
|
284 } |
|
285 |
|
286 return addressSelectFilterBuffer; |
|
287 } |
|
288 |
|
289 |
|
290 // -------------------------------------------------------------------------- |
|
291 // TPbk2ServerMessageDataRetriever::GetAddressSelectType |
|
292 // -------------------------------------------------------------------------- |
|
293 // |
|
294 TAiwAddressSelectType TPbk2ServerMessageDataRetriever::GetAddressSelectTypeL |
|
295 ( const RMessage2& aMessage ) const |
|
296 { |
|
297 TAiwAddressSelectType ret = EAiwAllItemsSelect; |
|
298 |
|
299 TInt length = aMessage.GetDesLengthL( KFetchInstructionsSlot ); |
|
300 if ( length > 0 ) |
|
301 { |
|
302 HBufC8* dataBuf = HBufC8::NewLC( length ); |
|
303 TPtr8 ptr = dataBuf->Des(); |
|
304 aMessage.ReadL( KFetchInstructionsSlot, ptr ); |
|
305 |
|
306 TAiwContactSelectionDataType dataType = |
|
307 TAiwContactSelectionDataBase::SelectionDataTypeFromBuffer( ptr ); |
|
308 |
|
309 switch ( dataType ) |
|
310 { |
|
311 case EAiwSingleItemSelectionV1: |
|
312 { |
|
313 TAiwSingleItemSelectionDataV1Pckg data; |
|
314 data.Copy( ptr ); |
|
315 ret = data().AddressSelectType(); |
|
316 break; |
|
317 } |
|
318 |
|
319 case EAiwSingleItemSelectionV2: |
|
320 { |
|
321 // Deprecated |
|
322 break; |
|
323 } |
|
324 |
|
325 case EAiwSingleItemSelectionV3: |
|
326 { |
|
327 TAiwSingleItemSelectionDataV3Pckg data; |
|
328 data.Copy( ptr ); |
|
329 ret = data().AddressSelectType(); |
|
330 break; |
|
331 } |
|
332 |
|
333 case EAiwMultipleItemSelectionV1: |
|
334 { |
|
335 TAiwMultipleItemSelectionDataV1Pckg data; |
|
336 data.Copy( ptr ); |
|
337 ret = data().AddressSelectType(); |
|
338 break; |
|
339 } |
|
340 |
|
341 default: |
|
342 { |
|
343 break; |
|
344 } |
|
345 } |
|
346 |
|
347 CleanupStack::PopAndDestroy( dataBuf ); |
|
348 } |
|
349 |
|
350 return ret; |
|
351 } |
|
352 |
|
353 // -------------------------------------------------------------------------- |
|
354 // TPbk2ServerMessageDataRetriever::GetCommAddressSelectType |
|
355 // -------------------------------------------------------------------------- |
|
356 // |
|
357 TAiwCommAddressSelectType TPbk2ServerMessageDataRetriever:: |
|
358 GetCommAddressSelectTypeL( const RMessage2& aMessage ) const |
|
359 { |
|
360 TAiwCommAddressSelectType ret = EAiwCommEmpty; |
|
361 |
|
362 TInt length = aMessage.GetDesLengthL( KFetchInstructionsSlot ); |
|
363 if ( length > 0 ) |
|
364 { |
|
365 HBufC8* dataBuf = HBufC8::NewLC( length ); |
|
366 TPtr8 ptr = dataBuf->Des(); |
|
367 aMessage.ReadL( KFetchInstructionsSlot, ptr ); |
|
368 |
|
369 TAiwContactSelectionDataType dataType = |
|
370 TAiwContactSelectionDataBase::SelectionDataTypeFromBuffer( ptr ); |
|
371 |
|
372 switch ( dataType ) |
|
373 { |
|
374 case EAiwSingleItemSelectionV1: |
|
375 { |
|
376 TAiwSingleItemSelectionDataV1Pckg data; |
|
377 data.Copy( ptr ); |
|
378 ret = data().CommAddressSelectType(); |
|
379 break; |
|
380 } |
|
381 |
|
382 case EAiwSingleItemSelectionV2: |
|
383 { |
|
384 // Deprecated |
|
385 break; |
|
386 } |
|
387 |
|
388 case EAiwSingleItemSelectionV3: |
|
389 { |
|
390 TAiwSingleItemSelectionDataV3Pckg data; |
|
391 data.Copy( ptr ); |
|
392 ret = data().CommAddressSelectType(); |
|
393 break; |
|
394 } |
|
395 |
|
396 default: |
|
397 { |
|
398 break; |
|
399 } |
|
400 } |
|
401 |
|
402 CleanupStack::PopAndDestroy( dataBuf ); |
|
403 } |
|
404 |
|
405 return ret; |
|
406 } |
|
407 |
|
408 // -------------------------------------------------------------------------- |
|
409 // TPbk2ServerMessageDataRetriever::GetContactViewFilterL |
|
410 // -------------------------------------------------------------------------- |
|
411 // |
|
412 CVPbkFieldTypeSelector* |
|
413 TPbk2ServerMessageDataRetriever::GetContactViewFilterL |
|
414 ( const RMessage2& aMessage, |
|
415 const MVPbkFieldTypeList& aFieldTypeList ) const |
|
416 { |
|
417 CVPbkFieldTypeSelector* selector = NULL; |
|
418 |
|
419 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
420 if ( length > 0 ) |
|
421 { |
|
422 HBufC8* configuration = HBufC8::NewLC( length ); |
|
423 TPtr8 ptr = configuration->Des(); |
|
424 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
425 RDesReadStream readStream( ptr ); |
|
426 readStream.PushL(); |
|
427 |
|
428 HBufC8* viewFilterBuffer = NULL; |
|
429 Pbk2IPCPackage::InternalizeL |
|
430 ( viewFilterBuffer, readStream, KContactViewFilterBuffer ); |
|
431 if ( viewFilterBuffer ) |
|
432 { |
|
433 CleanupStack::PushL( viewFilterBuffer ); |
|
434 TPtr8 viewFilterPtr = viewFilterBuffer->Des(); |
|
435 selector = CVPbkFieldTypeSelector::NewL( aFieldTypeList ); |
|
436 CleanupStack::PushL( selector ); |
|
437 selector->InternalizeL( viewFilterPtr ); |
|
438 CleanupStack::Pop(); // selector |
|
439 CleanupStack::PopAndDestroy( viewFilterBuffer ); |
|
440 } |
|
441 |
|
442 CleanupStack::PopAndDestroy( &readStream ); |
|
443 CleanupStack::PopAndDestroy( configuration ); |
|
444 } |
|
445 |
|
446 return selector; |
|
447 } |
|
448 |
|
449 // -------------------------------------------------------------------------- |
|
450 // TPbk2ServerMessageDataRetriever::GetContactViewFilterForAttributeAssignL |
|
451 // -------------------------------------------------------------------------- |
|
452 // |
|
453 CVPbkFieldTypeSelector* |
|
454 TPbk2ServerMessageDataRetriever::GetContactViewFilterForAttributeAssignL |
|
455 ( const RMessage2& aMessage, |
|
456 const MVPbkFieldTypeList& aFieldTypeList ) const |
|
457 { |
|
458 CVPbkFieldTypeSelector* selector = NULL; |
|
459 |
|
460 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
461 if ( length > 0 ) |
|
462 { |
|
463 HBufC8* configuration = HBufC8::NewLC( length ); |
|
464 TPtr8 ptr = configuration->Des(); |
|
465 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
466 RDesReadStream readStream( ptr ); |
|
467 readStream.PushL(); |
|
468 |
|
469 HBufC8* filterSelectorBuffer = NULL; |
|
470 Pbk2IPCPackage::InternalizeL |
|
471 ( filterSelectorBuffer, readStream, KContactViewFilterBuffer ); |
|
472 if ( filterSelectorBuffer ) |
|
473 { |
|
474 CleanupStack::PushL( filterSelectorBuffer ); |
|
475 |
|
476 TResourceReader reader; |
|
477 reader.SetBuffer( filterSelectorBuffer ); |
|
478 selector = CVPbkFieldTypeSelector::NewL |
|
479 ( reader, aFieldTypeList ); |
|
480 |
|
481 CleanupStack::PopAndDestroy( filterSelectorBuffer ); |
|
482 } |
|
483 |
|
484 CleanupStack::PopAndDestroy( &readStream ); |
|
485 CleanupStack::PopAndDestroy( configuration ); |
|
486 } |
|
487 |
|
488 return selector; |
|
489 } |
|
490 |
|
491 // -------------------------------------------------------------------------- |
|
492 // CPbk2ContactAttributeAssigner::GetTitlePaneTextL |
|
493 // -------------------------------------------------------------------------- |
|
494 // |
|
495 HBufC* TPbk2ServerMessageDataRetriever::GetTitlePaneTextL |
|
496 ( const RMessage2& aMessage ) const |
|
497 { |
|
498 HBufC* titlePaneText = NULL; |
|
499 |
|
500 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
501 if ( length > 0 ) |
|
502 { |
|
503 HBufC8* configuration = HBufC8::NewLC( length ); |
|
504 TPtr8 ptr = configuration->Des(); |
|
505 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
506 RDesReadStream readStream( ptr ); |
|
507 readStream.PushL(); |
|
508 |
|
509 Pbk2IPCPackage::InternalizeL |
|
510 ( titlePaneText, readStream, KTitlePaneTextPosition ); |
|
511 |
|
512 CleanupStack::PopAndDestroy( &readStream ); |
|
513 CleanupStack::PopAndDestroy( configuration ); |
|
514 } |
|
515 |
|
516 return titlePaneText; |
|
517 } |
|
518 |
|
519 // -------------------------------------------------------------------------- |
|
520 // TPbk2ServerMessageDataRetriever::GetAttributeDataL |
|
521 // -------------------------------------------------------------------------- |
|
522 // |
|
523 TPbk2AttributeAssignData TPbk2ServerMessageDataRetriever::GetAttributeDataL |
|
524 ( const RMessage2& aMessage ) const |
|
525 { |
|
526 TPbk2AttributeAssignData attributeData; |
|
527 attributeData.iAttributeUid = TUid::Uid( KEPOCNullUID ); |
|
528 attributeData.iAttributeValue = KErrNotFound; |
|
529 |
|
530 TPckg<TPbk2AttributeAssignData> attributePckg( attributeData ); |
|
531 aMessage.ReadL( KAttributeDataSlot, attributePckg ); |
|
532 |
|
533 return attributeData; |
|
534 } |
|
535 |
|
536 // -------------------------------------------------------------------------- |
|
537 // TPbk2ServerMessageDataRetriever::GetDataBufferL |
|
538 // -------------------------------------------------------------------------- |
|
539 // |
|
540 HBufC* TPbk2ServerMessageDataRetriever::GetDataBufferL |
|
541 ( const RMessage2& aMessage ) const |
|
542 { |
|
543 HBufC* dataBuffer = NULL; |
|
544 |
|
545 TInt length = aMessage.GetDesLengthL( KDataPackageSlot ); |
|
546 if ( length > 0 ) |
|
547 { |
|
548 HBufC8* dataPackage = HBufC8::NewLC( length ); |
|
549 TPtr8 ptr = dataPackage->Des(); |
|
550 aMessage.ReadL( KDataPackageSlot, ptr ); |
|
551 RDesReadStream readStream( ptr ); |
|
552 readStream.PushL(); |
|
553 |
|
554 Pbk2IPCPackage::InternalizeL |
|
555 ( dataBuffer, readStream, KDataBufferPosition ); |
|
556 |
|
557 CleanupStack::PopAndDestroy( &readStream ); |
|
558 CleanupStack::PopAndDestroy( dataPackage ); |
|
559 } |
|
560 |
|
561 return dataBuffer; |
|
562 } |
|
563 |
|
564 // -------------------------------------------------------------------------- |
|
565 // TPbk2ServerMessageDataRetriever::GetFocusIndexL |
|
566 // -------------------------------------------------------------------------- |
|
567 // |
|
568 TInt TPbk2ServerMessageDataRetriever::GetFocusIndexL |
|
569 ( const RMessage2& aMessage ) const |
|
570 { |
|
571 TInt index = KErrNotFound; |
|
572 |
|
573 TInt length = aMessage.GetDesLengthL( KDataPackageSlot ); |
|
574 if ( length > 0 ) |
|
575 { |
|
576 HBufC8* dataPackage = HBufC8::NewLC( length ); |
|
577 TPtr8 ptr = dataPackage->Des(); |
|
578 aMessage.ReadL( KDataPackageSlot, ptr ); |
|
579 RDesReadStream readStream( ptr ); |
|
580 readStream.PushL(); |
|
581 |
|
582 HBufC* indexBuffer = NULL; |
|
583 Pbk2IPCPackage::InternalizeL |
|
584 ( indexBuffer, readStream, KIndexBufferPosition ); |
|
585 if ( indexBuffer ) |
|
586 { |
|
587 CleanupStack::PushL( indexBuffer ); |
|
588 TLex16 indexer(*indexBuffer); |
|
589 TInt err = indexer.Val(index); |
|
590 CleanupStack::PopAndDestroy( indexBuffer ); |
|
591 } |
|
592 |
|
593 CleanupStack::PopAndDestroy( &readStream ); |
|
594 CleanupStack::PopAndDestroy( dataPackage ); |
|
595 } |
|
596 |
|
597 return index; |
|
598 } |
|
599 |
|
600 // -------------------------------------------------------------------------- |
|
601 // TPbk2ServerMessageDataRetriever::GetMimeTypeL |
|
602 // -------------------------------------------------------------------------- |
|
603 // |
|
604 TInt TPbk2ServerMessageDataRetriever::GetMimeTypeL |
|
605 ( const RMessage2& aMessage ) const |
|
606 { |
|
607 TInt mimeType = Pbk2MimeTypeHandler::EMimeTypeNotSupported; |
|
608 |
|
609 TInt length = aMessage.GetDesLengthL( KDataPackageSlot ); |
|
610 if ( length > 0 ) |
|
611 { |
|
612 HBufC8* dataPackage = HBufC8::NewLC( length ); |
|
613 TPtr8 ptr = dataPackage->Des(); |
|
614 aMessage.ReadL( KDataPackageSlot, ptr ); |
|
615 RDesReadStream readStream( ptr ); |
|
616 readStream.PushL(); |
|
617 |
|
618 // MIME type |
|
619 HBufC8* mimeTypeBuffer = NULL; |
|
620 Pbk2IPCPackage::InternalizeL |
|
621 ( mimeTypeBuffer, readStream, KMimeTypePosition ); |
|
622 if ( mimeTypeBuffer ) |
|
623 { |
|
624 CleanupStack::PushL( mimeTypeBuffer ); |
|
625 mimeType = Pbk2MimeTypeHandler::MapMimeTypeL( *mimeTypeBuffer ); |
|
626 CleanupStack::PopAndDestroy( mimeTypeBuffer ); |
|
627 } |
|
628 |
|
629 CleanupStack::PopAndDestroy( &readStream ); |
|
630 CleanupStack::PopAndDestroy( dataPackage ); |
|
631 } |
|
632 |
|
633 return mimeType; |
|
634 } |
|
635 |
|
636 // -------------------------------------------------------------------------- |
|
637 // TPbk2ServerMessageDataRetriever::SingleContactAssignFlagsL |
|
638 // -------------------------------------------------------------------------- |
|
639 // |
|
640 TUint TPbk2ServerMessageDataRetriever::SingleContactAssignFlagsL |
|
641 ( const RMessage2& aMessage ) const |
|
642 { |
|
643 TAiwSingleContactAssignDataV1Pckg data; |
|
644 aMessage.ReadL( KAssignInstructionsSlot, data ); |
|
645 return data().Flags(); |
|
646 } |
|
647 |
|
648 // -------------------------------------------------------------------------- |
|
649 // TPbk2ServerMessageDataRetriever::MultipleContactAssignFlagsL |
|
650 // -------------------------------------------------------------------------- |
|
651 // |
|
652 TUint TPbk2ServerMessageDataRetriever::MultipleContactAssignFlagsL |
|
653 ( const RMessage2& aMessage ) const |
|
654 { |
|
655 TAiwMultipleContactAssignDataV1Pckg data; |
|
656 aMessage.ReadL( KAssignInstructionsSlot, data ); |
|
657 return data().Flags(); |
|
658 } |
|
659 |
|
660 // -------------------------------------------------------------------------- |
|
661 // TPbk2ServerMessageDataRetriever::FetchFlagsL |
|
662 // -------------------------------------------------------------------------- |
|
663 // |
|
664 TUint TPbk2ServerMessageDataRetriever::FetchFlagsL |
|
665 ( const RMessage2& aMessage ) const |
|
666 { |
|
667 TUint ret = 0; |
|
668 |
|
669 TInt length = aMessage.GetDesLengthL( KFetchInstructionsSlot ); |
|
670 if ( length > 0 ) |
|
671 { |
|
672 HBufC8* data = HBufC8::NewLC( length ); |
|
673 TPtr8 ptr = data->Des(); |
|
674 aMessage.ReadL( KFetchInstructionsSlot, ptr ); |
|
675 |
|
676 TAiwContactSelectionDataType dataType = |
|
677 TAiwContactSelectionDataBase::SelectionDataTypeFromBuffer( ptr ); |
|
678 |
|
679 switch ( dataType ) |
|
680 { |
|
681 case EAiwSingleEntrySelectionV1: |
|
682 { |
|
683 TAiwSingleEntrySelectionDataV1Pckg data; |
|
684 data.Copy( ptr ); |
|
685 ret = data().Flags(); |
|
686 break; |
|
687 } |
|
688 case EAiwSingleEntrySelectionV2: |
|
689 { |
|
690 TAiwSingleEntrySelectionDataV2Pckg data; |
|
691 data.Copy( ptr ); |
|
692 ret = data().Flags(); |
|
693 break; |
|
694 } |
|
695 case EAiwMultipleEntrySelectionV1: |
|
696 { |
|
697 TAiwMultipleEntrySelectionDataV1Pckg data; |
|
698 data.Copy( ptr ); |
|
699 ret = data().Flags(); |
|
700 break; |
|
701 } |
|
702 case EAiwMultipleEntrySelectionV2: |
|
703 { |
|
704 TAiwMultipleEntrySelectionDataV2Pckg data; |
|
705 data.Copy( ptr ); |
|
706 ret = data().Flags(); |
|
707 break; |
|
708 } |
|
709 case EAiwSingleItemSelectionV1: |
|
710 { |
|
711 TAiwSingleItemSelectionDataV1Pckg data; |
|
712 data.Copy( ptr ); |
|
713 ret = data().Flags(); |
|
714 break; |
|
715 } |
|
716 case EAiwSingleItemSelectionV2: |
|
717 { |
|
718 // Deprecated |
|
719 break; |
|
720 } |
|
721 case EAiwSingleItemSelectionV3: |
|
722 { |
|
723 TAiwSingleItemSelectionDataV3Pckg data; |
|
724 data.Copy( ptr ); |
|
725 ret = data().Flags(); |
|
726 break; |
|
727 } |
|
728 case EAiwMultipleItemSelectionV1: |
|
729 { |
|
730 TAiwMultipleItemSelectionDataV1Pckg data; |
|
731 data.Copy( ptr ); |
|
732 ret = data().Flags(); |
|
733 break; |
|
734 } |
|
735 default: |
|
736 { |
|
737 aMessage.Panic( KPanicText, EInvalidFetchType ); |
|
738 break; |
|
739 } |
|
740 } |
|
741 |
|
742 CleanupStack::PopAndDestroy( data ); |
|
743 } |
|
744 |
|
745 return ret; |
|
746 } |
|
747 |
|
748 // -------------------------------------------------------------------------- |
|
749 // TPbk2ServerMessageDataRetriever::GetAttributeRemovalIndicatorValueL |
|
750 // -------------------------------------------------------------------------- |
|
751 // |
|
752 TBool TPbk2ServerMessageDataRetriever::GetAttributeRemovalIndicatorValueL |
|
753 ( const RMessage2& aMessage ) const |
|
754 { |
|
755 TAiwContactAttributeAssignDataV1Pckg attributeInstructions; |
|
756 aMessage.ReadL( KAssignInstructionsSlot, attributeInstructions ); |
|
757 return attributeInstructions().RemoveAttribute(); |
|
758 } |
|
759 |
|
760 // -------------------------------------------------------------------------- |
|
761 // TPbk2ServerMessageDataRetriever::GetEditorHelpContextL |
|
762 // -------------------------------------------------------------------------- |
|
763 // |
|
764 TCoeHelpContext TPbk2ServerMessageDataRetriever::GetEditorHelpContextL |
|
765 ( const RMessage2& aMessage ) const |
|
766 { |
|
767 TAiwSingleContactAssignDataV1Pckg data; |
|
768 aMessage.ReadL( KAssignInstructionsSlot, data ); |
|
769 return data().EditorHelpContext(); |
|
770 } |
|
771 |
|
772 // -------------------------------------------------------------------------- |
|
773 // CPbk2EntryFetchHandler::FetchDlgResourceL |
|
774 // -------------------------------------------------------------------------- |
|
775 // |
|
776 TInt TPbk2ServerMessageDataRetriever::GetFetchDialogResourceL |
|
777 ( const RMessage2& aMessage ) const |
|
778 { |
|
779 TInt result = 0; |
|
780 |
|
781 TInt length = aMessage.GetDesLengthL( KFetchInstructionsSlot ); |
|
782 if ( length > 0 ) |
|
783 { |
|
784 HBufC8* data = HBufC8::NewLC( length ); |
|
785 TPtr8 ptr = data->Des(); |
|
786 aMessage.ReadL( KFetchInstructionsSlot, ptr ); |
|
787 |
|
788 TAiwContactSelectionDataType dataType = |
|
789 TAiwContactSelectionDataBase::SelectionDataTypeFromBuffer( ptr ); |
|
790 |
|
791 switch ( dataType ) |
|
792 { |
|
793 case EAiwSingleEntrySelectionV1: // FALLTHROUGH |
|
794 case EAiwSingleEntrySelectionV2: |
|
795 { |
|
796 result = R_PBK2_SINGLE_ENTRY_FETCH_DLG; |
|
797 break; |
|
798 } |
|
799 |
|
800 case EAiwMultipleEntrySelectionV1: |
|
801 { |
|
802 result = R_PBK2_MULTIPLE_ENTRY_FETCH_DLG; |
|
803 TAiwMultipleEntrySelectionDataV1Pckg data; |
|
804 data.Copy( ptr ); |
|
805 if ( data().Flags() & EExcludeGroupsView ) |
|
806 { |
|
807 result = R_PBK2_MULTIPLE_ENTRY_FETCH_NO_GROUPS_DLG; |
|
808 } |
|
809 break; |
|
810 } |
|
811 case EAiwMultipleEntrySelectionV2: |
|
812 { |
|
813 result = R_PBK2_MULTIPLE_ENTRY_FETCH_DLG; |
|
814 TAiwMultipleEntrySelectionDataV2Pckg data; |
|
815 data.Copy( ptr ); |
|
816 if ( data().Flags() & EExcludeGroupsView ) |
|
817 { |
|
818 result = R_PBK2_MULTIPLE_ENTRY_FETCH_NO_GROUPS_DLG; |
|
819 } |
|
820 break; |
|
821 } |
|
822 |
|
823 case EAiwSingleItemSelectionV1: // FALLTHROUGH |
|
824 default: |
|
825 { |
|
826 break; |
|
827 } |
|
828 } |
|
829 CleanupStack::PopAndDestroy( data ); |
|
830 } |
|
831 |
|
832 return result; |
|
833 } |
|
834 |
|
835 // -------------------------------------------------------------------------- |
|
836 // TPbk2ServerMessageDataRetriever::FetchDefaultPrioritiesL |
|
837 // -------------------------------------------------------------------------- |
|
838 // |
|
839 RVPbkContactFieldDefaultPriorities |
|
840 TPbk2ServerMessageDataRetriever::FetchDefaultPrioritiesL |
|
841 ( const RMessage2& aMessage ) const |
|
842 { |
|
843 RVPbkContactFieldDefaultPriorities priorities; |
|
844 |
|
845 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
846 if ( length > 0 ) |
|
847 { |
|
848 HBufC8* instructions = HBufC8::NewLC( length ); |
|
849 TPtr8 ptr = instructions->Des(); |
|
850 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
851 RDesReadStream readStream( ptr ); |
|
852 readStream.PushL(); |
|
853 |
|
854 HBufC8* prioritiesBuffer = NULL; |
|
855 |
|
856 Pbk2IPCPackage::InternalizeL |
|
857 ( prioritiesBuffer, readStream, KDefaultPrioritiesPosition ); |
|
858 |
|
859 if ( prioritiesBuffer ) |
|
860 { |
|
861 CleanupStack::PushL( prioritiesBuffer ); |
|
862 TPtr8 prioPtr = prioritiesBuffer->Des(); |
|
863 TInt prioPtrLength = prioPtr.Length(); |
|
864 if ( prioPtrLength > 0 ) |
|
865 { |
|
866 priorities.InternalizeL( prioPtr ); |
|
867 } |
|
868 CleanupStack::PopAndDestroy( prioritiesBuffer ); |
|
869 } |
|
870 |
|
871 CleanupStack::PopAndDestroy( &readStream ); |
|
872 CleanupStack::PopAndDestroy( instructions ); |
|
873 } |
|
874 |
|
875 return priorities; |
|
876 } |
|
877 |
|
878 // -------------------------------------------------------------------------- |
|
879 // TPbk2ServerMessageDataRetriever::GetOrietationTypeL |
|
880 // -------------------------------------------------------------------------- |
|
881 // |
|
882 TInt TPbk2ServerMessageDataRetriever::GetOrietationTypeL( const RMessage2& aMessage ) const |
|
883 { |
|
884 TInt orientationType = 0; |
|
885 TInt length = aMessage.GetDesLengthL( KConfigurationPackageSlot ); |
|
886 if ( length > 0 ) |
|
887 { |
|
888 HBufC8* configuration = HBufC8::NewLC( length ); |
|
889 TPtr8 ptr = configuration->Des(); |
|
890 aMessage.ReadL( KConfigurationPackageSlot, ptr ); |
|
891 RDesReadStream readStream( ptr ); |
|
892 readStream.PushL(); |
|
893 |
|
894 HBufC8* orientationBuffer = NULL; |
|
895 Pbk2IPCPackage::InternalizeL |
|
896 ( orientationBuffer, readStream, |
|
897 KOrientationType ); |
|
898 |
|
899 if ( orientationBuffer ) |
|
900 { |
|
901 CleanupStack::PushL( orientationBuffer ); |
|
902 TPtr8 ptr = orientationBuffer->Des(); |
|
903 TLex8 lex( ptr ); |
|
904 lex.Val( orientationType ); |
|
905 CleanupStack::PopAndDestroy( orientationBuffer ); |
|
906 } |
|
907 |
|
908 CleanupStack::PopAndDestroy( &readStream ); |
|
909 CleanupStack::PopAndDestroy( configuration ); |
|
910 } |
|
911 return orientationType; |
|
912 } |
|
913 |
|
914 // End of File |