phonebookui/Phonebook2/ServerApplication/src/cpbk2preparemultipleassignphase.cpp
changeset 0 e686773b3f54
child 18 d4f567ce2e7c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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::Results
       
   216 // --------------------------------------------------------------------------
       
   217 //
       
   218 MVPbkContactLinkArray* CPbk2PrepareMultipleAssignPhase::Results() const
       
   219     {
       
   220     return iResults;
       
   221     }
       
   222 
       
   223 // --------------------------------------------------------------------------
       
   224 // CPbk2PrepareMultipleAssignPhase::ExtraResultData
       
   225 // --------------------------------------------------------------------------
       
   226 //
       
   227 TInt CPbk2PrepareMultipleAssignPhase::ExtraResultData() const
       
   228     {
       
   229     return KErrNotSupported;
       
   230     }
       
   231 
       
   232 // --------------------------------------------------------------------------
       
   233 // CPbk2PrepareMultipleAssignPhase::TakeStoreContact
       
   234 // --------------------------------------------------------------------------
       
   235 //
       
   236 MVPbkStoreContact* CPbk2PrepareMultipleAssignPhase::TakeStoreContact()
       
   237     {
       
   238     // Not supported
       
   239     return NULL;
       
   240     }
       
   241 
       
   242 // --------------------------------------------------------------------------
       
   243 // CPbk2PrepareMultipleAssignPhase::FieldContent
       
   244 // --------------------------------------------------------------------------
       
   245 //
       
   246 HBufC* CPbk2PrepareMultipleAssignPhase::FieldContent() const
       
   247     {
       
   248     return NULL;
       
   249     }
       
   250 
       
   251 // --------------------------------------------------------------------------
       
   252 // CPbk2PrepareMultipleAssignPhase::RunL
       
   253 // --------------------------------------------------------------------------
       
   254 //
       
   255 void CPbk2PrepareMultipleAssignPhase::RunL()
       
   256     {
       
   257     PrepareForAssignL();
       
   258 
       
   259     if ( iEntriesToRelocate && iEntriesToRelocate->Count() > 0 )
       
   260         {
       
   261         if ( iEntriesToRelocate->Count() == 1 )
       
   262             {
       
   263             RetrieveContactL();
       
   264             }
       
   265         else
       
   266             {
       
   267             RelocateContactsL();
       
   268             }
       
   269         }
       
   270     else
       
   271         {
       
   272         iObserver.NextPhase( *this );
       
   273         }
       
   274     }
       
   275 
       
   276 // --------------------------------------------------------------------------
       
   277 // CPbk2PrepareMultipleAssignPhase::RunError
       
   278 // --------------------------------------------------------------------------
       
   279 //
       
   280 TInt CPbk2PrepareMultipleAssignPhase::RunError( TInt aError )
       
   281     {
       
   282     if ( aError != KErrDied )
       
   283         {
       
   284         // If this is destroyed it is not safe to use iObserver anymore
       
   285         iObserver.PhaseError( *this, aError );
       
   286         }
       
   287     return KErrNone;
       
   288     }
       
   289 
       
   290 // --------------------------------------------------------------------------
       
   291 // CPbk2SelectCreateNewPropertyPhase::DoCancel
       
   292 // --------------------------------------------------------------------------
       
   293 //
       
   294 void CPbk2PrepareMultipleAssignPhase::DoCancel()
       
   295     {
       
   296     // Nothing to do
       
   297     }
       
   298 
       
   299 // --------------------------------------------------------------------------
       
   300 // CPbk2PrepareMultipleAssignPhase::ContactRelocatedL
       
   301 // --------------------------------------------------------------------------
       
   302 //
       
   303 void CPbk2PrepareMultipleAssignPhase::ContactRelocatedL
       
   304         ( MVPbkStoreContact* aRelocatedContact )
       
   305     {
       
   306     CleanupDeletePushL( aRelocatedContact );
       
   307     MVPbkContactLink* link = aRelocatedContact->CreateLinkLC();
       
   308 
       
   309     AppendResultL( link );
       
   310 
       
   311     CleanupStack::Pop(); // link
       
   312     CleanupStack::PopAndDestroy(); // aRelocatedContact
       
   313     }
       
   314 
       
   315 // --------------------------------------------------------------------------
       
   316 // CPbk2PrepareMultipleAssignPhase::ContactRelocationFailed
       
   317 // --------------------------------------------------------------------------
       
   318 //
       
   319 void CPbk2PrepareMultipleAssignPhase::ContactRelocationFailed
       
   320         ( TInt aReason, MVPbkStoreContact* aContact )
       
   321     {
       
   322     delete aContact;
       
   323 
       
   324     if ( aReason == KErrCancel )
       
   325         {
       
   326         if ( iResults && iResults->Count() > 0 )
       
   327             {
       
   328             // Continue with other contacts
       
   329             iObserver.NextPhase( *this );
       
   330             }
       
   331         else
       
   332             {
       
   333             // User canceled and there are no other contacts
       
   334             TPbk2AssignNoteService noteService;
       
   335             TRAP_IGNORE( noteService.ShowInformationNoteL
       
   336                 ( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ) );
       
   337 
       
   338             iObserver.PhaseCanceled( *this );
       
   339             }
       
   340         }
       
   341     else
       
   342         {
       
   343         iObserver.PhaseError( *this, aReason );
       
   344         }
       
   345     }
       
   346 
       
   347 // --------------------------------------------------------------------------
       
   348 // CPbk2PrepareMultipleAssignPhase::ContactsRelocationFailed
       
   349 // --------------------------------------------------------------------------
       
   350 //
       
   351 void CPbk2PrepareMultipleAssignPhase::ContactsRelocationFailed
       
   352         ( TInt aReason, CVPbkContactLinkArray* aContacts )
       
   353     {
       
   354     delete aContacts;
       
   355 
       
   356     if ( aReason == KErrCancel )
       
   357         {
       
   358         if ( iResults && iResults->Count() > 0 )
       
   359             {
       
   360             // Continue with other contacts
       
   361             iObserver.NextPhase( *this );
       
   362             }
       
   363         else
       
   364             {
       
   365             // User canceled and there are no other contacts
       
   366             TPbk2AssignNoteService noteService;
       
   367             TRAP_IGNORE( noteService.ShowInformationNoteL
       
   368                 ( R_QTN_PHOB_NOTE_DETAIL_NOT_ADDED ) );
       
   369 
       
   370             iObserver.PhaseCanceled( *this );
       
   371             }
       
   372         }
       
   373     else
       
   374         {
       
   375         // Other errors
       
   376         iObserver.PhaseError( *this, aReason );
       
   377         }
       
   378     }
       
   379 
       
   380 // --------------------------------------------------------------------------
       
   381 // CPbk2PrepareMultipleAssignPhase::RelocationProcessComplete
       
   382 // --------------------------------------------------------------------------
       
   383 //
       
   384 void CPbk2PrepareMultipleAssignPhase::RelocationProcessComplete()
       
   385     {
       
   386     iObserver.NextPhase( *this );
       
   387     }
       
   388 
       
   389 // --------------------------------------------------------------------------
       
   390 // CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationComplete
       
   391 // --------------------------------------------------------------------------
       
   392 //
       
   393 void CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationComplete
       
   394         ( MVPbkContactOperationBase& /*aOperation*/,
       
   395           MVPbkStoreContact* aContact )
       
   396     {
       
   397     TRAPD( err, RelocateContactL( aContact ) ); // takes ownership
       
   398     if ( err != KErrNone )
       
   399         {
       
   400         // RelocateContactL will leave with KErrDied if this was
       
   401         // destroyed
       
   402         if ( err != KErrDied )
       
   403             {
       
   404             iObserver.PhaseError( *this, err );
       
   405             }
       
   406         }
       
   407     }
       
   408 
       
   409 // --------------------------------------------------------------------------
       
   410 // CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationFailed
       
   411 // --------------------------------------------------------------------------
       
   412 //
       
   413 void CPbk2PrepareMultipleAssignPhase::VPbkSingleContactOperationFailed
       
   414         ( MVPbkContactOperationBase& /*aOperation*/, TInt aError )
       
   415     {
       
   416     delete iRetrieveOperation;
       
   417     iRetrieveOperation = NULL;
       
   418 
       
   419     iObserver.PhaseError( *this, aError );
       
   420     }
       
   421 
       
   422 // --------------------------------------------------------------------------
       
   423 // CPbk2PrepareMultipleAssignPhase::Pbk2ProcessKeyEventL
       
   424 // --------------------------------------------------------------------------
       
   425 //
       
   426 TBool CPbk2PrepareMultipleAssignPhase::Pbk2ProcessKeyEventL
       
   427         ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   428     {
       
   429     TBool ret = EFalse;
       
   430 
       
   431     if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
       
   432         {
       
   433         iObserver.PhaseOkToExit( *this, EEikBidCancel );
       
   434         ret = ETrue;
       
   435         }
       
   436 
       
   437     return ret;
       
   438     }
       
   439 
       
   440 // --------------------------------------------------------------------------
       
   441 // CPbk2PrepareMultipleAssignPhase::RetrieveContactL
       
   442 // --------------------------------------------------------------------------
       
   443 //
       
   444 void CPbk2PrepareMultipleAssignPhase::RetrieveContactL()
       
   445     {
       
   446     CPbk2ServerAppAppUi& appUi =
       
   447         static_cast<CPbk2ServerAppAppUi&>
       
   448             ( *CEikonEnv::Static()->EikAppUi() );
       
   449 
       
   450     delete iRetrieveOperation;
       
   451     iRetrieveOperation = NULL;
       
   452     iRetrieveOperation = appUi.ApplicationServices().ContactManager().
       
   453         RetrieveContactL( iEntriesToRelocate->At( KFirstElement ), *this );
       
   454     }
       
   455 
       
   456 // --------------------------------------------------------------------------
       
   457 // CPbk2PrepareMultipleAssignPhase::RelocateContactL
       
   458 // --------------------------------------------------------------------------
       
   459 //
       
   460 void CPbk2PrepareMultipleAssignPhase::RelocateContactL
       
   461         ( MVPbkStoreContact* aStoreContact )
       
   462     {
       
   463     CleanupDeletePushL( aStoreContact );
       
   464 
       
   465     delete iContactRelocator;
       
   466     iContactRelocator = NULL;
       
   467     iContactRelocator = CPbk2ContactRelocator::NewL();
       
   468 
       
   469     TBool thisDestroyed = EFalse;
       
   470     iDestroyedPtr = &thisDestroyed;
       
   471     TPbk2DestructionIndicator indicator( &thisDestroyed, iDestroyedPtr );
       
   472 
       
   473     CleanupStack::Pop( aStoreContact );
       
   474 
       
   475     // Asynchronously relocate the contact
       
   476     if ( iContactRelocator->RelocateContactL
       
   477         ( aStoreContact, *this, EPbk2DisplayStoreDoesNotSupportQuery,
       
   478           CPbk2ContactRelocator::EPbk2RelocatorExistingContact ) )
       
   479         {
       
   480         if ( thisDestroyed )
       
   481             {
       
   482             // The calling code excepts us to leave with KErrDied if
       
   483             // this was destroyed
       
   484             User::Leave( KErrDied );
       
   485             }
       
   486 
       
   487         // User accepted relocation
       
   488         if ( !iContactRelocator->IsPhoneMemoryInConfigurationL() )
       
   489             {
       
   490             // Note is shown only if phone memory is not in configuration
       
   491             iNoteFlags = KPbk2NoteFlagOneContactRelocated;
       
   492             }
       
   493         }
       
   494     }
       
   495 
       
   496 // --------------------------------------------------------------------------
       
   497 // CPbk2PrepareMultipleAssignPhase::RelocateContactsL
       
   498 // --------------------------------------------------------------------------
       
   499 //
       
   500 void CPbk2PrepareMultipleAssignPhase::RelocateContactsL()
       
   501     {
       
   502     delete iContactRelocator;
       
   503     iContactRelocator = NULL;
       
   504     iContactRelocator = CPbk2ContactRelocator::NewL();
       
   505 
       
   506     TBool thisDestroyed = EFalse;
       
   507     iDestroyedPtr = &thisDestroyed;
       
   508     TPbk2DestructionIndicator indicator( &thisDestroyed, iDestroyedPtr );
       
   509 
       
   510     // Asynchronously relocate contacts
       
   511     TBool res = iContactRelocator->RelocateContactsL( iEntriesToRelocate,
       
   512         *this, EPbk2DisplayStoreDoesNotSupportQuery );
       
   513 
       
   514     if ( !thisDestroyed )
       
   515         {
       
   516         iEntriesToRelocate = NULL;  // ownership was taken
       
   517 
       
   518         if ( res )
       
   519             {
       
   520             // User accepted relocation
       
   521             if ( !iContactRelocator->IsPhoneMemoryInConfigurationL() )
       
   522                 {
       
   523                 // Note is shown only if phone memory is not in configuration
       
   524                 iNoteFlags = KPbk2NoteFlagSeveralContactsRelocated;
       
   525                 }
       
   526             }
       
   527         }
       
   528     }
       
   529 
       
   530 // --------------------------------------------------------------------------
       
   531 // CPbk2PrepareMultipleAssignPhase::PrepareForAssignL
       
   532 // --------------------------------------------------------------------------
       
   533 //
       
   534 void CPbk2PrepareMultipleAssignPhase::PrepareForAssignL()
       
   535     {
       
   536     if ( iContactLinks )
       
   537         {
       
   538         const TInt count = iContactLinks->Count();
       
   539         for ( TInt i = 0; i < count; ++i )
       
   540             {
       
   541             MVPbkContactLink* link = iContactLinks->At(i).CloneLC();
       
   542             if ( SupportsFieldL( link->ContactStore().
       
   543                  StoreProperties().Uri() ) )
       
   544                 {
       
   545                 AppendResultL( link );
       
   546                 }
       
   547             else
       
   548                 {
       
   549                 SendToRelocationL( link );
       
   550                 }
       
   551             CleanupStack::Pop(); // iContactLinks->At(i).CloneLC()
       
   552             }
       
   553         }
       
   554     }
       
   555 
       
   556 // --------------------------------------------------------------------------
       
   557 // CPbk2PrepareMultipleAssignPhase::AppendResultL
       
   558 // --------------------------------------------------------------------------
       
   559 //
       
   560 void CPbk2PrepareMultipleAssignPhase::AppendResultL
       
   561         ( MVPbkContactLink* aContactLink )
       
   562     {
       
   563     if ( aContactLink )
       
   564         {
       
   565         if ( !iResults )
       
   566             {
       
   567             iResults = CVPbkContactLinkArray::NewL();
       
   568             }
       
   569 
       
   570         iResults->AppendL( aContactLink );
       
   571         }
       
   572     }
       
   573 
       
   574 // --------------------------------------------------------------------------
       
   575 // CPbk2PrepareMultipleAssignPhase::SendToRelocationL
       
   576 // --------------------------------------------------------------------------
       
   577 //
       
   578 void CPbk2PrepareMultipleAssignPhase::SendToRelocationL
       
   579         ( MVPbkContactLink* aContactLink )
       
   580     {
       
   581     if ( aContactLink )
       
   582         {
       
   583         if ( !iEntriesToRelocate )
       
   584             {
       
   585             iEntriesToRelocate = CVPbkContactLinkArray::NewL();
       
   586             }
       
   587 
       
   588         iEntriesToRelocate->AppendL( aContactLink );
       
   589         }
       
   590     }
       
   591 
       
   592 // --------------------------------------------------------------------------
       
   593 // CPbk2PrepareMultipleAssignPhase::SupportsFieldL
       
   594 // --------------------------------------------------------------------------
       
   595 //
       
   596 TBool CPbk2PrepareMultipleAssignPhase::SupportsFieldL
       
   597         ( TVPbkContactStoreUriPtr aStoreUri )
       
   598     {
       
   599     __ASSERT_DEBUG( iSelectFieldProperty->SelectedFieldType(),
       
   600         Panic( ENullPointer ) );
       
   601 
       
   602     CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
       
   603         ( *CEikonEnv::Static()->EikAppUi() );
       
   604 
       
   605     MVPbkContactStore* store =
       
   606         appUi.ApplicationServices().ContactManager().ContactStoresL().
       
   607             Find( aStoreUri );
       
   608 
       
   609     const MVPbkFieldTypeList& fieldTypeList =
       
   610             store->StoreProperties().SupportedFields();
       
   611 
       
   612     TBool result = EFalse;
       
   613     if ( fieldTypeList.ContainsSame
       
   614             ( *iSelectFieldProperty->SelectedFieldType() ) )
       
   615         {
       
   616         result = ETrue;
       
   617         }
       
   618 
       
   619     return result;
       
   620     }
       
   621 
       
   622 // --------------------------------------------------------------------------
       
   623 // CPbk2PrepareMultipleAssignPhase::IssueRequest
       
   624 // --------------------------------------------------------------------------
       
   625 //
       
   626 void CPbk2PrepareMultipleAssignPhase::IssueRequest()
       
   627     {
       
   628     TRequestStatus* status = &iStatus;
       
   629     User::RequestComplete( status, KErrNone );
       
   630     SetActive();
       
   631     }
       
   632 
       
   633 // End of File