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>
|
|
29 |
#include <Pbk2UIControls.rsg>
|
|
30 |
#include <Pbk2Commands.rsg>
|
|
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>
|
|
48 |
#include <VPbkEng.rsg>
|
|
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::DenyDelayed
|
|
311 |
// --------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
void CPbk2CommAddressSelectPhase::DenyDelayedL
|
|
314 |
( const TDesC8& /*aContactLinkBuffer*/ )
|
|
315 |
{
|
|
316 |
// Nothing to deny
|
|
317 |
}
|
|
318 |
|
|
319 |
// --------------------------------------------------------------------------
|
|
320 |
// CPbk2CommAddressSelectPhase::Results
|
|
321 |
// --------------------------------------------------------------------------
|
|
322 |
//
|
|
323 |
MVPbkContactLinkArray* CPbk2CommAddressSelectPhase::Results() const
|
|
324 |
{
|
|
325 |
return iResults;
|
|
326 |
}
|
|
327 |
|
|
328 |
// --------------------------------------------------------------------------
|
|
329 |
// CPbk2CommAddressSelectPhase::ExtraResultData
|
|
330 |
// --------------------------------------------------------------------------
|
|
331 |
//
|
|
332 |
TInt CPbk2CommAddressSelectPhase::ExtraResultData() const
|
|
333 |
{
|
|
334 |
return KErrNotSupported;
|
|
335 |
}
|
|
336 |
|
|
337 |
// --------------------------------------------------------------------------
|
|
338 |
// CPbk2CommAddressSelectPhase::TakeStoreContact
|
|
339 |
// --------------------------------------------------------------------------
|
|
340 |
//
|
|
341 |
MVPbkStoreContact* CPbk2CommAddressSelectPhase::TakeStoreContact()
|
|
342 |
{
|
|
343 |
MVPbkStoreContact* contact = iStoreContact;
|
|
344 |
iStoreContact = NULL;
|
|
345 |
return contact;
|
|
346 |
}
|
|
347 |
|
|
348 |
// --------------------------------------------------------------------------
|
|
349 |
// CPbk2CommAddressSelectPhase::FieldContent
|
|
350 |
// --------------------------------------------------------------------------
|
|
351 |
//
|
|
352 |
HBufC* CPbk2CommAddressSelectPhase::FieldContent() const
|
|
353 |
{
|
|
354 |
return iFieldContent;
|
|
355 |
}
|
|
356 |
|
|
357 |
// --------------------------------------------------------------------------
|
|
358 |
// CPbk2CommAddressSelectPhase::VPbkSingleContactOperationComplete
|
|
359 |
// --------------------------------------------------------------------------
|
|
360 |
//
|
|
361 |
void CPbk2CommAddressSelectPhase::VPbkSingleContactOperationComplete
|
|
362 |
( MVPbkContactOperationBase& /*aOperation*/,
|
|
363 |
MVPbkStoreContact* aContact )
|
|
364 |
{
|
|
365 |
__ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved ||
|
|
366 |
iState == ExSPContactRetrieved,
|
|
367 |
Panic( EPanicPreCond_ContactOperationComplete ) );
|
|
368 |
|
|
369 |
if ( iState == EInitialState )
|
|
370 |
{
|
|
371 |
iState = EMainContactRetrieved;
|
|
372 |
// Contact retrieval complete, take contact ownership
|
|
373 |
delete iStoreContact;
|
|
374 |
iStoreContact = aContact;
|
|
375 |
StartLoadingxSPContactLinks();
|
|
376 |
}
|
|
377 |
else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved )
|
|
378 |
{
|
|
379 |
iState = ExSPContactRetrieved;
|
|
380 |
|
|
381 |
// xSP contact retrieval complete. Ignore errors, just try next one
|
|
382 |
// or go to next state.
|
|
383 |
/*TInt err = */ixSPStoreContactsArray.Append( aContact );
|
|
384 |
|
|
385 |
// Start retrieving next xSP contact, if there are some contacts left
|
|
386 |
if ( ixSPContactsArray->Count() > 0 )
|
|
387 |
{
|
|
388 |
RetrieveContact();
|
|
389 |
}
|
|
390 |
else
|
|
391 |
{
|
|
392 |
iState = ExSPContactsRetrieved;
|
|
393 |
StartLoadingPresenceIconInfo();
|
|
394 |
}
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
// --------------------------------------------------------------------------
|
|
399 |
// CPbk2CommAddressSelectPhase::VPbkSingleContactOperationFailed
|
|
400 |
// --------------------------------------------------------------------------
|
|
401 |
//
|
|
402 |
void CPbk2CommAddressSelectPhase::VPbkSingleContactOperationFailed
|
|
403 |
( MVPbkContactOperationBase& /*aOperation*/, TInt aError )
|
|
404 |
{
|
|
405 |
iObserver.PhaseError( *this, aError );
|
|
406 |
}
|
|
407 |
|
|
408 |
// --------------------------------------------------------------------------
|
|
409 |
// CPbk2CommAddressSelectPhase::Pbk2ProcessKeyEventL
|
|
410 |
// --------------------------------------------------------------------------
|
|
411 |
//
|
|
412 |
TBool CPbk2CommAddressSelectPhase::Pbk2ProcessKeyEventL
|
|
413 |
( const TKeyEvent& aKeyEvent, TEventCode aType )
|
|
414 |
{
|
|
415 |
TBool ret = EFalse;
|
|
416 |
|
|
417 |
if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
|
|
418 |
{
|
|
419 |
iObserver.PhaseOkToExit( *this, EEikBidCancel );
|
|
420 |
ret = ETrue;
|
|
421 |
}
|
|
422 |
|
|
423 |
return ret;
|
|
424 |
}
|
|
425 |
|
|
426 |
// --------------------------------------------------------------------------
|
|
427 |
// CPbk2CommAddressSelectPhase::VPbkOperationFailed
|
|
428 |
// --------------------------------------------------------------------------
|
|
429 |
//
|
|
430 |
void CPbk2CommAddressSelectPhase::VPbkOperationFailed(
|
|
431 |
MVPbkContactOperationBase* /*aOperation*/, TInt /*aError*/ )
|
|
432 |
{
|
|
433 |
// Ignore an error, xSP info can be omitted. Just run address select dialog
|
|
434 |
DoSelectAddresses();
|
|
435 |
}
|
|
436 |
// --------------------------------------------------------------------------
|
|
437 |
// CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted
|
|
438 |
// --------------------------------------------------------------------------
|
|
439 |
//
|
|
440 |
void CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted(
|
|
441 |
MVPbkContactOperationBase* /*aOperation*/,
|
|
442 |
MVPbkContactLinkArray* aArray )
|
|
443 |
{
|
|
444 |
iState = ExSPLinksRetrieved;
|
|
445 |
if ( !aArray || aArray->Count() == 0 )
|
|
446 |
{
|
|
447 |
StartLoadingPresenceIconInfo();
|
|
448 |
}
|
|
449 |
else
|
|
450 |
{
|
|
451 |
StartLoadingxSPContacts( *aArray );
|
|
452 |
}
|
|
453 |
}
|
|
454 |
|
|
455 |
// --------------------------------------------------------------------------
|
|
456 |
// CPbk2CommAddressSelectPhase::ReceiveIconInfoL
|
|
457 |
// --------------------------------------------------------------------------
|
|
458 |
//
|
|
459 |
void CPbk2CommAddressSelectPhase::ReceiveIconInfoL(
|
|
460 |
const TDesC8& /*aPackedLink*/,
|
|
461 |
const TDesC8& /*aBrandId*/,
|
|
462 |
const TDesC8& /*aElementId*/ )
|
|
463 |
{
|
|
464 |
// nothing to do
|
|
465 |
}
|
|
466 |
|
|
467 |
// --------------------------------------------------------------------------
|
|
468 |
// CPbk2CommAddressSelectPhase::ReceiveIconFileL
|
|
469 |
// --------------------------------------------------------------------------
|
|
470 |
//
|
|
471 |
void CPbk2CommAddressSelectPhase::ReceiveIconFileL(
|
|
472 |
const TDesC8& aBrandId,
|
|
473 |
const TDesC8& aElementId,
|
|
474 |
CFbsBitmap* aBrandedBitmap,
|
|
475 |
CFbsBitmap* aMask )
|
|
476 |
{
|
|
477 |
iState = EPresenceIconRetrieved;
|
|
478 |
|
|
479 |
// icon file received, save it to icon info array
|
|
480 |
TInt count = iPresenceIconArray.Count();
|
|
481 |
for ( TInt i = 0; i < count; i++ )
|
|
482 |
{
|
|
483 |
if ( iPresenceIconArray[i]->BrandId().CompareF( aBrandId ) == 0 &&
|
|
484 |
iPresenceIconArray[i]->ElementId().CompareF( aElementId ) == 0 )
|
|
485 |
{
|
|
486 |
if ( !iPresenceIconArray[i]->IconBitmap() )
|
|
487 |
{
|
|
488 |
iPresenceIconArray[i]->SetBitmap( aBrandedBitmap, aMask );
|
|
489 |
break;
|
|
490 |
}
|
|
491 |
}
|
|
492 |
}
|
|
493 |
|
|
494 |
// check if all icon files received
|
|
495 |
iState = EPresenceIconsRetrieved;
|
|
496 |
for ( TInt j = 0; j < count && iState == EPresenceIconsRetrieved; j++ )
|
|
497 |
{
|
|
498 |
if ( iPresenceIconArray[j]->IconBitmap() == NULL ||
|
|
499 |
iPresenceIconArray[j]->IconBitmapMask() == NULL )
|
|
500 |
{
|
|
501 |
// Not all retrieved, still in state EPresenceIconRetrieved.
|
|
502 |
iState = EPresenceIconRetrieved;
|
|
503 |
}
|
|
504 |
}
|
|
505 |
|
|
506 |
// start address fetch dialog, if it waits for presence icons
|
|
507 |
if ( iState == EPresenceIconsRetrieved )
|
|
508 |
{
|
|
509 |
DoSelectAddresses();
|
|
510 |
}
|
|
511 |
}
|
|
512 |
|
|
513 |
// --------------------------------------------------------------------------
|
|
514 |
// CPbk2CommAddressSelectPhase::PresenceSubscribeError
|
|
515 |
// --------------------------------------------------------------------------
|
|
516 |
//
|
|
517 |
void CPbk2CommAddressSelectPhase::PresenceSubscribeError(
|
|
518 |
const TDesC8& /*aPackedLink*/,
|
|
519 |
TInt /*aStatus*/ )
|
|
520 |
{
|
|
521 |
// nothing to do
|
|
522 |
}
|
|
523 |
|
|
524 |
// --------------------------------------------------------------------------
|
|
525 |
// CPbk2CommAddressSelectPhase::ErrorOccured
|
|
526 |
// --------------------------------------------------------------------------
|
|
527 |
//
|
|
528 |
void CPbk2CommAddressSelectPhase::ErrorOccured(
|
|
529 |
TInt /*aOpId*/,
|
|
530 |
TInt /*aStatus*/ )
|
|
531 |
{
|
|
532 |
if (iState == EPresenceIconInfoRetrieved ||
|
|
533 |
iState == EPresenceIconRetrieved )
|
|
534 |
{
|
|
535 |
iPresenceIconArray.ResetAndDestroy();
|
|
536 |
DoSelectAddresses();
|
|
537 |
}
|
|
538 |
}
|
|
539 |
|
|
540 |
// --------------------------------------------------------------------------
|
|
541 |
// CPbk2CommAddressSelectPhase::ReceiveIconInfosL
|
|
542 |
// --------------------------------------------------------------------------
|
|
543 |
//
|
|
544 |
void CPbk2CommAddressSelectPhase::ReceiveIconInfosL(
|
|
545 |
const TDesC8& aPackedLink,
|
|
546 |
RPointerArray <MContactPresenceInfo>& aInfoArray,
|
|
547 |
TInt aOpId )
|
|
548 |
{
|
|
549 |
iState = EPresenceIconInfoRetrieved;
|
|
550 |
// Must be TRAPped here because presence framework ignores the leave
|
|
551 |
// and this instance will be jammed if ReceiveIconInfosL leaves.
|
|
552 |
TRAPD( res, HandleReceiveIconInfosL( aPackedLink, aInfoArray, aOpId ) );
|
|
553 |
if ( res != KErrNone )
|
|
554 |
{
|
|
555 |
DoSelectAddresses();
|
|
556 |
}
|
|
557 |
|
|
558 |
}
|
|
559 |
// --------------------------------------------------------------------------
|
|
560 |
// CPbk2AddressSelectPhase::StoreReady
|
|
561 |
// --------------------------------------------------------------------------
|
|
562 |
//
|
|
563 |
void CPbk2CommAddressSelectPhase::StoreReady(
|
|
564 |
MVPbkContactStore& /*aContactStore*/ )
|
|
565 |
{
|
|
566 |
// not interested
|
|
567 |
}
|
|
568 |
|
|
569 |
// --------------------------------------------------------------------------
|
|
570 |
// CPbk2AddressSelectPhase::StoreUnavailable
|
|
571 |
// --------------------------------------------------------------------------
|
|
572 |
//
|
|
573 |
void CPbk2CommAddressSelectPhase::StoreUnavailable(
|
|
574 |
MVPbkContactStore& /*aContactStore*/,
|
|
575 |
TInt /*aReason*/ )
|
|
576 |
{
|
|
577 |
// not interested
|
|
578 |
}
|
|
579 |
|
|
580 |
// --------------------------------------------------------------------------
|
|
581 |
// CPbk2AttributeAddressSelectPhase::StoreUnavailable
|
|
582 |
// --------------------------------------------------------------------------
|
|
583 |
//
|
|
584 |
void CPbk2CommAddressSelectPhase::HandleStoreEventL(
|
|
585 |
MVPbkContactStore& /*aContactStore*/,
|
|
586 |
TVPbkContactStoreEvent aEvent )
|
|
587 |
{
|
|
588 |
if ( aEvent.iContactLink != NULL && iStoreContact != NULL )
|
|
589 |
{
|
|
590 |
if ( aEvent.iContactLink->RefersTo( *iStoreContact ) )
|
|
591 |
{
|
|
592 |
CancelServicePhase();
|
|
593 |
}
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
// --------------------------------------------------------------------------
|
|
598 |
// CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL
|
|
599 |
// --------------------------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL(
|
|
602 |
const TDesC8& /*aPackedLink*/,
|
|
603 |
RPointerArray<MContactPresenceInfo>& aInfoArray, TInt /*aOpId*/)
|
|
604 |
{
|
|
605 |
// service specific icons received
|
|
606 |
TInt count = aInfoArray.Count();
|
|
607 |
|
|
608 |
// calculate and set preferred icon size
|
|
609 |
TRect mainPane;
|
|
610 |
AknLayoutUtils::LayoutMetricsRect(
|
|
611 |
AknLayoutUtils::EMainPane, mainPane );
|
|
612 |
TAknLayoutRect listLayoutRect;
|
|
613 |
listLayoutRect.LayoutRect(
|
|
614 |
mainPane,
|
|
615 |
AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() );
|
|
616 |
TSize size(listLayoutRect.Rect().Size());
|
|
617 |
iContactPresence->SetPresenceIconSize( size );
|
|
618 |
|
|
619 |
for ( TInt i = 0; i < count; i++ )
|
|
620 |
{
|
|
621 |
if ( aInfoArray[i]->BrandId().Length() > 0 &&
|
|
622 |
aInfoArray[i]->ElementId().Length() > 0 &&
|
|
623 |
aInfoArray[i]->ServiceName().Length() > 0 )
|
|
624 |
{
|
|
625 |
TInt serviceSeparatorPos = aInfoArray[i]->ServiceName().
|
|
626 |
FindF( KServiceNameSeparator );
|
|
627 |
if ( serviceSeparatorPos > 0 )
|
|
628 |
{
|
|
629 |
TInt nameIdLength = aInfoArray[i]->ServiceName().Length() -
|
|
630 |
serviceSeparatorPos - 1;
|
|
631 |
// save icon info to our own array
|
|
632 |
CPbk2PresenceIconInfo* iconInfo = CPbk2PresenceIconInfo::NewL(
|
|
633 |
aInfoArray[i]->BrandId(),
|
|
634 |
aInfoArray[i]->ElementId(),
|
|
635 |
aInfoArray[i]->ServiceName().Right( nameIdLength ) );
|
|
636 |
|
|
637 |
CleanupStack::PushL( iconInfo );
|
|
638 |
iPresenceIconArray.AppendL( iconInfo ); // ownership is taken
|
|
639 |
CleanupStack::Pop( iconInfo );
|
|
640 |
|
|
641 |
// start retrieving icon file
|
|
642 |
TInt opId = iContactPresence->GetPresenceIconFileL(
|
|
643 |
aInfoArray[i]->BrandId(), aInfoArray[i]->ElementId() );
|
|
644 |
}
|
|
645 |
}
|
|
646 |
}
|
|
647 |
|
|
648 |
if ( iPresenceIconArray.Count() == 0 )
|
|
649 |
{
|
|
650 |
DoSelectAddresses();
|
|
651 |
}
|
|
652 |
}
|
|
653 |
|
|
654 |
// --------------------------------------------------------------------------
|
|
655 |
// CPbk2CommAddressSelectPhase::RetrieveContact
|
|
656 |
// --------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
void CPbk2CommAddressSelectPhase::RetrieveContact()
|
|
659 |
{
|
|
660 |
TRAPD( res, RetrieveContactL() );
|
|
661 |
if ( res != KErrNone )
|
|
662 |
{
|
|
663 |
DoSelectAddresses();
|
|
664 |
}
|
|
665 |
}
|
|
666 |
|
|
667 |
// --------------------------------------------------------------------------
|
|
668 |
// CPbk2CommAddressSelectPhase::RetrieveContactL
|
|
669 |
// --------------------------------------------------------------------------
|
|
670 |
//
|
|
671 |
void CPbk2CommAddressSelectPhase::RetrieveContactL()
|
|
672 |
{
|
|
673 |
__ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved ||
|
|
674 |
iState == ExSPContactRetrieved,
|
|
675 |
Panic( EPanicPreCond_RetrieveContactL ) );
|
|
676 |
|
|
677 |
CPbk2ServerAppAppUi& appUi =
|
|
678 |
static_cast<CPbk2ServerAppAppUi&>
|
|
679 |
( *iEikenv->EikAppUi() );
|
|
680 |
|
|
681 |
// Fetch one contact at a time if service cancellation is not
|
|
682 |
// commanded.
|
|
683 |
delete iRetrieveOperation;
|
|
684 |
iRetrieveOperation = NULL;
|
|
685 |
|
|
686 |
if ( iState == EInitialState )
|
|
687 |
{
|
|
688 |
iRetrieveOperation = appUi.ApplicationServices().ContactManager().
|
|
689 |
RetrieveContactL( *iContactLink, *this );
|
|
690 |
}
|
|
691 |
else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved )
|
|
692 |
{
|
|
693 |
iRetrieveOperation = appUi.ApplicationServices().ContactManager().
|
|
694 |
RetrieveContactL( ixSPContactsArray->At( 0 ), *this );
|
|
695 |
ixSPContactsArray->Delete( 0 );
|
|
696 |
}
|
|
697 |
}
|
|
698 |
|
|
699 |
// --------------------------------------------------------------------------
|
|
700 |
// CPbk2CommAddressSelectPhase::DoSelectAddresses
|
|
701 |
// --------------------------------------------------------------------------
|
|
702 |
//
|
|
703 |
void CPbk2CommAddressSelectPhase::DoSelectAddresses()
|
|
704 |
{
|
|
705 |
TRAPD( res, DoSelectAddressesL() );
|
|
706 |
if ( res != KErrNone )
|
|
707 |
{
|
|
708 |
iState = EAddressSelectError;
|
|
709 |
iObserver.PhaseError( *this, res );
|
|
710 |
}
|
|
711 |
}
|
|
712 |
|
|
713 |
// --------------------------------------------------------------------------
|
|
714 |
// CPbk2CommAddressSelectPhase::DoSelectAddressesL
|
|
715 |
// --------------------------------------------------------------------------
|
|
716 |
//
|
|
717 |
void CPbk2CommAddressSelectPhase::DoSelectAddressesL()
|
|
718 |
{
|
|
719 |
__ASSERT_DEBUG(iStoreContact, Panic(EPanicPreCond_DoSelectAddressesL));
|
|
720 |
|
|
721 |
FilterXspContactsL();
|
|
722 |
|
|
723 |
TResourceReader reader;
|
|
724 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId );
|
|
725 |
|
|
726 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
727 |
( *iEikenv->EikAppUi() );
|
|
728 |
|
|
729 |
TPbk2AddressSelectParams params
|
|
730 |
( *iStoreContact, appUi.ApplicationServices().ContactManager(),
|
|
731 |
appUi.ApplicationServices().NameFormatter(),
|
|
732 |
appUi.ApplicationServices().FieldProperties(),
|
|
733 |
reader, iTitleResId );
|
|
734 |
|
|
735 |
params.iCommMethod = iCommMethod;
|
|
736 |
|
|
737 |
// If default priorities are set use defaults directly.
|
|
738 |
params.SetDefaultPriorities( iPriorities );
|
|
739 |
|
|
740 |
// Launch call directly using default values.
|
|
741 |
params.SetUseDefaultDirectly( ETrue );
|
|
742 |
|
|
743 |
TArray<MVPbkStoreContact*> storeContactsArray =
|
|
744 |
ixSPStoreContactsArray.Array();
|
|
745 |
TArray<CPbk2PresenceIconInfo*> presenceIconsArray =
|
|
746 |
iPresenceIconArray.Array();
|
|
747 |
CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL(
|
|
748 |
params, iFieldTypeSelector, &storeContactsArray,
|
|
749 |
&presenceIconsArray );
|
|
750 |
|
|
751 |
// Correct CBA buttons
|
|
752 |
TInt correctedCba = CorrectRSK( iResourceId );
|
|
753 |
if ( correctedCba > KErrNone )
|
|
754 |
{
|
|
755 |
addressSelect->SetCba( correctedCba );
|
|
756 |
}
|
|
757 |
|
|
758 |
// Execute
|
|
759 |
iAddressSelectEliminator = addressSelect;
|
|
760 |
iAddressSelectEliminator->ResetWhenDestroyed
|
|
761 |
( &iAddressSelectEliminator );
|
|
762 |
|
|
763 |
appUi.StoreManager().RegisterStoreEventsL( *this );
|
|
764 |
MVPbkStoreContactField* resultField = addressSelect->ExecuteLD();
|
|
765 |
iState = EAddressSelectDone;
|
|
766 |
appUi.StoreManager().DeregisterStoreEvents( *this );
|
|
767 |
|
|
768 |
CleanupStack::PopAndDestroy(); // reader
|
|
769 |
|
|
770 |
if ( resultField )
|
|
771 |
{
|
|
772 |
CleanupDeletePushL(resultField);
|
|
773 |
|
|
774 |
// Save field content
|
|
775 |
MVPbkContactFieldData& fieldData = resultField->FieldData();
|
|
776 |
TVPbkFieldStorageType type = fieldData.DataType();
|
|
777 |
if ( type == EVPbkFieldStorageTypeText )
|
|
778 |
{
|
|
779 |
MVPbkContactFieldTextData& textData =
|
|
780 |
MVPbkContactFieldTextData::Cast( fieldData );
|
|
781 |
TPtrC ptr = textData.Text();
|
|
782 |
delete iFieldContent;
|
|
783 |
iFieldContent = NULL;
|
|
784 |
iFieldContent = HBufC::NewL( ptr.Length() );
|
|
785 |
iFieldContent->Des().Copy( ptr );
|
|
786 |
}
|
|
787 |
else if ( type == EVPbkFieldStorageTypeUri )
|
|
788 |
{
|
|
789 |
MVPbkContactFieldUriData& textData =
|
|
790 |
MVPbkContactFieldUriData::Cast( fieldData );
|
|
791 |
TPtrC ptr = textData.Uri();
|
|
792 |
delete iFieldContent;
|
|
793 |
iFieldContent = NULL;
|
|
794 |
iFieldContent = HBufC::NewL( ptr.Length() );
|
|
795 |
iFieldContent->Des().Copy( ptr );
|
|
796 |
}
|
|
797 |
|
|
798 |
// Append field to the result array
|
|
799 |
AppendResultL( resultField );
|
|
800 |
CleanupStack::PopAndDestroy(); // resultField
|
|
801 |
iObserver.NextPhase( *this );
|
|
802 |
}
|
|
803 |
else
|
|
804 |
{
|
|
805 |
// Normal cancellation and there is no results
|
|
806 |
// to be sent to caller
|
|
807 |
iObserver.PhaseCanceled( *this );
|
|
808 |
}
|
|
809 |
}
|
|
810 |
|
|
811 |
// --------------------------------------------------------------------------
|
|
812 |
// CPbk2CommAddressSelectPhase::CorrectRSK
|
|
813 |
// --------------------------------------------------------------------------
|
|
814 |
//
|
|
815 |
inline TInt CPbk2CommAddressSelectPhase::CorrectRSK
|
|
816 |
( TInt aAddressSelectResourceId )
|
|
817 |
{
|
|
818 |
TInt result = KErrNone;
|
|
819 |
|
|
820 |
if ( iRskBack )
|
|
821 |
{
|
|
822 |
switch ( aAddressSelectResourceId )
|
|
823 |
{
|
|
824 |
case R_PBK2_GENERIC_ADDRESS_SELECT:
|
|
825 |
case R_PBK2_PHONE_NUMBER_SELECT:
|
|
826 |
case R_PBK2_VIDEO_NUMBER_SELECT:
|
|
827 |
case R_PBK2_EMAIL_ADDRESS_SELECT:
|
|
828 |
case R_PBK2_EMAIL_OVER_SMS_ADDRESS_SELECT:
|
|
829 |
case R_PBK2_MMS_ADDRESS_SELECT:
|
|
830 |
case R_PBK2_POC_ADDRESS_SELECT:
|
|
831 |
case R_PBK2_VOIP_ADDRESS_SELECT:
|
|
832 |
case R_PBK2_DTMF_PHONE_NUMBER_SELECT:
|
|
833 |
case R_PBK2_THUMBNAIL_SELECT:
|
|
834 |
case R_PBK2_CALL_ITEM_NUMBER_SELECT:
|
|
835 |
{
|
|
836 |
result = R_AVKON_SOFTKEYS_SELECT_BACK__SELECT;
|
|
837 |
break;
|
|
838 |
}
|
|
839 |
|
|
840 |
default:
|
|
841 |
{
|
|
842 |
// Do nothing
|
|
843 |
break;
|
|
844 |
}
|
|
845 |
}
|
|
846 |
}
|
|
847 |
|
|
848 |
return result;
|
|
849 |
}
|
|
850 |
|
|
851 |
// --------------------------------------------------------------------------
|
|
852 |
// CPbk2CommAddressSelectPhase::AppendResultL
|
|
853 |
// --------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
void CPbk2CommAddressSelectPhase::AppendResultL
|
|
856 |
( const MVPbkStoreContactField* aField )
|
|
857 |
{
|
|
858 |
if ( aField )
|
|
859 |
{
|
|
860 |
// Add the contact link to the result array
|
|
861 |
MVPbkContactLink* link = aField->CreateLinkLC();
|
|
862 |
if ( link )
|
|
863 |
{
|
|
864 |
if ( !iResults )
|
|
865 |
{
|
|
866 |
iResults = CVPbkContactLinkArray::NewL();
|
|
867 |
}
|
|
868 |
|
|
869 |
CleanupStack::Pop(); // aField->CreateLinkLC()
|
|
870 |
|
|
871 |
iResults->AppendL( link );
|
|
872 |
}
|
|
873 |
}
|
|
874 |
}
|
|
875 |
|
|
876 |
// --------------------------------------------------------------------------
|
|
877 |
// CPbk2CommAddressSelectPhase::GetImppFieldDataL
|
|
878 |
// --------------------------------------------------------------------------
|
|
879 |
//
|
|
880 |
void CPbk2CommAddressSelectPhase::GetImppFieldDataL( CDesC16ArrayFlat& aXspIdArray, MVPbkStoreContact& aContact )
|
|
881 |
{
|
|
882 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
883 |
( *iEikenv->EikAppUi() );
|
|
884 |
|
|
885 |
const MVPbkFieldType* type = appUi.ApplicationServices().ContactManager().
|
|
886 |
FieldTypes().Find( R_VPBK_FIELD_TYPE_IMPP );
|
|
887 |
|
|
888 |
CVPbkBaseContactFieldTypeIterator* itr =
|
|
889 |
CVPbkBaseContactFieldTypeIterator::NewLC( *type,
|
|
890 |
aContact.Fields() );
|
|
891 |
|
|
892 |
while ( itr->HasNext() )
|
|
893 |
{
|
|
894 |
const MVPbkBaseContactField* field = itr->Next();
|
|
895 |
const MVPbkContactFieldUriData& uri =
|
|
896 |
MVPbkContactFieldUriData::Cast(field->FieldData() );
|
|
897 |
HBufC* data = uri.Uri().AllocL();
|
|
898 |
CleanupStack::PushL(data);
|
|
899 |
aXspIdArray.AppendL( data->Des() );
|
|
900 |
CleanupStack::PopAndDestroy(data); //data
|
|
901 |
}
|
|
902 |
CleanupStack::PopAndDestroy(itr); //itr
|
|
903 |
}
|
|
904 |
|
|
905 |
// --------------------------------------------------------------------------
|
|
906 |
// CPbk2CommAddressSelectPhase::FilterXspContactsL
|
|
907 |
// --------------------------------------------------------------------------
|
|
908 |
//
|
|
909 |
void CPbk2CommAddressSelectPhase::FilterXspContactsL()
|
|
910 |
{
|
|
911 |
TInt xspContactCount = ixSPStoreContactsArray.Count();
|
|
912 |
|
|
913 |
if ( xspContactCount > 0 )
|
|
914 |
{
|
|
915 |
for ( TInt i = xspContactCount - 1; i >= 0; --i )
|
|
916 |
{
|
|
917 |
MVPbkStoreContact* contact = ixSPStoreContactsArray[i];
|
|
918 |
if ( !IsMatchL( *contact, *iStoreContact ) )
|
|
919 |
{
|
|
920 |
ixSPStoreContactsArray.Remove(i);
|
|
921 |
delete contact;
|
|
922 |
}
|
|
923 |
}
|
|
924 |
}
|
|
925 |
}
|
|
926 |
|
|
927 |
// --------------------------------------------------------------------------
|
|
928 |
// CPbk2CommAddressSelectPhase::IsMatchL
|
|
929 |
// --------------------------------------------------------------------------
|
|
930 |
//
|
|
931 |
TBool CPbk2CommAddressSelectPhase::IsMatchL( MVPbkStoreContact& aXspContact,
|
|
932 |
MVPbkStoreContact& aStoreContact )
|
|
933 |
{
|
|
934 |
TBool result = EFalse;
|
|
935 |
|
|
936 |
CDesCArrayFlat* storeContactXspIdArray = new ( ELeave ) CDesCArrayFlat( KMaxXspServiceCount );
|
|
937 |
CleanupStack::PushL( storeContactXspIdArray );
|
|
938 |
GetImppFieldDataL( *storeContactXspIdArray, aStoreContact );
|
|
939 |
|
|
940 |
CDesCArrayFlat* xspContcatXspIdArray = new ( ELeave ) CDesCArrayFlat( KMaxXspServiceCount );
|
|
941 |
CleanupStack::PushL( xspContcatXspIdArray );
|
|
942 |
GetImppFieldDataL( *xspContcatXspIdArray, aXspContact );
|
|
943 |
|
|
944 |
for ( TInt i = 0; i < storeContactXspIdArray->MdcaCount(); i++ )
|
|
945 |
{
|
|
946 |
TPtrC data = storeContactXspIdArray->MdcaPoint( i );
|
|
947 |
for ( TInt j = 0; j < xspContcatXspIdArray->MdcaCount(); j++ )
|
|
948 |
{
|
|
949 |
TPtrC data1 = xspContcatXspIdArray->MdcaPoint( j );
|
|
950 |
if ( data1.CompareF( data ) == 0 )
|
|
951 |
{
|
|
952 |
result = ETrue;
|
|
953 |
break;
|
|
954 |
}
|
|
955 |
}
|
|
956 |
}
|
|
957 |
CleanupStack::PopAndDestroy(); // xspContcatXspIdArray
|
|
958 |
CleanupStack::PopAndDestroy(); // storeContactXspIdArray
|
|
959 |
|
|
960 |
return result;
|
|
961 |
}
|
|
962 |
|
|
963 |
// --------------------------------------------------------------------------
|
|
964 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks
|
|
965 |
// --------------------------------------------------------------------------
|
|
966 |
//
|
|
967 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks()
|
|
968 |
{
|
|
969 |
TRAPD( res, StartLoadingxSPContactLinksL() );
|
|
970 |
if (res != KErrNone)
|
|
971 |
{
|
|
972 |
DoSelectAddresses();
|
|
973 |
}
|
|
974 |
}
|
|
975 |
|
|
976 |
// --------------------------------------------------------------------------
|
|
977 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL
|
|
978 |
// --------------------------------------------------------------------------
|
|
979 |
//
|
|
980 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL()
|
|
981 |
{
|
|
982 |
delete ixSPContactOperation;
|
|
983 |
ixSPContactOperation = NULL;
|
|
984 |
ixSPContactOperation = ixSPManager->GetxSPContactLinksL(
|
|
985 |
*iStoreContact, *this, *this);
|
|
986 |
}
|
|
987 |
|
|
988 |
// --------------------------------------------------------------------------
|
|
989 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContacts
|
|
990 |
// --------------------------------------------------------------------------
|
|
991 |
//
|
|
992 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContacts(
|
|
993 |
MVPbkContactLinkArray& aArray )
|
|
994 |
{
|
|
995 |
TRAPD( res, StartLoadingxSPContactsL( aArray ) );
|
|
996 |
if ( res != KErrNone )
|
|
997 |
{
|
|
998 |
DoSelectAddresses();
|
|
999 |
}
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
// --------------------------------------------------------------------------
|
|
1003 |
// CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL
|
|
1004 |
// --------------------------------------------------------------------------
|
|
1005 |
//
|
|
1006 |
void CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL(
|
|
1007 |
MVPbkContactLinkArray& aArray )
|
|
1008 |
{
|
|
1009 |
// Take a own copy of supplied contact links
|
|
1010 |
if (!ixSPContactsArray)
|
|
1011 |
{
|
|
1012 |
ixSPContactsArray = CVPbkContactLinkArray::NewL();
|
|
1013 |
}
|
|
1014 |
ixSPStoreContactsArray.ResetAndDestroy();
|
|
1015 |
|
|
1016 |
CopyContactLinksL( aArray, *ixSPContactsArray );
|
|
1017 |
RetrieveContactL();
|
|
1018 |
}
|
|
1019 |
|
|
1020 |
|
|
1021 |
// --------------------------------------------------------------------------
|
|
1022 |
// CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo
|
|
1023 |
// --------------------------------------------------------------------------
|
|
1024 |
//
|
|
1025 |
void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo()
|
|
1026 |
{
|
|
1027 |
TRAPD( res, StartLoadingPresenceIconInfoL());
|
|
1028 |
if ( res != KErrNone )
|
|
1029 |
{
|
|
1030 |
// In error case continue like there are no presence icons.
|
|
1031 |
DoSelectAddresses();
|
|
1032 |
}
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
// --------------------------------------------------------------------------
|
|
1036 |
// CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL
|
|
1037 |
// --------------------------------------------------------------------------
|
|
1038 |
//
|
|
1039 |
void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL()
|
|
1040 |
{
|
|
1041 |
const TInt oneAddress = 1;
|
|
1042 |
if ( ( iCommMethod ==
|
|
1043 |
VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ||
|
|
1044 |
iCommMethod ==
|
|
1045 |
VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) &&
|
|
1046 |
NumOfAddressesL() > oneAddress )
|
|
1047 |
{
|
|
1048 |
GetPresenceInfoL();
|
|
1049 |
}
|
|
1050 |
else
|
|
1051 |
{
|
|
1052 |
DoSelectAddresses();
|
|
1053 |
}
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
// --------------------------------------------------------------------------
|
|
1057 |
// CPbk2CommAddressSelectPhase::NumOfAddressesL
|
|
1058 |
// --------------------------------------------------------------------------
|
|
1059 |
//
|
|
1060 |
TInt CPbk2CommAddressSelectPhase::NumOfAddressesL(
|
|
1061 |
MVPbkStoreContact& aStoreContact )
|
|
1062 |
{
|
|
1063 |
CVPbkFieldFilter::TConfig config( aStoreContact.Fields(),
|
|
1064 |
&iFieldTypeSelector );
|
|
1065 |
CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
|
|
1066 |
TInt result = fieldFilter->FieldCount();
|
|
1067 |
delete fieldFilter;
|
|
1068 |
return result;
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
// --------------------------------------------------------------------------
|
|
1072 |
// CPbk2CommAddressSelectPhase::NumOfAddressesL
|
|
1073 |
// --------------------------------------------------------------------------
|
|
1074 |
//
|
|
1075 |
TInt CPbk2CommAddressSelectPhase::NumOfAddressesL()
|
|
1076 |
{
|
|
1077 |
TInt numOfAddresses = 0;
|
|
1078 |
if ( iStoreContact )
|
|
1079 |
{
|
|
1080 |
numOfAddresses += NumOfAddressesL( *iStoreContact );
|
|
1081 |
}
|
|
1082 |
|
|
1083 |
const TInt count = ixSPStoreContactsArray.Count();
|
|
1084 |
for ( TInt i = 0; i < count; ++i )
|
|
1085 |
{
|
|
1086 |
numOfAddresses += NumOfAddressesL( *ixSPStoreContactsArray[i] );
|
|
1087 |
}
|
|
1088 |
return numOfAddresses;
|
|
1089 |
}
|
|
1090 |
|
|
1091 |
// --------------------------------------------------------------------------
|
|
1092 |
// CPbk2CommAddressSelectPhase::GetPresenceInfoL
|
|
1093 |
// --------------------------------------------------------------------------
|
|
1094 |
//
|
|
1095 |
void CPbk2CommAddressSelectPhase::GetPresenceInfoL()
|
|
1096 |
{
|
|
1097 |
if ( !iContactPresence )
|
|
1098 |
{
|
|
1099 |
iContactPresence = TContactPresenceFactory::NewContactPresenceL(
|
|
1100 |
*this );
|
|
1101 |
}
|
|
1102 |
// ...and start presence icons retrieving
|
|
1103 |
HBufC8* packedLink = iContactLink->PackLC();
|
|
1104 |
// Operation id no needed because CancelAll is used.
|
|
1105 |
/*TInt opId =*/iContactPresence->GetPresenceInfoL( *packedLink );
|
|
1106 |
CleanupStack::PopAndDestroy( packedLink );
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
// End of File
|