phonebookui/Phonebook2/ServerApplication/inc/CPbk2PrepareSingleAssignPhase.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 prepare single assign phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2PREPARESINGLEASSIGNPHASE_H
       
    20 #define CPBK2PREPARESINGLEASSIGNPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2ContactRelocatorObserver.h>
       
    25 #include <CPbk2ContactRelocator.h>
       
    26 #include <MPbk2KeyEventHandler.h>
       
    27 #include "MPbk2ServicePhase.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CVPbkContactLinkArray;
       
    31 class MPbk2ServicePhaseObserver;
       
    32 class MVPbkContactLinkArray;
       
    33 class MPbk2SelectFieldProperty;
       
    34 class MVPbkStoreContact;
       
    35 class CPbk2KeyEventDealer;
       
    36 class CEikonEnv;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41  * Phonebook 2 server app prepare single assign phase.
       
    42  * Responsible for preparing contact for assign.
       
    43  */
       
    44 class CPbk2PrepareSingleAssignPhase :
       
    45                 public CActive,
       
    46                 public MPbk2ServicePhase,
       
    47                 private MPbk2ContactRelocatorObserver,
       
    48                 private MPbk2KeyEventHandler
       
    49     {
       
    50     public: // Construction
       
    51 
       
    52         /**
       
    53          * Creates a new instance of this class.
       
    54          *
       
    55          * @param aObserver             Observer.
       
    56          * @param aStoreContact         Contact to operate with,
       
    57          *                              ownership is taken.
       
    58          * @param aSelectFieldProperty  Select field property.
       
    59          * @param aSelectFieldResult    Result from the select field dialog.
       
    60          * @param aFieldIndex           Index of the field to assign data to.
       
    61          * @param aNoteFlags            Information note flags.
       
    62          * @param aRelocationFlags      Relocation flags.
       
    63          * @return  A new instance of this class.
       
    64          */
       
    65         static CPbk2PrepareSingleAssignPhase* NewL(
       
    66                 MPbk2ServicePhaseObserver& aObserver,
       
    67                 MVPbkStoreContact* aStoreContact,
       
    68                 MPbk2SelectFieldProperty* aSelectFieldProperty,
       
    69                 TInt aSelectFieldResult,
       
    70                 TInt& aFieldIndex,
       
    71                 TUint& aNoteFlags,
       
    72                 TUint aRelocationFlags );
       
    73 
       
    74         /**
       
    75          * Destructor.
       
    76          */
       
    77         ~CPbk2PrepareSingleAssignPhase();
       
    78 
       
    79     public: // From MPbk2ServicePhase
       
    80         void LaunchServicePhaseL();
       
    81         void CancelServicePhase();
       
    82         void RequestCancelL(
       
    83                 TInt aExitCommandId );
       
    84         void AcceptDelayedL(
       
    85                 const TDesC8& aContactLinkBuffer );
       
    86         void DenyDelayedL(
       
    87                 const TDesC8& aContactLinkBuffer );
       
    88         MVPbkContactLinkArray* Results() const;
       
    89         TInt ExtraResultData() const;
       
    90         MVPbkStoreContact* TakeStoreContact();
       
    91         HBufC* FieldContent() const;
       
    92 
       
    93     private: // From CActive
       
    94         void RunL();
       
    95         void DoCancel();
       
    96         TInt RunError(
       
    97                 TInt aError );
       
    98 
       
    99     private: // From MPbk2ContactRelocatorObserver
       
   100         void ContactRelocatedL(
       
   101                 MVPbkStoreContact* aRelocatedContact );
       
   102         void ContactRelocationFailed(
       
   103                 TInt aReason,
       
   104                 MVPbkStoreContact* aContact );
       
   105         void ContactsRelocationFailed(
       
   106                 TInt aReason,
       
   107                 CVPbkContactLinkArray* aContacts );
       
   108         void RelocationProcessComplete();
       
   109 
       
   110     private: // From MPbk2KeyEventHandler
       
   111         TBool Pbk2ProcessKeyEventL(
       
   112                 const TKeyEvent& aKeyEvent,
       
   113                 TEventCode aType );
       
   114 
       
   115     private: // Implementation
       
   116         CPbk2PrepareSingleAssignPhase(
       
   117                 MPbk2ServicePhaseObserver& aObserver,
       
   118                 MVPbkStoreContact* aStoreContact,
       
   119                 MPbk2SelectFieldProperty* aSelectFieldProperty,
       
   120                 TInt aSelectFieldResult,
       
   121                 TInt& aFieldIndex,
       
   122                 TUint& aNoteFlags,
       
   123                 TUint aRelocationFlags );
       
   124         void ConstructL();
       
   125         TBool RelocateContactL(
       
   126                 Pbk2ContactRelocator::TPbk2ContactRelocationQueryPolicy aPolicy,
       
   127                 TBool& aThisDestroyed );
       
   128         TInt QueryForDataReplaceL();
       
   129         TInt QueryForRelocationL();
       
   130         void PrepareForAssignL();
       
   131         TBool IsContactFromPhoneMemoryL(
       
   132                 const MVPbkStoreContact& aStoreContact );
       
   133         void AppendResultL(
       
   134                 const MVPbkStoreContact* aStoreContact );
       
   135         void IssueRequest();
       
   136 
       
   137     private: // Data
       
   138         /// Ref: Observer
       
   139         MPbk2ServicePhaseObserver& iObserver;
       
   140         /// Own: Store contact
       
   141         MVPbkStoreContact* iStoreContact;
       
   142         /// Own: Select field dialog result
       
   143         TInt iSelectFieldResult;
       
   144         /// Ref: Select field property
       
   145         MPbk2SelectFieldProperty* iSelectFieldProperty;
       
   146         /// Ref: Index of the field to assign data to
       
   147         TInt& iFieldIndex;
       
   148         /// Ref: Information note flags
       
   149         TUint& iNoteFlags;
       
   150         /// Own: Contact relocator
       
   151         CPbk2ContactRelocator* iContactRelocator;
       
   152         /// Own: Indicates is this destroyed
       
   153         TBool* iDestroyedPtr;
       
   154         /// Own: Relocation flags
       
   155         TUint iRelocationFlags;
       
   156         /// Own: Results
       
   157         CVPbkContactLinkArray* iResults;
       
   158         /// Own: Key event dealer
       
   159         CPbk2KeyEventDealer* iDealer;
       
   160         /// Ref: Eikon enviroment
       
   161         CEikonEnv* iEikEnv;
       
   162     };
       
   163 
       
   164 #endif // CPBK2PREPARESINGLEASSIGNPHASE_H
       
   165 
       
   166 // End of File