phoneapp/phoneuicontrol/inc/cphonenumberentrymanager.h
changeset 0 5f000ab63145
child 16 4393b07b8c5d
child 50 377c906a8701
child 61 41a7f70b3818
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Manager number entry for state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPONENUMBERENTRYMANAGER_H
       
    20 #define CPONENUMBERENTRYMANAGER_H
       
    21 
       
    22 //INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "cphonestate.h"
       
    26 #include "tphonecmdparamboolean.h"
       
    27 #include "tphonecmdparamkeyevent.h"
       
    28 
       
    29 class CPhoneCbaManager;
       
    30 class MPhoneViewCommandHandle;
       
    31 class MPhoneStateMachine;
       
    32 class MPhoneCustomization;
       
    33 class CPhoneState;
       
    34 class CEikonEnv;
       
    35 
       
    36 /**
       
    37  * Class contains helper functions for NE content
       
    38  *
       
    39  * @lib phoneuicontrol
       
    40  * @since S60 v9.1
       
    41  */
       
    42 NONSHARABLE_CLASS( CPhoneNumberEntryManager ) :  public CBase
       
    43                                              
       
    44     {
       
    45     public:
       
    46         
       
    47         /**
       
    48         * Creates new instance of CPhoneNumberEntryManager
       
    49         * @param aState: Handle to cphonestate.
       
    50         * @param aStateMachine: a state machine
       
    51         * @param aViewCommandHandle: Handle to the PhoneUIView.
       
    52         * @param aCustomization: Handle to customization.
       
    53         * @param aCbaManager: Handle to cphonecbamanager.
       
    54         * @return CPhoneNumberEntryManager* object  
       
    55         */
       
    56         static CPhoneNumberEntryManager* CPhoneNumberEntryManager::NewL(
       
    57                     CPhoneState* aState,
       
    58                     MPhoneViewCommandHandle& aViewCommandHandle,
       
    59                     MPhoneStateMachine& aStateMachine,
       
    60                     MPhoneCustomization* aCustomization,
       
    61                     CPhoneCbaManager& aCbaManager );
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CPhoneNumberEntryManager();    
       
    66         
       
    67     public:
       
    68 
       
    69         /**
       
    70         * Stores the number entry content to the cache
       
    71         */
       
    72         void StoreNumberEntryContentL();
       
    73         
       
    74         /**
       
    75         * Restores the number entry content from the cache 
       
    76         */        
       
    77         void RestoreNumberEntryContentL();
       
    78 
       
    79         /**
       
    80         * Check if number entry content is stored
       
    81         * @param None
       
    82         * @return boolean value indicating that number entry content is stored
       
    83         */
       
    84         TBool IsNumberEntryContentStored();
       
    85         
       
    86         /**
       
    87         * Clears the number entry content cache
       
    88         */        
       
    89         void ClearNumberEntryContentCache();
       
    90         
       
    91         /**
       
    92         * Creates number entry
       
    93         */ 
       
    94         void CreateNumberEntryL();
       
    95         
       
    96         /**
       
    97         * Set Number Entry visibility.
       
    98         * @param aVisible ETrue if numberentry is wanted to be shown
       
    99         *                 (Note ETrue will set NE CBA's)
       
   100         *                 EFalse if numberentry isnt wanted to be shown
       
   101         *                 (Note EFalse doesnt affect to CBA's)
       
   102         */
       
   103         void SetNumberEntryVisibilityL( TPhoneCmdParamBoolean aVisible );
       
   104         
       
   105         /**
       
   106         * Passes create number entry command forward if NE can be created.
       
   107         */
       
   108         void HandleCreateNumberEntryL();
       
   109         
       
   110         /**
       
   111         * Check if number entry is used
       
   112         * @return boolean value indicating that number entry is used
       
   113         */
       
   114         TBool IsNumberEntryUsedL() const;
       
   115         
       
   116         /**
       
   117         * Check if number entry is visible
       
   118         * @return boolean value indicating that number entry is visible
       
   119         */
       
   120         TBool IsNumberEntryVisibleL() const;
       
   121         
       
   122         /**
       
   123          * Returns phone number from the phone number entry.
       
   124          * @return  Phone number
       
   125          */
       
   126         HBufC* PhoneNumberFromEntryLC() const;
       
   127         
       
   128         /**
       
   129         * Informs phoneengine that phone number has been edited i.e. phonenumber parser is run
       
   130         */
       
   131         void HandleNumberEntryEdited();
       
   132         
       
   133         /**
       
   134         * Handles key events in situations when there exists a number entry.
       
   135         * In this case number entry may be visible or hidden.
       
   136         * @param aKeyEvent - key event
       
   137         * @param aEventCode - event code
       
   138         */
       
   139         void KeyEventForExistingNumberEntryL(
       
   140                 const TKeyEvent& aKeyEvent,
       
   141                 TEventCode aEventCode );
       
   142         
       
   143         /**
       
   144         * Returns ETrue if alphanumeric characters are supported.
       
   145         * @param aKeyEvent Key event.
       
   146         * @return ETrue if alphanumeric chars are supported.
       
   147         */
       
   148         TBool IsAlphanumericSupportedAndCharInput(
       
   149                 const TKeyEvent& aKeyEvent ) const;
       
   150         
       
   151         /**
       
   152         * Handle state-specific behaviour when number entry is cleared
       
   153         */
       
   154         void HandleNumberEntryClearedL();
       
   155         
       
   156         /**
       
   157          * Internal number entry handling methods.
       
   158          */
       
   159         void NumberEntryClearL() const;
       
   160          
       
   161         /**
       
   162          * Returns ETrue if NumberEntry is in numeric mode.
       
   163          */
       
   164         TBool NumberEntryInNumericModeL();
       
   165         
       
   166         /**
       
   167          * Toggles alpha numeric mode.
       
   168          */
       
   169         TBool NumberEntryToggleAlphaNumericModeL();
       
   170         
       
   171     private:
       
   172         
       
   173         /**
       
   174         * Checks is given key contains numeric charaters or if customization is used
       
   175         * alphanumeir letters
       
   176         */
       
   177         TBool IsValidAlphaNumericKey( const TKeyEvent& aKeyEvent,
       
   178                 TEventCode aEventCode );
       
   179     
       
   180     private:
       
   181     
       
   182         /**
       
   183         * C++ default constructor.
       
   184         */
       
   185         CPhoneNumberEntryManager(
       
   186                 CPhoneState* aState,
       
   187                 MPhoneViewCommandHandle& aViewCommandHandle,
       
   188                 MPhoneStateMachine& aStateMachine,
       
   189                 MPhoneCustomization* aCustomization,
       
   190                 CPhoneCbaManager& aCbaManager );
       
   191         
       
   192         /**
       
   193         * Symbian constructor
       
   194         */
       
   195         void ConstructL();
       
   196         
       
   197     private:
       
   198         
       
   199         CPhoneState* iState;
       
   200         MPhoneViewCommandHandle& iViewCommandHandle;
       
   201         MPhoneStateMachine& iStateMachine;
       
   202         MPhoneCustomization* iCustomization;
       
   203         CPhoneCbaManager& iCbaManager;
       
   204         
       
   205                 
       
   206         /**
       
   207         * Cache for the number entry content
       
   208         */
       
   209         HBufC* iNumberEntryContent;
       
   210         
       
   211         /**
       
   212         * Internal variable for EikonEnv to avoid
       
   213         * use of static system calls
       
   214         */
       
   215         CEikonEnv& iEnv;
       
   216 
       
   217     };
       
   218 
       
   219 
       
   220 #endif // CPONENUMBERENTRYMANAGER_H