phoneuis/easydialing/inc/dialingextensioninterface.h
branchRCL_3
changeset 62 5266b1f337bd
child 81 c26cc2a7c548
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Ecom interface header
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CDIALEREXTENSIONINTERFACE_H
       
    19 #define __CDIALEREXTENSIONINTERFACE_H
       
    20 
       
    21 #include <ecom/ecom.h>
       
    22 #include <coecntrl.h>
       
    23 #include <eikmenup.h>
       
    24 
       
    25 
       
    26 /** UID of dialing extension ECom interface. */
       
    27 const TUid KEasyDialingPluginInterfaceUID = { 0x200212A1 };
       
    28 
       
    29 /** UID of easy dialing plugin. */
       
    30 const TUid KEasyDialingPluginImplementationUID = { 0x200212A0 };
       
    31 
       
    32 /**
       
    33  * Observer class for easy dialing.
       
    34  */
       
    35 class MDialingExtensionObserver
       
    36     {
       
    37 public:
       
    38     
       
    39     /**
       
    40      * Identifiers for easy dialing events.
       
    41      */
       
    42     typedef enum TEvent_enum
       
    43         {
       
    44         
       
    45         /** Contact search has completed. */
       
    46         ESearchComplete = 1,
       
    47         
       
    48         /** Easy dialing has gained or given up the focus. */
       
    49         EFocusChanged,
       
    50         
       
    51         /** Easy dialing has started communication launcher (a.k.a. contact view) */
       
    52         ECCALauncherStarted,
       
    53         
       
    54         /** Communication launcher a.k.a. contact view has been close. */
       
    55         ECCALauncherExit,
       
    56         
       
    57         /** Easy dialing feature has been switched on. */
       
    58         EEasyDialingEnabled,
       
    59         
       
    60         /** Easy dialing feature has been switched off. */
       
    61         EEasyDialingDisabled,
       
    62         
       
    63         /** User has started communication (SMS, IM, E-mail ...). Not used for phone calls. */
       
    64         ECommunicationStarted,
       
    65         
       
    66         /** User has cancelled communication once started. */
       
    67         ECommunicationCancelled
       
    68        
       
    69         } TEvent;
       
    70 
       
    71 
       
    72     /**
       
    73      * Handles event from easy dialing plugin.
       
    74      * 
       
    75      * @param aEvent    Event id.
       
    76      * 
       
    77      */
       
    78     virtual void HandleDialingExtensionEvent( MDialingExtensionObserver::TEvent aEvent ) = 0;
       
    79     };
       
    80 
       
    81 
       
    82 
       
    83 
       
    84 /**
       
    85  * Easy dialing plugin class.
       
    86  */
       
    87 
       
    88 class CDialingExtensionInterface : public CCoeControl
       
    89     {
       
    90 public:
       
    91 
       
    92     
       
    93     /**
       
    94      * Enumeration for keyboard modes. Keyboardmode affect on how search string is matched 
       
    95      * with contacts. 
       
    96      */
       
    97     typedef enum 
       
    98         {
       
    99     
       
   100         /*
       
   101          * ENormalKeyboard is used when there is no QWERTY keyboard, or non-hybrid mode
       
   102          * QWERTY keyboard.
       
   103          */
       
   104         EDefaultKeyboard = 0,
       
   105         
       
   106         /*
       
   107          * EHybridQwerty is used with hybrid mode QWERTY keyboard. Hybrid mode means
       
   108          * that keys where a letter and number share a common key, short press to that key
       
   109          * produces the number, not the letter.
       
   110          */
       
   111         EHybridQwerty
       
   112         
       
   113         } TKeyboardMode;
       
   114     
       
   115     /**
       
   116      * Creates an instance of plugin.
       
   117      */
       
   118     static CDialingExtensionInterface* NewL();
       
   119 
       
   120 
       
   121     /**
       
   122      * Destructor.
       
   123      */
       
   124     virtual ~CDialingExtensionInterface();
       
   125     
       
   126     
       
   127     /**
       
   128      * Does the rest of the initialization of the plugin.
       
   129      * Must be called after NewL before using any other 
       
   130      * functions of the plugin.
       
   131      * 
       
   132      * @param aParent   Parent container of the plugin.
       
   133      */
       
   134     virtual void InitializeL( CCoeControl& aParent ) = 0;
       
   135     
       
   136 
       
   137     /**
       
   138      * Resets the previous search results. 
       
   139      */
       
   140     virtual void Reset() = 0;
       
   141     
       
   142         
       
   143     /**
       
   144      * Adds an observer to the plugin.
       
   145      * 
       
   146      * @param aObserver Observer to be added.
       
   147      */
       
   148     virtual void AddObserverL( MDialingExtensionObserver* aObserver ) = 0;
       
   149    
       
   150     
       
   151     /**
       
   152      * Removes an observer from the plugin.
       
   153      * 
       
   154      * @param aObserver Observer to be removed.
       
   155      */
       
   156     virtual void RemoveObserver( MDialingExtensionObserver* aObserver ) = 0;
       
   157 
       
   158     
       
   159     /**
       
   160      * Sets input string (search string) to plugin.
       
   161      * 
       
   162      * @param aDesC Input string descriptor.
       
   163      */
       
   164     virtual void SetInputL( const TDesC& aDesC ) = 0;
       
   165 
       
   166 
       
   167     /**
       
   168      * Gets the resource id of plugin's control button area resource.
       
   169      * 
       
   170      * @return  Resource id.
       
   171      */
       
   172     virtual TInt CbaResourceId( ) = 0;
       
   173     
       
   174     
       
   175     /**
       
   176      * Gets the resource id of plugin's menu bar resource.
       
   177      * 
       
   178      * @return  Resource id.
       
   179      */
       
   180     virtual TInt MenuResourceId() = 0;
       
   181     
       
   182     
       
   183     /**
       
   184      * Gets the resource id of plugin's menu bar resource.
       
   185      * 
       
   186      * @param   aMenuPane   Menu pane
       
   187      * @param   aMenuResourceId Menu bar resource id.
       
   188      * @return  Resource id.
       
   189      */
       
   190     virtual TBool InitializeMenuPaneL( CEikMenuPane& aMenuPane, TInt aMenuResourceId ) = 0;
       
   191 
       
   192     
       
   193     /**
       
   194      * Handle a command. Supported command IDs are defined in header
       
   195      * easydialingcommands.hrh.
       
   196      * 
       
   197      * @param   aCommand   Command id.
       
   198      * @return  ETrue if command was handled, EFalse otherwise.
       
   199      */
       
   200     virtual TBool HandleCommandL( TInt aCommand ) = 0;
       
   201 
       
   202     
       
   203     /**
       
   204      * Tells if extension is currently enabled from settings.
       
   205      * @return  ETrue if extension is enabled, EFalse otherwise.
       
   206      */
       
   207     virtual TBool IsEnabled() const = 0;
       
   208     
       
   209     
       
   210     /**
       
   211      * Set keyboard mode to be used in matching.
       
   212      * @param  aMode    Mode to be used.
       
   213      */
       
   214     virtual void SetKeyboardMode( TKeyboardMode aMode ) = 0;
       
   215     
       
   216 private: // data
       
   217 
       
   218     /** ECom instance identifier key. */
       
   219     TUid iDestructorIDKey;
       
   220     };
       
   221 
       
   222 
       
   223 
       
   224 // INLINE FUNCTIONS
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // CDialingExtensionInterface::NewL
       
   228 //
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 inline CDialingExtensionInterface* CDialingExtensionInterface::NewL()
       
   232     {
       
   233     // TEComResolverParams resolverParams; // data passed to the plugin
       
   234     // resolverParams.SetDataType();    // no data yet
       
   235 
       
   236     TAny* ptr = REComSession::CreateImplementationL( KEasyDialingPluginImplementationUID,
       
   237                                                      _FOFF( CDialingExtensionInterface, iDestructorIDKey )
       
   238                                                      // resolverParams 
       
   239                                                     );
       
   240 
       
   241     return STATIC_CAST( CDialingExtensionInterface*, ptr );
       
   242     }
       
   243 
       
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // CDialingExtensionInterface::~CDialingExtensionInterface()
       
   247 //
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 inline CDialingExtensionInterface::~CDialingExtensionInterface()
       
   251     {
       
   252     REComSession::DestroyedImplementation( iDestructorIDKey );
       
   253     }
       
   254     
       
   255 #endif //__CDIALEREXTENSIONINTERFACE_H
       
   256 
       
   257 // End of file