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 prepare single assign phase. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include "CPbk2PrepareSingleAssignPhase.h" |
|
20 |
||
21 |
// Phonebook 2 |
|
22 |
#include "MPbk2ServicePhaseObserver.h" |
|
23 |
#include "CPbk2ServerAppAppUi.h" |
|
24 |
#include "Pbk2ContactAssignerFactory.h" |
|
25 |
#include "TPbk2AssignNoteService.h" |
|
26 |
#include "MPbk2SelectFieldProperty.h" |
|
27 |
#include "Pbk2ServerApp.hrh" |
|
28 |
#include "CPbk2KeyEventDealer.h" |
|
29 |
#include <TPbk2DestructionIndicator.h> |
|
30 |
#include <MPbk2ApplicationServices.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
31 |
#include <Pbk2ServerApp.rsg> |
63 | 32 |
|
33 |
// Virtual Phonebook |
|
34 |
#include <MVPbkContactLink.h> |
|
35 |
#include <CVPbkContactLinkArray.h> |
|
36 |
#include <MVPbkStoreContact.h> |
|
37 |
#include <MVPbkContactStore.h> |
|
38 |
#include <MVPbkContactStoreProperties.h> |
|
39 |
#include <VPbkContactStoreUris.h> |
|
40 |
||
41 |
||
42 |
using namespace Pbk2ContactRelocator; |
|
43 |
||
44 |
/// Unnamed namespace for local definitions |
|
45 |
namespace { |
|
46 |
||
47 |
#ifdef _DEBUG |
|
48 |
||
49 |
enum TPanicCode |
|
50 |
{ |
|
51 |
ENullPointer, |
|
52 |
ELogicRelocation |
|
53 |
}; |
|
54 |
||
55 |
void Panic(TPanicCode aReason) |
|
56 |
{ |
|
57 |
_LIT( KPanicText, "CPbk2PrepareSingleAssignPhase" ); |
|
58 |
User::Panic( KPanicText, aReason ); |
|
59 |
} |
|
60 |
||
61 |
#endif // _DEBUG |
|
62 |
||
63 |
} /// namespace |
|
64 |
||
65 |
// -------------------------------------------------------------------------- |
|
66 |
// CPbk2PrepareSingleAssignPhase::CPbk2PrepareSingleAssignPhase |
|
67 |
// -------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
CPbk2PrepareSingleAssignPhase::CPbk2PrepareSingleAssignPhase |
|
70 |
( MPbk2ServicePhaseObserver& aObserver, |
|
71 |
MVPbkStoreContact* aStoreContact, |
|
72 |
MPbk2SelectFieldProperty* aSelectFieldProperty, |
|
73 |
TInt aSelectFieldResult, TInt& aFieldIndex, TUint& aNoteFlags, |
|
74 |
TUint aRelocationFlags ) : |
|
75 |
CActive( EPriorityIdle ), |
|
76 |
iObserver( aObserver ), |
|
77 |
iStoreContact( aStoreContact ), |
|
78 |
iSelectFieldResult( aSelectFieldResult ), |
|
79 |
iSelectFieldProperty( aSelectFieldProperty ), |
|
80 |
iFieldIndex( aFieldIndex ), |
|
81 |
iNoteFlags( aNoteFlags ), |
|
82 |
iRelocationFlags( aRelocationFlags ) |
|
83 |
{ |
|
84 |
CActiveScheduler::Add( this ); |
|
85 |
} |
|
86 |
||
87 |
// -------------------------------------------------------------------------- |
|
88 |
// CPbk2PrepareSingleAssignPhase::~CPbk2PrepareSingleAssignPhase |
|
89 |
// -------------------------------------------------------------------------- |
|
90 |
// |
|
91 |
CPbk2PrepareSingleAssignPhase::~CPbk2PrepareSingleAssignPhase() |
|
92 |
{ |
|
93 |
Cancel(); |
|
94 |
delete iContactRelocator; |
|
95 |
delete iStoreContact; |
|
96 |
delete iResults; |
|
97 |
delete iDealer; |
|
98 |
||
99 |
if ( iDestroyedPtr ) |
|
100 |
{ |
|
101 |
*iDestroyedPtr = ETrue; |
|
102 |
} |
|
103 |
} |
|
104 |
||
105 |
// -------------------------------------------------------------------------- |
|
106 |
// CPbk2PrepareSingleAssignPhase::ConstructL |
|
107 |
// -------------------------------------------------------------------------- |
|
108 |
// |
|
109 |
inline void CPbk2PrepareSingleAssignPhase::ConstructL() |
|
110 |
{ |
|
111 |
iEikEnv = CEikonEnv::Static(); |
|
112 |
||
113 |
iDealer = CPbk2KeyEventDealer::NewL( *this ); |
|
114 |
} |
|
115 |
||
116 |
// -------------------------------------------------------------------------- |
|
117 |
// CPbk2PrepareSingleAssignPhase::NewL |
|
118 |
// -------------------------------------------------------------------------- |
|
119 |
// |
|
120 |
CPbk2PrepareSingleAssignPhase* CPbk2PrepareSingleAssignPhase::NewL |
|
121 |
( MPbk2ServicePhaseObserver& aObserver, |
|
122 |
MVPbkStoreContact* aStoreContact, |
|
123 |
MPbk2SelectFieldProperty* aSelectFieldProperty, |
|
124 |
TInt aSelectFieldResult, TInt& aFieldIndex, TUint& aNoteFlags, |
|
125 |
TUint aRelocationFlags ) |
|
126 |
{ |
|
127 |
CPbk2PrepareSingleAssignPhase* self = |
|
128 |
new ( ELeave ) CPbk2PrepareSingleAssignPhase |
|
129 |
( aObserver, aStoreContact, aSelectFieldProperty, |
|
130 |
aSelectFieldResult, aFieldIndex, aNoteFlags, |
|
131 |
aRelocationFlags ); |
|
132 |
CleanupStack::PushL( self ); |
|
133 |
self->ConstructL(); |
|
134 |
CleanupStack::Pop( self ); |
|
135 |
return self; |
|
136 |
} |
|
137 |
||
138 |
// -------------------------------------------------------------------------- |
|
139 |
// CPbk2PrepareSingleAssignPhase::LaunchServicePhaseL |
|
140 |
// -------------------------------------------------------------------------- |
|
141 |
// |
|
142 |
void CPbk2PrepareSingleAssignPhase::LaunchServicePhaseL() |
|
143 |
{ |
|
144 |
IssueRequest(); |
|
145 |
} |
|
146 |
||
147 |
// -------------------------------------------------------------------------- |
|
148 |
// CPbk2PrepareSingleAssignPhase::CancelServicePhase |
|
149 |
// -------------------------------------------------------------------------- |
|
150 |
// |
|
151 |
void CPbk2PrepareSingleAssignPhase::CancelServicePhase() |
|
152 |
{ |
|
153 |
delete iContactRelocator; |
|
154 |
iContactRelocator = NULL; |
|
155 |
||
156 |
iObserver.PhaseCanceled( *this ); |
|
157 |
} |
|
158 |
||
159 |
// -------------------------------------------------------------------------- |
|
160 |
// CPbk2PrepareSingleAssignPhase::RequestCancelL |
|
161 |
// -------------------------------------------------------------------------- |
|
162 |
// |
|
163 |
void CPbk2PrepareSingleAssignPhase::RequestCancelL( TInt aExitCommandId ) |
|
164 |
{ |
|
165 |
delete iContactRelocator; |
|
166 |
iContactRelocator = NULL; |
|
167 |
||
168 |
// Withdraw our key event agent so that it does not react to |
|
169 |
// app shutter's escape key event simulation |
|
170 |
delete iDealer; |
|
171 |
iDealer = NULL; |
|
172 |
||
173 |
if ( aExitCommandId == EEikBidCancel ) |
|
174 |
{ |
|
175 |
iObserver.PhaseAborted( *this ); |
|
176 |
} |
|
177 |
else |
|
178 |
{ |
|
179 |
iObserver.PhaseCanceled( *this ); |
|
180 |
} |
|
181 |
} |
|
182 |
||
183 |
// -------------------------------------------------------------------------- |
|
184 |
// CPbk2PrepareSingleAssignPhase::AcceptDelayed |
|
185 |
// -------------------------------------------------------------------------- |
|
186 |
// |
|
187 |
void CPbk2PrepareSingleAssignPhase::AcceptDelayedL |
|
188 |
( const TDesC8& /*aContactLinkBuffer*/ ) |
|
189 |
{ |
|
190 |
// Nothing to do |
|
191 |
} |
|
192 |
||
193 |
// -------------------------------------------------------------------------- |
|
194 |
// CPbk2PrepareSingleAssignPhase::Results |
|
195 |
// -------------------------------------------------------------------------- |
|
196 |
// |
|
197 |
MVPbkContactLinkArray* CPbk2PrepareSingleAssignPhase::Results() const |
|
198 |
{ |
|
199 |
return iResults; |
|
200 |
} |
|
201 |
||
202 |
// -------------------------------------------------------------------------- |
|
203 |
// CPbk2PrepareSingleAssignPhase::ExtraResultData |
|
204 |
// -------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
TInt CPbk2PrepareSingleAssignPhase::ExtraResultData() const |
|
207 |
{ |
|
208 |
return KErrNotSupported; |
|
209 |
} |
|
210 |
||
211 |
// -------------------------------------------------------------------------- |
|
212 |
// CPbk2PrepareSingleAssignPhase::TakeStoreContact |
|
213 |
// -------------------------------------------------------------------------- |
|
214 |
// |
|
215 |
MVPbkStoreContact* CPbk2PrepareSingleAssignPhase::TakeStoreContact() |
|
216 |
{ |
|
217 |
MVPbkStoreContact* contact = iStoreContact; |
|
218 |
iStoreContact = NULL; |
|
219 |
return contact; |
|
220 |
} |
|
221 |
||
222 |
// -------------------------------------------------------------------------- |
|
223 |
// CPbk2PrepareSingleAssignPhase::FieldContent |
|
224 |
// -------------------------------------------------------------------------- |
|
225 |
// |
|
226 |
HBufC* CPbk2PrepareSingleAssignPhase::FieldContent() const |
|
227 |
{ |
|
228 |
return NULL; |
|
229 |
} |
|
230 |
||
231 |
// -------------------------------------------------------------------------- |
|
232 |
// CPbk2PrepareSingleAssignPhase::RunL |
|
233 |
// -------------------------------------------------------------------------- |
|
234 |
// |
|
235 |
void CPbk2PrepareSingleAssignPhase::RunL() |
|
236 |
{ |
|
237 |
PrepareForAssignL(); |
|
238 |
} |
|
239 |
||
240 |
// -------------------------------------------------------------------------- |
|
241 |
// CPbk2PrepareSingleAssignPhase::RunError |
|
242 |
// -------------------------------------------------------------------------- |
|
243 |
// |
|
244 |
TInt CPbk2PrepareSingleAssignPhase::RunError( TInt aError ) |
|
245 |
{ |
|
246 |
if ( aError != KErrDied ) |
|
247 |
{ |
|
248 |
// If this is destroyed it is not safe to use iObserver anymore |
|
249 |
iObserver.PhaseError( *this, aError ); |
|
250 |
} |
|
251 |
return KErrNone; |
|
252 |
} |
|
253 |
||
254 |
// -------------------------------------------------------------------------- |
|
255 |
// CPbk2SelectCreateNewPropertyPhase::DoCancel |
|
256 |
// -------------------------------------------------------------------------- |
|
257 |
// |
|
258 |
void CPbk2PrepareSingleAssignPhase::DoCancel() |
|
259 |
{ |
|
260 |
// Nothing to do |
|
261 |
} |
|
262 |
||
263 |
// -------------------------------------------------------------------------- |
|
264 |
// CPbk2PrepareSingleAssignPhase::ContactRelocatedL |
|
265 |
// -------------------------------------------------------------------------- |
|
266 |
// |
|
267 |
void CPbk2PrepareSingleAssignPhase::ContactRelocatedL |
|
268 |
( MVPbkStoreContact* aRelocatedContact ) |
|
269 |
{ |
|
270 |
delete iStoreContact; |
|
271 |
iStoreContact = aRelocatedContact; |
|
272 |
||
273 |
AppendResultL( iStoreContact ); |
|
274 |
} |
|
275 |
||
276 |
// -------------------------------------------------------------------------- |
|
277 |
// CPbk2PrepareSingleAssignPhase::ContactRelocationFailed |
|
278 |
// -------------------------------------------------------------------------- |
|
279 |
// |
|
280 |
void CPbk2PrepareSingleAssignPhase::ContactRelocationFailed |
|
281 |
( TInt aReason, MVPbkStoreContact* aContact ) |
|
282 |
{ |
|
283 |
delete aContact; |
|
284 |
||
285 |
if ( aReason != KErrCancel ) |
|
286 |
{ |
|
287 |
iObserver.PhaseError( *this, aReason ); |
|
288 |
} |
|
289 |
} |
|
290 |
||
291 |
// -------------------------------------------------------------------------- |
|
292 |
// CPbk2PrepareSingleAssignPhase::ContactsRelocationFailed |
|
293 |
// -------------------------------------------------------------------------- |
|
294 |
// |
|
295 |
void CPbk2PrepareSingleAssignPhase::ContactsRelocationFailed |
|
296 |
( TInt /*aReason*/, CVPbkContactLinkArray* /*aContacts*/ ) |
|
297 |
{ |
|
298 |
// The code should never enter here |
|
299 |
__ASSERT_DEBUG( EFalse, Panic( ELogicRelocation ) ); |
|
300 |
} |
|
301 |
||
302 |
// -------------------------------------------------------------------------- |
|
303 |
// CPbk2PrepareSingleAssignPhase::RelocationProcessComplete |
|
304 |
// -------------------------------------------------------------------------- |
|
305 |
// |
|
306 |
void CPbk2PrepareSingleAssignPhase::RelocationProcessComplete() |
|
307 |
{ |
|
308 |
// Next phase is select single property |
|
309 |
iObserver.PreviousPhase( *this ); |
|
310 |
} |
|
311 |
||
312 |
// -------------------------------------------------------------------------- |
|
313 |
// CPbk2PrepareSingleAssignPhase::Pbk2ProcessKeyEventL |
|
314 |
// -------------------------------------------------------------------------- |
|
315 |
// |
|
316 |
TBool CPbk2PrepareSingleAssignPhase::Pbk2ProcessKeyEventL |
|
317 |
( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
318 |
{ |
|
319 |
TBool ret = EFalse; |
|
320 |
||
321 |
if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) |
|
322 |
{ |
|
323 |
iObserver.PhaseOkToExit( *this, EEikBidCancel ); |
|
324 |
ret = ETrue; |
|
325 |
} |
|
326 |
||
327 |
return ret; |
|
328 |
} |
|
329 |
||
330 |
// -------------------------------------------------------------------------- |
|
331 |
// CPbk2PrepareSingleAssignPhase::RelocateContactL |
|
332 |
// -------------------------------------------------------------------------- |
|
333 |
// |
|
334 |
TBool CPbk2PrepareSingleAssignPhase::RelocateContactL |
|
335 |
( Pbk2ContactRelocator::TPbk2ContactRelocationQueryPolicy aPolicy, |
|
336 |
TBool& aThisDestroyed ) |
|
337 |
{ |
|
338 |
delete iContactRelocator; |
|
339 |
iContactRelocator = NULL; |
|
340 |
iContactRelocator = CPbk2ContactRelocator::NewL(); |
|
341 |
||
342 |
MVPbkStoreContact* contact = iStoreContact; |
|
343 |
iStoreContact = NULL; |
|
344 |
||
345 |
// Asynchronously relocate the contact |
|
346 |
TBool relocate = iContactRelocator->RelocateContactL |
|
347 |
( contact, *this, aPolicy, iRelocationFlags ); |
|
348 |
||
349 |
if ( !aThisDestroyed ) |
|
350 |
{ |
|
351 |
if ( !relocate ) |
|
352 |
{ |
|
353 |
// Cancel |
|
354 |
TPbk2AssignNoteService noteService; |
|
355 |
noteService.ShowInformationNoteL |
|
356 |
( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ); |
|
357 |
} |
|
358 |
else |
|
359 |
{ |
|
360 |
// User accepted relocation |
|
361 |
if ( !iContactRelocator->IsPhoneMemoryInConfigurationL() ) |
|
362 |
{ |
|
363 |
// Note is shown only if phone memory is not in configuration |
|
364 |
iNoteFlags = KPbk2NoteFlagOneContactRelocated; |
|
365 |
} |
|
366 |
} |
|
367 |
} |
|
368 |
||
369 |
return relocate; |
|
370 |
} |
|
371 |
||
372 |
// -------------------------------------------------------------------------- |
|
373 |
// CPbk2PrepareSingleAssignPhase::QueryForDataReplaceL |
|
374 |
// -------------------------------------------------------------------------- |
|
375 |
// |
|
376 |
TInt CPbk2PrepareSingleAssignPhase::QueryForDataReplaceL() |
|
377 |
{ |
|
378 |
TInt ret = KErrNone; |
|
379 |
||
380 |
TBool thisDestroyed = EFalse; |
|
381 |
iDestroyedPtr = &thisDestroyed; |
|
382 |
TPbk2DestructionIndicator indicator |
|
383 |
( &thisDestroyed, iDestroyedPtr ); |
|
384 |
||
385 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
|
386 |
( *iEikEnv->EikAppUi() ); |
|
387 |
||
388 |
// Query for data replace |
|
389 |
TPbk2AssignNoteService noteService; |
|
390 |
TInt queryResult = noteService.ShowReplaceDetailQueryL |
|
391 |
( appUi.ApplicationServices().NameFormatter(), *iStoreContact ); |
|
392 |
||
393 |
||
394 |
if ( !thisDestroyed && !queryResult ) |
|
395 |
{ |
|
396 |
// User didn't agree to replace data |
|
397 |
if ( IsContactFromPhoneMemoryL( *iStoreContact ) ) |
|
398 |
{ |
|
399 |
TPbk2AssignNoteService noteService; |
|
400 |
noteService.ShowInformationNoteL |
|
401 |
( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ); |
|
402 |
||
403 |
ret = KErrCancel; |
|
404 |
} |
|
405 |
else |
|
406 |
{ |
|
407 |
TPbk2ContactRelocationQueryPolicy relocationPolicy = |
|
408 |
EPbk2DisplayBasicQuery; |
|
409 |
||
410 |
if ( RelocateContactL( relocationPolicy, thisDestroyed ) ) |
|
411 |
{ |
|
412 |
ret = KErrNotReady; |
|
413 |
} |
|
414 |
else |
|
415 |
{ |
|
416 |
ret = KErrCancel; |
|
417 |
} |
|
418 |
} |
|
419 |
} |
|
420 |
||
421 |
||
422 |
if ( thisDestroyed ) |
|
423 |
{ |
|
424 |
ret = KErrDied; |
|
425 |
} |
|
426 |
||
427 |
return ret; |
|
428 |
} |
|
429 |
||
430 |
// -------------------------------------------------------------------------- |
|
431 |
// CPbk2PrepareSingleAssignPhase::QueryForRelocationL |
|
432 |
// -------------------------------------------------------------------------- |
|
433 |
// |
|
434 |
TInt CPbk2PrepareSingleAssignPhase::QueryForRelocationL() |
|
435 |
{ |
|
436 |
TInt ret = KErrCancel; |
|
437 |
||
438 |
TBool thisDestroyed = EFalse; |
|
439 |
iDestroyedPtr = &thisDestroyed; |
|
440 |
TPbk2DestructionIndicator indicator |
|
441 |
( &thisDestroyed, iDestroyedPtr ); |
|
442 |
||
443 |
if ( iSelectFieldProperty->SelectedFieldType() ) |
|
444 |
{ |
|
445 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
|
446 |
( *iEikEnv->EikAppUi() ); |
|
447 |
||
448 |
TPbk2AssignNoteService noteService; |
|
449 |
noteService.ShowCanNotAddDetailNoteL |
|
450 |
( appUi.ApplicationServices().NameFormatter(), *iStoreContact ); |
|
451 |
} |
|
452 |
||
453 |
if ( IsContactFromPhoneMemoryL( *iStoreContact ) ) |
|
454 |
{ |
|
455 |
TPbk2AssignNoteService noteService; |
|
456 |
noteService.ShowInformationNoteL |
|
457 |
( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ); |
|
458 |
} |
|
459 |
else |
|
460 |
{ |
|
461 |
TPbk2ContactRelocationQueryPolicy relocationPolicy = |
|
462 |
EPbk2DisplayStoreDoesNotSupportQuery; |
|
463 |
||
464 |
if ( RelocateContactL( relocationPolicy, thisDestroyed ) ) |
|
465 |
{ |
|
466 |
ret = KErrNotReady; |
|
467 |
} |
|
468 |
} |
|
469 |
||
470 |
if ( thisDestroyed ) |
|
471 |
{ |
|
472 |
ret = KErrDied; |
|
473 |
} |
|
474 |
||
475 |
return ret; |
|
476 |
} |
|
477 |
||
478 |
// -------------------------------------------------------------------------- |
|
479 |
// CPbk2PrepareSingleAssignPhase::PrepareForAssignL |
|
480 |
// -------------------------------------------------------------------------- |
|
481 |
// |
|
482 |
void CPbk2PrepareSingleAssignPhase::PrepareForAssignL() |
|
483 |
{ |
|
484 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
|
485 |
( *iEikEnv->EikAppUi() ); |
|
486 |
||
487 |
switch( iSelectFieldResult ) |
|
488 |
{ |
|
489 |
case KErrNone: |
|
490 |
// leave iFieldIndex intact. |
|
491 |
{ |
|
492 |
iObserver.NextPhase( *this ); |
|
493 |
break; |
|
494 |
} |
|
495 |
case KErrNotFound: |
|
496 |
{ |
|
497 |
iFieldIndex = KErrNotFound; |
|
498 |
iObserver.NextPhase( *this ); |
|
499 |
break; |
|
500 |
} |
|
501 |
case KErrPathNotFound: |
|
502 |
{ |
|
503 |
TInt fieldIndex = iSelectFieldProperty->SelectedFieldIndex(); |
|
504 |
if ( fieldIndex > KErrNotFound ) |
|
505 |
{ |
|
506 |
iFieldIndex = fieldIndex; |
|
507 |
} |
|
508 |
iObserver.NextPhase( *this ); |
|
509 |
break; |
|
510 |
} |
|
511 |
case KErrAlreadyExists: |
|
512 |
{ |
|
513 |
TInt result = QueryForDataReplaceL(); |
|
514 |
if ( result == KErrNone ) |
|
515 |
{ |
|
516 |
iFieldIndex = iSelectFieldProperty->SelectedFieldIndex(); |
|
517 |
iObserver.NextPhase( *this ); |
|
518 |
} |
|
519 |
else if ( result == KErrCancel ) |
|
520 |
{ |
|
521 |
iObserver.PhaseCanceled( *this ); |
|
522 |
} |
|
523 |
else if ( result == KErrNotReady ) |
|
524 |
{ |
|
525 |
// Contact relocation took place, do not inform observer yet |
|
526 |
} |
|
527 |
else if ( result == KErrDied ) |
|
528 |
{ |
|
529 |
// This has been destroyed, do nothing |
|
530 |
} |
|
531 |
else |
|
532 |
{ |
|
533 |
iObserver.PhaseError( *this, result ); |
|
534 |
} |
|
535 |
break; |
|
536 |
} |
|
537 |
case KErrNotSupported: |
|
538 |
{ |
|
539 |
TInt result = QueryForRelocationL(); |
|
540 |
if ( result == KErrCancel ) |
|
541 |
{ |
|
542 |
iObserver.PhaseCanceled( *this ); |
|
543 |
} |
|
544 |
else if ( result == KErrNotReady ) |
|
545 |
{ |
|
546 |
// Contact relocation took place, do not inform observer yet |
|
547 |
} |
|
548 |
else if ( result == KErrDied ) |
|
549 |
{ |
|
550 |
// This has been destroyed, do nothing |
|
551 |
} |
|
552 |
else |
|
553 |
{ |
|
554 |
iObserver.PhaseError( *this, result ); |
|
555 |
} |
|
556 |
break; |
|
557 |
} |
|
558 |
case KErrAbort: |
|
559 |
{ |
|
560 |
iObserver.PhaseAborted( *this ); |
|
561 |
break; |
|
562 |
} |
|
563 |
case KErrCancel: // FALLTHROUGH |
|
564 |
default: |
|
565 |
{ |
|
566 |
iObserver.PhaseCanceled( *this ); |
|
567 |
} |
|
568 |
}; |
|
569 |
} |
|
570 |
||
571 |
// -------------------------------------------------------------------------- |
|
572 |
// CPbk2PrepareSingleAssignPhase::IsContactFromPhoneMemoryL |
|
573 |
// -------------------------------------------------------------------------- |
|
574 |
// |
|
575 |
TBool CPbk2PrepareSingleAssignPhase::IsContactFromPhoneMemoryL |
|
576 |
( const MVPbkStoreContact& aStoreContact ) |
|
577 |
{ |
|
578 |
TBool result = EFalse; |
|
579 |
||
580 |
TVPbkContactStoreUriPtr phoneMemoryUri |
|
581 |
( VPbkContactStoreUris::DefaultCntDbUri() ); |
|
582 |
||
583 |
TVPbkContactStoreUriPtr contactUri = |
|
584 |
aStoreContact.ParentStore().StoreProperties().Uri(); |
|
585 |
||
586 |
if ( contactUri.Compare( |
|
587 |
phoneMemoryUri, |
|
588 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) == 0 ) |
|
589 |
{ |
|
590 |
result = ETrue; |
|
591 |
} |
|
592 |
||
593 |
return result; |
|
594 |
} |
|
595 |
||
596 |
// -------------------------------------------------------------------------- |
|
597 |
// CPbk2PrepareSingleAssignPhase::AppendResultL |
|
598 |
// -------------------------------------------------------------------------- |
|
599 |
// |
|
600 |
void CPbk2PrepareSingleAssignPhase::AppendResultL |
|
601 |
( const MVPbkStoreContact* aStoreContact ) |
|
602 |
{ |
|
603 |
if ( aStoreContact ) |
|
604 |
{ |
|
605 |
// Add the contact link to the result array |
|
606 |
MVPbkContactLink* link = aStoreContact->CreateLinkLC(); |
|
607 |
if ( link ) |
|
608 |
{ |
|
609 |
if ( !iResults ) |
|
610 |
{ |
|
611 |
iResults = CVPbkContactLinkArray::NewL(); |
|
612 |
} |
|
613 |
||
614 |
CleanupStack::Pop(); // aStoreContact->CreateLinkLC() |
|
615 |
||
616 |
iResults->AppendL( link ); |
|
617 |
} |
|
618 |
} |
|
619 |
} |
|
620 |
||
621 |
// -------------------------------------------------------------------------- |
|
622 |
// CPbk2PrepareSingleAssignPhase::IssueRequest |
|
623 |
// -------------------------------------------------------------------------- |
|
624 |
// |
|
625 |
void CPbk2PrepareSingleAssignPhase::IssueRequest() |
|
626 |
{ |
|
627 |
TRequestStatus* status = &iStatus; |
|
628 |
User::RequestComplete( status, KErrNone ); |
|
629 |
SetActive(); |
|
630 |
} |
|
631 |
||
632 |
// End of File |