phonebookui/Phonebook2/ServerApplication/inc/CPbk2AssignAttributePhase.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 contact attribute assign phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ASSIGNATTRIBUTEPHASE_H
       
    20 #define CPBK2ASSIGNATTRIBUTEPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <Pbk2ServerAppIPC.h>
       
    25 #include <MVPbkSingleContactOperationObserver.h>
       
    26 #include <MVPbkContactObserver.h>
       
    27 #include "MPbk2ServicePhase.h"
       
    28 #include "MPbk2ContactAssignerObserver.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CVPbkContactLinkArray;
       
    32 class MPbk2ServicePhaseObserver;
       
    33 class MVPbkContactLinkArray;
       
    34 class MVPbkContactOperationBase;
       
    35 class MPbk2ContactAssigner;
       
    36 class MVPbkStoreContact;
       
    37 class MVPbkStoreContactField;
       
    38 class CEikonEnv;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * Phonebook 2 server app contact attribute assign phase.
       
    44  * Responsible for assigning given attribute to given contact.
       
    45  */
       
    46 class CPbk2AssignAttributePhase : public CBase,
       
    47                                   public MPbk2ServicePhase,
       
    48                                   private MPbk2ContactAssignerObserver,
       
    49                                   private MVPbkContactObserver,
       
    50                                   private MVPbkSingleContactOperationObserver
       
    51     {
       
    52     public: // Construction
       
    53 
       
    54         /**
       
    55          * Creates a new instance of this class.
       
    56          *
       
    57          * @param aObserver             Observer.
       
    58          * @param aStoreContact         Contact to operate with,
       
    59          *                              ownership is taken.
       
    60          * @param aAttributeData        Attribute data to assign.
       
    61          * @param aRemoveAttribute      Remove attribute indicator.
       
    62          * @return  A new instance of this class.
       
    63          */
       
    64         static CPbk2AssignAttributePhase* NewL(
       
    65                 MPbk2ServicePhaseObserver& aObserver,
       
    66                 MVPbkContactLinkArray* aContactLinks,
       
    67                 TPbk2AttributeAssignData aAttributeData,
       
    68                 TBool aRemoveAttribute );
       
    69 
       
    70         /**
       
    71          * Destructor.
       
    72          */
       
    73         ~CPbk2AssignAttributePhase();
       
    74 
       
    75     public: // From MPbk2ServicePhase
       
    76         void LaunchServicePhaseL();
       
    77         void CancelServicePhase();
       
    78         void RequestCancelL(
       
    79                 TInt aExitCommandId );
       
    80         void AcceptDelayedL(
       
    81                 const TDesC8& aContactLinkBuffer );
       
    82         void DenyDelayedL(
       
    83                 const TDesC8& aContactLinkBuffer );
       
    84         MVPbkContactLinkArray* Results() const;
       
    85         TInt ExtraResultData() const;
       
    86         MVPbkStoreContact* TakeStoreContact();
       
    87         HBufC* FieldContent() const;
       
    88 
       
    89     private: // From MPbk2ContactAssignerObserver
       
    90         void AssignComplete(
       
    91                 MPbk2ContactAssigner& aAssigner,
       
    92                 TInt aIndex );
       
    93         void AssignFailed(
       
    94                 MPbk2ContactAssigner& aAssigner,
       
    95                 TInt aErrorCode );
       
    96 
       
    97     private: // From MVPbkSingleContactOperationObserver
       
    98         void VPbkSingleContactOperationComplete(
       
    99                 MVPbkContactOperationBase& aOperation,
       
   100                 MVPbkStoreContact* aContact );
       
   101         void VPbkSingleContactOperationFailed(
       
   102                 MVPbkContactOperationBase& aOperation,
       
   103                 TInt aError );
       
   104 
       
   105     private: // From MVPbkContactObserver
       
   106         void ContactOperationCompleted(
       
   107                 TContactOpResult aResult );
       
   108         void ContactOperationFailed(
       
   109                 TContactOp aOpCode,
       
   110                 TInt aErrorCode,
       
   111                 TBool aErrorNotified );
       
   112 
       
   113     private: // Implementation
       
   114         CPbk2AssignAttributePhase(
       
   115                 MPbk2ServicePhaseObserver& aObserver,
       
   116                 TPbk2AttributeAssignData aAttributeData,
       
   117                 TBool aRemoveAttribute );
       
   118         void ConstructL(
       
   119                 const MVPbkContactLinkArray* aContactLinks );
       
   120         void RetrieveContactL();
       
   121         void RetrieveContactFieldL();
       
   122         void AppendResultL();
       
   123         void FinalizeL();
       
   124         void AssignAttributeL();
       
   125 
       
   126     private: // Data
       
   127         /// Ref: Observer
       
   128         MPbk2ServicePhaseObserver& iObserver;
       
   129         /// Own: Contact attribute assigner
       
   130         MPbk2ContactAssigner* iContactAttributeAssigner;
       
   131         /// Own: Contact links to operate with
       
   132         CVPbkContactLinkArray* iContactLinks;
       
   133         /// Own: Results
       
   134         CVPbkContactLinkArray* iResults;
       
   135         /// Own: Attribute data to assign
       
   136         TPbk2AttributeAssignData iAttributeData;
       
   137         /// Own: Contact retrieve operation
       
   138         MVPbkContactOperationBase* iRetrieveOperation;
       
   139         /// Own: Remove attribute indicator
       
   140         TBool iRemoveAttribute;
       
   141         /// Own: Store contact
       
   142         MVPbkStoreContact* iStoreContact;
       
   143         /// Own: Store contact field
       
   144         MVPbkStoreContactField* iStoreContactField;
       
   145         /// Ref: Eikon enviroment
       
   146         CEikonEnv* iEikEnv;
       
   147     };
       
   148 
       
   149 #endif // CPBK2ASSIGNATTRIBUTEPHASE_H
       
   150 
       
   151 // End of File