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 app address select phase. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "CPbk2CommAddressSelectPhase.h" |
|
19 |
||
20 |
// Phonebook 2 |
|
21 |
#include "MPbk2ServicePhaseObserver.h" |
|
22 |
#include "CPbk2ServerAppAppUi.h" |
|
23 |
#include "CPbk2KeyEventDealer.h" |
|
24 |
#include <MPbk2DialogEliminator.h> |
|
25 |
#include <CPbk2AddressSelect.h> |
|
26 |
#include <TPbk2AddressSelectParams.h> |
|
27 |
#include <MPbk2ApplicationServices.h> |
|
28 |
#include <CPbk2PresenceIconInfo.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
29 |
#include <Pbk2UIControls.rsg> |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
30 |
#include <Pbk2Commands.rsg> |
63 | 31 |
#include <CPbk2StoreManager.h> |
32 |
||
33 |
// Virtual Phonebook |
|
34 |
#include <MVPbkContactLink.h> |
|
35 |
#include <CVPbkContactLinkArray.h> |
|
36 |
#include <MVPbkContactOperationBase.h> |
|
37 |
#include <MVPbkStoreContact.h> |
|
38 |
#include <CVPbkContactManager.h> |
|
39 |
#include <VPbkFieldTypeSelectorFactory.h> |
|
40 |
#include <CVPbkxSPContacts.h> |
|
41 |
#include <MVPbkContactFieldData.h> |
|
42 |
#include <MVPbkContactFieldTextData.h> |
|
43 |
#include <MVPbkContactFieldUriData.h> |
|
44 |
#include <CVPbkFieldTypeRefsList.h> |
|
45 |
#include <CVPbkContactFieldIterator.h> |
|
46 |
#include <CVPbkFieldTypeSelector.h> |
|
47 |
#include <CVPbkFieldFilter.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
48 |
#include <VPbkEng.rsg> |
63 | 49 |
|
50 |
// System includes |
|
51 |
#include <barsread.h> |
|
52 |
#include <avkon.rsg> |
|
53 |
#include <contactpresencefactory.h> |
|
54 |
#include <mcontactpresence.h> |
|
55 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
56 |
#include <aknlists.h> |
|
57 |
||
58 |
/// Unnamed namespace for local definitions |
|
59 |
namespace { |
|
60 |
||
61 |
#ifdef _DEBUG |
|
62 |
enum TPanicCode |
|
63 |
{ |
|
64 |
EPanicPreCond_LaunchServicePhaseL = 1, |
|
65 |
EPanicPreCond_ContactOperationComplete, |
|
66 |
EPanicPreCond_RetrieveContactL, |
|
67 |
EPanicPreCond_DoSelectAddressesL |
|
68 |
}; |
|
69 |
||
70 |
static void Panic(TPanicCode aReason) |
|
71 |
{ |
|
72 |
_LIT(KPanicText, "CPbk2CommAddressSelectPhase"); |
|
73 |
User::Panic(KPanicText, aReason); |
|
74 |
} |
|
75 |
#endif // _DEBUG |
|
76 |
||
77 |
// Separator between service name and user's id in the service name returned |
|
78 |
// in presence icon info. |
|
79 |
_LIT( KServiceNameSeparator, ":"); |
|
80 |
||
81 |
const TInt KMaxXspServiceCount = 5; |
|
82 |
/** |
|
83 |
* Copies a link array to another. |
|
84 |
* |
|
85 |
* @param aSourceLinkArray Link array which is copied |
|
86 |
* @param aTargetLinkArray Links are copied to this |
|
87 |
*/ |
|
88 |
void CopyContactLinksL( const MVPbkContactLinkArray& aSourceLinkArray, |
|
89 |
CVPbkContactLinkArray& aTargetLinkArray ) |
|
90 |
{ |
|
91 |
const TInt count = aSourceLinkArray.Count(); |
|
92 |
for ( TInt i(0); i < count; ++i ) |
|
93 |
{ |
|
94 |
const MVPbkContactLink& contactLink = aSourceLinkArray.At(i); |
|
95 |
aTargetLinkArray.AppendL( contactLink.CloneLC() ); |
|
96 |
CleanupStack::Pop(); // link |
|
97 |
} |
|
98 |
} |
|
99 |
||
100 |
struct TMap |
|
101 |
{ |
|
102 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector selector; |
|
103 |
TInt resId; |
|
104 |
}; |
|
105 |
||
106 |
const TMap KFieldMapTable[] = { |
|
107 |
{ VPbkFieldTypeSelectorFactory::EVoiceCallSelector, R_PBK2_CALL_ITEM_NUMBER_SELECT }, |
|
108 |
{ VPbkFieldTypeSelectorFactory::EUniEditorSelector, R_PBK2_GENERIC_ADDRESS_SELECT }, |
|
109 |
{ VPbkFieldTypeSelectorFactory::EEmailEditorSelector, R_PBK2_EMAIL_ADDRESS_SELECT }, |
|
110 |
{ VPbkFieldTypeSelectorFactory::EInstantMessagingSelector, R_PBK2_GENERIC_ADDRESS_SELECT }, |
|
111 |
{ VPbkFieldTypeSelectorFactory::EVOIPCallSelector, R_PBK2_VOIP_ADDRESS_SELECT }, |
|
112 |
{ VPbkFieldTypeSelectorFactory::EURLSelector, R_PBK2_URL_ADDRESS_SELECT }, |
|
113 |
{ VPbkFieldTypeSelectorFactory::EVideoCallSelector, R_PBK2_VIDEO_NUMBER_SELECT }, |
|
114 |
{ VPbkFieldTypeSelectorFactory::EPocSelector, R_PBK2_POC_ADDRESS_SELECT } |
|
115 |
}; |
|
116 |
const TInt KFieldMapTableLength = sizeof( KFieldMapTable ) / sizeof( TMap ); |
|
117 |
||
118 |
TInt AddressSelectResourceId |
|
119 |
( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aType ) |
|
120 |
{ |
|
121 |
TInt resourceId = KErrNotFound; |
|
122 |
for( TInt i = 0; i < KFieldMapTableLength; i++ ) |
|
123 |
{ |
|
124 |
if( aType == KFieldMapTable[i].selector ) |
|
125 |
{ |
|
126 |
resourceId = KFieldMapTable[i].resId; |
|
127 |
break; |
|
128 |
} |
|
129 |
} |
|
130 |
||
131 |
return resourceId; |
|
132 |
} |
|
133 |
||
134 |
} /// namespace |
|
135 |
||
136 |
// -------------------------------------------------------------------------- |
|
137 |
// CPbk2CommAddressSelectPhase::CPbk2CommAddressSelectPhase |
|
138 |
// -------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
CPbk2CommAddressSelectPhase::CPbk2CommAddressSelectPhase |
|
141 |
( MPbk2ServicePhaseObserver& aObserver, |
|
142 |
RVPbkContactFieldDefaultPriorities& aPriorities, |
|
143 |
TBool aRskBack, |
|
144 |
CVPbkFieldTypeSelector& aFieldTypeSelector, |
|
145 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
|
146 |
aCommSelector ) : |
|
147 |
iObserver( aObserver ), |
|
148 |
iPriorities( aPriorities ), |
|
149 |
iRskBack( aRskBack ), |
|
150 |
iFieldTypeSelector ( aFieldTypeSelector ), |
|
151 |
iState( EInitialState ), |
|
152 |
iCommMethod( aCommSelector ) |
|
153 |
{ |
|
154 |
} |
|
155 |
||
156 |
// -------------------------------------------------------------------------- |
|
157 |
// CPbk2CommAddressSelectPhase::~CPbk2CommAddressSelectPhase |
|
158 |
// -------------------------------------------------------------------------- |
|
159 |
// |
|
160 |
CPbk2CommAddressSelectPhase::~CPbk2CommAddressSelectPhase() |
|
161 |
{ |
|
162 |
if ( iAddressSelectEliminator != NULL ) |
|
163 |
{ |
|
164 |
iAddressSelectEliminator->ForceExit(); |
|
165 |
} |
|
166 |
delete iStoreContact; |
|
167 |
delete iRetrieveOperation; |
|
168 |
delete iContactLink; |
|
169 |
delete iResults; |
|
170 |
delete iDealer; |
|
171 |
delete ixSPManager; |
|
172 |
delete ixSPContactOperation; |
|
173 |
delete ixSPContactsArray; |
|
174 |
ixSPStoreContactsArray.ResetAndDestroy(); |
|
175 |
delete iFieldContent; |
|
176 |
if( iContactPresence ) |
|
177 |
{ |
|
178 |
iContactPresence->Close(); |
|
179 |
iContactPresence = NULL; |
|
180 |
} |
|
181 |
iPresenceIconArray.ResetAndDestroy(); |
|
182 |
} |
|
183 |
||
184 |
// -------------------------------------------------------------------------- |
|
185 |
// CPbk2CommAddressSelectPhase::ConstructL |
|
186 |
// -------------------------------------------------------------------------- |
|
187 |
// |
|
188 |
inline void CPbk2CommAddressSelectPhase::ConstructL |
|
189 |
( const MVPbkContactLink& aContactLink ) |
|
190 |
{ |
|
191 |
iEikenv = CEikonEnv::Static(); |
|
192 |
||
193 |
// Copy contact link provided by the client |
|
194 |
MVPbkContactLink* link = aContactLink.CloneLC(); |
|
195 |
User::LeaveIfNull( link ); |
|
196 |
CleanupStack::Pop(); //link |
|
197 |
iContactLink = link; |
|
198 |
||
199 |
iDealer = CPbk2KeyEventDealer::NewL( *this ); |
|
200 |
||
201 |
// Map TVPbkFieldTypeSelector to resource id |
|
202 |
iResourceId = AddressSelectResourceId( iCommMethod ); |
|
203 |
if ( iResourceId == KErrNotFound ) |
|
204 |
{ |
|
205 |
User::LeaveIfError( KErrArgument ); |
|
206 |
} |
|
207 |
||
208 |
// Create xSP contacts manager |
|
209 |
CPbk2ServerAppAppUi& appUi = |
|
210 |
static_cast<CPbk2ServerAppAppUi&>(*CEikonEnv::Static()->EikAppUi()); |
|
211 |
||
212 |
ixSPManager = CVPbkxSPContacts::NewL( |
|
213 |
appUi.ApplicationServices().ContactManager() ); |
|
214 |
} |
|
215 |
||
216 |
// -------------------------------------------------------------------------- |
|
217 |
// CPbk2CommAddressSelectPhase::NewL |
|
218 |
// -------------------------------------------------------------------------- |
|
219 |
// |
|
220 |
CPbk2CommAddressSelectPhase* CPbk2CommAddressSelectPhase::NewL |
|
221 |
( MPbk2ServicePhaseObserver& aObserver, |
|
222 |
const MVPbkContactLink& aContactLink, |
|
223 |
RVPbkContactFieldDefaultPriorities& aPriorities, |
|
224 |
CVPbkFieldTypeSelector& aFieldTypeSelector, |
|
225 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
|
226 |
aCommSelector, |
|
227 |
TBool aRskBack ) |
|
228 |
{ |
|
229 |
CPbk2CommAddressSelectPhase* self = new ( ELeave ) |
|
230 |
CPbk2CommAddressSelectPhase( aObserver, aPriorities, aRskBack, |
|
231 |
aFieldTypeSelector, aCommSelector ); |
|
232 |
CleanupStack::PushL( self ); |
|
233 |
self->ConstructL( aContactLink ); |
|
234 |
CleanupStack::Pop( self ); |
|
235 |
return self; |
|
236 |
} |
|
237 |
||
238 |
// -------------------------------------------------------------------------- |
|
239 |
// CPbk2CommAddressSelectPhase::LaunchServicePhaseL |
|
240 |
// -------------------------------------------------------------------------- |
|
241 |
// |
|
242 |
void CPbk2CommAddressSelectPhase::LaunchServicePhaseL() |
|
243 |
{ |
|
244 |
__ASSERT_DEBUG( iState == EInitialState, |
|
245 |
Panic( EPanicPreCond_LaunchServicePhaseL ) ); |
|
246 |
||
247 |
RetrieveContactL(); |
|
248 |
||
249 |
} |
|
250 |
||
251 |
// -------------------------------------------------------------------------- |
|
252 |
// CPbk2CommAddressSelectPhase::CancelServicePhase |
|
253 |
// -------------------------------------------------------------------------- |
|
254 |
// |
|
255 |
void CPbk2CommAddressSelectPhase::CancelServicePhase() |
|
256 |
{ |
|
257 |
if ( iAddressSelectEliminator != NULL ) |
|
258 |
{ |
|
259 |
iAddressSelectEliminator->ForceExit(); |
|
260 |
} |
|
261 |
||
262 |
delete iRetrieveOperation; |
|
263 |
iRetrieveOperation = NULL; |
|
264 |
||
265 |
if ( iContactPresence ) |
|
266 |
{ |
|
267 |
iContactPresence->CancelAll(); |
|
268 |
} |
|
269 |
||
270 |
iObserver.PhaseCanceled( *this ); |
|
271 |
} |
|
272 |
||
273 |
// -------------------------------------------------------------------------- |
|
274 |
// CPbk2CommAddressSelectPhase::RequestCancelL |
|
275 |
// -------------------------------------------------------------------------- |
|
276 |
// |
|
277 |
void CPbk2CommAddressSelectPhase::RequestCancelL( TInt aExitCommandId ) |
|
278 |
{ |
|
279 |
if ( iAddressSelectEliminator != NULL ) |
|
280 |
{ |
|
281 |
iAddressSelectEliminator->RequestExitL( aExitCommandId ); |
|
282 |
} |
|
283 |
||
284 |
// Withdraw our key event agent so that it does not react to |
|
285 |
// app shutter's escape key event simulation |
|
286 |
delete iDealer; |
|
287 |
iDealer = NULL; |
|
288 |
||
289 |
if ( aExitCommandId == EEikBidCancel ) |
|
290 |
{ |
|
291 |
iObserver.PhaseAborted( *this ); |
|
292 |
} |
|
293 |
else |
|
294 |
{ |
|
295 |
iObserver.PhaseCanceled( *this ); |
|
296 |
} |
|
297 |
} |
|
298 |
||
299 |
// -------------------------------------------------------------------------- |
|
300 |
// CPbk2CommAddressSelectPhase::AcceptDelayed |
|
301 |
// -------------------------------------------------------------------------- |
|
302 |
// |
|
303 |
void CPbk2CommAddressSelectPhase::AcceptDelayedL |
|
304 |
( const TDesC8& /*aContactLinkBuffer*/ ) |
|
305 |
{ |
|
306 |
// Nothing to accept |
|
307 |
} |
|
308 |
||
309 |
// -------------------------------------------------------------------------- |
|
310 |
// CPbk2CommAddressSelectPhase::Results |
|
311 |
// -------------------------------------------------------------------------- |
|
312 |
// |
|
313 |
MVPbkContactLinkArray* CPbk2CommAddressSelectPhase::Results() const |
|
314 |
{ |
|
315 |
return iResults; |
|
316 |
} |
|
317 |
||
318 |
// -------------------------------------------------------------------------- |
|
319 |
// CPbk2CommAddressSelectPhase::ExtraResultData |
|
320 |
// -------------------------------------------------------------------------- |
|
321 |
// |
|
322 |
TInt CPbk2CommAddressSelectPhase::ExtraResultData() const |
|
323 |
{ |
|
324 |
return KErrNotSupported; |
|
325 |
} |
|
326 |
||
327 |
// -------------------------------------------------------------------------- |
|
328 |
// CPbk2CommAddressSelectPhase::TakeStoreContact |
|
329 |
// -------------------------------------------------------------------------- |
|
330 |
// |
|
331 |
MVPbkStoreContact* CPbk2CommAddressSelectPhase::TakeStoreContact() |
|
332 |
{ |
|
333 |
MVPbkStoreContact* contact = iStoreContact; |
|
334 |
iStoreContact = NULL; |
|
335 |
return contact; |
|
336 |
} |
|
337 |
||
338 |
// -------------------------------------------------------------------------- |
|
339 |
// CPbk2CommAddressSelectPhase::FieldContent |
|
340 |
// -------------------------------------------------------------------------- |
|
341 |
// |
|
342 |
HBufC* CPbk2CommAddressSelectPhase::FieldContent() const |
|
343 |
{ |
|
344 |
return iFieldContent; |
|
345 |
} |
|
346 |
||
347 |
// -------------------------------------------------------------------------- |
|
348 |
// CPbk2CommAddressSelectPhase::VPbkSingleContactOperationComplete |
|
349 |
// -------------------------------------------------------------------------- |
|
350 |
// |
|
351 |
void CPbk2CommAddressSelectPhase::VPbkSingleContactOperationComplete |
|
352 |
( MVPbkContactOperationBase& /*aOperation*/, |
|
353 |
MVPbkStoreContact* aContact ) |
|
354 |
{ |
|
355 |
__ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved || |
|
356 |
iState == ExSPContactRetrieved, |
|
357 |
Panic( EPanicPreCond_ContactOperationComplete ) ); |
|
358 |
||
359 |
if ( iState == EInitialState ) |
|
360 |
{ |
|
361 |
iState = EMainContactRetrieved; |
|
362 |
// Contact retrieval complete, take contact ownership |
|
363 |
delete iStoreContact; |
|
364 |
iStoreContact = aContact; |
|
365 |
StartLoadingxSPContactLinks(); |
|
366 |
} |
|
367 |
else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved ) |
|
368 |
{ |
|
369 |
iState = ExSPContactRetrieved; |
|
370 |
||
371 |
// xSP contact retrieval complete. Ignore errors, just try next one |
|
372 |
// or go to next state. |
|
373 |
/*TInt err = */ixSPStoreContactsArray.Append( aContact ); |
|
374 |
||
375 |
// Start retrieving next xSP contact, if there are some contacts left |
|
376 |
if ( ixSPContactsArray->Count() > 0 ) |
|
377 |
{ |
|
378 |
RetrieveContact(); |
|
379 |
} |
|
380 |
else |
|
381 |
{ |
|
382 |
iState = ExSPContactsRetrieved; |
|
383 |
StartLoadingPresenceIconInfo(); |
|
384 |
} |
|
385 |
} |
|
386 |
} |
|
387 |
||
388 |
// -------------------------------------------------------------------------- |
|
389 |
// CPbk2CommAddressSelectPhase::VPbkSingleContactOperationFailed |
|
390 |
// -------------------------------------------------------------------------- |
|
391 |
// |
|
392 |
void CPbk2CommAddressSelectPhase::VPbkSingleContactOperationFailed |
|
393 |
( MVPbkContactOperationBase& /*aOperation*/, TInt aError ) |
|
394 |
{ |
|
395 |
iObserver.PhaseError( *this, aError ); |
|
396 |
} |
|
397 |
||
398 |
// -------------------------------------------------------------------------- |
|
399 |
// CPbk2CommAddressSelectPhase::Pbk2ProcessKeyEventL |
|
400 |
// -------------------------------------------------------------------------- |
|
401 |
// |
|
402 |
TBool CPbk2CommAddressSelectPhase::Pbk2ProcessKeyEventL |
|
403 |
( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
404 |
{ |
|
405 |
TBool ret = EFalse; |
|
406 |
||
407 |
if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) |
|
408 |
{ |
|
409 |
iObserver.PhaseOkToExit( *this, EEikBidCancel ); |
|
410 |
ret = ETrue; |
|
411 |
} |
|
412 |
||
413 |
return ret; |
|
414 |
} |
|
415 |
||
416 |
// -------------------------------------------------------------------------- |
|
417 |
// CPbk2CommAddressSelectPhase::VPbkOperationFailed |
|
418 |
// -------------------------------------------------------------------------- |
|
419 |
// |
|
420 |
void CPbk2CommAddressSelectPhase::VPbkOperationFailed( |
|
421 |
MVPbkContactOperationBase* /*aOperation*/, TInt /*aError*/ ) |
|
422 |
{ |
|
423 |
// Ignore an error, xSP info can be omitted. Just run address select dialog |
|
424 |
DoSelectAddresses(); |
|
425 |
} |
|
426 |
// -------------------------------------------------------------------------- |
|
427 |
// CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted |
|
428 |
// -------------------------------------------------------------------------- |
|
429 |
// |
|
430 |
void CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted( |
|
431 |
MVPbkContactOperationBase* /*aOperation*/, |
|
432 |
MVPbkContactLinkArray* aArray ) |
|
433 |
{ |
|
434 |
iState = ExSPLinksRetrieved; |
|
435 |
if ( !aArray || aArray->Count() == 0 ) |
|
436 |
{ |
|
437 |
StartLoadingPresenceIconInfo(); |
|
438 |
} |
|
439 |
else |
|
440 |
{ |
|
441 |
StartLoadingxSPContacts( *aArray ); |
|
442 |
} |
|
443 |
} |
|
444 |
||
445 |
// -------------------------------------------------------------------------- |
|
446 |
// CPbk2CommAddressSelectPhase::ReceiveIconInfoL |
|
447 |
// -------------------------------------------------------------------------- |
|
448 |
// |
|
449 |
void CPbk2CommAddressSelectPhase::ReceiveIconInfoL( |
|
450 |
const TDesC8& /*aPackedLink*/, |
|
451 |
const TDesC8& /*aBrandId*/, |
|
452 |
const TDesC8& /*aElementId*/ ) |
|
453 |
{ |
|
454 |
// nothing to do |
|
455 |
} |
|
456 |
||
457 |
// -------------------------------------------------------------------------- |
|
458 |
// CPbk2CommAddressSelectPhase::ReceiveIconFileL |
|
459 |
// -------------------------------------------------------------------------- |
|
460 |
// |
|
461 |
void CPbk2CommAddressSelectPhase::ReceiveIconFileL( |
|
462 |
const TDesC8& aBrandId, |
|
463 |
const TDesC8& aElementId, |
|
464 |
CFbsBitmap* aBrandedBitmap, |
|
465 |
CFbsBitmap* aMask ) |
|
466 |
{ |
|
467 |
iState = EPresenceIconRetrieved; |
|
468 |
||
469 |
// icon file received, save it to icon info array |
|
470 |
TInt count = iPresenceIconArray.Count(); |
|
471 |
for ( TInt i = 0; i < count; i++ ) |
|
472 |
{ |
|
473 |
if ( iPresenceIconArray[i]->BrandId().CompareF( aBrandId ) == 0 && |
|
474 |
iPresenceIconArray[i]->ElementId().CompareF( aElementId ) == 0 ) |
|
475 |
{ |
|
476 |
if ( !iPresenceIconArray[i]->IconBitmap() ) |
|
477 |
{ |
|
478 |
iPresenceIconArray[i]->SetBitmap( aBrandedBitmap, aMask ); |
|
479 |
break; |
|
480 |
} |
|
481 |
} |
|
482 |
} |
|
483 |
||
484 |
// check if all icon files received |
|
485 |
iState = EPresenceIconsRetrieved; |
|
486 |
for ( TInt j = 0; j < count && iState == EPresenceIconsRetrieved; j++ ) |
|
487 |
{ |
|
488 |
if ( iPresenceIconArray[j]->IconBitmap() == NULL || |
|
489 |
iPresenceIconArray[j]->IconBitmapMask() == NULL ) |
|
490 |
{ |
|
491 |
// Not all retrieved, still in state EPresenceIconRetrieved. |
|
492 |
iState = EPresenceIconRetrieved; |
|
493 |
} |
|
494 |
} |
|
495 |
||
496 |
// start address fetch dialog, if it waits for presence icons |
|
497 |
if ( iState == EPresenceIconsRetrieved ) |
|
498 |
{ |
|
499 |
DoSelectAddresses(); |
|
500 |
} |
|
501 |
} |
|
502 |
||
503 |
// -------------------------------------------------------------------------- |
|
504 |
// CPbk2CommAddressSelectPhase::PresenceSubscribeError |
|
505 |
// -------------------------------------------------------------------------- |
|
506 |
// |
|
507 |
void CPbk2CommAddressSelectPhase::PresenceSubscribeError( |
|
508 |
const TDesC8& /*aPackedLink*/, |
|
509 |
TInt /*aStatus*/ ) |
|
510 |
{ |
|
511 |
// nothing to do |
|
512 |
} |
|
513 |
||
514 |
// -------------------------------------------------------------------------- |
|
515 |
// CPbk2CommAddressSelectPhase::ErrorOccured |
|
516 |
// -------------------------------------------------------------------------- |
|
517 |
// |
|
518 |
void CPbk2CommAddressSelectPhase::ErrorOccured( |
|
519 |
TInt /*aOpId*/, |
|
520 |
TInt /*aStatus*/ ) |
|
521 |
{ |
|
522 |
if (iState == EPresenceIconInfoRetrieved || |
|
523 |
iState == EPresenceIconRetrieved ) |
|
524 |
{ |
|
525 |
iPresenceIconArray.ResetAndDestroy(); |
|
526 |
DoSelectAddresses(); |
|
527 |
} |
|
528 |
} |
|
529 |
||
530 |
// -------------------------------------------------------------------------- |
|
531 |
// CPbk2CommAddressSelectPhase::ReceiveIconInfosL |
|
532 |
// -------------------------------------------------------------------------- |
|
533 |
// |
|
534 |
void CPbk2CommAddressSelectPhase::ReceiveIconInfosL( |
|
535 |
const TDesC8& aPackedLink, |
|
536 |
RPointerArray <MContactPresenceInfo>& aInfoArray, |
|
537 |
TInt aOpId ) |
|
538 |
{ |
|
539 |
iState = EPresenceIconInfoRetrieved; |
|
540 |
// Must be TRAPped here because presence framework ignores the leave |
|
541 |
// and this instance will be jammed if ReceiveIconInfosL leaves. |
|
542 |
TRAPD( res, HandleReceiveIconInfosL( aPackedLink, aInfoArray, aOpId ) ); |
|
543 |
if ( res != KErrNone ) |
|
544 |
{ |
|
545 |
DoSelectAddresses(); |
|
546 |
} |
|
547 |
||
548 |
} |
|
549 |
// -------------------------------------------------------------------------- |
|
550 |
// CPbk2AddressSelectPhase::StoreReady |
|
551 |
// -------------------------------------------------------------------------- |
|
552 |
// |
|
553 |
void CPbk2CommAddressSelectPhase::StoreReady( |
|
554 |
MVPbkContactStore& /*aContactStore*/ ) |
|
555 |
{ |
|
556 |
// not interested |
|
557 |
} |
|
558 |
||
559 |
// -------------------------------------------------------------------------- |
|
560 |
// CPbk2AddressSelectPhase::StoreUnavailable |
|
561 |
// -------------------------------------------------------------------------- |
|
562 |
// |
|
563 |
void CPbk2CommAddressSelectPhase::StoreUnavailable( |
|
564 |
MVPbkContactStore& /*aContactStore*/, |
|
565 |
TInt /*aReason*/ ) |
|
566 |
{ |
|
567 |
// not interested |
|
568 |
} |
|
569 |
||
570 |
// -------------------------------------------------------------------------- |
|
571 |
// CPbk2AttributeAddressSelectPhase::StoreUnavailable |
|
572 |
// -------------------------------------------------------------------------- |
|
573 |
// |
|
574 |
void CPbk2CommAddressSelectPhase::HandleStoreEventL( |
|
575 |
MVPbkContactStore& /*aContactStore*/, |
|
576 |
TVPbkContactStoreEvent aEvent ) |
|
577 |
{ |
|
578 |
if ( aEvent.iContactLink != NULL && iStoreContact != NULL ) |
|
579 |
{ |
|
580 |
if ( aEvent.iContactLink->RefersTo( *iStoreContact ) ) |
|
581 |
{ |
|
582 |
CancelServicePhase(); |
|
583 |
} |
|
584 |
} |
|
585 |
} |
|
586 |
||
587 |
// -------------------------------------------------------------------------- |
|
588 |
// CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL |
|
589 |
// -------------------------------------------------------------------------- |
|
590 |
// |
|
591 |
void CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL( |
|
592 |
const TDesC8& /*aPackedLink*/, |
|
593 |
RPointerArray<MContactPresenceInfo>& aInfoArray, TInt /*aOpId*/) |
|
594 |
{ |
|
595 |
// service specific icons received |
|
596 |
TInt count = aInfoArray.Count(); |
|
597 |
||
598 |
// calculate and set preferred icon size |
|
599 |
TRect mainPane; |
|
600 |
AknLayoutUtils::LayoutMetricsRect( |
|
601 |
AknLayoutUtils::EMainPane, mainPane ); |
|
602 |
TAknLayoutRect listLayoutRect; |
|
603 |
listLayoutRect.LayoutRect( |
|
604 |
mainPane, |
|
605 |
AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() ); |
|
606 |
TSize size(listLayoutRect.Rect().Size()); |
|
607 |
iContactPresence->SetPresenceIconSize( size ); |
|
608 |
||
609 |
for ( TInt i = 0; i < count; i++ ) |
|
610 |
{ |
|
611 |
if ( aInfoArray[i]->BrandId().Length() > 0 && |
|
612 |
aInfoArray[i]->ElementId().Length() > 0 && |
|
613 |
aInfoArray[i]->ServiceName().Length() > 0 ) |
|
614 |
{ |
|
615 |
TInt serviceSeparatorPos = aInfoArray[i]->ServiceName(). |
|
616 |
FindF( KServiceNameSeparator ); |
|
617 |
if ( serviceSeparatorPos > 0 ) |
|
618 |
{ |
|
619 |
TInt nameIdLength = aInfoArray[i]->ServiceName().Length() - |
|
620 |
serviceSeparatorPos - 1; |
|
621 |
// save icon info to our own array |
|
622 |
CPbk2PresenceIconInfo* iconInfo = CPbk2PresenceIconInfo::NewL( |
|
623 |
aInfoArray[i]->BrandId(), |
|
624 |
aInfoArray[i]->ElementId(), |
|
625 |
aInfoArray[i]->ServiceName().Right( nameIdLength ) ); |
|
626 |
||
627 |
CleanupStack::PushL( iconInfo ); |
|
628 |
iPresenceIconArray.AppendL( iconInfo ); // ownership is taken |
|
629 |
CleanupStack::Pop( iconInfo ); |
|
630 |
||
631 |
// start retrieving icon file |
|
632 |
TInt opId = iContactPresence->GetPresenceIconFileL( |
|
633 |
aInfoArray[i]->BrandId(), aInfoArray[i]->ElementId() ); |
|
634 |
} |
|
635 |
} |
|
636 |
} |
|
637 |
||
638 |
if ( iPresenceIconArray.Count() == 0 ) |
|
639 |
{ |
|
640 |
DoSelectAddresses(); |
|
641 |
} |
|
642 |
} |
|
643 |
||
644 |
// -------------------------------------------------------------------------- |
|
645 |
// CPbk2CommAddressSelectPhase::RetrieveContact |
|
646 |
// -------------------------------------------------------------------------- |
|
647 |
// |
|
648 |
void CPbk2CommAddressSelectPhase::RetrieveContact() |
|
649 |
{ |
|
650 |
TRAPD( res, RetrieveContactL() ); |
|
651 |
if ( res != KErrNone ) |
|
652 |
{ |
|
653 |
DoSelectAddresses(); |
|
654 |
} |
|
655 |
} |
|
656 |
||
657 |
// -------------------------------------------------------------------------- |
|
658 |
// CPbk2CommAddressSelectPhase::RetrieveContactL |
|
659 |
// -------------------------------------------------------------------------- |
|
660 |
// |
|
661 |
void CPbk2CommAddressSelectPhase::RetrieveContactL() |
|
662 |
{ |
|
663 |
__ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved || |
|
664 |
iState == ExSPContactRetrieved, |
|
665 |
Panic( EPanicPreCond_RetrieveContactL ) ); |
|
666 |
||
667 |
CPbk2ServerAppAppUi& appUi = |
|
668 |
static_cast<CPbk2ServerAppAppUi&> |
|
669 |
( *iEikenv->EikAppUi() ); |
|
670 |
||
671 |
// Fetch one contact at a time if service cancellation is not |
|
672 |
// commanded. |
|
673 |
delete iRetrieveOperation; |
|
674 |
iRetrieveOperation = NULL; |
|
675 |
||
676 |
if ( iState == EInitialState ) |
|
677 |
{ |
|
678 |
iRetrieveOperation = appUi.ApplicationServices().ContactManager(). |
|
679 |
RetrieveContactL( *iContactLink, *this ); |
|
680 |
} |
|
681 |
else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved ) |
|
682 |
{ |
|
683 |
iRetrieveOperation = appUi.ApplicationServices().ContactManager(). |
|
684 |
RetrieveContactL( ixSPContactsArray->At( 0 ), *this ); |
|
685 |
ixSPContactsArray->Delete( 0 ); |
|
686 |
} |
|
687 |
} |
|
688 |
||
689 |
// -------------------------------------------------------------------------- |
|
690 |
// CPbk2CommAddressSelectPhase::DoSelectAddresses |
|
691 |
// -------------------------------------------------------------------------- |
|
692 |
// |
|
693 |
void CPbk2CommAddressSelectPhase::DoSelectAddresses() |
|
694 |
{ |
|
695 |
TRAPD( res, DoSelectAddressesL() ); |
|
696 |
if ( res != KErrNone ) |
|
697 |
{ |
|
698 |
iState = EAddressSelectError; |
|
699 |
iObserver.PhaseError( *this, res ); |
|
700 |
} |
|
701 |
} |
|
702 |
||
703 |
// -------------------------------------------------------------------------- |
|
704 |
// CPbk2CommAddressSelectPhase::DoSelectAddressesL |
|
705 |
// -------------------------------------------------------------------------- |
|
706 |
// |
|
707 |
void CPbk2CommAddressSelectPhase::DoSelectAddressesL() |
|
708 |
{ |
|
709 |
__ASSERT_DEBUG(iStoreContact, Panic(EPanicPreCond_DoSelectAddressesL)); |
|
710 |
||
711 |
FilterXspContactsL(); |
|
712 |
||
713 |
TResourceReader reader; |
|
714 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId ); |
|
715 |
||
716 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
|
717 |
( *iEikenv->EikAppUi() ); |
|
718 |
||
719 |
TPbk2AddressSelectParams params |
|
720 |
( *iStoreContact, appUi.ApplicationServices().ContactManager(), |
|
721 |
appUi.ApplicationServices().NameFormatter(), |
|
722 |
appUi.ApplicationServices().FieldProperties(), |
|
723 |
reader, iTitleResId ); |
|
724 |
||
725 |
params.iCommMethod = iCommMethod; |
|
726 |
||
727 |
// If default priorities are set use defaults directly. |
|
728 |
params.SetDefaultPriorities( iPriorities ); |
|
729 |
||
730 |
// Launch call directly using default values. |
|
731 |
params.SetUseDefaultDirectly( ETrue ); |
|
732 |
||
733 |
TArray<MVPbkStoreContact*> storeContactsArray = |
|
734 |
ixSPStoreContactsArray.Array(); |
|
735 |
TArray<CPbk2PresenceIconInfo*> presenceIconsArray = |
|
736 |
iPresenceIconArray.Array(); |
|
737 |
CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( |
|
738 |
params, iFieldTypeSelector, &storeContactsArray, |
|
739 |
&presenceIconsArray ); |
|
740 |
||
741 |
// Correct CBA buttons |
|
742 |
TInt correctedCba = CorrectRSK( iResourceId ); |
|
743 |
if ( correctedCba > KErrNone ) |
|
744 |
{ |
|
745 |
addressSelect->SetCba( correctedCba ); |
|
746 |
} |
|
747 |
||
748 |
// Execute |
|
749 |
iAddressSelectEliminator = addressSelect; |
|
750 |
iAddressSelectEliminator->ResetWhenDestroyed |
|
751 |
( &iAddressSelectEliminator ); |
|
752 |
||
753 |
appUi.StoreManager().RegisterStoreEventsL( *this ); |
|
754 |
MVPbkStoreContactField* resultField = addressSelect->ExecuteLD(); |
|
755 |
iState = EAddressSelectDone; |
|
756 |
appUi.StoreManager().DeregisterStoreEvents( *this ); |
|
757 |
||
758 |
CleanupStack::PopAndDestroy(); // reader |
|
759 |
||
760 |
if ( resultField ) |
|
761 |
{ |
|
762 |
CleanupDeletePushL(resultField); |
|
763 |
||
764 |
// Save field content |
|
765 |
MVPbkContactFieldData& fieldData = resultField->FieldData(); |
|
766 |
TVPbkFieldStorageType type = fieldData.DataType(); |
|
767 |
if ( type == EVPbkFieldStorageTypeText ) |
|
768 |
{ |
|
769 |
MVPbkContactFieldTextData& textData = |
|
770 |
MVPbkContactFieldTextData::Cast( fieldData ); |
|
771 |
TPtrC ptr = textData.Text(); |
|
772 |
delete iFieldContent; |
|
773 |
iFieldContent = NULL; |
|
774 |
iFieldContent = HBufC::NewL( ptr.Length() ); |
|
775 |
iFieldContent->Des().Copy( ptr ); |
|
776 |
} |
|
777 |
else if ( type == EVPbkFieldStorageTypeUri ) |
|
778 |
{ |
|
779 |
MVPbkContactFieldUriData& textData = |
|
780 |
MVPbkContactFieldUriData::Cast( fieldData ); |
|
781 |
TPtrC ptr = textData.Uri(); |
|
782 |
delete iFieldContent; |
|
783 |
iFieldContent = NULL; |
|
784 |
iFieldContent = HBufC::NewL( ptr.Length() ); |
|
785 |
iFieldContent->Des().Copy( ptr ); |
|
786 |
} |
|
787 |
||
788 |
// Append field to the result array |
|
789 |
AppendResultL( resultField ); |
|
790 |
CleanupStack::PopAndDestroy(); // resultField |
|
791 |
iObserver.NextPhase( *this ); |
|
792 |
} |
|
793 |
else |
|
794 |
{ |
|
795 |
// Normal cancellation and there is no results |
|
796 |
// to be sent to caller |
|
797 |
iObserver.PhaseCanceled( *this ); |
|
798 |
} |
|
799 |
} |
|
800 |
||
801 |
// -------------------------------------------------------------------------- |
|
802 |
// CPbk2CommAddressSelectPhase::CorrectRSK |
|
803 |
// -------------------------------------------------------------------------- |
|
804 |
// |
|
805 |
inline TInt CPbk2CommAddressSelectPhase::CorrectRSK |
|
806 |
( TInt aAddressSelectResourceId ) |
|
807 |
{ |
|
808 |
TInt result = KErrNone; |
|
809 |
||
810 |
if ( iRskBack ) |
|
811 |
{ |
|
812 |
switch ( aAddressSelectResourceId ) |
|
813 |
{ |
|
814 |
case R_PBK2_GENERIC_ADDRESS_SELECT: |
|
815 |
case R_PBK2_PHONE_NUMBER_SELECT: |
|
816 |
case R_PBK2_VIDEO_NUMBER_SELECT: |
|
817 |
case R_PBK2_EMAIL_ADDRESS_SELECT: |
|
818 |
case R_PBK2_EMAIL_OVER_SMS_ADDRESS_SELECT: |
|
819 |
case R_PBK2_MMS_ADDRESS_SELECT: |
|
820 |
case R_PBK2_POC_ADDRESS_SELECT: |
|
821 |
case R_PBK2_VOIP_ADDRESS_SELECT: |
|
822 |
case R_PBK2_DTMF_PHONE_NUMBER_SELECT: |
|
823 |
case R_PBK2_THUMBNAIL_SELECT: |
|
824 |
case R_PBK2_CALL_ITEM_NUMBER_SELECT: |
|
825 |
{ |
|
826 |
result = R_AVKON_SOFTKEYS_SELECT_BACK__SELECT; |
|
827 |
break; |
|
828 |
} |
|
829 |
||
830 |
default: |
|
831 |
{ |
|
832 |
// Do nothing |
|
833 |
break; |
|
834 |
} |
|
835 |
} |
|
836 |
} |
|
837 |
||
838 |
return result; |
|
839 |
} |
|
840 |
||
841 |
// -------------------------------------------------------------------------- |
|
842 |
// CPbk2CommAddressSelectPhase::AppendResultL |
|
843 |
// -------------------------------------------------------------------------- |
|
844 |
// |
|
845 |
void CPbk2CommAddressSelectPhase::AppendResultL |
|
846 |
( const MVPbkStoreContactField* aField ) |
|
847 |
{ |
|
848 |
if ( aField ) |
|
849 |
{ |
|
850 |
// Add the contact link to the result array |
|
851 |
MVPbkContactLink* link = aField->CreateLinkLC(); |
|
852 |
if ( link ) |
|
853 |
{ |
|
854 |
if ( !iResults ) |
|
855 |
{ |
|
856 |
iResults = CVPbkContactLinkArray::NewL(); |
|
857 |
} |
|
858 |
||
859 |
CleanupStack::Pop(); // aField->CreateLinkLC() |
|
860 |
||
861 |
iResults->AppendL( link ); |
|
862 |
} |
|
863 |
} |
|
864 |
} |
|
865 |
||
866 |
// -------------------------------------------------------------------------- |
|
867 |
// CPbk2CommAddressSelectPhase::GetImppFieldDataL |
|
868 |
// -------------------------------------------------------------------------- |
|
869 |
// |
|
870 |
void CPbk2CommAddressSelectPhase::GetImppFieldDataL( CDesC16ArrayFlat& aXspIdArray, MVPbkStoreContact& aContact ) |
|
871 |
{ |
|
872 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
|
873 |
( *iEikenv->EikAppUi() ); |
|
874 |
||
875 |
const MVPbkFieldType* type = appUi.ApplicationServices().ContactManager(). |
|
876 |
FieldTypes().Find( R_VPBK_FIELD_TYPE_IMPP ); |
|
877 |
||
878 |
CVPbkBaseContactFieldTypeIterator* itr = |
|
879 |
CVPbkBaseContactFieldTypeIterator::NewLC( *type, |
|
880 |
aContact.Fields() ); |
|
881 |
||
882 |
while ( itr->HasNext() ) |
|
883 |
{ |
|
884 |
const MVPbkBaseContactField* field = itr->Next(); |
|
885 |
const MVPbkContactFieldUriData& uri = |
|
886 |
MVPbkContactFieldUriData::Cast(field->FieldData() ); |
|
887 |
HBufC* data = uri.Uri().AllocL(); |
|
888 |
CleanupStack::PushL(data); |
|
889 |
aXspIdArray.AppendL( data->Des() ); |
|
890 |
CleanupStack::PopAndDestroy(data); //data |
|
891 |
} |
|
892 |
CleanupStack::PopAndDestroy(itr); //itr |
|
893 |
} |
|
894 |
||
895 |
// -------------------------------------------------------------------------- |
|
896 |
// CPbk2CommAddressSelectPhase::FilterXspContactsL |
|
897 |
// -------------------------------------------------------------------------- |
|
898 |
// |
|
899 |
void CPbk2CommAddressSelectPhase::FilterXspContactsL() |
|
900 |
{ |
|
901 |
TInt xspContactCount = ixSPStoreContactsArray.Count(); |
|
902 |
||
903 |
if ( xspContactCount > 0 ) |
|
904 |
{ |
|
905 |
for ( TInt i = xspContactCount - 1; i >= 0; --i ) |
|
906 |
{ |
|
907 |
MVPbkStoreContact* contact = ixSPStoreContactsArray[i]; |
|
908 |
if ( !IsMatchL( *contact, *iStoreContact ) ) |
|
909 |
{ |
|
910 |
ixSPStoreContactsArray.Remove(i); |
|
911 |
delete contact; |
|
912 |
} |
|
913 |
} |
|
914 |
} |
|
915 |
} |
|
916 |
||
917 |
// -------------------------------------------------------------------------- |
|
918 |
// CPbk2CommAddressSelectPhase::IsMatchL |
|
919 |
// -------------------------------------------------------------------------- |
|
920 |
// |
|
921 |
TBool CPbk2CommAddressSelectPhase::IsMatchL( MVPbkStoreContact& aXspContact, |
|
922 |
MVPbkStoreContact& aStoreContact ) |
|
923 |
{ |
|
924 |
TBool result = EFalse; |
|
925 |
||
926 |
CDesCArrayFlat* storeContactXspIdArray = new ( ELeave ) CDesCArrayFlat( KMaxXspServiceCount ); |
|
927 |
CleanupStack::PushL( storeContactXspIdArray ); |
|
928 |
GetImppFieldDataL( *storeContactXspIdArray, aStoreContact ); |
|
929 |
||
930 |
CDesCArrayFlat* xspContcatXspIdArray = new ( ELeave ) CDesCArrayFlat( KMaxXspServiceCount ); |
|
931 |
CleanupStack::PushL( xspContcatXspIdArray ); |
|
932 |
GetImppFieldDataL( *xspContcatXspIdArray, aXspContact ); |
|
933 |
||
934 |
for ( TInt i = 0; i < storeContactXspIdArray->MdcaCount(); i++ ) |
|
935 |
{ |
|
936 |
TPtrC data = storeContactXspIdArray->MdcaPoint( i ); |
|
937 |
for ( TInt j = 0; j < xspContcatXspIdArray->MdcaCount(); j++ ) |
|
938 |
{ |
|
939 |
TPtrC data1 = xspContcatXspIdArray->MdcaPoint( j ); |
|
940 |
if ( data1.CompareF( data ) == 0 ) |
|
941 |
{ |
|
942 |
result = ETrue; |
|
943 |
break; |
|
944 |
} |
|
945 |
} |
|
946 |
} |
|
947 |
CleanupStack::PopAndDestroy(); // xspContcatXspIdArray |
|
948 |
CleanupStack::PopAndDestroy(); // storeContactXspIdArray |
|
949 |
||
950 |
return result; |
|
951 |
} |
|
952 |
||
953 |
// -------------------------------------------------------------------------- |
|
954 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks |
|
955 |
// -------------------------------------------------------------------------- |
|
956 |
// |
|
957 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks() |
|
958 |
{ |
|
959 |
TRAPD( res, StartLoadingxSPContactLinksL() ); |
|
960 |
if (res != KErrNone) |
|
961 |
{ |
|
962 |
DoSelectAddresses(); |
|
963 |
} |
|
964 |
} |
|
965 |
||
966 |
// -------------------------------------------------------------------------- |
|
967 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL |
|
968 |
// -------------------------------------------------------------------------- |
|
969 |
// |
|
970 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL() |
|
971 |
{ |
|
972 |
delete ixSPContactOperation; |
|
973 |
ixSPContactOperation = NULL; |
|
974 |
ixSPContactOperation = ixSPManager->GetxSPContactLinksL( |
|
975 |
*iStoreContact, *this, *this); |
|
976 |
} |
|
977 |
||
978 |
// -------------------------------------------------------------------------- |
|
979 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContacts |
|
980 |
// -------------------------------------------------------------------------- |
|
981 |
// |
|
982 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContacts( |
|
983 |
MVPbkContactLinkArray& aArray ) |
|
984 |
{ |
|
985 |
TRAPD( res, StartLoadingxSPContactsL( aArray ) ); |
|
986 |
if ( res != KErrNone ) |
|
987 |
{ |
|
988 |
DoSelectAddresses(); |
|
989 |
} |
|
990 |
} |
|
991 |
||
992 |
// -------------------------------------------------------------------------- |
|
993 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL |
|
994 |
// -------------------------------------------------------------------------- |
|
995 |
// |
|
996 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL( |
|
997 |
MVPbkContactLinkArray& aArray ) |
|
998 |
{ |
|
999 |
// Take a own copy of supplied contact links |
|
1000 |
if (!ixSPContactsArray) |
|
1001 |
{ |
|
1002 |
ixSPContactsArray = CVPbkContactLinkArray::NewL(); |
|
1003 |
} |
|
1004 |
ixSPStoreContactsArray.ResetAndDestroy(); |
|
1005 |
||
1006 |
CopyContactLinksL( aArray, *ixSPContactsArray ); |
|
1007 |
RetrieveContactL(); |
|
1008 |
} |
|
1009 |
||
1010 |
||
1011 |
// -------------------------------------------------------------------------- |
|
1012 |
// CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo |
|
1013 |
// -------------------------------------------------------------------------- |
|
1014 |
// |
|
1015 |
void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo() |
|
1016 |
{ |
|
1017 |
TRAPD( res, StartLoadingPresenceIconInfoL()); |
|
1018 |
if ( res != KErrNone ) |
|
1019 |
{ |
|
1020 |
// In error case continue like there are no presence icons. |
|
1021 |
DoSelectAddresses(); |
|
1022 |
} |
|
1023 |
} |
|
1024 |
||
1025 |
// -------------------------------------------------------------------------- |
|
1026 |
// CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL |
|
1027 |
// -------------------------------------------------------------------------- |
|
1028 |
// |
|
1029 |
void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL() |
|
1030 |
{ |
|
1031 |
const TInt oneAddress = 1; |
|
1032 |
if ( ( iCommMethod == |
|
1033 |
VPbkFieldTypeSelectorFactory::EInstantMessagingSelector || |
|
1034 |
iCommMethod == |
|
1035 |
VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) && |
|
1036 |
NumOfAddressesL() > oneAddress ) |
|
1037 |
{ |
|
1038 |
GetPresenceInfoL(); |
|
1039 |
} |
|
1040 |
else |
|
1041 |
{ |
|
1042 |
DoSelectAddresses(); |
|
1043 |
} |
|
1044 |
} |
|
1045 |
||
1046 |
// -------------------------------------------------------------------------- |
|
1047 |
// CPbk2CommAddressSelectPhase::NumOfAddressesL |
|
1048 |
// -------------------------------------------------------------------------- |
|
1049 |
// |
|
1050 |
TInt CPbk2CommAddressSelectPhase::NumOfAddressesL( |
|
1051 |
MVPbkStoreContact& aStoreContact ) |
|
1052 |
{ |
|
1053 |
CVPbkFieldFilter::TConfig config( aStoreContact.Fields(), |
|
1054 |
&iFieldTypeSelector ); |
|
1055 |
CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
1056 |
TInt result = fieldFilter->FieldCount(); |
|
1057 |
delete fieldFilter; |
|
1058 |
return result; |
|
1059 |
} |
|
1060 |
||
1061 |
// -------------------------------------------------------------------------- |
|
1062 |
// CPbk2CommAddressSelectPhase::NumOfAddressesL |
|
1063 |
// -------------------------------------------------------------------------- |
|
1064 |
// |
|
1065 |
TInt CPbk2CommAddressSelectPhase::NumOfAddressesL() |
|
1066 |
{ |
|
1067 |
TInt numOfAddresses = 0; |
|
1068 |
if ( iStoreContact ) |
|
1069 |
{ |
|
1070 |
numOfAddresses += NumOfAddressesL( *iStoreContact ); |
|
1071 |
} |
|
1072 |
||
1073 |
const TInt count = ixSPStoreContactsArray.Count(); |
|
1074 |
for ( TInt i = 0; i < count; ++i ) |
|
1075 |
{ |
|
1076 |
numOfAddresses += NumOfAddressesL( *ixSPStoreContactsArray[i] ); |
|
1077 |
} |
|
1078 |
return numOfAddresses; |
|
1079 |
} |
|
1080 |
||
1081 |
// -------------------------------------------------------------------------- |
|
1082 |
// CPbk2CommAddressSelectPhase::GetPresenceInfoL |
|
1083 |
// -------------------------------------------------------------------------- |
|
1084 |
// |
|
1085 |
void CPbk2CommAddressSelectPhase::GetPresenceInfoL() |
|
1086 |
{ |
|
1087 |
if ( !iContactPresence ) |
|
1088 |
{ |
|
1089 |
iContactPresence = TContactPresenceFactory::NewContactPresenceL( |
|
1090 |
*this ); |
|
1091 |
} |
|
1092 |
// ...and start presence icons retrieving |
|
1093 |
HBufC8* packedLink = iContactLink->PackLC(); |
|
1094 |
// Operation id no needed because CancelAll is used. |
|
1095 |
/*TInt opId =*/iContactPresence->GetPresenceInfoL( *packedLink ); |
|
1096 |
CleanupStack::PopAndDestroy( packedLink ); |
|
1097 |
} |
|
1098 |
||
1099 |
// End of File |