hsappkeyhandler/inc/hsappkeyplugin.h
changeset 116 305818acdca4
parent 92 782e3408c2ab
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Main plugin class
    14 * Description:  Main plugin class
    15  *
    15 *
    16 */
    16 */
    17 
       
    18 
    17 
    19 #ifndef HSAPPKEYPLUGIN_H
    18 #ifndef HSAPPKEYPLUGIN_H
    20 #define HSAPPKEYPLUGIN_H
    19 #define HSAPPKEYPLUGIN_H
    21 
    20 
    22 #include <sysapkeyhandlerplugininterface.h>
    21 #include <sysapkeyhandlerplugininterface.h>
    23 #include <hb/hbcore/hbdevicedialogsymbian.h>
    22 #include <hb/hbcore/hbdevicedialogsymbian.h>
    24 
    23 
    25 class CEikonEnv;
    24 class CEikonEnv;
    26 class CHbDeviceDialogSymbian;
       
    27 
    25 
    28 /**
    26 /**
    29 *  CAppKeyPlugin
    27 *  CAppKeyPlugin
    30 *  An implementation of the CSysapKeyHandlerPlugin definition. The plugin handles EKeyXXX events.
    28 *  An implementation of the CSysapKeyHandlerPlugin definition. The plugin handles EKeyXXX events.
    31 *  This is concrete class, instance of which
    29 *  This is concrete class, instance of which
    34 *  @since Series 60 version 3.1
    32 *  @since Series 60 version 3.1
    35 */
    33 */
    36 class CHsAppKeyPlugin : public CSysapKeyHandlerPlugin,
    34 class CHsAppKeyPlugin : public CSysapKeyHandlerPlugin,
    37                         public MHbDeviceDialogObserver
    35                         public MHbDeviceDialogObserver
    38     {
    36     {
    39     public: // Constructors and destructor
    37 public: // Constructors and destructor
    40         /**
    38     /**
    41         * Two-phased constructor.
    39     * Two-phased constructor.
    42         */
    40     */
    43         static CHsAppKeyPlugin* NewL();
    41     static CHsAppKeyPlugin* NewL();
    44         
       
    45         /**
       
    46         * Destructor.
       
    47         */
       
    48         virtual ~CHsAppKeyPlugin();
       
    49     public: //MHbDeviceDialogObserver interfaces
       
    50         void DataReceived(CHbSymbianVariantMap& aData);
       
    51         
       
    52         void DeviceDialogClosed(TInt aCompletionCode);
       
    53     
       
    54     public: // New functions
       
    55         /**
       
    56         * HandleKeyEventL
       
    57         * @since Series 60 Series60_version 3.0
       
    58         * @param const TKeyEvent& aKeyEvent, TEventCode aType
       
    59         * @return TKeyResponse If key was consumed. Generally it should be, since the KEF calls the plugins only with the right key.
       
    60         */
       
    61         virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, 
       
    62                                               TEventCode aType );
       
    63 
    42 
    64         /**
    43     /**
    65         * Provides the key events that the plugin wants to listen to.
    44     * Destructor.
    66         * Plugins should overload this method if they are of version 2 or higher.
    45     */
    67         * iCode, iScanCode and iModifiers MUST be defined in each TKeyEvent.
    46     virtual ~CHsAppKeyPlugin();
    68         *
       
    69         * @since S60 5.1
       
    70         * @return array of key events
       
    71         */
       
    72         void ProvideKeyEventsL( RArray<TKeyEvent>& aKeyEventArray );
       
    73     private: // Constructors
       
    74         /**
       
    75         * C++ default constructor.
       
    76         */
       
    77         CHsAppKeyPlugin();
       
    78 
    47 
    79         /**
    48 public: //MHbDeviceDialogObserver interfaces
    80         * By default Symbian 2nd phase constructor is private.
    49     void DataReceived( CHbSymbianVariantMap& aData );
    81         */
    50     void DeviceDialogClosed( TInt aCompletionCode );
    82         void ConstructL();
       
    83         
       
    84         void HandleShortPressL();
       
    85         
       
    86         void HandleLongPressL();
       
    87 
    51 
    88     private: //data
    52 public: // New functions
    89         /** Cached pointer to the CEikonEnv singelton instance */
    53     /**
    90         CEikonEnv* iEikEnv;
    54     * HandleKeyEventL
    91         TBool iSecondEvent;
    55     * @since Series 60 Series60_version 3.0
    92         CHbDeviceDialogSymbian* mDialog;
    56     * @param const TKeyEvent& aKeyEvent, TEventCode aType
       
    57     * @return TKeyResponse If key was consumed. Generally it should be, since the KEF calls the plugins only with the right key.
       
    58     */
       
    59     virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,
       
    60                                           TEventCode aType );
       
    61 
       
    62     /**
       
    63     * Provides the key events that the plugin wants to listen to.
       
    64     * Plugins should overload this method if they are of version 2 or higher.
       
    65     * iCode, iScanCode and iModifiers MUST be defined in each TKeyEvent.
       
    66     *
       
    67     * @since S60 5.1
       
    68     * @return array of key events
       
    69     */
       
    70     void ProvideKeyEventsL( RArray<TKeyEvent>& aKeyEventArray );
       
    71 
       
    72 private: // Constructors
       
    73     /**
       
    74     * C++ default constructor.
       
    75     */
       
    76     CHsAppKeyPlugin();
       
    77 
       
    78     /**
       
    79     * By default Symbian 2nd phase constructor is private.
       
    80     */
       
    81     void ConstructL();
       
    82 
       
    83 private: // helper methods
       
    84     void HandleShortPressL();
       
    85     void HandleLongPressL();
       
    86     void DismissTaskSwitcher();
       
    87 
       
    88 private: //data
       
    89     CEikonEnv* iEikEnv;
       
    90     TBool iSecondEvent;
       
    91     CHbDeviceDialogSymbian* iDialog;
    93     };
    92     };
    94 
    93 
    95 #endif // HSAPPKEYPLUGIN_H
    94 #endif // HSAPPKEYPLUGIN_H
    96 
       
    97 // End of File
       
    98 
       
    99 
       
   100