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