phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareMultipleAssignPhase.h
branchRCL_3
changeset 20 f4a778e096c2
equal deleted inserted replaced
19:5b6f26637ad3 20: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 #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         void DenyDelayedL(
       
    85                 const TDesC8& aContactLinkBuffer );
       
    86         MVPbkContactLinkArray* Results() const;
       
    87         TInt ExtraResultData() const;
       
    88         MVPbkStoreContact* TakeStoreContact();
       
    89         HBufC* FieldContent() const;
       
    90 
       
    91     private: // From CActive
       
    92         void RunL();
       
    93         void DoCancel();
       
    94         TInt RunError(
       
    95                 TInt aError );
       
    96 
       
    97     private: // From MPbk2ContactRelocatorObserver
       
    98         void ContactRelocatedL(
       
    99                 MVPbkStoreContact* aRelocatedContact );
       
   100         void ContactRelocationFailed(
       
   101                 TInt aReason,
       
   102                 MVPbkStoreContact* aContact );
       
   103         void ContactsRelocationFailed(
       
   104                 TInt aReason,
       
   105                 CVPbkContactLinkArray* aContacts );
       
   106         void RelocationProcessComplete();
       
   107 
       
   108     private: // From MVPbkSingleContactOperationObserver
       
   109         void VPbkSingleContactOperationComplete(
       
   110                 MVPbkContactOperationBase& aOperation,
       
   111                 MVPbkStoreContact* aContact );
       
   112         void VPbkSingleContactOperationFailed(
       
   113                 MVPbkContactOperationBase& aOperation,
       
   114                 TInt aError );
       
   115 
       
   116     private: // From MPbk2KeyEventHandler
       
   117         TBool Pbk2ProcessKeyEventL(
       
   118                 const TKeyEvent& aKeyEvent,
       
   119                 TEventCode aType );
       
   120 
       
   121     private: // Implementation
       
   122         CPbk2PrepareMultipleAssignPhase(
       
   123                 MPbk2ServicePhaseObserver& aObserver,
       
   124                 MPbk2SelectFieldProperty* aSelectFieldProperty,
       
   125                 TUint& aNoteFlags );
       
   126         void ConstructL(
       
   127                 const MVPbkContactLinkArray* aContactLinks );
       
   128         void RetrieveContactL();
       
   129         void RelocateContactL(
       
   130                 MVPbkStoreContact* aStoreContact );
       
   131         void RelocateContactsL();
       
   132         void PrepareForAssignL();
       
   133         void AppendResultL(
       
   134                 MVPbkContactLink* aContactLink );
       
   135         void SendToRelocationL(
       
   136                 MVPbkContactLink* aContactLink );
       
   137         TBool SupportsFieldL(
       
   138                 TVPbkContactStoreUriPtr aStoreUri );
       
   139         void IssueRequest();
       
   140 
       
   141     private: // Data
       
   142         /// Ref: Observer
       
   143         MPbk2ServicePhaseObserver& iObserver;
       
   144         /// Own: Contact data assigner
       
   145         MPbk2ContactDataAssigner* iContactDataAssigner;
       
   146         /// Ref: Select field property
       
   147         MPbk2SelectFieldProperty* iSelectFieldProperty;
       
   148         /// Ref: Information note flags
       
   149         TUint& iNoteFlags;
       
   150         /// Own: Contact relocator
       
   151         CPbk2ContactRelocator* iContactRelocator;
       
   152         /// Own: Indicates is this destroyed
       
   153         TBool* iDestroyedPtr;
       
   154         /// Own: Results
       
   155         CVPbkContactLinkArray* iResults;
       
   156         /// Own: Contact links to operate with
       
   157         CVPbkContactLinkArray* iContactLinks;
       
   158         /// Own: Contacts to be relocated
       
   159         CVPbkContactLinkArray* iEntriesToRelocate;
       
   160         /// Own: Key event dealer
       
   161         CPbk2KeyEventDealer* iDealer;
       
   162         /// Own: Retrieve contact operation
       
   163         MVPbkContactOperationBase* iRetrieveOperation;
       
   164     };
       
   165 
       
   166 #endif // CPBK2PREPAREMULTIPLEASSIGNPHASE_H
       
   167 
       
   168 // End of File