phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareAttributeAssignPhase.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 85 38bb213f60ba
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 attribute assign phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2PREPAREATTRIBUTEASSIGNPHASE_H
       
    20 #define CPBK2PREPAREATTRIBUTEASSIGNPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MVPbkSingleContactOperationObserver.h>
       
    25 #include <MPbk2ContactRelocatorObserver.h>
       
    26 #include <CPbk2ContactRelocator.h>
       
    27 #include <MPbk2KeyEventHandler.h>
       
    28 #include <Pbk2ServerAppIPC.h>
       
    29 #include "MPbk2ServicePhase.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CVPbkContactLinkArray;
       
    33 class MPbk2ServicePhaseObserver;
       
    34 class MVPbkContactLinkArray;
       
    35 class MVPbkContactOperationBase;
       
    36 class MVPbkStoreContact;
       
    37 class CPbk2KeyEventDealer;
       
    38 class CEikonEnv;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * Phonebook 2 server app prepare attribute assign phase.
       
    44  * Responsible for preparing contact for assign.
       
    45  */
       
    46 class CPbk2PrepareAttributeAssignPhase :
       
    47                 public CBase,
       
    48                 public MPbk2ServicePhase,
       
    49                 private MVPbkSingleContactOperationObserver,
       
    50                 private MPbk2ContactRelocatorObserver,
       
    51                 private MPbk2KeyEventHandler
       
    52     {
       
    53     public: // Construction
       
    54 
       
    55         /**
       
    56          * Creates a new instance of this class.
       
    57          *
       
    58          * @param aObserver             Observer.
       
    59          * @param aContactLinks         Contacts to operate with.
       
    60          * @param aAttributeData        Attribute data.
       
    61          * @return  A new instance of this class.
       
    62          */
       
    63         static CPbk2PrepareAttributeAssignPhase* NewL(
       
    64                 MPbk2ServicePhaseObserver& aObserver,
       
    65                 MVPbkContactLinkArray* aContactLinks,
       
    66                 TPbk2AttributeAssignData aAttributeData,
       
    67                 TBool aRemoveAttribute );
       
    68 
       
    69         /**
       
    70          * Destructor.
       
    71          */
       
    72         ~CPbk2PrepareAttributeAssignPhase();
       
    73 
       
    74     public: // From MPbk2ServicePhase
       
    75         void LaunchServicePhaseL();
       
    76         void CancelServicePhase();
       
    77         void RequestCancelL(
       
    78                 TInt aExitCommandId );
       
    79         void AcceptDelayedL(
       
    80                 const TDesC8& aContactLinkBuffer );
       
    81         void DenyDelayedL(
       
    82                 const TDesC8& aContactLinkBuffer );
       
    83         MVPbkContactLinkArray* Results() const;
       
    84         TInt ExtraResultData() const;
       
    85         MVPbkStoreContact* TakeStoreContact();
       
    86         HBufC* FieldContent() const;
       
    87 
       
    88     private: // From MVPbkSingleContactOperationObserver
       
    89         void VPbkSingleContactOperationComplete(
       
    90                 MVPbkContactOperationBase& aOperation,
       
    91                 MVPbkStoreContact* aContact );
       
    92         void VPbkSingleContactOperationFailed(
       
    93                 MVPbkContactOperationBase& aOperation,
       
    94                 TInt aError );
       
    95 
       
    96     private: // From MPbk2ContactRelocatorObserver
       
    97         void ContactRelocatedL(
       
    98                 MVPbkStoreContact* aRelocatedContact );
       
    99         void ContactRelocationFailed(
       
   100                 TInt aReason,
       
   101                 MVPbkStoreContact* aContact );
       
   102         void ContactsRelocationFailed(
       
   103                 TInt aReason,
       
   104                 CVPbkContactLinkArray* aContacts );
       
   105         void RelocationProcessComplete();
       
   106 
       
   107     private: // From MPbk2KeyEventHandler
       
   108         TBool Pbk2ProcessKeyEventL(
       
   109                 const TKeyEvent& aKeyEvent,
       
   110                 TEventCode aType );
       
   111 
       
   112     private: // Implementation
       
   113         CPbk2PrepareAttributeAssignPhase(
       
   114                 MPbk2ServicePhaseObserver& aObserver,
       
   115                 TPbk2AttributeAssignData aAttributeData,
       
   116                 TBool aRemoveAttribute );
       
   117         void ConstructL(
       
   118                 MVPbkContactLinkArray& aContactLinks );
       
   119         void RetrieveContactL();
       
   120         void PrepareAssignL();
       
   121         TBool ValidateContactL();
       
   122         TBool ContactMeetsPreconditionsL();
       
   123         TBool ContactNeedsRelocation();
       
   124         void RelocateContactL();
       
   125         void AppendResultL(
       
   126                 const MVPbkStoreContact* aStoreContact );
       
   127         void AppendResultL(
       
   128                 const MVPbkContactLink& aContactLink );
       
   129 
       
   130     private: // Data
       
   131         /// Ref: Observer
       
   132         MPbk2ServicePhaseObserver& iObserver;
       
   133         /// Own: Contact links
       
   134         CVPbkContactLinkArray* iContactLinks;
       
   135         /// Own: Store contact
       
   136         MVPbkStoreContact* iStoreContact;
       
   137         /// Own: Contact relocator
       
   138         CPbk2ContactRelocator* iContactRelocator;
       
   139         /// Own: Key event dealer
       
   140         CPbk2KeyEventDealer* iDealer;
       
   141         /// Own: Attribute data
       
   142         TPbk2AttributeAssignData iAttributeData;
       
   143         /// Own: Results array
       
   144         CVPbkContactLinkArray* iResults;
       
   145         /// Own: Contact retrieve operation
       
   146         MVPbkContactOperationBase* iRetrieveOperation;
       
   147         /// Own: Indicates is this a attribute removal operation
       
   148         TBool iRemoveAttribute;
       
   149         /// Ref: Eikon enviroment
       
   150         CEikonEnv* iEikenv;
       
   151     };
       
   152 
       
   153 #endif // CPBK2PREPAREATTRIBUTEASSIGNPHASE_H
       
   154 
       
   155 // End of File