62
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 - 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: Definition of CDialer class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CDIALER_H
|
|
21 |
#define CDIALER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <coecntrl.h>
|
|
25 |
#include <coemain.h>
|
|
26 |
|
|
27 |
#include <peninputsrveventhandler.h>
|
|
28 |
#include <peninputclient.h>
|
|
29 |
#include "mnumberentry.h"
|
|
30 |
#include "mphoneqwertymodeobserver.h"
|
|
31 |
|
|
32 |
// CONSTANTS
|
|
33 |
|
|
34 |
// FORWARD DECLARATIONS
|
|
35 |
class CEikButtonGroupContainer;
|
|
36 |
class CDialerKeyPadContainer;
|
|
37 |
class CDialerNumberEntry;
|
|
38 |
class MNumberEntry;
|
|
39 |
class CEikMenuPane;
|
|
40 |
class CEikonEnv;
|
|
41 |
class CAknEdwinState;
|
|
42 |
class MNumberEntryObserver;
|
|
43 |
class CDialingExtensionInterface;
|
|
44 |
class CDialingExtensionObserver;
|
|
45 |
class CDialerToolbarContainer;
|
|
46 |
class MPhoneDialerController;
|
|
47 |
|
|
48 |
// CLASS DECLARATION
|
|
49 |
|
|
50 |
/**
|
|
51 |
* CDialer class.
|
|
52 |
*
|
|
53 |
* @lib dialer.lib
|
|
54 |
* @since Series60_5.0
|
|
55 |
*
|
|
56 |
* Description:
|
|
57 |
* Dialer is used in two applications, telephony and video telephony.
|
|
58 |
*
|
|
59 |
* In Telephony dialer handles number (number/sip address) input from
|
|
60 |
* user via touch screen, VKB or hw keyboard (ITU-T and QWERTY).
|
|
61 |
*
|
|
62 |
* From host application dialer requires:
|
|
63 |
* - View/container as CCoeControl
|
|
64 |
*
|
|
65 |
*
|
|
66 |
* Usage:
|
|
67 |
*
|
|
68 |
|
|
69 |
// Hide status pane.
|
|
70 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
71 |
{
|
|
72 |
static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi())->
|
|
73 |
StatusPane()->MakeVisible( ETrue);
|
|
74 |
}
|
|
75 |
else
|
|
76 |
{
|
|
77 |
static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi())->
|
|
78 |
StatusPane()->MakeVisible( EFalse );
|
|
79 |
}
|
|
80 |
|
|
81 |
// Calculate dialer area:
|
|
82 |
TRect screenRect(
|
|
83 |
TPoint( 0, 0 ),
|
|
84 |
iCoeEnv->ScreenDevice()->SizeInPixels() );
|
|
85 |
|
|
86 |
TAknLayoutRect appRect;
|
|
87 |
appRect.LayoutRect(
|
|
88 |
screenRect, AknLayout::application_window( screenRect );
|
|
89 |
|
|
90 |
TAknLayoutRect mainRect;
|
|
91 |
mainRect.LayoutRect(
|
|
92 |
appRect.Rect(),
|
|
93 |
AknLayout::main_pane( appRect.Rect(), 0, 1, 0 ) );
|
|
94 |
|
|
95 |
TRect mainPane( mainRect.Rect() );
|
|
96 |
|
|
97 |
// Reduce the space that CBA need from the rect
|
|
98 |
CEikButtonGroupContainer cba = iEikEnv.AppUiFactory()->Cba();
|
|
99 |
TRect mainPane( aRect );
|
|
100 |
cba->ReduceRect( mainPane );
|
|
101 |
|
|
102 |
// Create dialer from container (CCoeControl) that created
|
|
103 |
// dialer window (CreateWindowL).
|
|
104 |
|
|
105 |
|
|
106 |
* In telephony dialer:
|
|
107 |
|
|
108 |
// Create dialer.
|
|
109 |
CDialer* dialer = CDialer::NewL( *this, aDialerArea );
|
|
110 |
|
|
111 |
// Open dialer
|
|
112 |
// Open and show dialer
|
|
113 |
iDialer->CreateNumberEntry();
|
|
114 |
|
|
115 |
// methods in MNumberEntry are available to contol dialer and
|
|
116 |
// get/set text in number entry.
|
|
117 |
|
|
118 |
// Close dialer
|
|
119 |
iDialer->RemoveNumberEntry( );
|
|
120 |
// Delete dialer
|
|
121 |
delete dialer;
|
|
122 |
*
|
|
123 |
*/
|
|
124 |
NONSHARABLE_CLASS(CDialer) :
|
|
125 |
public CCoeControl,
|
|
126 |
public MNumberEntry,
|
|
127 |
public MCoeControlObserver,
|
|
128 |
public MPhoneQwertyModeObserver,
|
|
129 |
public MPenUiActivationHandler
|
|
130 |
{
|
|
131 |
public: // Constructors and destructor
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Two phase constructor
|
|
135 |
* @param aContainer Parent container
|
|
136 |
* @param aRect Area to use for dialer
|
|
137 |
* @param aController Dialer controller providing state data for dialer
|
|
138 |
* @return New instance of Dialer
|
|
139 |
*/
|
|
140 |
IMPORT_C static CDialer* NewL( const CCoeControl& aContainer,
|
|
141 |
const TRect& aRect,
|
|
142 |
MPhoneDialerController* aController );
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Destructor.
|
|
146 |
*/
|
|
147 |
IMPORT_C virtual ~CDialer();
|
|
148 |
|
|
149 |
public: // New functions
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Return MNumberEntry API of Dialer
|
|
153 |
* @return Pointer to MNumberEntry implementation
|
|
154 |
*/
|
|
155 |
IMPORT_C MNumberEntry* NumberEntry();
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Set number entry observer.
|
|
159 |
*/
|
|
160 |
IMPORT_C void SetNumberEntryObserver( MNumberEntryObserver& aObserver );
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Sets controller of the dialer. Controller is responsible of providing
|
|
164 |
* toolbar functions, text prompt, etc, as appropriate for the curret dialer state.
|
|
165 |
*/
|
|
166 |
IMPORT_C void SetControllerL( MPhoneDialerController* aController );
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Gets current controller of the dialer.
|
|
170 |
*/
|
|
171 |
IMPORT_C MPhoneDialerController* Controller();
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Returns pointer to easydialing interface. This can be NULL if
|
|
175 |
* easydialing is not present in device, so value must be checked
|
|
176 |
* before using the interface.
|
|
177 |
*
|
|
178 |
* @return Pointer to easydialing interface
|
|
179 |
*/
|
|
180 |
IMPORT_C CDialingExtensionInterface* GetEasyDialingInterface() const;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* Toolbar of the easydialing layout is owned by the Dialer.
|
|
184 |
* Calling this methods updates status of its buttons.
|
|
185 |
*/
|
|
186 |
IMPORT_C void UpdateToolbar();
|
|
187 |
|
|
188 |
/**
|
|
189 |
* Updates number entry editor to correct state. State depends on
|
|
190 |
* qwerty availability and easydialing and voip settings.
|
|
191 |
*/
|
|
192 |
void UpdateNumberEntryConfiguration();
|
|
193 |
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Relayout and draw control. Also updates toolbar.
|
|
197 |
*/
|
|
198 |
IMPORT_C void RelayoutAndDraw();
|
|
199 |
|
|
200 |
public: // from MNumberEntry
|
|
201 |
|
|
202 |
/**
|
|
203 |
* Sets number entry active.
|
|
204 |
*/
|
|
205 |
void CreateNumberEntry();
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Return pointer to number entry
|
|
209 |
* @return The NE.
|
|
210 |
*/
|
|
211 |
CCoeControl* GetNumberEntry( ) const;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Query, is number entry used.
|
|
215 |
* @return ETrue is NE is used.
|
|
216 |
*/
|
|
217 |
TBool IsNumberEntryUsed( ) const;
|
|
218 |
|
|
219 |
/**
|
|
220 |
* This disables NE drawing but doesn't empty the component.
|
|
221 |
* @param aVisibility NE visible or not.
|
|
222 |
*/
|
|
223 |
void SetNumberEntryVisible(
|
|
224 |
const TBool& aVisibility = ETrue );
|
|
225 |
|
|
226 |
/**
|
|
227 |
* Set Number Entry text.
|
|
228 |
* @param aDesC The text.
|
|
229 |
*/
|
|
230 |
void SetTextToNumberEntry( const TDesC& aDesC );
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Get Number Entry Text.
|
|
234 |
* @param aDes The text.
|
|
235 |
*/
|
|
236 |
void GetTextFromNumberEntry( TDes& aDes );
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Removes NE and empties the buffer.
|
|
240 |
*/
|
|
241 |
void RemoveNumberEntry( );
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Set number entry's editor mode.
|
|
245 |
* @param aMode for number editor input mode.
|
|
246 |
* @return Input mode of the editor.
|
|
247 |
*/
|
|
248 |
TInt ChangeEditorMode( TBool aDefaultMode = EFalse );
|
|
249 |
|
|
250 |
/**
|
|
251 |
* Open VKB
|
|
252 |
*/
|
|
253 |
void OpenVkbL();
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Get number entry's editor mode.
|
|
257 |
* @return Input mode of the editor.
|
|
258 |
*/
|
|
259 |
TInt GetEditorMode() const;
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Resets number entry editor to default values.
|
|
263 |
*/
|
|
264 |
void ResetEditorToDefaultValues();
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Set number entry's prompt text.
|
|
268 |
* @param aPromptText.
|
|
269 |
*/
|
|
270 |
void SetNumberEntryPromptText( const TDesC& aPromptText );
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Enable or disable tactile feedback.
|
|
274 |
* @param aEnable.
|
|
275 |
*/
|
|
276 |
void EnableTactileFeedback( const TBool aEnable );
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Handle Qwerty mode change.
|
|
280 |
* @param aMode 0 = off, 1 = on
|
|
281 |
*/
|
|
282 |
IMPORT_C void HandleQwertyModeChange( TInt aMode );
|
|
283 |
|
|
284 |
/**
|
|
285 |
* @see MIdleQwertyModeObserver.
|
|
286 |
*/
|
|
287 |
IMPORT_C void HandleKeyboardLayoutChange();
|
|
288 |
|
|
289 |
private: // Functions from MCoeControlObserver
|
|
290 |
|
|
291 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
|
|
292 |
|
|
293 |
private: // Functions from CCoeControl
|
|
294 |
|
|
295 |
/**
|
|
296 |
* @see CCoeControl
|
|
297 |
*/
|
|
298 |
void SizeChanged();
|
|
299 |
|
|
300 |
/**
|
|
301 |
* @see CCoeControl
|
|
302 |
*/
|
|
303 |
void PositionChanged();
|
|
304 |
|
|
305 |
/**
|
|
306 |
* @see CCoeControl
|
|
307 |
*/
|
|
308 |
TInt CountComponentControls() const;
|
|
309 |
|
|
310 |
/**
|
|
311 |
* @see CCoeControl
|
|
312 |
*/
|
|
313 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
314 |
|
|
315 |
/**
|
|
316 |
* @see CCoeControl
|
|
317 |
*/
|
|
318 |
void Draw( const TRect& aRect ) const;
|
|
319 |
|
|
320 |
/**
|
|
321 |
* @see CCoeControl
|
|
322 |
*/
|
|
323 |
void FocusChanged( TDrawNow aDrawNow );
|
|
324 |
|
|
325 |
/**
|
|
326 |
* @see CCoeControl
|
|
327 |
*/
|
|
328 |
void MakeVisible( TBool aVisible );
|
|
329 |
|
|
330 |
/**
|
|
331 |
* @see CCoeControl
|
|
332 |
*/
|
|
333 |
void PrepareForFocusGainL();
|
|
334 |
|
|
335 |
/**
|
|
336 |
* @see CCoeControl
|
|
337 |
*/
|
|
338 |
void HandleResourceChange( TInt aType );
|
|
339 |
|
|
340 |
/**
|
|
341 |
* @see CCoeControl
|
|
342 |
*/
|
|
343 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
344 |
|
|
345 |
|
|
346 |
private:
|
|
347 |
|
|
348 |
/**
|
|
349 |
* Constructor
|
|
350 |
*/
|
|
351 |
CDialer();
|
|
352 |
|
|
353 |
/**
|
|
354 |
* 2nd phase constructor.
|
|
355 |
* @param aContainer Parent container
|
|
356 |
* @param aRect Area to use for dialer
|
|
357 |
* @param aController Dialer controller providing state data for dialer
|
|
358 |
*/
|
|
359 |
void ConstructL( const CCoeControl& aContainer,
|
|
360 |
const TRect& aRect,
|
|
361 |
MPhoneDialerController* aController );
|
|
362 |
|
|
363 |
/**
|
|
364 |
* Load resource file.
|
|
365 |
*/
|
|
366 |
void LoadResourceL();
|
|
367 |
|
|
368 |
/**
|
|
369 |
* Unload resource file.
|
|
370 |
*/
|
|
371 |
void UnLoadResources();
|
|
372 |
|
|
373 |
/**
|
|
374 |
* @see CCoeControl::ComponentControl()
|
|
375 |
* @param aIndex control index
|
|
376 |
*/
|
|
377 |
CCoeControl* ComponentControlForDialerMode( const TInt aIndex ) const;
|
|
378 |
|
|
379 |
/**
|
|
380 |
* Returns edwin state
|
|
381 |
* @return Pointer to CAknEdwinState
|
|
382 |
*/
|
|
383 |
CAknEdwinState* EdwinState() const;
|
|
384 |
|
|
385 |
/** Editor types. */
|
|
386 |
enum TEditorType
|
|
387 |
{
|
|
388 |
ENumericEditor,
|
|
389 |
EAlphanumericEditor,
|
|
390 |
EVirtualKeyboardEditor
|
|
391 |
};
|
|
392 |
|
|
393 |
/**
|
|
394 |
* Updates editor flags for virtual
|
|
395 |
* keyboard.
|
|
396 |
*/
|
|
397 |
void UpdateEdwinState( TEditorType aType );
|
|
398 |
|
|
399 |
/**
|
|
400 |
* Disables numeric key sounds, or removed disabling.
|
|
401 |
*/
|
|
402 |
void DisableNumericKeySounds( TBool aSounds );
|
|
403 |
|
|
404 |
/**
|
|
405 |
* Loads easydialing plugin. If loading fails (for instance when
|
|
406 |
* easydialing feature flag is not enabled in the device),
|
|
407 |
* iEasyDialer will be NULL after this function returns.
|
|
408 |
*/
|
|
409 |
void LoadEasyDialingPlugin();
|
|
410 |
|
|
411 |
/**
|
|
412 |
* Checks if Easy dialing is available, allowed, and currently enabled.
|
|
413 |
*
|
|
414 |
* @return ETrue if Easy Dialing is enabked
|
|
415 |
*/
|
|
416 |
TBool EasyDialingEnabled() const;
|
|
417 |
|
|
418 |
/**
|
|
419 |
* Layout number entry component. The used layout depends on
|
|
420 |
* the availability and state of Easy dialing.
|
|
421 |
*/
|
|
422 |
void LayoutNumberEntry( const TRect& aParent, TInt aVariety );
|
|
423 |
|
|
424 |
public:
|
|
425 |
|
|
426 |
/**
|
|
427 |
* @see MPenUiActivationHandler
|
|
428 |
*/
|
|
429 |
void OnPeninputUiDeactivated();
|
|
430 |
|
|
431 |
/**
|
|
432 |
* @see MPenUiActivationHandler
|
|
433 |
*/
|
|
434 |
void OnPeninputUiActivated();
|
|
435 |
|
|
436 |
private: // Data
|
|
437 |
|
|
438 |
// Component controls of dialer.
|
|
439 |
RPointerArray<CCoeControl> iComponentControls;
|
|
440 |
|
|
441 |
// Keypad container - owned
|
|
442 |
CDialerKeyPadContainer* iKeypadArea;
|
|
443 |
|
|
444 |
// Number entry container - owned
|
|
445 |
CDialerNumberEntry* iNumberEntry;
|
|
446 |
|
|
447 |
// Is Number entry (e.g. dialer) being used at the moment
|
|
448 |
TBool iIsUsed;
|
|
449 |
|
|
450 |
// Resource
|
|
451 |
TInt iResourceOffset;
|
|
452 |
|
|
453 |
// Is virtual key board open
|
|
454 |
TBool iVirtualKeyBoardOpen;
|
|
455 |
|
|
456 |
/**
|
|
457 |
* Easydialing plugin. This can be NULL if easydialing feature flag
|
|
458 |
* is not enabled in the device.
|
|
459 |
* Own.
|
|
460 |
*/
|
|
461 |
CDialingExtensionInterface* iEasyDialer;
|
|
462 |
|
|
463 |
/**
|
|
464 |
* Observer for Easydialing.
|
|
465 |
* Own.
|
|
466 |
*/
|
|
467 |
CDialingExtensionObserver* iDialingExtensionObserver;
|
|
468 |
|
|
469 |
/**
|
|
470 |
* Toolbar used in Easy dialing layout.
|
|
471 |
* Own.
|
|
472 |
*/
|
|
473 |
CDialerToolbarContainer* iToolbar;
|
|
474 |
|
|
475 |
/**
|
|
476 |
* Controller rules the mode of the Dialer (e.g. normal, DTMF, restricted...)
|
|
477 |
* Not owned.
|
|
478 |
*/
|
|
479 |
MPhoneDialerController* iController;
|
|
480 |
|
|
481 |
/*
|
|
482 |
* Is qwerty mode on.
|
|
483 |
*/
|
|
484 |
TBool iQwertyMode;
|
|
485 |
|
|
486 |
/**
|
|
487 |
* Is hybrid keyboard mode used.
|
|
488 |
*/
|
|
489 |
TBool iHybridKeyboardMode;
|
|
490 |
|
|
491 |
/**
|
|
492 |
* Server wich sends events via callback when the virtual keyboard is opened/closed.
|
|
493 |
*/
|
|
494 |
RPeninputServer iPeninputServer;
|
|
495 |
|
|
496 |
/**
|
|
497 |
* Current type of the editor field. The field is numeric unless
|
|
498 |
* the device is in QWERTY mode and there is some consumer (like VoIP, EasyDialing)
|
|
499 |
* for the alphabetic characters.
|
|
500 |
*/
|
|
501 |
TEditorType iEditorType;
|
|
502 |
|
|
503 |
/*
|
|
504 |
* ETrue if numeric keysounds are disabled. They are disabled when number
|
|
505 |
* key should produce DTMF tone.
|
|
506 |
*/
|
|
507 |
TBool iNumericKeySoundsDisabled;
|
|
508 |
};
|
|
509 |
|
|
510 |
#endif // CDIALER_H
|
|
511 |
|
|
512 |
// End of File
|