phonebookui/Phonebook2/ServerApplication/src/cpbk2preparemultipleassignphase.cpp
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 68 9da50d567e3c
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     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 "CPbk2PrepareMultipleAssignPhase.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 <CPbk2ContactRelocator.h>
       
    31 #include <MPbk2ApplicationServices.h>
       
    32 #include <Pbk2ServerApp.rsg>
       
    33 
       
    34 // Virtual Phonebook
       
    35 #include <MVPbkContactLink.h>
       
    36 #include <CVPbkContactLinkArray.h>
       
    37 #include <MVPbkContactOperationBase.h>
       
    38 #include <MVPbkStoreContact.h>
       
    39 #include <MVPbkContactStore.h>
       
    40 #include <MVPbkContactStoreList.h>
       
    41 #include <MVPbkContactStoreProperties.h>
       
    42 #include <CVPbkContactManager.h>
       
    43 #include <VPbkContactStoreUris.h>
       
    44 #include <MVPbkFieldType.h>
       
    45 
       
    46 
       
    47 using namespace Pbk2ContactRelocator;
       
    48 
       
    49 /// Unnamed namespace for local definitions
       
    50 namespace {
       
    51 
       
    52 const TInt KFirstElement( 0 );
       
    53 
       
    54 /**
       
    55  * Copies a link array to another.
       
    56  *
       
    57  * @param aSourceLinkArray    Link array which is copied
       
    58  * @param aTargetLinkArray    Links are copied to this
       
    59  */
       
    60 void CopyContactLinksL( const MVPbkContactLinkArray& aSourceLinkArray,
       
    61         CVPbkContactLinkArray& aTargetLinkArray )
       
    62     {
       
    63     const TInt count = aSourceLinkArray.Count();
       
    64     for ( TInt i(0); i < count; ++i )
       
    65         {
       
    66         const MVPbkContactLink& contactLink = aSourceLinkArray.At(i);
       
    67         aTargetLinkArray.AppendL( contactLink.CloneLC() );
       
    68         CleanupStack::Pop(); // link
       
    69         }
       
    70     }
       
    71 
       
    72 #ifdef _DEBUG
       
    73 
       
    74 enum TPanicCode
       
    75     {
       
    76     ENullPointer,
       
    77     ELogicRelocation
       
    78     };
       
    79 
       
    80 void Panic(TPanicCode aReason)
       
    81     {
       
    82     _LIT( KPanicText, "CPbk2PrepareMultipleAssignPhase" );
       
    83     User::Panic( KPanicText, aReason );
       
    84     }
       
    85 
       
    86 #endif // _DEBUG
       
    87 
       
    88 } /// namespace
       
    89 
       
    90 // --------------------------------------------------------------------------
       
    91 // CPbk2PrepareMultipleAssignPhase::CPbk2PrepareMultipleAssignPhase
       
    92 // --------------------------------------------------------------------------
       
    93 //
       
    94 CPbk2PrepareMultipleAssignPhase::CPbk2PrepareMultipleAssignPhase
       
    95         ( MPbk2ServicePhaseObserver& aObserver,
       
    96           MPbk2SelectFieldProperty* aSelectFieldProperty,
       
    97           TUint& aNoteFlags ) :
       
    98             CActive( EPriorityIdle ),
       
    99             iObserver( aObserver ),
       
   100             iSelectFieldProperty( aSelectFieldProperty ),
       
   101             iNoteFlags( aNoteFlags )
       
   102     {
       
   103     CActiveScheduler::Add( this );
       
   104     }
       
   105 
       
   106 // --------------------------------------------------------------------------
       
   107 // CPbk2PrepareMultipleAssignPhase::~CPbk2PrepareMultipleAssignPhase
       
   108 // --------------------------------------------------------------------------
       
   109 //
       
   110 CPbk2PrepareMultipleAssignPhase::~CPbk2PrepareMultipleAssignPhase()
       
   111     {
       
   112     Cancel();
       
   113     delete iContactRelocator;
       
   114     delete iResults;
       
   115     delete iDealer;
       
   116     delete iRetrieveOperation;
       
   117     delete iContactLinks;
       
   118     delete iEntriesToRelocate;
       
   119 
       
   120     if ( iDestroyedPtr )
       
   121         {
       
   122         *iDestroyedPtr = ETrue;
       
   123         }
       
   124     }
       
   125 
       
   126 // --------------------------------------------------------------------------
       
   127 // CPbk2PrepareMultipleAssignPhase::ConstructL
       
   128 // --------------------------------------------------------------------------
       
   129 //
       
   130 inline void CPbk2PrepareMultipleAssignPhase::ConstructL
       
   131         ( const MVPbkContactLinkArray* aContactLinks )
       
   132     {
       
   133     iDealer = CPbk2KeyEventDealer::NewL( *this );
       
   134 
       
   135     iContactLinks = CVPbkContactLinkArray::NewL();
       
   136     // Take a own copy of supplied contact links
       
   137     CopyContactLinksL( *aContactLinks, *iContactLinks );
       
   138     }
       
   139 
       
   140 // --------------------------------------------------------------------------
       
   141 // CPbk2PrepareMultipleAssignPhase::NewL
       
   142 // --------------------------------------------------------------------------
       
   143 //
       
   144 CPbk2PrepareMultipleAssignPhase* CPbk2PrepareMultipleAssignPhase::NewL
       
   145         ( MPbk2ServicePhaseObserver& aObserver,
       
   146           const MVPbkContactLinkArray* aContactLinks,
       
   147           MPbk2SelectFieldProperty* aSelectFieldProperty,
       
   148           TUint& aNoteFlags )
       
   149     {
       
   150     CPbk2PrepareMultipleAssignPhase* self =
       
   151         new ( ELeave ) CPbk2PrepareMultipleAssignPhase
       
   152             ( aObserver, aSelectFieldProperty, aNoteFlags );
       
   153     CleanupStack::PushL( self );
       
   154     self->ConstructL( aContactLinks );
       
   155     CleanupStack::Pop( self );
       
   156     return self;
       
   157     }
       
   158 
       
   159 // --------------------------------------------------------------------------
       
   160 // CPbk2PrepareMultipleAssignPhase::LaunchServicePhaseL
       
   161 // --------------------------------------------------------------------------
       
   162 //
       
   163 void CPbk2PrepareMultipleAssignPhase::LaunchServicePhaseL()
       
   164     {
       
   165     IssueRequest();
       
   166     }
       
   167 
       
   168 // --------------------------------------------------------------------------
       
   169 // CPbk2PrepareMultipleAssignPhase::CancelServicePhase
       
   170 // --------------------------------------------------------------------------
       
   171 //
       
   172 void CPbk2PrepareMultipleAssignPhase::CancelServicePhase()
       
   173     {
       
   174     delete iContactRelocator;
       
   175     iContactRelocator = NULL;
       
   176 
       
   177     iObserver.PhaseCanceled( *this );
       
   178     }
       
   179 
       
   180 // --------------------------------------------------------------------------
       
   181 // CPbk2PrepareMultipleAssignPhase::RequestCancelL
       
   182 // --------------------------------------------------------------------------
       
   183 //
       
   184 void CPbk2PrepareMultipleAssignPhase::RequestCancelL( TInt aExitCommandId )
       
   185     {
       
   186     delete iContactRelocator;
       
   187     iContactRelocator = NULL;
       
   188 
       
   189     // Withdraw our key event agent so that it does not react to
       
   190     // app shutter's escape key event simulation
       
   191     delete iDealer;
       
   192     iDealer = NULL;
       
   193 
       
   194    if ( aExitCommandId == EEikBidCancel )
       
   195         {
       
   196         iObserver.PhaseAborted( *this );
       
   197         }
       
   198     else
       
   199         {
       
   200         iObserver.PhaseCanceled( *this );
       
   201         }
       
   202     }
       
   203 
       
   204 // --------------------------------------------------------------------------
       
   205 // CPbk2PrepareMultipleAssignPhase::AcceptDelayed
       
   206 // --------------------------------------------------------------------------
       
   207 //
       
   208 void CPbk2PrepareMultipleAssignPhase::AcceptDelayedL
       
   209         ( const TDesC8& /*aContactLinkBuffer*/ )
       
   210     {
       
   211     // Nothing to do
       
   212     }
       
   213 
       
   214 // --------------------------------------------------------------------------
       
   215 // CPbk2PrepareMultipleAssignPhase::DenyDelayed
       
   216 // --------------------------------------------------------------------------
       
   217 //
       
   218 void CPbk2PrepareMultipleAssignPhase::DenyDelayedL
       
   219         ( const TDesC8& /*aContactLinkBuffer*/ )
       
   220     {
       
   221     // Nothing to do
       
   222     }
       
   223 
       
   224 // --------------------------------------------------------------------------
       
   225 // CPbk2PrepareMultipleAssignPhase::Results
       
   226 // --------------------------------------------------------------------------
       
   227 //
       
   228 MVPbkContactLinkArray* CPbk2PrepareMultipleAssignPhase::Results() const
       
   229     {
       
   230     return iResults;
       
   231     }
       
   232 
       
   233 // --------------------------------------------------------------------------
       
   234 // CPbk2PrepareMultipleAssignPhase::ExtraResultData
       
   235 // --------------------------------------------------------------------------
       
   236 //
       
   237 TInt CPbk2PrepareMultipleAssignPhase::ExtraResultData() const
       
   238     {
       
   239     return KErrNotSupported;
       
   240     }
       
   241 
       
   242 // --------------------------------------------------------------------------
       
   243 // CPbk2PrepareMultipleAssignPhase::TakeStoreContact
       
   244 // --------------------------------------------------------------------------
       
   245 //
       
   246 MVPbkStoreContact* CPbk2PrepareMultipleAssignPhase::TakeStoreContact()
       
   247     {
       
   248     // Not supported
       
   249     return NULL;
       
   250     }
       
   251 
       
   252 // --------------------------------------------------------------------------
       
   253 // CPbk2PrepareMultipleAssignPhase::FieldContent
       
   254 // --------------------------------------------------------------------------
       
   255 //
       
   256 HBufC* CPbk2PrepareMultipleAssignPhase::FieldContent() const
       
   257     {
       
   258     return NULL;
       
   259     }
       
   260 
       
   261 // --------------------------------------------------------------------------
       
   262 // CPbk2PrepareMultipleAssignPhase::RunL
       
   263 // --------------------------------------------------------------------------
       
   264 //
       
   265 void CPbk2PrepareMultipleAssignPhase::RunL()
       
   266     {
       
   267     PrepareForAssignL();
       
   268 
       
   269     if ( iEntriesToRelocate && iEntriesToRelocate->Count() > 0 )
       
   270         {
       
   271         if ( iEntriesToRelocate->Count() == 1 )
       
   272             {
       
   273             RetrieveContactL();
       
   274             }
       
   275         else
       
   276             {
       
   277             RelocateContactsL();
       
   278             }
       
   279         }
       
   280     else
       
   281         {
       
   282         iObserver.NextPhase( *this );
       
   283         }
       
   284     }
       
   285 
       
   286 // --------------------------------------------------------------------------
       
   287 // CPbk2PrepareMultipleAssignPhase::RunError
       
   288 // --------------------------------------------------------------------------
       
   289 //
       
   290 TInt CPbk2PrepareMultipleAssignPhase::RunError( TInt aError )
       
   291     {
       
   292     if ( aError != KErrDied )
       
   293         {
       
   294         // If this is destroyed it is not safe to use iObserver anymore
       
   295         iObserver.PhaseError( *this, aError );
       
   296         }
       
   297     return KErrNone;
       
   298     }
       
   299 
       
   300 // --------------------------------------------------------------------------
       
   301 // CPbk2SelectCreateNewPropertyPhase::DoCancel
       
   302 // --------------------------------------------------------------------------
       
   303 //
       
   304 void CPbk2PrepareMultipleAssignPhase::DoCancel()
       
   305     {
       
   306     // Nothing to do
       
   307     }
       
   308 
       
   309 // --------------------------------------------------------------------------
       
   310 // CPbk2PrepareMultipleAssignPhase::ContactRelocatedL
       
   311 // --------------------------------------------------------------------------
       
   312 //
       
   313 void CPbk2PrepareMultipleAssignPhase::ContactRelocatedL
       
   314         ( MVPbkStoreContact* aRelocatedContact )
       
   315     {
       
   316     CleanupDeletePushL( aRelocatedContact );
       
   317     MVPbkContactLink* link = aRelocatedContact->CreateLinkLC();
       
   318 
       
   319     AppendResultL( link );
       
   320 
       
   321     CleanupStack::Pop(); // link
       
   322     CleanupStack::PopAndDestroy(); // aRelocatedContact
       
   323     }
       
   324 
       
   325 // --------------------------------------------------------------------------
       
   326 // CPbk2PrepareMultipleAssignPhase::ContactRelocationFailed
       
   327 // --------------------------------------------------------------------------
       
   328 //
       
   329 void CPbk2PrepareMultipleAssignPhase::ContactRelocationFailed
       
   330         ( TInt aReason, MVPbkStoreContact* aContact )
       
   331     {
       
   332     delete aContact;
       
   333 
       
   334     if ( aReason == KErrCancel )
       
   335         {
       
   336         if ( iResults && iResults->Count() > 0 )
       
   337             {
       
   338             // Continue with other contacts
       
   339             iObserver.NextPhase( *this );
       
   340             }
       
   341         else
       
   342             {
       
   343             // User canceled and there are no other contacts
       
   344             TPbk2AssignNoteService noteService;
       
   345             TRAP_IGNORE( noteService.ShowInformationNoteL
       
   346                 ( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ) );
       
   347 
       
   348             iObserver.PhaseCanceled( *this );
       
   349             }
       
   350         }
       
   351     else
       
   352         {
       
   353         iObserver.PhaseError( *this, aReason );
       
   354         }
       
   355     }
       
   356 
       
   357 // --------------------------------------------------------------------------
       
   358 // CPbk2PrepareMultipleAssignPhase::ContactsRelocationFailed
       
   359 // --------------------------------------------------------------------------
       
   360 //
       
   361 void CPbk2PrepareMultipleAssignPhase::ContactsRelocationFailed
       
   362         ( TInt aReason, CVPbkContactLinkArray* aContacts )
       
   363     {
       
   364     delete aContacts;
       
   365 
       
   366     if ( aReason == KErrCancel )
       
   367         {
       
   368         if ( iResults && iResults->Count() > 0 )
       
   369             {
       
   370             // Continue with other contacts
       
   371             iObserver.NextPhase( *this );
       
   372             }
       
   373         else
       
   374             {
       
   375             // User canceled and there are no other contacts
       
   376             TPbk2AssignNoteService noteService;
       
   377             TRAP_IGNORE( noteService.ShowInformationNoteL
       
   378                 ( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ) );
       
   379 
       
   380             iObserver.PhaseCanceled( *this );
       
   381             }
       
   382         }
       
   383     else
       
   384         {
       
   385         // Other errors
       
   386         iObserver.PhaseError( *this, aReason );
       
   387         }
       
   388     }
       
   389 
       
   390 // --------------------------------------------------------------------------
       
   391 // CPbk2PrepareMultipleAssignPhase::RelocationProcessComplete
       
   392 // --------------------------------------------------------------------------
       
   393 //
       
   394 void CPbk2PrepareMultipleAssignPhase::RelocationProcessComplete()
       
   395     {
       
   396     iObserver.NextPhase( *this );
       
   397     }
       
   398 
       
   399 // --------------------------------------------------------------------------
       
   400 // CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationComplete
       
   401 // --------------------------------------------------------------------------
       
   402 //
       
   403 void CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationComplete
       
   404         ( MVPbkContactOperationBase& /*aOperation*/,
       
   405           MVPbkStoreContact* aContact )
       
   406     {
       
   407     TRAPD( err, RelocateContactL( aContact ) ); // takes ownership
       
   408     if ( err != KErrNone )
       
   409         {
       
   410         // RelocateContactL will leave with KErrDied if this was
       
   411         // destroyed
       
   412         if ( err != KErrDied )
       
   413             {
       
   414             iObserver.PhaseError( *this, err );
       
   415             }
       
   416         }
       
   417     }
       
   418 
       
   419 // --------------------------------------------------------------------------
       
   420 // CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationFailed
       
   421 // --------------------------------------------------------------------------
       
   422 //
       
   423 void CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationFailed
       
   424         ( MVPbkContactOperationBase& /*aOperation*/, TInt aError )
       
   425     {
       
   426     delete iRetrieveOperation;
       
   427     iRetrieveOperation = NULL;
       
   428 
       
   429     iObserver.PhaseError( *this, aError );
       
   430     }
       
   431 
       
   432 // --------------------------------------------------------------------------
       
   433 // CPbk2PrepareMultipleAssignPhase::Pbk2ProcessKeyEventL
       
   434 // --------------------------------------------------------------------------
       
   435 //
       
   436 TBool CPbk2PrepareMultipleAssignPhase::Pbk2ProcessKeyEventL
       
   437         ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   438     {
       
   439     TBool ret = EFalse;
       
   440 
       
   441     if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
       
   442         {
       
   443         iObserver.PhaseOkToExit( *this, EEikBidCancel );
       
   444         ret = ETrue;
       
   445         }
       
   446 
       
   447     return ret;
       
   448     }
       
   449 
       
   450 // --------------------------------------------------------------------------
       
   451 // CPbk2PrepareMultipleAssignPhase::RetrieveContactL
       
   452 // --------------------------------------------------------------------------
       
   453 //
       
   454 void CPbk2PrepareMultipleAssignPhase::RetrieveContactL()
       
   455     {
       
   456     CPbk2ServerAppAppUi& appUi =
       
   457         static_cast<CPbk2ServerAppAppUi&>
       
   458             ( *CEikonEnv::Static()->EikAppUi() );
       
   459 
       
   460     delete iRetrieveOperation;
       
   461     iRetrieveOperation = NULL;
       
   462     iRetrieveOperation = appUi.ApplicationServices().ContactManager().
       
   463         RetrieveContactL( iEntriesToRelocate->At( KFirstElement ), *this );
       
   464     }
       
   465 
       
   466 // --------------------------------------------------------------------------
       
   467 // CPbk2PrepareMultipleAssignPhase::RelocateContactL
       
   468 // --------------------------------------------------------------------------
       
   469 //
       
   470 void CPbk2PrepareMultipleAssignPhase::RelocateContactL
       
   471         ( MVPbkStoreContact* aStoreContact )
       
   472     {
       
   473     CleanupDeletePushL( aStoreContact );
       
   474 
       
   475     delete iContactRelocator;
       
   476     iContactRelocator = NULL;
       
   477     iContactRelocator = CPbk2ContactRelocator::NewL();
       
   478 
       
   479     TBool thisDestroyed = EFalse;
       
   480     iDestroyedPtr = &thisDestroyed;
       
   481     TPbk2DestructionIndicator indicator( &thisDestroyed, iDestroyedPtr );
       
   482 
       
   483     CleanupStack::Pop( aStoreContact );
       
   484 
       
   485     // Asynchronously relocate the contact
       
   486     if ( iContactRelocator->RelocateContactL
       
   487         ( aStoreContact, *this, EPbk2DisplayStoreDoesNotSupportQuery,
       
   488           CPbk2ContactRelocator::EPbk2RelocatorExistingContact ) )
       
   489         {
       
   490         if ( thisDestroyed )
       
   491             {
       
   492             // The calling code excepts us to leave with KErrDied if
       
   493             // this was destroyed
       
   494             User::Leave( KErrDied );
       
   495             }
       
   496 
       
   497         // User accepted relocation
       
   498         if ( !iContactRelocator->IsPhoneMemoryInConfigurationL() )
       
   499             {
       
   500             // Note is shown only if phone memory is not in configuration
       
   501             iNoteFlags = KPbk2NoteFlagOneContactRelocated;
       
   502             }
       
   503         }
       
   504     }
       
   505 
       
   506 // --------------------------------------------------------------------------
       
   507 // CPbk2PrepareMultipleAssignPhase::RelocateContactsL
       
   508 // --------------------------------------------------------------------------
       
   509 //
       
   510 void CPbk2PrepareMultipleAssignPhase::RelocateContactsL()
       
   511     {
       
   512     delete iContactRelocator;
       
   513     iContactRelocator = NULL;
       
   514     iContactRelocator = CPbk2ContactRelocator::NewL();
       
   515 
       
   516     TBool thisDestroyed = EFalse;
       
   517     iDestroyedPtr = &thisDestroyed;
       
   518     TPbk2DestructionIndicator indicator( &thisDestroyed, iDestroyedPtr );
       
   519 
       
   520     // Asynchronously relocate contacts
       
   521     TBool res = iContactRelocator->RelocateContactsL( iEntriesToRelocate,
       
   522         *this, EPbk2DisplayStoreDoesNotSupportQuery );
       
   523 
       
   524     if ( !thisDestroyed )
       
   525         {
       
   526         iEntriesToRelocate = NULL;  // ownership was taken
       
   527 
       
   528         if ( res )
       
   529             {
       
   530             // User accepted relocation
       
   531             if ( !iContactRelocator->IsPhoneMemoryInConfigurationL() )
       
   532                 {
       
   533                 // Note is shown only if phone memory is not in configuration
       
   534                 iNoteFlags = KPbk2NoteFlagSeveralContactsRelocated;
       
   535                 }
       
   536             }
       
   537         }
       
   538     }
       
   539 
       
   540 // --------------------------------------------------------------------------
       
   541 // CPbk2PrepareMultipleAssignPhase::PrepareForAssignL
       
   542 // --------------------------------------------------------------------------
       
   543 //
       
   544 void CPbk2PrepareMultipleAssignPhase::PrepareForAssignL()
       
   545     {
       
   546     if ( iContactLinks )
       
   547         {
       
   548         const TInt count = iContactLinks->Count();
       
   549         for ( TInt i = 0; i < count; ++i )
       
   550             {
       
   551             MVPbkContactLink* link = iContactLinks->At(i).CloneLC();
       
   552             if ( SupportsFieldL( link->ContactStore().
       
   553                  StoreProperties().Uri() ) )
       
   554                 {
       
   555                 AppendResultL( link );
       
   556                 }
       
   557             else
       
   558                 {
       
   559                 SendToRelocationL( link );
       
   560                 }
       
   561             CleanupStack::Pop(); // iContactLinks->At(i).CloneLC()
       
   562             }
       
   563         }
       
   564     }
       
   565 
       
   566 // --------------------------------------------------------------------------
       
   567 // CPbk2PrepareMultipleAssignPhase::AppendResultL
       
   568 // --------------------------------------------------------------------------
       
   569 //
       
   570 void CPbk2PrepareMultipleAssignPhase::AppendResultL
       
   571         ( MVPbkContactLink* aContactLink )
       
   572     {
       
   573     if ( aContactLink )
       
   574         {
       
   575         if ( !iResults )
       
   576             {
       
   577             iResults = CVPbkContactLinkArray::NewL();
       
   578             }
       
   579 
       
   580         iResults->AppendL( aContactLink );
       
   581         }
       
   582     }
       
   583 
       
   584 // --------------------------------------------------------------------------
       
   585 // CPbk2PrepareMultipleAssignPhase::SendToRelocationL
       
   586 // --------------------------------------------------------------------------
       
   587 //
       
   588 void CPbk2PrepareMultipleAssignPhase::SendToRelocationL
       
   589         ( MVPbkContactLink* aContactLink )
       
   590     {
       
   591     if ( aContactLink )
       
   592         {
       
   593         if ( !iEntriesToRelocate )
       
   594             {
       
   595             iEntriesToRelocate = CVPbkContactLinkArray::NewL();
       
   596             }
       
   597 
       
   598         iEntriesToRelocate->AppendL( aContactLink );
       
   599         }
       
   600     }
       
   601 
       
   602 // --------------------------------------------------------------------------
       
   603 // CPbk2PrepareMultipleAssignPhase::SupportsFieldL
       
   604 // --------------------------------------------------------------------------
       
   605 //
       
   606 TBool CPbk2PrepareMultipleAssignPhase::SupportsFieldL
       
   607         ( TVPbkContactStoreUriPtr aStoreUri )
       
   608     {
       
   609     __ASSERT_DEBUG( iSelectFieldProperty->SelectedFieldType(),
       
   610         Panic( ENullPointer ) );
       
   611 
       
   612     CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
       
   613         ( *CEikonEnv::Static()->EikAppUi() );
       
   614 
       
   615     MVPbkContactStore* store =
       
   616         appUi.ApplicationServices().ContactManager().ContactStoresL().
       
   617             Find( aStoreUri );
       
   618 
       
   619     const MVPbkFieldTypeList& fieldTypeList =
       
   620             store->StoreProperties().SupportedFields();
       
   621 
       
   622     TBool result = EFalse;
       
   623     if ( fieldTypeList.ContainsSame
       
   624             ( *iSelectFieldProperty->SelectedFieldType() ) )
       
   625         {
       
   626         result = ETrue;
       
   627         }
       
   628 
       
   629     return result;
       
   630     }
       
   631 
       
   632 // --------------------------------------------------------------------------
       
   633 // CPbk2PrepareMultipleAssignPhase::IssueRequest
       
   634 // --------------------------------------------------------------------------
       
   635 //
       
   636 void CPbk2PrepareMultipleAssignPhase::IssueRequest()
       
   637     {
       
   638     TRequestStatus* status = &iStatus;
       
   639     User::RequestComplete( status, KErrNone );
       
   640     SetActive();
       
   641     }
       
   642 
       
   643 // End of File