phonebookui/Phonebook2/ServerApplication/inc/CPbk2SingleAssignDataPhase.h
changeset 0 e686773b3f54
child 18 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 contact data assign phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2SINGLEASSIGNDATAPHASE_H
       
    20 #define CPBK2SINGLEASSIGNDATAPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MVPbkContactObserver.h>
       
    25 #include <MPbk2EditedContactObserver.h>
       
    26 #include <MPbk2ExitCallback.h>
       
    27 #include "MPbk2ServicePhase.h"
       
    28 #include "MPbk2ContactAssignerObserver.h"
       
    29 #include <coehelp.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 MPbk2DialogEliminator;
       
    39 class CEikonEnv;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44  * Phonebook 2 server app contact data assign phase.
       
    45  * Responsible for assigning given data to given contacts.
       
    46  */
       
    47 class CPbk2SingleAssignDataPhase : public CBase,
       
    48                                    public MPbk2ServicePhase,
       
    49                                    private MPbk2ContactAssignerObserver,
       
    50                                    private MVPbkContactObserver,
       
    51                                    private MPbk2EditedContactObserver,
       
    52                                    private MPbk2ExitCallback
       
    53     {
       
    54     public: // Construction
       
    55 
       
    56         /**
       
    57          * Creates a new instance of this class.
       
    58          *
       
    59          * @param aObserver             Observer.
       
    60          * @param aStoreContact         Contact to operate with,
       
    61          *                              ownership is taken.
       
    62          * @param aSelectFieldProperty  Selected field property.
       
    63          * @param aSelectedField        Selected field index.
       
    64          * @param aDataBuffer           Textual data to assign.
       
    65          * @param aMimeType             Mime type of the data to assign.
       
    66          * @param aHelpContext          Editor help context.
       
    67          * @param aAssignFlags          Assign flags.
       
    68          * @param aNoteFlags            Information note flags.
       
    69          * @return  A new instance of this class.
       
    70          */
       
    71         static CPbk2SingleAssignDataPhase* NewL(
       
    72                 MPbk2ServicePhaseObserver& aObserver,
       
    73                 MVPbkStoreContact* aStoreContact,
       
    74                 MPbk2SelectFieldProperty* aSelectedFieldProperty,
       
    75                 TInt aSelectedFieldIndex,
       
    76                 HBufC* aDataBuffer,
       
    77                 TInt aMimeType,
       
    78                 TCoeHelpContext aHelpContext,
       
    79                 TUint aAssignFlags,
       
    80                 TUint aNoteFlags );
       
    81 
       
    82         /**
       
    83          * Destructor.
       
    84          */
       
    85         ~CPbk2SingleAssignDataPhase();
       
    86 
       
    87     public: // From MPbk2ServicePhase
       
    88         void LaunchServicePhaseL();
       
    89         void CancelServicePhase();
       
    90         void RequestCancelL(
       
    91                 TInt aExitCommandId );
       
    92         void AcceptDelayedL(
       
    93                 const TDesC8& aContactLinkBuffer );
       
    94         MVPbkContactLinkArray* Results() const;
       
    95         TInt ExtraResultData() const;
       
    96         MVPbkStoreContact* TakeStoreContact();
       
    97         HBufC* FieldContent() const;
       
    98 
       
    99     private: // From MPbk2ContactAssignerObserver
       
   100         void AssignComplete(
       
   101                 MPbk2ContactAssigner& aAssigner,
       
   102                 TInt aIndex );
       
   103         void AssignFailed(
       
   104                 MPbk2ContactAssigner& aAssigner,
       
   105                 TInt aErrorCode );
       
   106 
       
   107     private: // From MVPbkContactObserver
       
   108         void ContactOperationCompleted(
       
   109                 TContactOpResult aResult );
       
   110         void ContactOperationFailed(
       
   111                 TContactOp aOpCode,
       
   112                 TInt aErrorCode,
       
   113                 TBool aErrorNotified );
       
   114 
       
   115     private: // From MPbk2EditedContactObserver
       
   116         void ContactEditingComplete(
       
   117                 MVPbkStoreContact* aEditedContact );
       
   118         void ContactEditingDeletedContact(
       
   119                 MVPbkStoreContact* aEditedContact );
       
   120         void ContactEditingAborted();
       
   121 
       
   122     public: // From MPbk2ExitCallback
       
   123         TBool OkToExitL(
       
   124                 TInt aCommandId );
       
   125 
       
   126     private: // Implementation
       
   127         CPbk2SingleAssignDataPhase(
       
   128                 MPbk2ServicePhaseObserver& aObserver,
       
   129                 MVPbkStoreContact* aStoreContact,
       
   130                 MPbk2SelectFieldProperty* aSelectedFieldProperty,
       
   131                 TInt aSelectedFieldIndex,
       
   132                 HBufC* aDataBuffer,
       
   133                 TInt aMimeType,
       
   134                 TCoeHelpContext aHelpContext,
       
   135                 TUint aAssignFlags,
       
   136                 TUint aNoteFlags );
       
   137         void RetrieveContactL();
       
   138         void DoAssignDataL();
       
   139         void HandleContactDataAssignedL(
       
   140                 TInt aIndex );
       
   141         void AppendResultL(
       
   142                 const MVPbkStoreContact* aStoreContact );
       
   143         void DisplayNotesL();
       
   144         TBool IsContactInSelectedMemoryL(
       
   145                 MVPbkStoreContact& aContact );
       
   146         void FinalizeL(
       
   147                 const MVPbkStoreContact* aStoreContact );
       
   148 
       
   149     private: // Data
       
   150         /// Ref: Observer
       
   151         MPbk2ServicePhaseObserver& iObserver;
       
   152         /// Own: Store contact
       
   153         MVPbkStoreContact* iStoreContact;
       
   154         /// Own: Results
       
   155         CVPbkContactLinkArray* iResults;
       
   156         /// Own: To check is this destroyed
       
   157         TBool* iDestroyedPtr;
       
   158         /// Own: Contact data assigner
       
   159         MPbk2ContactAssigner* iContactDataAssigner;
       
   160         /// Own: Selected field index
       
   161         TInt iSelectedFieldIndex;
       
   162         /// Ref: Select field property
       
   163         MPbk2SelectFieldProperty* iSelectedFieldProperty;
       
   164         /// Own: Textual data to assign
       
   165         HBufC* iDataBuffer;
       
   166         /// Own: Mime type
       
   167         TInt iMimeType;
       
   168         /// Ref: Contact editor eliminator
       
   169         MPbk2DialogEliminator* iContactEditorEliminator;
       
   170         /// Own: Editor help context
       
   171         TCoeHelpContext iHelpContext;
       
   172         /// Own: Assign flags set by the consumer
       
   173         TUint iAssignFlags;
       
   174         /// Own: Note flags
       
   175         TUint iNoteFlags;
       
   176         /// Ref: Eikon enviroment
       
   177         CEikonEnv* iEikEnv;
       
   178     };
       
   179 
       
   180 #endif // CPBK2SINGLEASSIGNDATAPHASE_H
       
   181 
       
   182 // End of File