phonebookui/Phonebook2/ServerApplication/inc/CPbk2AddressSelectPhase.h
changeset 0 e686773b3f54
child 15 e8e3147d53eb
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 address select phase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ADDRESSSELECTPHASE_H
       
    20 #define CPBK2ADDRESSSELECTPHASE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MVPbkSingleContactOperationObserver.h>
       
    25 #include <MPbk2KeyEventHandler.h>
       
    26 #include "MPbk2ServicePhase.h"
       
    27 #include <AiwContactSelectionDataTypes.h>
       
    28 #include <MVPbkContactStoreObserver.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CVPbkContactLinkArray;
       
    32 class MPbk2DialogEliminator;
       
    33 class MPbk2ServicePhaseObserver;
       
    34 class MVPbkContactOperationBase;
       
    35 class RVPbkContactFieldDefaultPriorities;
       
    36 class MVPbkStoreContact;
       
    37 class MVPbkStoreContactField;
       
    38 class CPbk2KeyEventDealer;
       
    39 class CEikonEnv;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44  * Phonebook 2 server app address select phase.
       
    45  * Responsible for performing address select.
       
    46  */
       
    47 class CPbk2AddressSelectPhase : public CBase,
       
    48                                 public MPbk2ServicePhase,
       
    49                                 private MVPbkSingleContactOperationObserver,
       
    50                                 private MPbk2KeyEventHandler,
       
    51                                 public MVPbkContactStoreObserver
       
    52     {
       
    53     public: // Construction
       
    54 
       
    55         /**
       
    56          * Creates a new instance of this class.
       
    57          *
       
    58          * @param aObserver         Observer.
       
    59          * @param aContactLinks     Contact links.
       
    60          * @param aPriorities       Address select default priorities.
       
    61          * @param aAddressSelectType       Address select type.
       
    62          * @param aRskBack          Indicates whether the RSK should be Back.
       
    63          * @return  A new instance of this class.
       
    64          */
       
    65         static CPbk2AddressSelectPhase* NewL(
       
    66                 MPbk2ServicePhaseObserver& aObserver,
       
    67                 MVPbkContactLinkArray& aContactLinks,
       
    68                 RVPbkContactFieldDefaultPriorities& aPriorities,
       
    69                 TAiwAddressSelectType aAddressSelectType,
       
    70                 TBool aRskBack );
       
    71 
       
    72         /**
       
    73          * Destructor.
       
    74          */
       
    75         ~CPbk2AddressSelectPhase();
       
    76 
       
    77     public: // From MPbk2ServicePhase
       
    78         void LaunchServicePhaseL();
       
    79         void CancelServicePhase();
       
    80         void RequestCancelL(
       
    81                 TInt aExitCommandId );
       
    82         void AcceptDelayedL(
       
    83                 const TDesC8& aContactLinkBuffer );
       
    84         MVPbkContactLinkArray* Results() const;
       
    85         TInt ExtraResultData() const;
       
    86         MVPbkStoreContact* TakeStoreContact();
       
    87         HBufC* FieldContent() const;
       
    88 
       
    89     public: // From MVPbkSingleContactOperationObserver
       
    90         void VPbkSingleContactOperationComplete(
       
    91                 MVPbkContactOperationBase& aOperation,
       
    92                 MVPbkStoreContact* aContact );
       
    93         void VPbkSingleContactOperationFailed(
       
    94                 MVPbkContactOperationBase& aOperation,
       
    95                 TInt aError );
       
    96 
       
    97     private: // From MPbk2KeyEventHandler
       
    98         TBool Pbk2ProcessKeyEventL(
       
    99                 const TKeyEvent& aKeyEvent,
       
   100                 TEventCode aType );
       
   101                 
       
   102     private: // From MVPbkContactStoreObserver
       
   103         void StoreReady(
       
   104                 MVPbkContactStore& aContactStore );
       
   105         void StoreUnavailable(
       
   106                 MVPbkContactStore& aContactStore,
       
   107                 TInt aReason );
       
   108         void HandleStoreEventL(
       
   109                 MVPbkContactStore& aContactStore,
       
   110                 TVPbkContactStoreEvent aEvent );
       
   111 
       
   112     private: // Implementation
       
   113         CPbk2AddressSelectPhase(
       
   114                 MPbk2ServicePhaseObserver& aObserver,
       
   115                 RVPbkContactFieldDefaultPriorities& aPriorities,                
       
   116                 TBool aRskBack );
       
   117         void ConstructL(
       
   118                 MVPbkContactLinkArray& aContactLinks,
       
   119                 TAiwAddressSelectType aAddressSelectType );
       
   120         void RetrieveContactL();
       
   121         void DoSelectAddressesL();
       
   122         TInt CorrectRSK(
       
   123                 TInt aAddressSelectResourceId );
       
   124         MVPbkStoreContactField* CheckIfFieldAlreadySelectedLC();
       
   125         void AddFieldToResultsAndContinueL(
       
   126                 MVPbkStoreContactField* aField );
       
   127         void AppendResultL(
       
   128                 const MVPbkStoreContactField* aField );
       
   129         TInt AddressSelectResourceId(
       
   130                 TAiwAddressSelectType aType );                
       
   131 
       
   132     private: // Data
       
   133         /// Ref: Observer
       
   134         MPbk2ServicePhaseObserver& iObserver;
       
   135         /// Own: Contact links
       
   136         CVPbkContactLinkArray* iContactLinks;
       
   137         /// Own: Results array
       
   138         CVPbkContactLinkArray* iResults;
       
   139         /// Ref: Address select default priorities
       
   140         RVPbkContactFieldDefaultPriorities& iPriorities;
       
   141         /// Own: Address select resource id
       
   142         TInt iResourceId;
       
   143         /// Own: Indicates whether the RSK should be Back
       
   144         TBool iRskBack;
       
   145         /// Ref: For address select dialog's exit handling
       
   146         MPbk2DialogEliminator* iAddressSelectEliminator;
       
   147         /// Own: Contact retrieve operation
       
   148         MVPbkContactOperationBase* iRetrieveOperation;
       
   149         /// Own: Store contact
       
   150         MVPbkStoreContact* iStoreContact;
       
   151         /// Own: Key event dealer
       
   152         CPbk2KeyEventDealer* iDealer;
       
   153         /// Own: Title resource id
       
   154         TInt iTitleResId;
       
   155         /// Ref: Eikon enviroment
       
   156         CEikonEnv* iEikenv;
       
   157     };
       
   158 
       
   159 #endif // CPBK2ADDRESSSELECTPHASE_H
       
   160 
       
   161 // End of File