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>
|
|
31 |
#include <Pbk2ServerApp.rsg>
|
|
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::DenyDelayed
|
|
195 |
// --------------------------------------------------------------------------
|
|
196 |
//
|
|
197 |
void CPbk2PrepareSingleAssignPhase::DenyDelayedL
|
|
198 |
( const TDesC8& /*aContactLinkBuffer*/ )
|
|
199 |
{
|
|
200 |
// Nothing to do
|
|
201 |
}
|
|
202 |
|
|
203 |
// --------------------------------------------------------------------------
|
|
204 |
// CPbk2PrepareSingleAssignPhase::Results
|
|
205 |
// --------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
MVPbkContactLinkArray* CPbk2PrepareSingleAssignPhase::Results() const
|
|
208 |
{
|
|
209 |
return iResults;
|
|
210 |
}
|
|
211 |
|
|
212 |
// --------------------------------------------------------------------------
|
|
213 |
// CPbk2PrepareSingleAssignPhase::ExtraResultData
|
|
214 |
// --------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
TInt CPbk2PrepareSingleAssignPhase::ExtraResultData() const
|
|
217 |
{
|
|
218 |
return KErrNotSupported;
|
|
219 |
}
|
|
220 |
|
|
221 |
// --------------------------------------------------------------------------
|
|
222 |
// CPbk2PrepareSingleAssignPhase::TakeStoreContact
|
|
223 |
// --------------------------------------------------------------------------
|
|
224 |
//
|
|
225 |
MVPbkStoreContact* CPbk2PrepareSingleAssignPhase::TakeStoreContact()
|
|
226 |
{
|
|
227 |
MVPbkStoreContact* contact = iStoreContact;
|
|
228 |
iStoreContact = NULL;
|
|
229 |
return contact;
|
|
230 |
}
|
|
231 |
|
|
232 |
// --------------------------------------------------------------------------
|
|
233 |
// CPbk2PrepareSingleAssignPhase::FieldContent
|
|
234 |
// --------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
HBufC* CPbk2PrepareSingleAssignPhase::FieldContent() const
|
|
237 |
{
|
|
238 |
return NULL;
|
|
239 |
}
|
|
240 |
|
|
241 |
// --------------------------------------------------------------------------
|
|
242 |
// CPbk2PrepareSingleAssignPhase::RunL
|
|
243 |
// --------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
void CPbk2PrepareSingleAssignPhase::RunL()
|
|
246 |
{
|
|
247 |
PrepareForAssignL();
|
|
248 |
}
|
|
249 |
|
|
250 |
// --------------------------------------------------------------------------
|
|
251 |
// CPbk2PrepareSingleAssignPhase::RunError
|
|
252 |
// --------------------------------------------------------------------------
|
|
253 |
//
|
|
254 |
TInt CPbk2PrepareSingleAssignPhase::RunError( TInt aError )
|
|
255 |
{
|
|
256 |
if ( aError != KErrDied )
|
|
257 |
{
|
|
258 |
// If this is destroyed it is not safe to use iObserver anymore
|
|
259 |
iObserver.PhaseError( *this, aError );
|
|
260 |
}
|
|
261 |
return KErrNone;
|
|
262 |
}
|
|
263 |
|
|
264 |
// --------------------------------------------------------------------------
|
|
265 |
// CPbk2SelectCreateNewPropertyPhase::DoCancel
|
|
266 |
// --------------------------------------------------------------------------
|
|
267 |
//
|
|
268 |
void CPbk2PrepareSingleAssignPhase::DoCancel()
|
|
269 |
{
|
|
270 |
// Nothing to do
|
|
271 |
}
|
|
272 |
|
|
273 |
// --------------------------------------------------------------------------
|
|
274 |
// CPbk2PrepareSingleAssignPhase::ContactRelocatedL
|
|
275 |
// --------------------------------------------------------------------------
|
|
276 |
//
|
|
277 |
void CPbk2PrepareSingleAssignPhase::ContactRelocatedL
|
|
278 |
( MVPbkStoreContact* aRelocatedContact )
|
|
279 |
{
|
|
280 |
delete iStoreContact;
|
|
281 |
iStoreContact = aRelocatedContact;
|
|
282 |
|
|
283 |
AppendResultL( iStoreContact );
|
|
284 |
}
|
|
285 |
|
|
286 |
// --------------------------------------------------------------------------
|
|
287 |
// CPbk2PrepareSingleAssignPhase::ContactRelocationFailed
|
|
288 |
// --------------------------------------------------------------------------
|
|
289 |
//
|
|
290 |
void CPbk2PrepareSingleAssignPhase::ContactRelocationFailed
|
|
291 |
( TInt aReason, MVPbkStoreContact* aContact )
|
|
292 |
{
|
|
293 |
delete aContact;
|
|
294 |
|
|
295 |
if ( aReason != KErrCancel )
|
|
296 |
{
|
|
297 |
iObserver.PhaseError( *this, aReason );
|
|
298 |
}
|
|
299 |
}
|
|
300 |
|
|
301 |
// --------------------------------------------------------------------------
|
|
302 |
// CPbk2PrepareSingleAssignPhase::ContactsRelocationFailed
|
|
303 |
// --------------------------------------------------------------------------
|
|
304 |
//
|
|
305 |
void CPbk2PrepareSingleAssignPhase::ContactsRelocationFailed
|
|
306 |
( TInt /*aReason*/, CVPbkContactLinkArray* /*aContacts*/ )
|
|
307 |
{
|
|
308 |
// The code should never enter here
|
|
309 |
__ASSERT_DEBUG( EFalse, Panic( ELogicRelocation ) );
|
|
310 |
}
|
|
311 |
|
|
312 |
// --------------------------------------------------------------------------
|
|
313 |
// CPbk2PrepareSingleAssignPhase::RelocationProcessComplete
|
|
314 |
// --------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
void CPbk2PrepareSingleAssignPhase::RelocationProcessComplete()
|
|
317 |
{
|
|
318 |
// Next phase is select single property
|
|
319 |
iObserver.PreviousPhase( *this );
|
|
320 |
}
|
|
321 |
|
|
322 |
// --------------------------------------------------------------------------
|
|
323 |
// CPbk2PrepareSingleAssignPhase::Pbk2ProcessKeyEventL
|
|
324 |
// --------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
TBool CPbk2PrepareSingleAssignPhase::Pbk2ProcessKeyEventL
|
|
327 |
( const TKeyEvent& aKeyEvent, TEventCode aType )
|
|
328 |
{
|
|
329 |
TBool ret = EFalse;
|
|
330 |
|
|
331 |
if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
|
|
332 |
{
|
|
333 |
iObserver.PhaseOkToExit( *this, EEikBidCancel );
|
|
334 |
ret = ETrue;
|
|
335 |
}
|
|
336 |
|
|
337 |
return ret;
|
|
338 |
}
|
|
339 |
|
|
340 |
// --------------------------------------------------------------------------
|
|
341 |
// CPbk2PrepareSingleAssignPhase::RelocateContactL
|
|
342 |
// --------------------------------------------------------------------------
|
|
343 |
//
|
|
344 |
TBool CPbk2PrepareSingleAssignPhase::RelocateContactL
|
|
345 |
( Pbk2ContactRelocator::TPbk2ContactRelocationQueryPolicy aPolicy,
|
|
346 |
TBool& aThisDestroyed )
|
|
347 |
{
|
|
348 |
delete iContactRelocator;
|
|
349 |
iContactRelocator = NULL;
|
|
350 |
iContactRelocator = CPbk2ContactRelocator::NewL();
|
|
351 |
|
|
352 |
MVPbkStoreContact* contact = iStoreContact;
|
|
353 |
iStoreContact = NULL;
|
|
354 |
|
|
355 |
// Asynchronously relocate the contact
|
|
356 |
TBool relocate = iContactRelocator->RelocateContactL
|
|
357 |
( contact, *this, aPolicy, iRelocationFlags );
|
|
358 |
|
|
359 |
if ( !aThisDestroyed )
|
|
360 |
{
|
|
361 |
if ( !relocate )
|
|
362 |
{
|
|
363 |
// Cancel
|
|
364 |
TPbk2AssignNoteService noteService;
|
|
365 |
noteService.ShowInformationNoteL
|
|
366 |
( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED );
|
|
367 |
}
|
|
368 |
else
|
|
369 |
{
|
|
370 |
// User accepted relocation
|
|
371 |
if ( !iContactRelocator->IsPhoneMemoryInConfigurationL() )
|
|
372 |
{
|
|
373 |
// Note is shown only if phone memory is not in configuration
|
|
374 |
iNoteFlags = KPbk2NoteFlagOneContactRelocated;
|
|
375 |
}
|
|
376 |
}
|
|
377 |
}
|
|
378 |
|
|
379 |
return relocate;
|
|
380 |
}
|
|
381 |
|
|
382 |
// --------------------------------------------------------------------------
|
|
383 |
// CPbk2PrepareSingleAssignPhase::QueryForDataReplaceL
|
|
384 |
// --------------------------------------------------------------------------
|
|
385 |
//
|
|
386 |
TInt CPbk2PrepareSingleAssignPhase::QueryForDataReplaceL()
|
|
387 |
{
|
|
388 |
TInt ret = KErrNone;
|
|
389 |
|
|
390 |
TBool thisDestroyed = EFalse;
|
|
391 |
iDestroyedPtr = &thisDestroyed;
|
|
392 |
TPbk2DestructionIndicator indicator
|
|
393 |
( &thisDestroyed, iDestroyedPtr );
|
|
394 |
|
|
395 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
396 |
( *iEikEnv->EikAppUi() );
|
|
397 |
|
|
398 |
// Query for data replace
|
|
399 |
TPbk2AssignNoteService noteService;
|
|
400 |
TInt queryResult = noteService.ShowReplaceDetailQueryL
|
|
401 |
( appUi.ApplicationServices().NameFormatter(), *iStoreContact );
|
|
402 |
|
|
403 |
|
|
404 |
if ( !thisDestroyed && !queryResult )
|
|
405 |
{
|
|
406 |
// User didn't agree to replace data
|
|
407 |
if ( IsContactFromPhoneMemoryL( *iStoreContact ) )
|
|
408 |
{
|
|
409 |
TPbk2AssignNoteService noteService;
|
|
410 |
noteService.ShowInformationNoteL
|
|
411 |
( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED );
|
|
412 |
|
|
413 |
ret = KErrCancel;
|
|
414 |
}
|
|
415 |
else
|
|
416 |
{
|
|
417 |
TPbk2ContactRelocationQueryPolicy relocationPolicy =
|
|
418 |
EPbk2DisplayBasicQuery;
|
|
419 |
|
|
420 |
if ( RelocateContactL( relocationPolicy, thisDestroyed ) )
|
|
421 |
{
|
|
422 |
ret = KErrNotReady;
|
|
423 |
}
|
|
424 |
else
|
|
425 |
{
|
|
426 |
ret = KErrCancel;
|
|
427 |
}
|
|
428 |
}
|
|
429 |
}
|
|
430 |
|
|
431 |
|
|
432 |
if ( thisDestroyed )
|
|
433 |
{
|
|
434 |
ret = KErrDied;
|
|
435 |
}
|
|
436 |
|
|
437 |
return ret;
|
|
438 |
}
|
|
439 |
|
|
440 |
// --------------------------------------------------------------------------
|
|
441 |
// CPbk2PrepareSingleAssignPhase::QueryForRelocationL
|
|
442 |
// --------------------------------------------------------------------------
|
|
443 |
//
|
|
444 |
TInt CPbk2PrepareSingleAssignPhase::QueryForRelocationL()
|
|
445 |
{
|
|
446 |
TInt ret = KErrCancel;
|
|
447 |
|
|
448 |
TBool thisDestroyed = EFalse;
|
|
449 |
iDestroyedPtr = &thisDestroyed;
|
|
450 |
TPbk2DestructionIndicator indicator
|
|
451 |
( &thisDestroyed, iDestroyedPtr );
|
|
452 |
|
|
453 |
if ( iSelectFieldProperty->SelectedFieldType() )
|
|
454 |
{
|
|
455 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
456 |
( *iEikEnv->EikAppUi() );
|
|
457 |
|
|
458 |
TPbk2AssignNoteService noteService;
|
|
459 |
noteService.ShowCanNotAddDetailNoteL
|
|
460 |
( appUi.ApplicationServices().NameFormatter(), *iStoreContact );
|
|
461 |
}
|
|
462 |
|
|
463 |
if ( IsContactFromPhoneMemoryL( *iStoreContact ) )
|
|
464 |
{
|
|
465 |
TPbk2AssignNoteService noteService;
|
|
466 |
noteService.ShowInformationNoteL
|
|
467 |
( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED );
|
|
468 |
}
|
|
469 |
else
|
|
470 |
{
|
|
471 |
TPbk2ContactRelocationQueryPolicy relocationPolicy =
|
|
472 |
EPbk2DisplayStoreDoesNotSupportQuery;
|
|
473 |
|
|
474 |
if ( RelocateContactL( relocationPolicy, thisDestroyed ) )
|
|
475 |
{
|
|
476 |
ret = KErrNotReady;
|
|
477 |
}
|
|
478 |
}
|
|
479 |
|
|
480 |
if ( thisDestroyed )
|
|
481 |
{
|
|
482 |
ret = KErrDied;
|
|
483 |
}
|
|
484 |
|
|
485 |
return ret;
|
|
486 |
}
|
|
487 |
|
|
488 |
// --------------------------------------------------------------------------
|
|
489 |
// CPbk2PrepareSingleAssignPhase::PrepareForAssignL
|
|
490 |
// --------------------------------------------------------------------------
|
|
491 |
//
|
|
492 |
void CPbk2PrepareSingleAssignPhase::PrepareForAssignL()
|
|
493 |
{
|
|
494 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
495 |
( *iEikEnv->EikAppUi() );
|
|
496 |
|
|
497 |
switch( iSelectFieldResult )
|
|
498 |
{
|
|
499 |
case KErrNone:
|
|
500 |
// leave iFieldIndex intact.
|
|
501 |
{
|
|
502 |
iObserver.NextPhase( *this );
|
|
503 |
break;
|
|
504 |
}
|
|
505 |
case KErrNotFound:
|
|
506 |
{
|
|
507 |
iFieldIndex = KErrNotFound;
|
|
508 |
iObserver.NextPhase( *this );
|
|
509 |
break;
|
|
510 |
}
|
|
511 |
case KErrPathNotFound:
|
|
512 |
{
|
|
513 |
TInt fieldIndex = iSelectFieldProperty->SelectedFieldIndex();
|
|
514 |
if ( fieldIndex > KErrNotFound )
|
|
515 |
{
|
|
516 |
iFieldIndex = fieldIndex;
|
|
517 |
}
|
|
518 |
iObserver.NextPhase( *this );
|
|
519 |
break;
|
|
520 |
}
|
|
521 |
case KErrAlreadyExists:
|
|
522 |
{
|
|
523 |
TInt result = QueryForDataReplaceL();
|
|
524 |
if ( result == KErrNone )
|
|
525 |
{
|
|
526 |
iFieldIndex = iSelectFieldProperty->SelectedFieldIndex();
|
|
527 |
iObserver.NextPhase( *this );
|
|
528 |
}
|
|
529 |
else if ( result == KErrCancel )
|
|
530 |
{
|
|
531 |
iObserver.PhaseCanceled( *this );
|
|
532 |
}
|
|
533 |
else if ( result == KErrNotReady )
|
|
534 |
{
|
|
535 |
// Contact relocation took place, do not inform observer yet
|
|
536 |
}
|
|
537 |
else if ( result == KErrDied )
|
|
538 |
{
|
|
539 |
// This has been destroyed, do nothing
|
|
540 |
}
|
|
541 |
else
|
|
542 |
{
|
|
543 |
iObserver.PhaseError( *this, result );
|
|
544 |
}
|
|
545 |
break;
|
|
546 |
}
|
|
547 |
case KErrNotSupported:
|
|
548 |
{
|
|
549 |
TInt result = QueryForRelocationL();
|
|
550 |
if ( result == KErrCancel )
|
|
551 |
{
|
|
552 |
iObserver.PhaseCanceled( *this );
|
|
553 |
}
|
|
554 |
else if ( result == KErrNotReady )
|
|
555 |
{
|
|
556 |
// Contact relocation took place, do not inform observer yet
|
|
557 |
}
|
|
558 |
else if ( result == KErrDied )
|
|
559 |
{
|
|
560 |
// This has been destroyed, do nothing
|
|
561 |
}
|
|
562 |
else
|
|
563 |
{
|
|
564 |
iObserver.PhaseError( *this, result );
|
|
565 |
}
|
|
566 |
break;
|
|
567 |
}
|
|
568 |
case KErrAbort:
|
|
569 |
{
|
|
570 |
iObserver.PhaseAborted( *this );
|
|
571 |
break;
|
|
572 |
}
|
|
573 |
case KErrCancel: // FALLTHROUGH
|
|
574 |
default:
|
|
575 |
{
|
|
576 |
iObserver.PhaseCanceled( *this );
|
|
577 |
}
|
|
578 |
};
|
|
579 |
}
|
|
580 |
|
|
581 |
// --------------------------------------------------------------------------
|
|
582 |
// CPbk2PrepareSingleAssignPhase::IsContactFromPhoneMemoryL
|
|
583 |
// --------------------------------------------------------------------------
|
|
584 |
//
|
|
585 |
TBool CPbk2PrepareSingleAssignPhase::IsContactFromPhoneMemoryL
|
|
586 |
( const MVPbkStoreContact& aStoreContact )
|
|
587 |
{
|
|
588 |
TBool result = EFalse;
|
|
589 |
|
|
590 |
TVPbkContactStoreUriPtr phoneMemoryUri
|
|
591 |
( VPbkContactStoreUris::DefaultCntDbUri() );
|
|
592 |
|
|
593 |
TVPbkContactStoreUriPtr contactUri =
|
|
594 |
aStoreContact.ParentStore().StoreProperties().Uri();
|
|
595 |
|
|
596 |
if ( contactUri.Compare(
|
|
597 |
phoneMemoryUri,
|
|
598 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) == 0 )
|
|
599 |
{
|
|
600 |
result = ETrue;
|
|
601 |
}
|
|
602 |
|
|
603 |
return result;
|
|
604 |
}
|
|
605 |
|
|
606 |
// --------------------------------------------------------------------------
|
|
607 |
// CPbk2PrepareSingleAssignPhase::AppendResultL
|
|
608 |
// --------------------------------------------------------------------------
|
|
609 |
//
|
|
610 |
void CPbk2PrepareSingleAssignPhase::AppendResultL
|
|
611 |
( const MVPbkStoreContact* aStoreContact )
|
|
612 |
{
|
|
613 |
if ( aStoreContact )
|
|
614 |
{
|
|
615 |
// Add the contact link to the result array
|
|
616 |
MVPbkContactLink* link = aStoreContact->CreateLinkLC();
|
|
617 |
if ( link )
|
|
618 |
{
|
|
619 |
if ( !iResults )
|
|
620 |
{
|
|
621 |
iResults = CVPbkContactLinkArray::NewL();
|
|
622 |
}
|
|
623 |
|
|
624 |
CleanupStack::Pop(); // aStoreContact->CreateLinkLC()
|
|
625 |
|
|
626 |
iResults->AppendL( link );
|
|
627 |
}
|
|
628 |
}
|
|
629 |
}
|
|
630 |
|
|
631 |
// --------------------------------------------------------------------------
|
|
632 |
// CPbk2PrepareSingleAssignPhase::IssueRequest
|
|
633 |
// --------------------------------------------------------------------------
|
|
634 |
//
|
|
635 |
void CPbk2PrepareSingleAssignPhase::IssueRequest()
|
|
636 |
{
|
|
637 |
TRequestStatus* status = &iStatus;
|
|
638 |
User::RequestComplete( status, KErrNone );
|
|
639 |
SetActive();
|
|
640 |
}
|
|
641 |
|
|
642 |
// End of File
|