author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:18:17 +0300 | |
branch | RCL_3 |
changeset 26 | 8baf28733c3d |
parent 25 | 5266b1f337bd |
permissions | -rw-r--r-- |
25 | 1 |
/* |
2 |
* Copyright (c) 2007 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: Manager for numberentry |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <eikenv.h> |
|
21 |
#include <eikapp.h> |
|
22 |
#include <gulicon.h> |
|
23 |
#include <w32std.h> |
|
24 |
#include <baclipb.h> // CClipboard |
|
25 |
#include <dialer.rsg> |
|
26 |
#include <eikimage.h> // CEikImage |
|
27 |
#include <barsread.h> // TResourceReader |
|
28 |
#include <featmgr.h> |
|
29 |
#include <eiklabel.h> |
|
30 |
#include <aknappui.h> |
|
31 |
#include <AknUtils.h> |
|
32 |
#include <AknsDrawUtils.h> |
|
33 |
#include <applayout.cdl.h> |
|
34 |
#include <AknLayoutFont.h> |
|
35 |
#include <AknLayout2Def.h> |
|
36 |
#include <AknPhoneNumberEditor.h> |
|
37 |
#include <AknLayout2ScalableDef.h> |
|
38 |
#include <AknsBasicBackgroundControlContext.h> |
|
39 |
#include <AknsFrameBackgroundControlContext.h> |
|
40 |
#include <aknlayoutscalable_apps.cdl.h> |
|
41 |
#include <layoutmetadata.cdl.h> |
|
42 |
||
43 |
#include "cdialernumberentry.h" |
|
44 |
#include "dialercommon.h" |
|
45 |
#include "dialertrace.h" |
|
46 |
#include "dialer.hrh" |
|
47 |
#include "mnumberentry.h" |
|
48 |
#include <dialingextensioninterface.h> |
|
49 |
#include <phoneappcommands.hrh> |
|
50 |
||
51 |
const TInt KNumberEntryControlCount = 2; // = number entry, label |
|
52 |
||
53 |
_LIT( KPhoneValidChars, "0123456789*#+pwPW" ); |
|
54 |
_LIT( KPhoneVanityValidChars, "0123456789*#+pwABCDEFGHIJKLMNOPQRSTUVWXYZ" ); |
|
55 |
||
56 |
const TInt KKeyCtrlA( 1 ); |
|
57 |
const TInt KKeyCtrlC( 3 ); |
|
58 |
const TInt KKeyCtrlV( 22 ); |
|
59 |
const TInt KKeyCtrlX( 24 ); |
|
60 |
||
61 |
// ========================= MEMBER FUNCTIONS ================================ |
|
62 |
||
63 |
// --------------------------------------------------------------------------- |
|
64 |
// NewL |
|
65 |
// Symbian OS two phased constructor |
|
66 |
// |
|
67 |
// --------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
CDialerNumberEntry* CDialerNumberEntry::NewL( |
|
70 |
const CCoeControl& aContainer ) |
|
71 |
{ |
|
72 |
CDialerNumberEntry* self = |
|
73 |
new( ELeave )CDialerNumberEntry( aContainer ); |
|
74 |
CleanupStack::PushL( self ); |
|
75 |
self->ConstructL(); |
|
76 |
CleanupStack::Pop(); // self |
|
77 |
return self; |
|
78 |
} |
|
79 |
||
80 |
||
81 |
// --------------------------------------------------------------------------- |
|
82 |
// ConstructL |
|
83 |
// Symbian OS two phased constructor |
|
84 |
// |
|
85 |
// --------------------------------------------------------------------------- |
|
86 |
// |
|
87 |
void CDialerNumberEntry::ConstructL() |
|
88 |
{ |
|
89 |
DIALER_PRINT("numberentry::ConstructL<"); |
|
90 |
BaseConstructL(); |
|
91 |
||
92 |
// Create number entry editor |
|
93 |
iEditor = new( ELeave ) CAknPhoneNumberEditor; |
|
94 |
iEditor->SetContainerWindowL( *this ); |
|
95 |
iEditor->SetParent( this ); |
|
96 |
iEditor->SetMopParent( this ); |
|
97 |
TResourceReader reader; |
|
98 |
iCoeEnv->CreateResourceReaderLC( reader, R_INPUTFIELD ); |
|
99 |
ConstructEditorFromResourceL( reader ); |
|
100 |
||
101 |
iFrameContext = CAknsFrameBackgroundControlContext::NewL( |
|
102 |
KAknsIIDNone, TRect(0,0,4,4), TRect(1,1,3,3), EFalse ); |
|
103 |
||
104 |
iFrameContext->SetFrame( KAknsIIDQsnFrInput ); |
|
105 |
||
106 |
iFrameContext->SetParentContext( |
|
107 |
AknsDrawUtils::ControlContextOfParent(this) ); |
|
108 |
||
109 |
CleanupStack::PopAndDestroy(); // reader |
|
110 |
iEditor->SetObserver( this ); |
|
111 |
||
112 |
iLabel = new( ELeave ) CEikLabel; |
|
113 |
iLabel->SetContainerWindowL( *this ); |
|
114 |
iLabel->SetParent( this ); |
|
115 |
iLabel->SetMopParent( this ); |
|
116 |
iLabel->SetTextL( KNullDesC ); |
|
117 |
iLabel->MakeVisible( EFalse ); |
|
118 |
CheckLabelSkinningColor(); |
|
119 |
||
120 |
iAppUi = iEikonEnv->EikAppUi(); |
|
121 |
__ASSERT_ALWAYS( iAppUi, DialerPanic( EDialerPanicNoApplicationInstance ) ); |
|
122 |
||
123 |
iLateFocuser = CIdle::NewL( CActive::EPriorityIdle ); |
|
124 |
||
125 |
ActivateL(); |
|
126 |
DIALER_PRINT("numberentry::ConstructL>"); |
|
127 |
} |
|
128 |
||
129 |
||
130 |
// Constructor |
|
131 |
CDialerNumberEntry::CDialerNumberEntry( |
|
132 |
const CCoeControl& aContainer ) |
|
133 |
: CDialerContainerBase ( const_cast<CCoeControl&>(aContainer) ) |
|
134 |
{ |
|
135 |
} |
|
136 |
||
137 |
||
138 |
// Destructor |
|
139 |
CDialerNumberEntry::~CDialerNumberEntry() |
|
140 |
{ |
|
141 |
AknsUtils::DeregisterControlPosition( this ); |
|
142 |
||
143 |
delete iEditor; |
|
144 |
delete iFrameContext; |
|
145 |
delete iLabel; |
|
146 |
||
147 |
if ( iLateFocuser ) |
|
148 |
{ |
|
149 |
iLateFocuser->Cancel(); |
|
150 |
} |
|
151 |
delete iLateFocuser; |
|
152 |
||
153 |
} |
|
154 |
||
155 |
||
156 |
// --------------------------------------------------------------------------- |
|
157 |
// CDialerNumberEntry::SetNumberEntryObserver |
|
158 |
// --------------------------------------------------------------------------- |
|
159 |
// |
|
160 |
void CDialerNumberEntry::SetNumberEntryObserver( |
|
161 |
MNumberEntryObserver& aObserver ) |
|
162 |
{ |
|
163 |
iObserver = &aObserver; |
|
164 |
} |
|
165 |
||
166 |
// --------------------------------------------------------------------------- |
|
167 |
// Delays the setting of focus or removes the focus |
|
168 |
// --------------------------------------------------------------------------- |
|
169 |
// |
|
170 |
void CDialerNumberEntry::SetFocus( TBool aFocus, TDrawNow aDrawNow ) |
|
171 |
{ |
|
172 |
DIALER_PRINT("numberentry::SetFocus<"); |
|
173 |
||
174 |
TBool vkbOpen = ( iEditor->AknEditorFlags() & EAknEditorFlagTouchInputModeOpened ); |
|
175 |
||
26
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
176 |
iLateFocuser->Cancel(); |
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
177 |
|
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
178 |
if ( aFocus && !vkbOpen && iLateFocuserCanBeUsed ) |
25 | 179 |
{ |
180 |
// The setting of focus needs to be delayed, because otherwise |
|
181 |
// editors cursor is drawn first. Cursor can be seen clearly |
|
182 |
// when going from landscape mode homescreen to dialer (when |
|
183 |
// dialer's support for landscape mode has been removed) |
|
184 |
// The reason behind this is that giving a focus to editor will cause |
|
185 |
// enabling of cursor in window server and the window server's |
|
186 |
// render plugin will draw the cursor first, before the |
|
187 |
// dialer gets drawn. The delay in dialer drawing is caused by the |
|
188 |
// screen rotation from landscape to portrait. |
|
189 |
iLateFocuser->Start( TCallBack( SetLateFocus, this ) ); |
|
190 |
} |
|
191 |
else |
|
192 |
{ |
|
193 |
DoSetFocus( aFocus, aDrawNow ); |
|
194 |
} |
|
26
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
195 |
|
25 | 196 |
DIALER_PRINT("numberentry::SetFocus>"); |
197 |
} |
|
198 |
||
199 |
// --------------------------------------------------------------------------- |
|
200 |
// CDialerNumberEntry::SetLateFocus |
|
201 |
// --------------------------------------------------------------------------- |
|
202 |
// |
|
203 |
TInt CDialerNumberEntry::SetLateFocus( TAny* aThis ) |
|
204 |
{ |
|
205 |
DIALER_PRINT("numberentry::SetLateFocus<"); |
|
206 |
CDialerNumberEntry* self = static_cast<CDialerNumberEntry*>( aThis ); |
|
207 |
||
208 |
self->DoSetFocus( ETrue, ENoDrawNow ); |
|
209 |
||
210 |
DIALER_PRINT("numberentry::SetLateFocus>"); |
|
211 |
return KErrNone; |
|
212 |
} |
|
213 |
||
214 |
// --------------------------------------------------------------------------- |
|
215 |
// Set the focuss |
|
216 |
// --------------------------------------------------------------------------- |
|
217 |
// |
|
218 |
void CDialerNumberEntry::DoSetFocus( TBool aFocus, TDrawNow aDrawNow ) |
|
219 |
{ |
|
220 |
DIALER_PRINT("numberentry::DoSetFocus<"); |
|
221 |
// IsFocused() and iEditor->IsFocused() may return other values besides ETrue |
|
222 |
// and EFalse. This is why we need to check their return values against zero |
|
223 |
// and use the result in comparison against aFocus. |
|
224 |
if ( aFocus != (IsFocused() ? ETrue : EFalse) ) |
|
225 |
{ |
|
226 |
CCoeControl::SetFocus( aFocus, aDrawNow ); |
|
227 |
} |
|
228 |
||
229 |
if ( aFocus != (iEditor-> IsFocused() ? ETrue : EFalse ) ) |
|
230 |
{ |
|
231 |
iEditor->SetFocus( aFocus ); |
|
26
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
232 |
} |
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
233 |
|
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
234 |
// Don't allow usage of late focuser until next layout change or Dialer launch |
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
235 |
iLateFocuserCanBeUsed = EFalse; |
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
236 |
|
25 | 237 |
DIALER_PRINT("numberentry::DoSetFocus>"); |
238 |
} |
|
239 |
||
240 |
// --------------------------------------------------------------------------- |
|
241 |
// CDialerNumberEntry::TextLength |
|
242 |
// --------------------------------------------------------------------------- |
|
243 |
// |
|
244 |
TInt CDialerNumberEntry::TextLength() |
|
245 |
{ |
|
246 |
return iEditor->TextLength(); |
|
247 |
} |
|
248 |
||
249 |
// --------------------------------------------------------------------------- |
|
250 |
// CDialerNumberEntry::GetNumberEntry |
|
251 |
// --------------------------------------------------------------------------- |
|
252 |
// |
|
253 |
CCoeControl* CDialerNumberEntry::GetNumberEntry( ) const |
|
254 |
{ |
|
255 |
return iEditor; |
|
256 |
} |
|
257 |
||
258 |
// --------------------------------------------------------------------------- |
|
259 |
// CDialerNumberEntry::CreateNumberEntry |
|
260 |
// --------------------------------------------------------------------------- |
|
261 |
// |
|
262 |
void CDialerNumberEntry::CreateNumberEntry() |
|
263 |
{ |
|
264 |
iEditor->SetFocus( ETrue ); |
|
265 |
} |
|
266 |
||
267 |
// --------------------------------------------------------------------------- |
|
268 |
// CDialerNumberEntry::ChangeEditorMode |
|
269 |
// --------------------------------------------------------------------------- |
|
270 |
// |
|
271 |
TInt CDialerNumberEntry::ChangeEditorMode( TBool aDefaultMode ) |
|
272 |
{ |
|
273 |
return iEditor->ChangeEditorMode( aDefaultMode ); |
|
274 |
} |
|
275 |
||
276 |
// --------------------------------------------------------------------------- |
|
277 |
// CDialerNumberEntry::GetEditorMode |
|
278 |
// --------------------------------------------------------------------------- |
|
279 |
// |
|
280 |
TInt CDialerNumberEntry::GetEditorMode() const |
|
281 |
{ |
|
282 |
return iEditor->GetEditorMode(); |
|
283 |
} |
|
284 |
||
285 |
// --------------------------------------------------------------------------- |
|
286 |
// CDialerNumberEntry::SetTextToNumberEntry |
|
287 |
// --------------------------------------------------------------------------- |
|
288 |
// |
|
289 |
void CDialerNumberEntry::SetTextToNumberEntry( const TDesC& aDesC ) |
|
290 |
{ |
|
291 |
DIALER_PRINT("numberentry::SetTextToNumberEntry<"); |
|
292 |
||
293 |
iEditor->SetText( aDesC ); |
|
294 |
||
295 |
if ( iEasyDialer && iOperationMode == EModeEasyDialing ) |
|
296 |
{ |
|
297 |
TRAP_IGNORE( iEasyDialer->SetInputL( aDesC ) ); |
|
298 |
} |
|
299 |
||
300 |
iEditor->DrawNow(); |
|
301 |
||
302 |
DIALER_PRINT("numberentry::SetTextToNumberEntry>"); |
|
303 |
} |
|
304 |
||
305 |
// --------------------------------------------------------------------------- |
|
306 |
// CDialerNumberEntry::GetTextFromNumberEntry |
|
307 |
// --------------------------------------------------------------------------- |
|
308 |
// |
|
309 |
void CDialerNumberEntry::GetTextFromNumberEntry( TDes& aDes ) |
|
310 |
{ |
|
311 |
iEditor->GetText( aDes ); |
|
312 |
} |
|
313 |
||
314 |
// --------------------------------------------------------------------------- |
|
315 |
// CDialerNumberEntry::Text |
|
316 |
// --------------------------------------------------------------------------- |
|
317 |
// |
|
318 |
TPtrC CDialerNumberEntry::Text() const |
|
319 |
{ |
|
320 |
return iEditor->Text(); |
|
321 |
} |
|
322 |
||
323 |
// --------------------------------------------------------------------------- |
|
324 |
// CDialerNumberEntry::ResetEditorToDefaultValues |
|
325 |
// --------------------------------------------------------------------------- |
|
326 |
// |
|
327 |
void CDialerNumberEntry::ResetEditorToDefaultValues() |
|
328 |
{ |
|
329 |
iEditor->SetFocus( EFalse ); |
|
330 |
SetTextToNumberEntry( KNullDesC ); |
|
331 |
iEditor->ResetEditorToDefaultValues(); |
|
332 |
} |
|
333 |
||
334 |
// --------------------------------------------------------------------------- |
|
335 |
// CDialerNumberEntry::SetNumberEntryPromptTextL |
|
336 |
// |
|
337 |
// --------------------------------------------------------------------------- |
|
338 |
// |
|
339 |
void CDialerNumberEntry::SetNumberEntryPromptTextL( const TDesC& aPromptText ) |
|
340 |
{ |
|
341 |
if ( aPromptText.Length() ) |
|
342 |
{ |
|
343 |
iLabel->MakeVisible( ETrue ); |
|
344 |
} |
|
345 |
else |
|
346 |
{ |
|
347 |
iLabel->MakeVisible( EFalse ); |
|
348 |
} |
|
349 |
||
350 |
iLabel->SetTextL( aPromptText ); |
|
351 |
} |
|
352 |
||
353 |
// ---------------------------------------------------------------------------- |
|
354 |
// CDialerNumberEntry::HandleCommandL |
|
355 |
// Handles NE specific commands. |
|
356 |
// ---------------------------------------------------------------------------- |
|
357 |
// |
|
358 |
TBool CDialerNumberEntry::HandleCommandL( TDialerCommandId aCommand) |
|
359 |
{ |
|
360 |
DIALER_PRINTF("numberentry::HandleCommandL<:", aCommand); |
|
361 |
||
362 |
TBool handled( ETrue ); |
|
363 |
switch ( aCommand ) |
|
364 |
{ |
|
365 |
case EDialerCmdTouchInput: // open touch input (VKB) |
|
366 |
{ |
|
367 |
StartVirtualKeyBoard(); |
|
368 |
} |
|
369 |
break; |
|
370 |
default: |
|
371 |
{ |
|
372 |
handled = EFalse; |
|
373 |
} |
|
374 |
break; |
|
375 |
} |
|
376 |
||
377 |
DIALER_PRINT("numberentry::HandleCommandL>"); |
|
378 |
return handled; |
|
379 |
} |
|
380 |
||
381 |
// --------------------------------------------------------------------------- |
|
382 |
// CDialerNumberEntry::ClearEditorFlags |
|
383 |
// --------------------------------------------------------------------------- |
|
384 |
// |
|
385 |
void CDialerNumberEntry::ClearEditorFlags() |
|
386 |
{ |
|
387 |
iEditor->ResetEditorToDefaultValues(); |
|
388 |
} |
|
389 |
||
390 |
// --------------------------------------------------------------------------- |
|
391 |
// CDialerNumberEntry::HandleControlEventL |
|
392 |
// --------------------------------------------------------------------------- |
|
393 |
// |
|
394 |
void CDialerNumberEntry::HandleControlEventL( CCoeControl* aControl, |
|
395 |
TCoeEvent aEventType ) |
|
396 |
{ |
|
397 |
DIALER_PRINT("numberentry::HandleControlEventL<"); |
|
398 |
||
399 |
if ( aControl == iEditor && aEventType == EEventStateChanged ) |
|
400 |
{ |
|
401 |
HandleEditorFormatting(); |
|
402 |
||
403 |
InformNumberEntryState(); |
|
404 |
||
405 |
iEditor->DrawDeferred(); |
|
406 |
} |
|
407 |
||
408 |
DIALER_PRINT("numberentry::HandleControlEventL>"); |
|
409 |
} |
|
410 |
||
411 |
// --------------------------------------------------------------------------- |
|
412 |
// CDialerNumberEntry::OfferKeyEventL |
|
413 |
// --------------------------------------------------------------------------- |
|
414 |
// |
|
415 |
TKeyResponse CDialerNumberEntry::OfferKeyEventL( |
|
416 |
const TKeyEvent& aKeyEvent, |
|
417 |
TEventCode aType ) |
|
418 |
{ |
|
419 |
TKeyResponse handled = EKeyWasNotConsumed; |
|
420 |
||
421 |
// First, offer keyevent to easy dialer. |
|
422 |
if (iEasyDialer) |
|
423 |
{ |
|
424 |
handled = iEasyDialer->OfferKeyEventL(aKeyEvent, aType); |
|
425 |
} |
|
426 |
||
427 |
// Then to number entry editor. |
|
428 |
if (handled == EKeyWasNotConsumed) |
|
429 |
{ |
|
430 |
// Clipboard support |
|
431 |
if ( aKeyEvent.iCode == KKeyCtrlA ) // CTRL + A |
|
432 |
{ |
|
433 |
iEditor->SelectAllL(); |
|
434 |
handled = EKeyWasConsumed; |
|
435 |
} |
|
436 |
else if ( aKeyEvent.iCode == KKeyCtrlC ) // CTRL + C |
|
437 |
{ |
|
438 |
iEditor->CcpuCopyL(); |
|
439 |
handled = EKeyWasConsumed; |
|
440 |
} |
|
441 |
else if ( aKeyEvent.iCode == KKeyCtrlV ) // CTRL + V |
|
442 |
{ |
|
443 |
iEditor->CcpuPasteL(); |
|
444 |
handled = EKeyWasConsumed; |
|
445 |
} |
|
446 |
else if ( aKeyEvent.iCode == KKeyCtrlX ) // CTRL + X |
|
447 |
{ |
|
448 |
iEditor->CcpuCutL(); |
|
449 |
handled = EKeyWasConsumed; |
|
450 |
} |
|
451 |
// Key events 1 - 28 can be generated by CTRL + key combinations. |
|
452 |
// Filter all unwanted key events, only BS is accepted by editor. |
|
453 |
else if ( aKeyEvent.iCode == EKeyBackspace || aKeyEvent.iCode >= EKeySpace ) |
|
454 |
{ |
|
455 |
handled = iEditor->OfferKeyEventL(aKeyEvent, aType); |
|
456 |
} |
|
457 |
} |
|
458 |
||
459 |
return handled; |
|
460 |
} |
|
461 |
||
462 |
// --------------------------------------------------------------------------- |
|
463 |
// CDialerNumberEntry::CountComponentControls |
|
464 |
// --------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
TInt CDialerNumberEntry::CountComponentControls() const |
|
467 |
{ |
|
468 |
return KNumberEntryControlCount; |
|
469 |
} |
|
470 |
||
471 |
// --------------------------------------------------------------------------- |
|
472 |
// CDialerNumberEntry::ComponentControl |
|
473 |
// --------------------------------------------------------------------------- |
|
474 |
// |
|
475 |
CCoeControl* CDialerNumberEntry::ComponentControl( TInt aIndex ) const |
|
476 |
{ |
|
477 |
__ASSERT_DEBUG( aIndex < KNumberEntryControlCount, |
|
478 |
User::Panic(_L("Dialer"), KErrArgument) ); |
|
479 |
||
480 |
if ( aIndex == 0 ) |
|
481 |
{ |
|
482 |
return iEditor; |
|
483 |
} |
|
484 |
else if ( aIndex == 1 ) |
|
485 |
{ |
|
486 |
return iLabel; |
|
487 |
} |
|
488 |
return NULL; |
|
489 |
} |
|
490 |
||
491 |
// --------------------------------------------------------------------------- |
|
492 |
// CDialerNumberEntry::Draw |
|
493 |
// --------------------------------------------------------------------------- |
|
494 |
// |
|
495 |
void CDialerNumberEntry::Draw( const TRect& /*aRect*/ ) const |
|
496 |
{ |
|
497 |
CWindowGc& gc = SystemGc( ); |
|
498 |
gc.SetBrushColor( AKN_LAF_COLOR( 0 /** White - get from layout */ )); |
|
499 |
TRect rect = Rect(); |
|
500 |
||
501 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
502 |
||
503 |
// Draw the skin background of the parent |
|
504 |
if ( !AknsDrawUtils::DrawFrame( skin, |
|
505 |
(CWindowGc&) gc, |
|
506 |
iOuterRect, |
|
507 |
iInnerRect, |
|
508 |
KAknsIIDQsnFrInput, |
|
509 |
KAknsIIDDefault )) |
|
510 |
{ |
|
511 |
DIALER_PRINT("numberentry::Draw.Frame.failed"); |
|
512 |
} |
|
513 |
||
514 |
gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
515 |
} |
|
516 |
||
517 |
||
518 |
// --------------------------------------------------------------------------- |
|
519 |
// CDialerNumberEntry::SetVariety |
|
520 |
// Set variety according to status |
|
521 |
// --------------------------------------------------------------------------- |
|
522 |
// |
|
523 |
void CDialerNumberEntry::SetVariety() |
|
524 |
{ |
|
525 |
} |
|
526 |
||
527 |
// --------------------------------------------------------------------------- |
|
528 |
// CDialerNumberEntry::SetLayout |
|
529 |
// --------------------------------------------------------------------------- |
|
530 |
// |
|
531 |
void CDialerNumberEntry::SetLayout() |
|
532 |
{ |
|
533 |
AknsUtils::RegisterControlPosition( this ); |
|
534 |
||
535 |
TDialerVariety variety( EDialerVarietyLandscape ); |
|
536 |
if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
537 |
{ |
|
538 |
variety = EDialerVarietyPortrait; |
|
539 |
} |
|
540 |
||
541 |
TRect parentRect( Rect() ); |
|
542 |
TAknTextComponentLayout neLayout = ( iOperationMode == EModeEasyDialing ? |
|
543 |
AknLayoutScalable_Apps::dia3_numentry_pane_t1( variety ) : |
|
544 |
AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety ) ); |
|
545 |
||
546 |
AknLayoutUtils::LayoutControl( |
|
547 |
iEditor, parentRect, |
|
548 |
neLayout.C(), |
|
549 |
neLayout.l(), |
|
550 |
neLayout.t(), |
|
551 |
neLayout.r(), |
|
552 |
neLayout.b(), |
|
553 |
neLayout.W(), |
|
554 |
neLayout.H() |
|
555 |
); |
|
556 |
||
557 |
RectFrameInnerOuterRects( |
|
558 |
parentRect, |
|
559 |
iOuterRect, |
|
560 |
iInnerRect ); |
|
561 |
||
562 |
UpdateNumberEntryFormats(); |
|
563 |
||
564 |
iFrameContext->SetFrameRects( iOuterRect, iInnerRect ); |
|
565 |
||
566 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
567 |
AknsDrawUtils::PrepareFrame( skin, |
|
568 |
iOuterRect, |
|
569 |
iInnerRect, |
|
570 |
KAknsIIDQsnFrInput, |
|
571 |
KAknsIIDDefault ); |
|
572 |
// Label layout |
|
573 |
||
574 |
// Portrait variety is temporarily used also in landscape. |
|
575 |
// Landscape layout data is now unavailable. |
|
576 |
TAknTextComponentLayout labelLayout = |
|
577 |
AknLayoutScalable_Apps::dialer2_ne_pane_t2( EDialerVarietyPortrait ); |
|
578 |
// Temporary solution |
|
579 |
labelLayout.Setl( neLayout.l() ); |
|
580 |
AknLayoutUtils::LayoutLabel( iLabel, parentRect, labelLayout ); |
|
581 |
||
582 |
HandleEditorFormatting(); |
|
583 |
iEditor->DrawDeferred(); |
|
26
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
584 |
|
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
585 |
// Allow usage of late focuser |
8baf28733c3d
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
586 |
iLateFocuserCanBeUsed = ETrue; |
25 | 587 |
} |
588 |
||
589 |
// --------------------------------------------------------------------------- |
|
590 |
// CDialerNumberEntry::ConstructEditorFromResourceL |
|
591 |
// --------------------------------------------------------------------------- |
|
592 |
// |
|
593 |
void CDialerNumberEntry::ConstructEditorFromResourceL( |
|
594 |
TResourceReader& aReader ) |
|
595 |
{ |
|
596 |
TInt maxChars = aReader.ReadInt16(); |
|
597 |
TInt maxLines = aReader.ReadInt16(); |
|
598 |
HBufC* truncation = aReader.ReadHBufCL(); |
|
599 |
CleanupStack::PushL( truncation ); |
|
600 |
TInt formatCount = aReader.ReadInt16(); |
|
601 |
iEditor->ConstructL( maxChars, maxLines, formatCount, *truncation ); |
|
602 |
CleanupStack::PopAndDestroy( truncation ); |
|
603 |
iFormatCount = formatCount; |
|
604 |
||
605 |
for ( TInt ii = 0; ii < iFormatCount; ii++ ) |
|
606 |
{ |
|
607 |
CAknPhoneNumberEditor::TFormat format( aReader ); |
|
608 |
CalculateLayout( format, ii ); |
|
609 |
iEditor->AddFormat( format ); |
|
610 |
} |
|
611 |
||
612 |
iEditor->SetFormat( KDialerNELayoutLargeFont ); |
|
613 |
} |
|
614 |
||
615 |
// --------------------------------------------------------------------------- |
|
616 |
// CDialerNumberEntry::UpdateNumberEntryFormats |
|
617 |
// --------------------------------------------------------------------------- |
|
618 |
// |
|
619 |
void CDialerNumberEntry::UpdateNumberEntryFormats( ) |
|
620 |
{ |
|
621 |
DIALER_PRINT("numberentry::UpdateNumberEntryFormats<"); |
|
622 |
TInt currentFormat = iEditor->CurrentFormatIndex(); |
|
623 |
||
624 |
for ( TInt ii = 0; ii < iFormatCount; ii++ ) |
|
625 |
{ |
|
626 |
CAknPhoneNumberEditor::TFormat format( iEditor->Format( ii ) ); |
|
627 |
CalculateLayout( format, ii ); |
|
628 |
iEditor->Format( ii ) = format; |
|
629 |
} |
|
630 |
||
631 |
iEditor->SetFormat( currentFormat ); |
|
632 |
DIALER_PRINT("numberentry::UpdateNumberEntryFormats>"); |
|
633 |
} |
|
634 |
||
635 |
// --------------------------------------------------------------------------- |
|
636 |
// CDialerNumberEntry::CalculateLayout |
|
637 |
// --------------------------------------------------------------------------- |
|
638 |
// |
|
639 |
void CDialerNumberEntry::CalculateLayout( |
|
640 |
CAknPhoneNumberEditor::TFormat& aFormat, TInt aNEVariety ) |
|
641 |
{ |
|
642 |
TAknLayoutText textsLine1Text; |
|
643 |
TAknLayoutText textsLine2Text; |
|
644 |
||
645 |
if ( iOperationMode == EModeEasyDialing ) |
|
646 |
{ |
|
647 |
TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
648 |
textsLine1Text.LayoutText( Rect(), AknLayoutScalable_Apps::dia3_numentry_pane_t1(variety) ); |
|
649 |
textsLine2Text = textsLine1Text; |
|
650 |
} |
|
651 |
else |
|
652 |
{ |
|
653 |
TInt variety = 0; |
|
654 |
if ( aNEVariety == KDialerNELayoutLargeFont ) |
|
655 |
{ |
|
656 |
variety = Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0; |
|
657 |
} |
|
658 |
else |
|
659 |
{ |
|
660 |
variety = Layout_Meta_Data::IsLandscapeOrientation() ? 3 : 1; |
|
661 |
} |
|
662 |
||
663 |
//Line 1 |
|
664 |
textsLine1Text.LayoutText( Rect(), |
|
665 |
AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety, 0, 0 ) ); |
|
666 |
//Line 2 |
|
667 |
textsLine2Text.LayoutText( Rect(), |
|
668 |
AknLayoutScalable_Apps::dialer2_ne_pane_t1( variety, 0, 1 ) ); |
|
669 |
} |
|
670 |
||
671 |
//take font from line 1 |
|
672 |
aFormat.iFont = textsLine1Text.Font(); |
|
673 |
const CAknLayoutFont* layoutFont = CAknLayoutFont::AsCAknLayoutFontOrNull( aFormat.iFont ); |
|
674 |
aFormat.iBottomBaselineOffset = layoutFont->BaselineToTextPaneBottom(); |
|
675 |
||
676 |
// Calculate baselineSeparation from the difference of the second |
|
677 |
// line and the first line bottom right Y coordinates. |
|
678 |
TInt baselineSeparation = |
|
679 |
textsLine2Text.TextRect().iBr.iY - textsLine1Text.TextRect().iBr.iY; |
|
680 |
aFormat.iBaselineSeparation = baselineSeparation; |
|
681 |
||
682 |
// Outer rect of the text editor is the inner rect of the whole text box |
|
683 |
aFormat.iOuterRect = iInnerRect; |
|
684 |
||
685 |
aFormat.iNumLines = 1; |
|
686 |
||
687 |
// If multiline layout is to be used, the exact number of lines is calculated |
|
688 |
// based on available area and the row height (i.e. baselineSeparation) |
|
689 |
if ( baselineSeparation > 0 && baselineSeparation < iInnerRect.Height() ) |
|
690 |
{ |
|
691 |
aFormat.iNumLines = ( iInnerRect.Height() / baselineSeparation ); |
|
692 |
||
693 |
// Center editor vertically to the available area. |
|
694 |
TInt editorHeight = aFormat.iNumLines * baselineSeparation; |
|
695 |
TInt deltaHeight = ( iInnerRect.Height() - editorHeight ) / 2; |
|
696 |
aFormat.iOuterRect.Shrink( 0, deltaHeight ); |
|
697 |
} |
|
698 |
} |
|
699 |
||
700 |
// --------------------------------------------------------------------------- |
|
701 |
// CDialerNumberEntry::HandleResourceChange |
|
702 |
// --------------------------------------------------------------------------- |
|
703 |
// |
|
704 |
void CDialerNumberEntry::HandleResourceChange( TInt aType ) |
|
705 |
{ |
|
706 |
CCoeControl::HandleResourceChange( aType ); |
|
707 |
||
708 |
if ( aType == KAknsMessageSkinChange ) |
|
709 |
{ |
|
710 |
CheckLabelSkinningColor(); |
|
711 |
} |
|
712 |
} |
|
713 |
||
714 |
// --------------------------------------------------------------------------- |
|
715 |
// CDialerNumberEntry::HandlePointerEventL |
|
716 |
// --------------------------------------------------------------------------- |
|
717 |
// |
|
718 |
void CDialerNumberEntry::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
719 |
{ |
|
720 |
// Normal pointer event handling and delegation to editor component |
|
721 |
// happens only if we are already in focus. Otherwise we just take the |
|
722 |
// focus. This is to prevent accidental cursor movements as putting the |
|
723 |
// cursor back to the end of the text is difficult for right-aligned |
|
724 |
// text. |
|
725 |
if ( iEditor->IsFocused() ) |
|
726 |
{ |
|
727 |
// If user hits the margin area between this control and the actual editor |
|
728 |
// control, then the event position is moved to be inside the editor region. |
|
729 |
// This makes it easier to move cursor with finger touch, especially in |
|
730 |
// both ends of the number field. |
|
731 |
TPoint eventPos( aPointerEvent.iPosition ); |
|
732 |
TRect editorRect( iEditor->Rect() ); |
|
733 |
editorRect.Shrink( 1, 1 ); // take rect which is fully inside the editor rect |
|
734 |
eventPos.iX = Min( eventPos.iX, editorRect.iBr.iX ); |
|
735 |
eventPos.iX = Max( eventPos.iX, editorRect.iTl.iX ); |
|
736 |
eventPos.iY = Min( eventPos.iY, editorRect.iBr.iY ); |
|
737 |
eventPos.iY = Max( eventPos.iY, editorRect.iTl.iY ); |
|
738 |
||
739 |
TPointerEvent modEvent( aPointerEvent ); |
|
740 |
modEvent.iPosition = eventPos; |
|
741 |
||
742 |
CCoeControl::HandlePointerEventL( modEvent ); |
|
743 |
} |
|
744 |
} |
|
745 |
||
746 |
// --------------------------------------------------------------------------- |
|
747 |
// CDialerNumberEntry::HandleEditorFormatting |
|
748 |
// --------------------------------------------------------------------------- |
|
749 |
// |
|
750 |
void CDialerNumberEntry::HandleEditorFormatting() |
|
751 |
{ |
|
752 |
TInt format( KDialerNELayoutLargeFont ); |
|
753 |
||
754 |
if ( !iEditor->WouldTextFitInFormat( KDialerNELayoutLargeFont ) ) |
|
755 |
{ |
|
756 |
format = KDialerNELayoutSmallFont; |
|
757 |
} |
|
758 |
||
759 |
if ( iEditor->CurrentFormatIndex() != format ) |
|
760 |
{ |
|
761 |
iEditor->DrawDeferred(); |
|
762 |
iEditor->SetFormat( format ); |
|
763 |
iFrameContext->SetRect( Rect() ); |
|
764 |
} |
|
765 |
||
766 |
} |
|
767 |
||
768 |
// --------------------------------------------------------------------------- |
|
769 |
// CDialerNumberEntry::StartVirtualKeyBoard |
|
770 |
// --------------------------------------------------------------------------- |
|
771 |
// |
|
772 |
void CDialerNumberEntry::StartVirtualKeyBoard( ) |
|
773 |
{ |
|
774 |
// To change focus to VKB, if not called VKB will not come visible |
|
775 |
iLateFocuser->Cancel(); |
|
776 |
DoSetFocus( ETrue, ENoDrawNow ); |
|
777 |
iEikonEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
|
778 |
iEditor->OpenVKB(); |
|
779 |
} |
|
780 |
||
781 |
// --------------------------------------------------------------------------- |
|
782 |
// CDialerNumberEntry::MopSupplyObject |
|
783 |
// --------------------------------------------------------------------------- |
|
784 |
// |
|
785 |
TTypeUid::Ptr CDialerNumberEntry::MopSupplyObject( TTypeUid aId ) |
|
786 |
{ |
|
787 |
if ( aId.iUid == MAknsControlContext::ETypeId && iFrameContext ) |
|
788 |
{ |
|
789 |
return MAknsControlContext::SupplyMopObject( aId, iFrameContext ); |
|
790 |
} |
|
791 |
else |
|
792 |
{ |
|
793 |
return CCoeControl::MopSupplyObject( aId ); |
|
794 |
} |
|
795 |
} |
|
796 |
||
797 |
// ----------------------------------------------------------------------------- |
|
798 |
// CDialerNumberEntry::RectFrameInnerOuterRects |
|
799 |
// ----------------------------------------------------------------------------- |
|
800 |
// |
|
801 |
void CDialerNumberEntry::RectFrameInnerOuterRects( const TRect& aFrameRect, |
|
802 |
TRect& aOuterRect, |
|
803 |
TRect& aInnerRect ) |
|
804 |
{ |
|
805 |
if ( iOperationMode == EModeEasyDialing ) |
|
806 |
{ |
|
807 |
aOuterRect = aFrameRect; |
|
808 |
TAknLayoutRect innerRectLayout; |
|
809 |
innerRectLayout.LayoutRect( aOuterRect, AknLayoutScalable_Apps::bg_dia3_numentry_pane_g1() ); |
|
810 |
aInnerRect = innerRectLayout.Rect(); |
|
811 |
||
812 |
// Add a bit of margin to left and right ends of the entry field if layout |
|
813 |
// doens't define enough. This is to enhance the touch usability. |
|
814 |
static const TInt KMinMargin( 15 ); |
|
815 |
aInnerRect.iTl.iX = Max( aInnerRect.iTl.iX, aOuterRect.iTl.iX + KMinMargin ); |
|
816 |
aInnerRect.iBr.iX = Min( aInnerRect.iBr.iX, aOuterRect.iBr.iX - KMinMargin ); |
|
817 |
} |
|
818 |
else |
|
819 |
{ |
|
820 |
if ( Layout_Meta_Data::IsMirrored() ) |
|
821 |
{ |
|
822 |
TAknLayoutRect frameTopRight; |
|
823 |
frameTopRight.LayoutRect( |
|
824 |
aFrameRect, |
|
825 |
AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g3().LayoutLine() ); |
|
826 |
||
827 |
TAknLayoutRect frameBottomLeft; |
|
828 |
frameBottomLeft.LayoutRect( |
|
829 |
aFrameRect, |
|
830 |
AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g4().LayoutLine() ); |
|
831 |
||
832 |
aOuterRect = TRect( frameTopRight.Rect().iTl, |
|
833 |
frameBottomLeft.Rect().iBr ); |
|
834 |
||
835 |
aInnerRect = TRect( frameTopRight.Rect().iBr, |
|
836 |
frameBottomLeft.Rect().iTl ); |
|
837 |
} |
|
838 |
else |
|
839 |
{ |
|
840 |
TAknLayoutRect frameTopLeft; |
|
841 |
frameTopLeft.LayoutRect( |
|
842 |
aFrameRect, |
|
843 |
AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g2().LayoutLine() ); |
|
844 |
||
845 |
TAknLayoutRect frameBottomRight; |
|
846 |
frameBottomRight.LayoutRect( |
|
847 |
aFrameRect, |
|
848 |
AknLayoutScalable_Apps::bg_popup_call2_rect_pane_g5().LayoutLine() ); |
|
849 |
||
850 |
aOuterRect = TRect( frameTopLeft.Rect().iTl, |
|
851 |
frameBottomRight.Rect().iBr ); |
|
852 |
aInnerRect = TRect( frameTopLeft.Rect().iBr, |
|
853 |
frameBottomRight.Rect().iTl ); |
|
854 |
} |
|
855 |
} |
|
856 |
} |
|
857 |
||
858 |
// ----------------------------------------------------------------------------- |
|
859 |
// CDialerNumberEntry::InformNumberEntryState() |
|
860 |
// ----------------------------------------------------------------------------- |
|
861 |
// |
|
862 |
void CDialerNumberEntry::InformNumberEntryState() |
|
863 |
{ |
|
864 |
if ( !iNumberContents && iEditor->TextLength() ) |
|
865 |
{ |
|
866 |
// Hide prompt text |
|
867 |
if ( iLabel->Text()->Length() ) |
|
868 |
{ |
|
869 |
iLabel->MakeVisible( EFalse ); |
|
870 |
} |
|
871 |
iNumberContents = ETrue; |
|
872 |
} |
|
873 |
else if ( iNumberContents && !iEditor->TextLength() ) |
|
874 |
{ |
|
875 |
// Show prompt text |
|
876 |
if ( iLabel->Text()->Length() ) |
|
877 |
{ |
|
878 |
iLabel->MakeVisible( ETrue ); |
|
879 |
} |
|
880 |
iNumberContents = EFalse; |
|
881 |
} |
|
882 |
||
883 |
if ( iPreviousNumberEntryContent.Compare( iEditor->Text() ) != 0 ) |
|
884 |
{ |
|
885 |
iPreviousNumberEntryContent.Zero(); |
|
886 |
iEditor->GetText( iPreviousNumberEntryContent ); |
|
887 |
||
888 |
// The following stores the information of validity of the number for normal calls. |
|
889 |
// This information is needed so that we don't show call items for invalid numbers. |
|
890 |
TBool validPhoneNumber = Validate( iEditor->Text() ); |
|
891 |
TInt commandId = validPhoneNumber ? EPhoneDialerValidNumber : EPhoneDialerInvalidNumber; |
|
892 |
||
893 |
TRAP_IGNORE( iAppUi->HandleCommandL( commandId ) ); |
|
894 |
||
895 |
if ( iEasyDialer && iOperationMode == EModeEasyDialing ) |
|
896 |
{ |
|
897 |
TRAP_IGNORE( iEasyDialer->SetInputL( iEditor->Text() ) ); |
|
898 |
} |
|
899 |
||
900 |
if ( iObserver ) |
|
901 |
{ |
|
902 |
iObserver->NumberEntryStateChanged( iNumberContents ); |
|
903 |
} |
|
904 |
} |
|
905 |
} |
|
906 |
||
907 |
// ----------------------------------------------------------------------------- |
|
908 |
// CDialerNumberEntry::CheckLabelSkinningColor() |
|
909 |
// ----------------------------------------------------------------------------- |
|
910 |
// |
|
911 |
void CDialerNumberEntry::CheckLabelSkinningColor() |
|
912 |
{ |
|
913 |
// Check skinning colour for the prompt text: |
|
914 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
915 |
TRgb skinColor; |
|
916 |
TInt error = |
|
917 |
AknsUtils::GetCachedColor( |
|
918 |
skin, |
|
919 |
skinColor, |
|
920 |
KAknsIIDQsnTextColors, |
|
921 |
EAknsCIQsnTextColorsCG51 ); |
|
922 |
||
923 |
if ( error == KErrNone ) |
|
924 |
{ |
|
925 |
// Ignore error |
|
926 |
TRAP_IGNORE( iLabel->OverrideColorL( EColorLabelText, skinColor ) ); |
|
927 |
} |
|
928 |
} |
|
929 |
||
930 |
// ----------------------------------------------------------------------------- |
|
931 |
// CDialerNumberEntry::MakeVisible( TBool aVisible ) |
|
932 |
// ----------------------------------------------------------------------------- |
|
933 |
// |
|
934 |
void CDialerNumberEntry::MakeVisible( TBool aVisible ) |
|
935 |
{ |
|
936 |
CCoeControl::MakeVisible( aVisible ); |
|
937 |
iEditor->MakeVisible( aVisible ); |
|
938 |
} |
|
939 |
||
940 |
// ----------------------------------------------------------------------------- |
|
941 |
// CDialerNumberEntry::SetEasyDialingPlugin |
|
942 |
// ----------------------------------------------------------------------------- |
|
943 |
// |
|
944 |
void CDialerNumberEntry::SetEasyDialingPlugin(CDialingExtensionInterface* aEasyDialer) |
|
945 |
{ |
|
946 |
DIALER_PRINT("numberentry::SetEasyDialingPlugin"); |
|
947 |
iEasyDialer = aEasyDialer; |
|
948 |
} |
|
949 |
||
950 |
// ----------------------------------------------------------------------------- |
|
951 |
// CDialerNumberEntry::SetOperationMode |
|
952 |
// ----------------------------------------------------------------------------- |
|
953 |
// |
|
954 |
void CDialerNumberEntry::SetOperationMode( TDialerOperationMode aMode ) |
|
955 |
{ |
|
956 |
iOperationMode = aMode; |
|
957 |
} |
|
958 |
||
959 |
// ----------------------------------------------------------------------------- |
|
960 |
// CDialerNumberEntry::Validate |
|
961 |
// ----------------------------------------------------------------------------- |
|
962 |
// |
|
963 |
TBool CDialerNumberEntry::Validate( const TDesC& aString ) |
|
964 |
{ |
|
965 |
DIALER_PRINT("numberentry::Validate"); |
|
966 |
||
967 |
if ( aString.Length() == 0 ) |
|
968 |
{ |
|
969 |
return EFalse; |
|
970 |
} |
|
971 |
||
972 |
// check first character |
|
973 |
TPtrC valid( KPhoneValidChars ); |
|
974 |
if ( valid.Locate( aString[0] ) == KErrNotFound ) |
|
975 |
{ |
|
976 |
return EFalse; |
|
977 |
} |
|
978 |
||
979 |
// if vanitydialing feature is enabled, also capital A-Z are accepted after first character |
|
980 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfHomeScreenVanityDialing ) ) |
|
981 |
{ |
|
982 |
valid.Set( KPhoneVanityValidChars ); |
|
983 |
} |
|
984 |
||
985 |
// check rest of the string |
|
986 |
for ( TInt i = 1; i < aString.Length(); i++ ) |
|
987 |
{ |
|
988 |
if ( valid.Locate( aString[i] ) == KErrNotFound ) |
|
989 |
{ |
|
990 |
return EFalse; |
|
991 |
} |
|
992 |
} |
|
993 |
||
994 |
return ETrue; |
|
995 |
} |
|
996 |
||
997 |
// End of File |