phonebookui/Phonebook2/ServerApplication/inc/CPbk2MultiAssignDataPhase.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 data assign phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2MULTIASSIGNDATAPHASE_H
       
    20 #define CPBK2MULTIASSIGNDATAPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MVPbkContactObserver.h>
       
    25 #include <MVPbkSingleContactOperationObserver.h>
       
    26 #include <MVPbkBatchOperationObserver.h>
       
    27 #include <MPbk2KeyEventHandler.h>
       
    28 #include "MPbk2ServicePhase.h"
       
    29 #include "MPbk2ContactAssignerObserver.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CVPbkContactLinkArray;
       
    33 class MPbk2ServicePhaseObserver;
       
    34 class MVPbkContactLinkArray;
       
    35 class MVPbkContactOperationBase;
       
    36 class MPbk2SelectFieldProperty;
       
    37 class MPbk2ContactAssigner;
       
    38 class MVPbkStoreContactField;
       
    39 class CPbk2KeyEventDealer;
       
    40 class CEikonEnv;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45  * Phonebook 2 server app contact data assign phase.
       
    46  * Responsible for assigning given data to given contacts.
       
    47  */
       
    48 class CPbk2MultiAssignDataPhase : public CBase,
       
    49                                   public MPbk2ServicePhase,
       
    50                                   private MPbk2ContactAssignerObserver,
       
    51                                   private MVPbkContactObserver,
       
    52                                   private MVPbkSingleContactOperationObserver,
       
    53                                   private MVPbkBatchOperationObserver,
       
    54                                   private MPbk2KeyEventHandler
       
    55     {
       
    56     public: // Construction
       
    57 
       
    58         /**
       
    59          * Creates a new instance of this class.
       
    60          *
       
    61          * @param aObserver             Observer.
       
    62          * @param aContactLinks         Contacts to operate with.
       
    63          * @param aSelectFieldProperty  Selected field property.
       
    64          * @param aDataBuffer           Textual data to assign.
       
    65          * @param aMimeType             Mime type of the data to assign.
       
    66          * @param aNoteFlags            Information note flags.
       
    67          * @return  A new instance of this class.
       
    68          */
       
    69         static CPbk2MultiAssignDataPhase* NewL(
       
    70                 MPbk2ServicePhaseObserver& aObserver,
       
    71                 MVPbkContactLinkArray* aContactLinks,
       
    72                 MPbk2SelectFieldProperty* aSelectedFieldProperty,
       
    73                 HBufC* aDataBuffer,
       
    74                 TInt aMimeType,
       
    75                 TUint aNoteFlags );
       
    76 
       
    77         /**
       
    78          * Destructor.
       
    79          */
       
    80         ~CPbk2MultiAssignDataPhase();
       
    81 
       
    82     public: // From MPbk2ServicePhase
       
    83         void LaunchServicePhaseL();
       
    84         void CancelServicePhase();
       
    85         void RequestCancelL(
       
    86                 TInt aExitCommandId );
       
    87         void AcceptDelayedL(
       
    88                 const TDesC8& aContactLinkBuffer );
       
    89         void DenyDelayedL(
       
    90                 const TDesC8& aContactLinkBuffer );
       
    91         MVPbkContactLinkArray* Results() const;
       
    92         TInt ExtraResultData() const;
       
    93         MVPbkStoreContact* TakeStoreContact();
       
    94         HBufC* FieldContent() const;
       
    95 
       
    96     private: // From MPbk2ContactAssignerObserver
       
    97         void AssignComplete(
       
    98                 MPbk2ContactAssigner& aAssigner,
       
    99                 TInt aIndex );
       
   100         void AssignFailed(
       
   101                 MPbk2ContactAssigner& aAssigner,
       
   102                 TInt aErrorCode );
       
   103 
       
   104     private: // From MVPbkContactObserver
       
   105         void ContactOperationCompleted(
       
   106                 TContactOpResult aResult );
       
   107         void ContactOperationFailed(
       
   108                 TContactOp aOpCode,
       
   109                 TInt aErrorCode,
       
   110                 TBool aErrorNotified );
       
   111 
       
   112     private: // From MVPbkSingleContactOperationObserver
       
   113         void VPbkSingleContactOperationComplete(
       
   114                 MVPbkContactOperationBase& aOperation,
       
   115                 MVPbkStoreContact* aContact );
       
   116         void VPbkSingleContactOperationFailed(
       
   117                 MVPbkContactOperationBase& aOperation,
       
   118                 TInt aError );
       
   119 
       
   120     private: // From MVPbkBatchOperationObserver
       
   121         void StepComplete(
       
   122                 MVPbkContactOperationBase& aOperation,
       
   123                 TInt aStepSize );
       
   124         TBool StepFailed(
       
   125                 MVPbkContactOperationBase& aOperation,
       
   126                 TInt aStepSize,
       
   127                 TInt aError );
       
   128         void OperationComplete(
       
   129                 MVPbkContactOperationBase& aOperation );
       
   130 
       
   131     private: // From MPbk2KeyEventHandler
       
   132         TBool Pbk2ProcessKeyEventL(
       
   133                 const TKeyEvent& aKeyEvent,
       
   134                 TEventCode aType );
       
   135 
       
   136     private: // Implementation
       
   137         CPbk2MultiAssignDataPhase(
       
   138                 MPbk2ServicePhaseObserver& aObserver,
       
   139                 MPbk2SelectFieldProperty* aSelectedFieldProperty,
       
   140                 HBufC* aDataBuffer,
       
   141                 TInt aMimeType,
       
   142                 TUint aNoteFlags );
       
   143         void ConstructL(
       
   144                 MVPbkContactLinkArray* aContactLinks );
       
   145         void AssignDataL();
       
   146         TBool SelectContactFieldL(
       
   147                 MVPbkStoreContactField*& aField );
       
   148         void AppendResultL(
       
   149                 MVPbkStoreContact* aStoreContact );
       
   150         void DisplayNotesL();
       
   151         void AppendResultAndContinueL(
       
   152                 MVPbkStoreContact* aContact );
       
   153         void RetrieveContactL();
       
   154         void CommitContactsL();
       
   155         void ContinueL();
       
   156         void Finalize();
       
   157 
       
   158     private: // Data
       
   159         /// Ref: Observer
       
   160         MPbk2ServicePhaseObserver& iObserver;
       
   161         /// Own: Contacts to operate with
       
   162         CVPbkContactLinkArray* iContactLinks;
       
   163         /// Own: Results
       
   164         CVPbkContactLinkArray* iResults;
       
   165         /// Own: Store contact
       
   166         MVPbkStoreContact* iStoreContact;
       
   167         /// Own: Array of store contacts
       
   168         CArrayPtrFlat<MVPbkStoreContact>* iStoreContacts;
       
   169         /// Own: To check is this destroyed
       
   170         TBool* iDestroyedPtr;
       
   171         /// Own: Contact retrieve operation
       
   172         MVPbkContactOperationBase* iRetrieveOperation;
       
   173         /// Own: Commit operation
       
   174         MVPbkContactOperationBase* iCommitOperation;
       
   175         /// Own: Contact data assigner
       
   176         MPbk2ContactAssigner* iContactDataAssigner;
       
   177         /// Ref: Select field property
       
   178         MPbk2SelectFieldProperty* iSelectedFieldProperty;
       
   179         /// Own: Textual data to assign
       
   180         HBufC* iDataBuffer;
       
   181         /// Own: Mime type
       
   182         TInt iMimeType;
       
   183         /// Own: Note flags
       
   184         TUint iNoteFlags;
       
   185         /// Own: Contacts processed
       
   186         TInt iContactsProcessed;
       
   187         /// Own: Key event dealer
       
   188         CPbk2KeyEventDealer* iDealer;
       
   189         /// Own: Indicates cancellation
       
   190         TBool iOperationCancelled;
       
   191         /// Ref: Eikon enviroment
       
   192         CEikonEnv* iEikenv;
       
   193     };
       
   194 
       
   195 #endif // CPBK2MULTIASSIGNDATAPHASE_H
       
   196 
       
   197 // End of File