phoneapp/phoneuiview/inc/cphonedialercontroller.h
branchRCL_3
changeset 3 8871b09be73b
parent 0 5f000ab63145
child 4 24062c24fe38
equal deleted inserted replaced
2:c84cf270c54f 3:8871b09be73b
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 
    18 
    19 #ifndef CPHONEDIALERCONTROLLER_H
    19 #ifndef CPHONEDIALERCONTROLLER_H
    20 #define CPHONEDIALERCONTROLLER_H
    20 #define CPHONEDIALERCONTROLLER_H
    21 
    21 
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <akntoolbarobserver.h>
    23 #include "mphonedialercontroller.h"
    24 #include <mnumberentry.h>
       
    25 #include "mphonenumberentrychangedhandler.h"
    24 #include "mphonenumberentrychangedhandler.h"
    26 
    25 
    27 class CAknToolbar;
       
    28 class CPhoneBubbleWrapper;
    26 class CPhoneBubbleWrapper;
    29 class CCoeEnv;
    27 class CCoeEnv;
    30 class CPhoneMenuController;
    28 class MAknsSkinInstance;
    31 class TPhoneCommandParam;
    29 class TPhoneCommandParam;
    32 class CAknButton;
    30 class CPhoneEasyDialingController;
    33 class TAknsItemID;
       
    34 class MPhoneDialerController;
       
    35 class TPhoneCommandParam;
       
    36 
    31 
    37 /**
    32 /**
    38  *  Dialer controller, updates toolbar buttons
    33  *  Dialer controller, provides toolbar button data for the normal mode dialer
    39  *
    34  *
    40  *  @lib PhoneUIView.lib
    35  *  @lib PhoneUIView.lib
    41  *  @since S60 v5.0
    36  *  @since S60 v5.0
    42  */
    37  */
    43 NONSHARABLE_CLASS( CPhoneDialerController ): 
    38 class CPhoneDialerController : 
    44     public CBase, public MAknToolbarObserver, public MNumberEntryObserver,
    39     public CBase,
    45     public MPhoneNumberEntryChangedHandler
    40     public MPhoneDialerController
    46     {
    41     {
    47 public:
    42 public: // constructor and destructor
    48     /**
    43     /**
    49      * Two-phased constructor.
    44      * Two-phased constructor.
       
    45      * @param aBubbleWrapper    Handle to bubble wrapper. Ownership not transferred.
       
    46      *                          May be NULL, but then emergency call state can't be identified
       
    47      * @param aCoeEnv           Handle to coeenv. Ownership not transferred.
       
    48      */
       
    49     static CPhoneDialerController* NewL( CPhoneBubbleWrapper* aBubbleWrapper,
       
    50                                          CCoeEnv& aCoeEnv );
       
    51     /**
       
    52      * Destructor.
       
    53      */
       
    54     IMPORT_C virtual ~CPhoneDialerController();
       
    55     
       
    56 protected: // constructors
       
    57     
       
    58     /**
       
    59      * Constructor.
       
    60      * 
    50      * @param aBubbleWrapper 
    61      * @param aBubbleWrapper 
    51      * @param aCoeEnv 
    62      * @param aCoeEnv 
    52      * @param aMenuController 
    63      */
    53      */
    64     IMPORT_C CPhoneDialerController( CPhoneBubbleWrapper* aBubbleWrapper,
    54     static CPhoneDialerController* NewL( CPhoneBubbleWrapper& aBubbleWrapper,
    65                                      CCoeEnv& aCoeEnv );
    55                                          CCoeEnv& aCoeEnv,
    66     /**
    56                                          CPhoneMenuController& aMenuController );
    67      * Symbian 2nd phase constructor.
    57     /**
    68      * 
    58      * Destructor.
    69      */
    59      */
    70     IMPORT_C void ConstructL();
    60     virtual ~CPhoneDialerController();
    71     
    61     
    72 public: // new methods
    62      /**
    73     
    63      * Updates toolbar buttons according to numberentry state.
    74     /**
    64      *
       
    65      * @since S60 v5.0
       
    66      */
       
    67     void UpdateToolbar();
       
    68     
       
    69      /**
       
    70      * Sets state of dtmf dialer visibility.
       
    71      *
       
    72      * @since S60 v5.0
       
    73      * @param aVisible
       
    74      */    
       
    75     void SetDtmfDialerVisibleL( TBool aVisible );  
       
    76     
       
    77      /**
       
    78      * Returns dtmf dialer visibility status.
       
    79      *
       
    80      * @since S60 v5.0
       
    81      * @return ETrue if DTMF Dialer is visible
       
    82      */     
       
    83     TBool IsDTMFDialerVisible() const;
       
    84     
       
    85      /**
       
    86      * Sets state of restricted dialer.
    75      * Sets state of restricted dialer.
    87      *
    76      *
    88      * @since S60 v5.0
    77      * @since S60 v5.0
    89      * @param aRestricted
    78      * @param aRestricted
    90      */      
    79      */      
    91 	void SetRestrictedDialer( TBool aRestricted );    
    80     void SetRestrictedDialer( TBool aRestricted );    
    92 	
    81     
    93      /**
    82      /**
    94      * Sets state of service code flag.
    83      * Sets state of service code flag.
    95      *
    84      *
    96      * @since S60 v5.0
    85      * @since S60 v5.0
    97      * @param aCommandParam
    86      * @param aCommandParam
    98      */	
    87      */
    99 	void SetServiceCodeFlagL( TPhoneCommandParam* aCommandParam );
    88     void SetServiceCodeFlag( TPhoneCommandParam* aCommandParam );
   100     
    89 
   101 	/**
    90     /**
   102     * Enables toolbar
    91      * Sets handle to the Easy Dialing controller.
   103     *
       
   104     * @since S60 v5.0
       
   105     */ 
       
   106 	void ShowToolbar();
       
   107 
       
   108     /**
       
   109     * Disables toolbar
       
   110     *
       
   111     * @since S60 v5.0
       
   112     */ 
       
   113     void HideToolbar();	
       
   114 
       
   115     /**
       
   116     * Sets custom dialer visible.
       
   117     * @param aCustomController Pointer to dialer extension implementation
       
   118     * @since S60 v5.1
       
   119     */    
       
   120     void ShowCustomizedDialerL( 
       
   121             MPhoneDialerController* aCustomController );
       
   122     
       
   123     /**
       
   124     * Sets custom dialer visible.
       
   125     * @since S60 v5.1
       
   126     */ 
       
   127     void HideCustomizedDialer();
       
   128 	
       
   129     /**
       
   130     * Returns flag indicating if customized dialer is visible.
       
   131     * @return ETrue if customized dialer visible, else EFalse
       
   132     * @since S60 v5.1
       
   133     */   
       
   134     TBool IsCustomizedDialerVisible() const;
       
   135 	
       
   136     /**
       
   137     * Returns sotkeys resource of the customized dialer
       
   138     * @return Customized dialer softkeys resource id
       
   139     * @since S60 v5.1
       
   140     */ 
       
   141     TInt CustomizedCbaResourceId() const;
       
   142 	
       
   143     /**
       
   144     * Returns menu resource of the customized dialer
       
   145     * @return Customized dialer menu resource id
       
   146     * @since S60 v5.1
       
   147     */ 
       
   148     TInt CustomizedMenuResourceId() const;
       
   149 
       
   150 public:     // from MAknToolbarObserver
       
   151     /**
       
   152      * From base class MAknToolbarObserver
       
   153      * Handles toolbar events for a certain toolbar item.
       
   154      *
       
   155      * @param aCommand The command ID of some toolbar item.
       
   156      */ 
       
   157     void OfferToolbarEventL( TInt aCommand );
       
   158     
       
   159     /**
       
   160      * From base class MAknToolbarObserver
       
   161      * Should be used to set the properties of some toolbar components 
       
   162      * before it is drawn.
       
   163      *   
       
   164      * @param aResourceId The resource ID for particular toolbar
       
   165      * @param aToolbar The toolbar object pointer
       
   166      */
       
   167     void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
       
   168     
       
   169 public:     // from MNumberEntryObserver
       
   170     /**
       
   171      * From base class MNumberEntryObserver
       
   172      * Indication that numberentry state changed
       
   173      *
       
   174      * @since S60 v5.0
       
   175      */
       
   176     void NumberEntryStateChanged( TBool aHidePromptText );    
       
   177     
       
   178 public:    // from base class MPhoneNumberEntryChangedHandler
       
   179         
       
   180     /**
       
   181      * From MPhoneNumberEntryChangedHandler
       
   182      * 
    92      * 
   183      * Handles number entry state change. 
    93      * @since S60 v5.2
   184      * Checks has the content of the number entry been modifed.
    94      * @param aController   Easy Dialing controller. Ownership not transferred.
   185      * Informs the via call back functionality the party interested about 
    95      */
   186      * the change. (at the moment phone state machine) 
    96     void SetEasyDialingController( CPhoneEasyDialingController* aController );
   187      * 
    97     
   188      * @since S60 5.0
    98 public: // From MPhoneDialerController
   189      */
    99 
   190      void HandleNumberEntryChanged( );
   100     /**
   191         
   101      * @see MPhoneDialerController
   192      /**
   102      */
   193       * From MPhoneNumberEntryChangedHandler
   103     IMPORT_C TInt CbaResourceId() const;
   194       * 
   104 
   195       * Sets the call back function that is used to get notification when the 
   105     /**
   196       * content of the Number Entry has changed. (Used by the the phone 
   106      * @see MPhoneDialerController
   197       * statemachine.)  
   107      */
   198       * 
   108     IMPORT_C TInt MenuResourceId() const;
   199       * @since S60 5.0
   109 
   200       */
   110     /**
   201      void SetNumberEntryChangedCallBack( TPhoneCommandParam* aCommandParam );
   111      * @see MPhoneDialerController
   202       
   112      */
   203 private:
   113     IMPORT_C const TDesC& NumberEntryPromptTextL();
   204 
   114 
   205     /**
   115     /**
   206      * Creates CAknButton with given parameters and leaves it to 
   116      * @see MPhoneDialerController
   207      * CleanupStack.
   117      */
   208      * 
   118 
   209      * @param aNormalIconId
   119     /**
   210      * @param aNormalMaskId
   120      * @see MPhoneDialerController
   211      * @param aTooltipText
   121      */
   212      * @param aSkinIconId
   122     IMPORT_C TInt GetButtonData( TButtonIndex aIndex, RPointerArray<CButtonData>& aData ) const;
   213      * @param aCommand 
   123     
   214      */  
   124     /**
   215     CAknButton* CreateButtonLC( TInt aNormalIconId,
   125      * @see MPhoneDialerController
   216                                 TInt aNormalMaskId,
   126      */
   217                                 const TDesC& aTooltipText, 
   127     IMPORT_C void SetNumberEntryIsEmpty( TBool aEmpty );
   218                                 const TAknsItemID& aSkinIconId,
   128     
   219                                 TInt aCommand );
   129     /**
   220     
   130      * @see MPhoneDialerController
   221     /**
   131      */
   222      * Creates button set for an empty Number Entry.  
   132     IMPORT_C TInt ButtonState( TButtonIndex aIndex ) const;
   223      */
   133     
   224     void CreateButtonSetNumberEntryEmpty();
   134     /**
   225 
   135      * @see MPhoneDialerController
   226     /**
   136      */
   227      * Creates button set for Number Entry when some charaters 
   137     IMPORT_C TBool ButtonDimmed( TButtonIndex aIndex ) const;
   228      * have been entered.
   138     
   229      */
   139     /**
   230     void CreateButtonSetNumberEntryNotEmpty();
   140      * @see MPhoneDialerController
   231     
   141      */
   232     /**
   142     IMPORT_C TBool EasyDialingAllowed() const;
   233      * Constructor.
   143 
   234      * 
   144 public: // data types
   235      * @param aBubbleWrapper 
   145     /** 
   236      * @param aCoeEnv 
   146      * Initialization data for one toolbar button state.
   237      * @param aMenuController 
   147      */
   238      */
   148     struct TLocalButtonData
   239     CPhoneDialerController( CPhoneBubbleWrapper& aBubbleWrapper,
   149         {
   240                              CCoeEnv& aCoeEnv,
   150         TInt iCommandId;
   241                              CPhoneMenuController& aMenuController );    
   151         TInt iSkinItemIdMinor;
   242     /**
   152         TInt iBitmapIndex;
   243      * Symbian 2nd phase constructor.
   153         TInt iBitmapMaskIndex;
   244      * 
   154         TInt iTooltipResourceId;
   245      */
   155         };
   246     void ConstructL();
   156     
   247     
   157 protected: // methods
   248     /**
   158     
   249      * Searches the skin id for the given icon.
   159     /**
   250      */
   160      * Check is there an emergency call ongoing.
   251     inline TAknsItemID SkinId( TInt aIconIndex );
   161      * @return  ETrue   if there's an active emergency call.
   252     
   162      *          EFalse  otherwise.
   253     /**
   163      */
   254      * Searches the tooltip text for the button using the 
   164     TBool EmergencyCallActive() const;
   255      * the given command id.
   165     
   256      * 
   166     /**
   257      * @param aCommandId the command id
   167      * Create button data object from given source data.
   258      * @param aText     the searched tooltip text
   168      * @param   aSourceData Defines, where the data should be loaded.
   259      */
   169      * @param   aSkin       Skin instance. Ownership not transferred.
   260     void  GetTooltipTextL( TInt aCommandId, HBufC*& aText ); 
   170      * @param   aMifFile    Full path to the MIF file holding the fallback graphics.
   261     
   171      * @return  New CButtonData instance. Ownership is transferred.
   262 private: // data
   172      */
   263     /**
   173     CButtonData* CreateButtonDataL( const TLocalButtonData& aSourceData, 
   264      * AknToolbar. 
   174             MAknsSkinInstance* aSkin, const TDesC& aMifFile ) const;
   265      * Not own.  
   175     
   266      */
   176 protected: // data
   267     CAknToolbar* iToolbar;
       
   268     
       
   269     /**
       
   270      * The reference to the Bubblewrapper
       
   271      */
       
   272     CPhoneBubbleWrapper& iBubbleWrapper;
       
   273     
       
   274     /**
   177     /**
   275      * CoeEnv 
   178      * CoeEnv 
   276      */
   179      */
   277     CCoeEnv& iCoeEnv;
   180     CCoeEnv& iCoeEnv;
   278     
   181     
   279     /**
   182     /**
   280      * Menucontroller
   183      * Handle to the Bubblewrapper. May be NULL. Not owned.
   281      */
   184      */
   282     CPhoneMenuController& iMenuController;    
   185     CPhoneBubbleWrapper* iBubbleWrapper;
   283     
   186     
   284     /**
   187     /**
   285      * Used to check is the Dialer in DTMF mode
   188      * Handle to Easy Dialing controller. May be NULL. Not owned. 
   286      */
   189      */
   287     TBool iDtmfDialerVisible;
   190     CPhoneEasyDialingController* iEasyDialingController;
   288 
   191     
   289     /**
   192     /**
   290      * Used to check is the Dialer in the restricted mode.
   193      * Used to check is the Dialer in the restricted mode.
   291      * 'Send' and 'Add to Contacts' buttons are dimmed.
   194      */
   292      */
   195     TBool iRestrictedDialer;
   293     TBool iRestrictedDialer; 
   196     
   294     
   197     /**
   295     /**
   198      * Used to check is the service code flag set, meaning that number entry
   296      * Used to check is the service code flag set.
   199      * contains a service code rather than phone number.
   297      * Tooltip text is changed between 'Send' or 'Call' 
       
   298      */
   200      */
   299     TBool iServiceCodeFlag;
   201     TBool iServiceCodeFlag;
   300     
   202     
   301     /*
   203     /**
   302      * Is used to check has the hide prompt text flag changed.
   204      * Store availability of phone number (etc) in the number entry.
   303      */
   205      */
   304     TBool iPreviousHidePromptTextStatus;
   206     TBool iNumberAvailable;
   305     
       
   306     // Pointer to dialer extension implementation
       
   307     MPhoneDialerController* iCustomizedDialer;
       
   308     
       
   309     /**
       
   310      * Is used to check should toolbar be updated. 
       
   311      */
       
   312     TBool iUpdateToolbar;
       
   313 
       
   314     };
   207     };
   315 
   208 
   316 #include    "cphonedialercontroller.inl"
       
   317 
       
   318 #endif // CPHONEDIALERCONTROLLER_H
   209 #endif // CPHONEDIALERCONTROLLER_H