phonebookui/Phonebook2/ServerApplication/inc/CPbk2SingleAssignDataPhase.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 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         void DenyDelayedL(
       
    95                 const TDesC8& aContactLinkBuffer );
       
    96         MVPbkContactLinkArray* Results() const;
       
    97         TInt ExtraResultData() const;
       
    98         MVPbkStoreContact* TakeStoreContact();
       
    99         HBufC* FieldContent() const;
       
   100 
       
   101     private: // From MPbk2ContactAssignerObserver
       
   102         void AssignComplete(
       
   103                 MPbk2ContactAssigner& aAssigner,
       
   104                 TInt aIndex );
       
   105         void AssignFailed(
       
   106                 MPbk2ContactAssigner& aAssigner,
       
   107                 TInt aErrorCode );
       
   108 
       
   109     private: // From MVPbkContactObserver
       
   110         void ContactOperationCompleted(
       
   111                 TContactOpResult aResult );
       
   112         void ContactOperationFailed(
       
   113                 TContactOp aOpCode,
       
   114                 TInt aErrorCode,
       
   115                 TBool aErrorNotified );
       
   116 
       
   117     private: // From MPbk2EditedContactObserver
       
   118         void ContactEditingComplete(
       
   119                 MVPbkStoreContact* aEditedContact );
       
   120         void ContactEditingDeletedContact(
       
   121                 MVPbkStoreContact* aEditedContact );
       
   122         void ContactEditingAborted();
       
   123 
       
   124     public: // From MPbk2ExitCallback
       
   125         TBool OkToExitL(
       
   126                 TInt aCommandId );
       
   127 
       
   128     private: // Implementation
       
   129         CPbk2SingleAssignDataPhase(
       
   130                 MPbk2ServicePhaseObserver& aObserver,
       
   131                 MVPbkStoreContact* aStoreContact,
       
   132                 MPbk2SelectFieldProperty* aSelectedFieldProperty,
       
   133                 TInt aSelectedFieldIndex,
       
   134                 HBufC* aDataBuffer,
       
   135                 TInt aMimeType,
       
   136                 TCoeHelpContext aHelpContext,
       
   137                 TUint aAssignFlags,
       
   138                 TUint aNoteFlags );
       
   139         void RetrieveContactL();
       
   140         void DoAssignDataL();
       
   141         void HandleContactDataAssignedL(
       
   142                 TInt aIndex );
       
   143         void AppendResultL(
       
   144                 const MVPbkStoreContact* aStoreContact );
       
   145         void DisplayNotesL();
       
   146         TBool IsContactInSelectedMemoryL(
       
   147                 MVPbkStoreContact& aContact );
       
   148         void FinalizeL(
       
   149                 const MVPbkStoreContact* aStoreContact );
       
   150 
       
   151     private: // Data
       
   152         /// Ref: Observer
       
   153         MPbk2ServicePhaseObserver& iObserver;
       
   154         /// Own: Store contact
       
   155         MVPbkStoreContact* iStoreContact;
       
   156         /// Own: Results
       
   157         CVPbkContactLinkArray* iResults;
       
   158         /// Own: To check is this destroyed
       
   159         TBool* iDestroyedPtr;
       
   160         /// Own: Contact data assigner
       
   161         MPbk2ContactAssigner* iContactDataAssigner;
       
   162         /// Own: Selected field index
       
   163         TInt iSelectedFieldIndex;
       
   164         /// Ref: Select field property
       
   165         MPbk2SelectFieldProperty* iSelectedFieldProperty;
       
   166         /// Own: Textual data to assign
       
   167         HBufC* iDataBuffer;
       
   168         /// Own: Mime type
       
   169         TInt iMimeType;
       
   170         /// Ref: Contact editor eliminator
       
   171         MPbk2DialogEliminator* iContactEditorEliminator;
       
   172         /// Own: Editor help context
       
   173         TCoeHelpContext iHelpContext;
       
   174         /// Own: Assign flags set by the consumer
       
   175         TUint iAssignFlags;
       
   176         /// Own: Note flags
       
   177         TUint iNoteFlags;
       
   178         /// Ref: Eikon enviroment
       
   179         CEikonEnv* iEikEnv;
       
   180     };
       
   181 
       
   182 #endif // CPBK2SINGLEASSIGNDATAPHASE_H
       
   183 
       
   184 // End of File