phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareMultipleAssignPhase.h
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 #ifndef CPBK2PREPAREMULTIPLEASSIGNPHASE_H
       
    20 #define CPBK2PREPAREMULTIPLEASSIGNPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2ContactRelocatorObserver.h>
       
    25 #include <MPbk2KeyEventHandler.h>
       
    26 #include <MVPbkSingleContactOperationObserver.h>
       
    27 #include <TVPbkContactStoreUriPtr.h>
       
    28 #include "MPbk2ServicePhase.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CVPbkContactLinkArray;
       
    32 class MPbk2ServicePhaseObserver;
       
    33 class MVPbkContactLink;
       
    34 class MVPbkContactLinkArray;
       
    35 class MVPbkContactOperationBase;
       
    36 class MPbk2SelectFieldProperty;
       
    37 class MPbk2ContactDataAssigner;
       
    38 class MVPbkStoreContact;
       
    39 class CPbk2KeyEventDealer;
       
    40 class CPbk2ContactRelocator;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45  * Phonebook 2 server app prepare single assign phase.
       
    46  * Responsible for preparing contact for assign.
       
    47  */
       
    48 class CPbk2PrepareMultipleAssignPhase :
       
    49                 public CActive,
       
    50                 public MPbk2ServicePhase,
       
    51                 private MPbk2ContactRelocatorObserver,
       
    52                 private MVPbkSingleContactOperationObserver,
       
    53                 private MPbk2KeyEventHandler
       
    54     {
       
    55     public: // Construction
       
    56 
       
    57         /**
       
    58          * Creates a new instance of this class.
       
    59          *
       
    60          * @param aObserver             Observer.
       
    61          * @param aContactLinks         Contact links to operate with.
       
    62          * @param aSelectFieldProperty  Select field property.
       
    63          * @param aNoteFlags            Information note flags.
       
    64          * @return  A new instance of this class.
       
    65          */
       
    66         static CPbk2PrepareMultipleAssignPhase* NewL(
       
    67                 MPbk2ServicePhaseObserver& aObserver,
       
    68                 const MVPbkContactLinkArray* aContactLinks,
       
    69                 MPbk2SelectFieldProperty* aSelectFieldProperty,
       
    70                 TUint& aNoteFlags );
       
    71 
       
    72         /**
       
    73          * Destructor.
       
    74          */
       
    75         ~CPbk2PrepareMultipleAssignPhase();
       
    76 
       
    77     public: // From MPbk2ServicePhase
       
    78         void LaunchServicePhaseL();
       
    79         void CancelServicePhase();
       
    80         void RequestCancelL(
       
    81                 TInt aExitCommandId );
       
    82         void AcceptDelayedL(
       
    83                 const TDesC8& aContactLinkBuffer );
       
    84         MVPbkContactLinkArray* Results() const;
       
    85         TInt ExtraResultData() const;
       
    86         MVPbkStoreContact* TakeStoreContact();
       
    87         HBufC* FieldContent() const;
       
    88 
       
    89     private: // From CActive
       
    90         void RunL();
       
    91         void DoCancel();
       
    92         TInt RunError(
       
    93                 TInt aError );
       
    94 
       
    95     private: // From MPbk2ContactRelocatorObserver
       
    96         void ContactRelocatedL(
       
    97                 MVPbkStoreContact* aRelocatedContact );
       
    98         void ContactRelocationFailed(
       
    99                 TInt aReason,
       
   100                 MVPbkStoreContact* aContact );
       
   101         void ContactsRelocationFailed(
       
   102                 TInt aReason,
       
   103                 CVPbkContactLinkArray* aContacts );
       
   104         void RelocationProcessComplete();
       
   105 
       
   106     private: // From MVPbkSingleContactOperationObserver
       
   107         void VPbkSingleContactOperationComplete(
       
   108                 MVPbkContactOperationBase& aOperation,
       
   109                 MVPbkStoreContact* aContact );
       
   110         void VPbkSingleContactOperationFailed(
       
   111                 MVPbkContactOperationBase& aOperation,
       
   112                 TInt aError );
       
   113 
       
   114     private: // From MPbk2KeyEventHandler
       
   115         TBool Pbk2ProcessKeyEventL(
       
   116                 const TKeyEvent& aKeyEvent,
       
   117                 TEventCode aType );
       
   118 
       
   119     private: // Implementation
       
   120         CPbk2PrepareMultipleAssignPhase(
       
   121                 MPbk2ServicePhaseObserver& aObserver,
       
   122                 MPbk2SelectFieldProperty* aSelectFieldProperty,
       
   123                 TUint& aNoteFlags );
       
   124         void ConstructL(
       
   125                 const MVPbkContactLinkArray* aContactLinks );
       
   126         void RetrieveContactL();
       
   127         void RelocateContactL(
       
   128                 MVPbkStoreContact* aStoreContact );
       
   129         void RelocateContactsL();
       
   130         void PrepareForAssignL();
       
   131         void AppendResultL(
       
   132                 MVPbkContactLink* aContactLink );
       
   133         void SendToRelocationL(
       
   134                 MVPbkContactLink* aContactLink );
       
   135         TBool SupportsFieldL(
       
   136                 TVPbkContactStoreUriPtr aStoreUri );
       
   137         void IssueRequest();
       
   138 
       
   139     private: // Data
       
   140         /// Ref: Observer
       
   141         MPbk2ServicePhaseObserver& iObserver;
       
   142         /// Own: Contact data assigner
       
   143         MPbk2ContactDataAssigner* iContactDataAssigner;
       
   144         /// Ref: Select field property
       
   145         MPbk2SelectFieldProperty* iSelectFieldProperty;
       
   146         /// Ref: Information note flags
       
   147         TUint& iNoteFlags;
       
   148         /// Own: Contact relocator
       
   149         CPbk2ContactRelocator* iContactRelocator;
       
   150         /// Own: Indicates is this destroyed
       
   151         TBool* iDestroyedPtr;
       
   152         /// Own: Results
       
   153         CVPbkContactLinkArray* iResults;
       
   154         /// Own: Contact links to operate with
       
   155         CVPbkContactLinkArray* iContactLinks;
       
   156         /// Own: Contacts to be relocated
       
   157         CVPbkContactLinkArray* iEntriesToRelocate;
       
   158         /// Own: Key event dealer
       
   159         CPbk2KeyEventDealer* iDealer;
       
   160         /// Own: Retrieve contact operation
       
   161         MVPbkContactOperationBase* iRetrieveOperation;
       
   162     };
       
   163 
       
   164 #endif // CPBK2PREPAREMULTIPLEASSIGNPHASE_H
       
   165 
       
   166 // End of File