phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareAttributeAssignPhase.h
changeset 0 e686773b3f54
child 58 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 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         MVPbkContactLinkArray* Results() const;
       
    82         TInt ExtraResultData() const;
       
    83         MVPbkStoreContact* TakeStoreContact();
       
    84         HBufC* FieldContent() const;
       
    85 
       
    86     private: // From MVPbkSingleContactOperationObserver
       
    87         void VPbkSingleContactOperationComplete(
       
    88                 MVPbkContactOperationBase& aOperation,
       
    89                 MVPbkStoreContact* aContact );
       
    90         void VPbkSingleContactOperationFailed(
       
    91                 MVPbkContactOperationBase& aOperation,
       
    92                 TInt aError );
       
    93 
       
    94     private: // From MPbk2ContactRelocatorObserver
       
    95         void ContactRelocatedL(
       
    96                 MVPbkStoreContact* aRelocatedContact );
       
    97         void ContactRelocationFailed(
       
    98                 TInt aReason,
       
    99                 MVPbkStoreContact* aContact );
       
   100         void ContactsRelocationFailed(
       
   101                 TInt aReason,
       
   102                 CVPbkContactLinkArray* aContacts );
       
   103         void RelocationProcessComplete();
       
   104 
       
   105     private: // From MPbk2KeyEventHandler
       
   106         TBool Pbk2ProcessKeyEventL(
       
   107                 const TKeyEvent& aKeyEvent,
       
   108                 TEventCode aType );
       
   109 
       
   110     private: // Implementation
       
   111         CPbk2PrepareAttributeAssignPhase(
       
   112                 MPbk2ServicePhaseObserver& aObserver,
       
   113                 TPbk2AttributeAssignData aAttributeData,
       
   114                 TBool aRemoveAttribute );
       
   115         void ConstructL(
       
   116                 MVPbkContactLinkArray& aContactLinks );
       
   117         void RetrieveContactL();
       
   118         void PrepareAssignL();
       
   119         TBool ValidateContactL();
       
   120         TBool ContactMeetsPreconditionsL();
       
   121         TBool ContactNeedsRelocation();
       
   122         void RelocateContactL();
       
   123         void AppendResultL(
       
   124                 const MVPbkStoreContact* aStoreContact );
       
   125         void AppendResultL(
       
   126                 const MVPbkContactLink& aContactLink );
       
   127 
       
   128     private: // Data
       
   129         /// Ref: Observer
       
   130         MPbk2ServicePhaseObserver& iObserver;
       
   131         /// Own: Contact links
       
   132         CVPbkContactLinkArray* iContactLinks;
       
   133         /// Own: Store contact
       
   134         MVPbkStoreContact* iStoreContact;
       
   135         /// Own: Contact relocator
       
   136         CPbk2ContactRelocator* iContactRelocator;
       
   137         /// Own: Key event dealer
       
   138         CPbk2KeyEventDealer* iDealer;
       
   139         /// Own: Attribute data
       
   140         TPbk2AttributeAssignData iAttributeData;
       
   141         /// Own: Results array
       
   142         CVPbkContactLinkArray* iResults;
       
   143         /// Own: Contact retrieve operation
       
   144         MVPbkContactOperationBase* iRetrieveOperation;
       
   145         /// Own: Indicates is this a attribute removal operation
       
   146         TBool iRemoveAttribute;
       
   147         /// Ref: Eikon enviroment
       
   148         CEikonEnv* iEikenv;
       
   149     };
       
   150 
       
   151 #endif // CPBK2PREPAREATTRIBUTEASSIGNPHASE_H
       
   152 
       
   153 // End of File