|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Default key handling of System Application |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SYSAPDEFAULTKEYHANDLER_H |
|
20 #define SYSAPDEFAULTKEYHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <coedef.h> |
|
24 #include <AknCapServerClient.h> |
|
25 |
|
26 class MSysapCallback; |
|
27 class RAknKeylock2; |
|
28 |
|
29 |
|
30 /** |
|
31 * Default key handling of System Application. |
|
32 * |
|
33 * System Application is responsible for handling certain keys and launching |
|
34 * functionality related to them. This class contains the platform default implementation |
|
35 * of System Application's key handling. |
|
36 * |
|
37 * @lib None. |
|
38 * @since S60 3.2 |
|
39 */ |
|
40 class CSysApDefaultKeyHandler : public CBase |
|
41 { |
|
42 |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Symbian two-phased constructor. |
|
47 * |
|
48 * @since S60 3.2 |
|
49 * @param aCallback reference to System Application callback interface. |
|
50 * @return pointer to a new instance of CSysApDefaultKeyHandler. |
|
51 */ |
|
52 static CSysApDefaultKeyHandler* NewL( MSysapCallback& callback ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CSysApDefaultKeyHandler(); |
|
58 |
|
59 /** |
|
60 * Handles key events |
|
61 * This method impelements the default key handling functionality of System Application. |
|
62 * |
|
63 * @since S60 3.2 |
|
64 * @param aKeyEvent contains information about the key event |
|
65 * @param aType contains information about the type of the key event |
|
66 * @return EKeyWasNotConsumed no key handling applied |
|
67 * EKeyWasConsumed key was handled |
|
68 */ |
|
69 TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
70 |
|
71 /** |
|
72 * Returns whether the key event is considered to be a device mode key event, |
|
73 * which usually causes a transition in the device mode (e.g. grip, flip or twist). |
|
74 * |
|
75 * @since S60 3.2 |
|
76 * @param aKeyEvent key event |
|
77 * @return TBool ETrue key event is considered to be a device mode key |
|
78 * EFalse not a device moed key |
|
79 */ |
|
80 static TBool IsDeviceModeKey( const TKeyEvent& aKeyEvent ); |
|
81 |
|
82 protected: |
|
83 /** |
|
84 * Constructor. |
|
85 * |
|
86 * @param aCallback reference to System Application callback interface. |
|
87 */ |
|
88 CSysApDefaultKeyHandler( MSysapCallback& callback ); |
|
89 |
|
90 private: |
|
91 |
|
92 /** |
|
93 * C++ default constructor. |
|
94 * No implementation. |
|
95 */ |
|
96 CSysApDefaultKeyHandler(); |
|
97 |
|
98 /** |
|
99 * Symbian second-phase constructor. |
|
100 * |
|
101 * @since S60 3.2 |
|
102 */ |
|
103 void ConstructL(); |
|
104 |
|
105 /** |
|
106 * Starts an application or brings an already running application |
|
107 * to foreground. |
|
108 * |
|
109 * @since S60 3.2 |
|
110 * @param aUid UID of the application that is activated |
|
111 * @leave a system wide error code |
|
112 */ |
|
113 void ActivateApplicationL( const TUid aUid ) const; |
|
114 |
|
115 /** |
|
116 * Launches PoC application. |
|
117 * |
|
118 * @since S60 3.2 |
|
119 * @leave a system wide error code |
|
120 */ |
|
121 void LaunchPocL(); |
|
122 |
|
123 #ifndef SYSAP_USE_STARTUP_UI_PHASE |
|
124 /** |
|
125 * Returns whether system is in normal operational state, e.g. |
|
126 * startup activities has been performed. |
|
127 * When the normal state has been reached, it is allowed to activate GUI applications. |
|
128 * |
|
129 * @since S60 3.2 |
|
130 * @return TBool ETrue if the normal operational state has been reached. |
|
131 */ |
|
132 TBool IsStateNormal() const; |
|
133 #endif // SYSAP_USE_STARTUP_UI_PHASE |
|
134 |
|
135 /** |
|
136 * Returns whether UI is ready after boot. |
|
137 */ |
|
138 TBool UiReady() const; |
|
139 |
|
140 /** |
|
141 * Returns whether device lock is on or not. |
|
142 * |
|
143 * @since S60 3.2 |
|
144 * @return TBool ETrue if device lock is enabled, EFalse otherwise. |
|
145 */ |
|
146 TBool IsDeviceLocked() const; |
|
147 |
|
148 /** |
|
149 * Sets display state according to current flip state. |
|
150 * |
|
151 * @since S60 3.2 |
|
152 * @param aFlipOpen flip status, ETrue if flip is open. |
|
153 */ |
|
154 void SetDisplayState( TBool aFlipOpen ) const; |
|
155 |
|
156 /** |
|
157 * Shows keys locked note if keypad/device lock is enabled. |
|
158 * |
|
159 * @since S60 3.2 |
|
160 * @return TBool ETrue if keys are locked and note was shown |
|
161 */ |
|
162 TBool DoShowKeysLockedNote(); |
|
163 |
|
164 private: // data |
|
165 |
|
166 /** |
|
167 * Reference to callback object. |
|
168 */ |
|
169 MSysapCallback& iCallback; |
|
170 |
|
171 /** |
|
172 * Stores camera feature flag state. If ETrue, the system has camera installed. |
|
173 */ |
|
174 TBool iCameraSupported; |
|
175 |
|
176 /** |
|
177 * Stores cover display feature flag state. If ETrue, the system has cover display. |
|
178 */ |
|
179 TBool iCoverDisplaySupported; |
|
180 |
|
181 /** |
|
182 * Pointer to sysap-owned RAknKeylock2* |
|
183 * Not own. |
|
184 */ |
|
185 RAknKeylock2* iKeylock; |
|
186 |
|
187 /** |
|
188 * Handle of the captured camera key event. |
|
189 */ |
|
190 TInt iCapturedEKeyCamera; |
|
191 |
|
192 /** |
|
193 * Handle of the captured twist key open event. |
|
194 */ |
|
195 TInt iCapturedEKeyTwistOpen; |
|
196 |
|
197 /** |
|
198 * Handle of the captured twist key close event. |
|
199 */ |
|
200 TInt iCapturedEKeyTwistClose; |
|
201 |
|
202 /** |
|
203 * Handle of the captured grip key open event. |
|
204 */ |
|
205 TInt iCapturedEKeyGripOpen; |
|
206 |
|
207 /** |
|
208 * Handle of the captured grip key close event. |
|
209 */ |
|
210 TInt iCapturedEKeyGripClose; |
|
211 |
|
212 /** |
|
213 * Handle of the captured PoC key event. |
|
214 */ |
|
215 TInt iCapturedEKeyPoC; |
|
216 |
|
217 /** |
|
218 * Avkon UI Server connection state. |
|
219 */ |
|
220 TBool iAknUiServerConnected; |
|
221 |
|
222 /** |
|
223 * Avkon UI Server |
|
224 */ |
|
225 RAknUiServer iAknUiServer; |
|
226 |
|
227 }; |
|
228 |
|
229 #endif // SYSAPDEFAULTKEYHANDLER_H |