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