diff -r fcdfafb36fe7 -r aecbbf00d063 uifw/AvKon/src/AknQueryControl.cpp --- a/uifw/AvKon/src/AknQueryControl.cpp Thu Aug 19 10:11:06 2010 +0300 +++ b/uifw/AvKon/src/AknQueryControl.cpp Tue Aug 31 15:28:30 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -77,9 +77,8 @@ #include // for testability hooks #include -#include "akntrace.h" const TInt KPinCodeTacticonInterval = 30000000; // 30s -const TInt KPinCodeMaxTacticons = 5; +const TInt KPinCodeMaxTacticons = 10; /******* * CAknQueryControlExtension */ @@ -111,14 +110,12 @@ CAknQueryControlExtension::~CAknQueryControlExtension() { - _AKNTRACE_FUNC_ENTER; delete iOriginalPrompt; delete iBackspaceButton; delete iKeypad; delete iPinTacticonTimer; iPinTacticonTimer = NULL; - _AKNTRACE_FUNC_EXIT; } CAknLocationEditor *CAknQueryControl::LocationEd() const @@ -140,12 +137,10 @@ void CAknQueryExtension::CreateEditorContextL() { - _AKNTRACE_FUNC_ENTER; delete iEditorContext; iEditorContext = NULL; iEditorContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrInput, TRect(0,0,1,1), TRect(0,0,1,1), EFalse ); - _AKNTRACE_FUNC_EXIT; } CAknsFrameBackgroundControlContext* CAknQueryExtension::EditorContext() @@ -164,23 +159,19 @@ void CAknQueryExtension::CreateExtensionL( const CAknQueryControl* aQueryControl ) { - _AKNTRACE_FUNC_ENTER; CAknQueryExtension* extension = CAknQueryExtension::NewL(); CleanupStack::PushL( extension ); AknsPointerStore::StorePointerL( static_cast(aQueryControl), extension ); CleanupStack::Pop(); // extension - _AKNTRACE_FUNC_EXIT; } void CAknQueryExtension::DestroyExtension( const CAknQueryControl* aQueryControl ) { - _AKNTRACE_FUNC_ENTER; delete Instance( aQueryControl ); AknsPointerStore::RemovePointer( static_cast(aQueryControl) ); - _AKNTRACE_FUNC_EXIT; } CAknQueryExtension* CAknQueryExtension::NewL() @@ -191,7 +182,6 @@ CAknQueryExtension::~CAknQueryExtension() { delete iEditorContext; - _AKNTRACE( "[%s][%s]exit", "CAknQueryExtension", "~CAknQueryExtension" ); } /***************************** @@ -224,24 +214,17 @@ EXPORT_C void TAknQueryEcsObserver::HandleEcsEvent( CAknEcsDetector* /*aDetector*/, CAknEcsDetector::TState aUpdatedState ) { - _AKNTRACE( "[%s][%s] aUpdatedState: %d", "TAknQueryEcsObserver", __FUNCTION__,aUpdatedState); - TRAP_IGNORE( iParent->SetEcsCbaVisibleL( aUpdatedState == CAknEcsDetector::ECompleteMatch || - aUpdatedState == CAknEcsDetector::EServiceNumMatch ) ); + TRAP_IGNORE( iParent->SetEcsCbaVisibleL( aUpdatedState == CAknEcsDetector::ECompleteMatch ) ); // Hide the emergency call number again. // Number should be visible only in Partial or Complete match state if ( aUpdatedState != CAknEcsDetector::EPartialMatch && - aUpdatedState != CAknEcsDetector::ECompleteMatch && - aUpdatedState != CAknEcsDetector::EServiceNumMatch ) + aUpdatedState != CAknEcsDetector::ECompleteMatch ) { if ( iParent->QueryType() == EPinLayout ) { - _AKNTRACE( "[%s][%s] ", "RevealSecretText( EFalse )", __FUNCTION__); - if( iParent->ControlByLayoutOrNull( EPinLayout ) ) - { - static_cast - ( iParent->ControlByLayoutOrNull( EPinLayout ) )->RevealSecretText( EFalse ); - } + static_cast + ( iParent->ControlByLayoutOrNull( EPinLayout ) )->RevealSecretText( EFalse ); } } @@ -249,10 +232,8 @@ // If the query is cancelled, the iParent is deleted! if ( aUpdatedState == CAknEcsDetector::ECallAttempted ) { - _AKNTRACE( "[%s][%s] ", "cancel query", __FUNCTION__); TRAP_IGNORE( iParent->CancelQueryL() ); } - _AKNTRACE_FUNC_EXIT; } @@ -313,7 +294,6 @@ */ EXPORT_C CAknQueryControl::~CAknQueryControl() { - _AKNTRACE( "[%s][%s] enter", "CAknQueryControl", "~CAknQueryControl"); AKNTASHOOK_REMOVE(); if (iEdwin) AknsUtils::DeregisterControlPosition(iEdwin); @@ -370,7 +350,6 @@ delete iIncreaseValueButton; delete iDecreaseValueButton; #endif //defined( RD_SCALABLE_UI_V2) - _AKNTRACE( "[%s][%s] exit", "CAknQueryControl", "~CAknQueryControl"); } /** @@ -378,10 +357,9 @@ */ EXPORT_C void CAknQueryControl::ConstructFromResourceL(TResourceReader &aRes) { - _AKNTRACE_FUNC_ENTER; // Construct extension CAknQueryExtension::CreateExtensionL( this ); - iExtension = new (ELeave)CAknQueryControlExtension; + iExtension = new (ELeave)CAknQueryControlExtension; iEcsObserver = new (ELeave) TAknQueryEcsObserver(this); iEditIndicator = CAknQueryEditIndicator::NewL(this); @@ -425,12 +403,10 @@ iExtension->iKeypad = CAknKeypad::NewL( *this, iQueryType ); } } - _AKNTRACE_FUNC_EXIT; } void CAknQueryControl::ConstructQueryL(TResourceReader& aRes) { - _AKNTRACE( "[%s][%s] iQueryType : %d", "CAknQueryControl", "ConstructQueryL", iQueryType ); switch(iQueryType) { case EConfirmationQueryLayout: @@ -744,21 +720,18 @@ { extension->CreateEditorContextL(); } - _AKNTRACE_FUNC_EXIT; } TInt CAknQueryControl::PinCodeTimeoutCallback( TAny* aThis ) { - _AKNTRACE_FUNC_ENTER; // play tacticon static_cast( aThis )->PlayPinCodeTacticon(); - _AKNTRACE_FUNC_EXIT; + return KErrNone; } void CAknQueryControl::PlayPinCodeTacticon() { - _AKNTRACE_FUNC_ENTER; // play tacticon RTacticon client; if ( KErrNone == client.Connect() ) @@ -783,12 +756,10 @@ StopPinCodeTacticonTimer(); } } - _AKNTRACE_FUNC_EXIT; } void CAknQueryControl::ResetPinCodeTacticonTimer() { - _AKNTRACE_FUNC_ENTER; // stop old timer StopPinCodeTacticonTimer(); @@ -806,12 +777,10 @@ TCallBack( PinCodeTimeoutCallback, this ) ); } } - _AKNTRACE_FUNC_EXIT; } void CAknQueryControl::StopPinCodeTacticonTimer() { - _AKNTRACE_FUNC_ENTER; if ( iExtension ) { // delete timer @@ -820,7 +789,6 @@ // set the timer null, so that it will not be used again iExtension->iPinTacticonTimer = NULL; } - _AKNTRACE_FUNC_EXIT; } /// @@ -957,7 +925,6 @@ */ EXPORT_C TKeyResponse CAknQueryControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType) { - _AKNTRACE( "[%s][%s] aKeyEvent.iCode :%d, aType:%d ", "CAknQueryControl", __FUNCTION__, aKeyEvent.iCode, aType); TKeyResponse response( EKeyWasNotConsumed ); // Send key handling for emergency call support @@ -983,7 +950,6 @@ ResetPinCodeTacticonTimer(); } } - _AKNTRACE_FUNC_EXIT; return response; } @@ -1143,7 +1109,6 @@ TBool reveal = EFalse; TInt ecsState( iEcsDetector->State() ); if ( ( ecsState == CAknEcsDetector::ECompleteMatch ) || - ( ecsState == CAknEcsDetector::EServiceNumMatch ) || ( ecsState == CAknEcsDetector::ECompleteMatchThenSendKey ) ) { // Further check to ensure that the matched number is the entire buffer @@ -1152,14 +1117,12 @@ { reveal = ETrue; - if ( ecsState == CAknEcsDetector::ECompleteMatch || - ecsState == CAknEcsDetector::EServiceNumMatch ) + if ( ecsState == CAknEcsDetector::ECompleteMatch ) { - SetEcsCbaVisibleL( ETrue ); + SetEcsCbaVisibleL( ETrue ); } } } - _AKNTRACE( "[%s][%s] iPinEdwin->RevealSecretText( %d )", "CAknQueryControl", __FUNCTION__, reveal); iPinEdwin->RevealSecretText( reveal ); } } @@ -2568,7 +2531,6 @@ */ void CAknQueryControl::CancelQueryL() { - _AKNTRACE_FUNC_ENTER; if (iQueryControlObserver) { iQueryControlObserver->HandleQueryEditorStateEventL(this, MAknQueryControlObserver::EEmergencyCallAttempted, MAknQueryControlObserver::EEditorValueValid); @@ -2581,7 +2543,6 @@ key.iScanCode = EStdKeyNull; iEikonEnv->SimulateKeyEventL(key, EEventKey); } - _AKNTRACE_FUNC_EXIT; } /** @@ -2639,7 +2600,7 @@ EXPORT_C void CAknQueryControl::SetImageL(CEikImage* aImage) { // Gets ownership of the aImage - _AKNTRACE_FUNC_ENTER; + if ( iImage && iImage->IsPictureOwnedExternally() ) { delete ((CApaMaskedBitmap*) iImage->Bitmap()); @@ -2657,13 +2618,11 @@ iAnimation = NULL; Layout(); - _AKNTRACE_FUNC_EXIT; } EXPORT_C void CAknQueryControl::SetImageL(const TDesC& aImageFile, TInt aBmpId, TInt aBmpMaskId) { - _AKNTRACE_FUNC_ENTER; CEikImage* image = new(ELeave) CEikImage; CleanupStack::PushL( image ); @@ -2694,12 +2653,10 @@ CleanupStack::Pop(); //image SetImageL(image); // gets ownership - _AKNTRACE_FUNC_EXIT; } EXPORT_C void CAknQueryControl::SetAnimationL(TInt aResource) { - _AKNTRACE_FUNC_ENTER; delete iAnimation; iAnimation = NULL; iAnimation = CAknBitmapAnimation::NewL(); @@ -2720,12 +2677,10 @@ iExtension->iAnimationId = aResource; Layout(); - _AKNTRACE_FUNC_EXIT; } EXPORT_C void CAknQueryControl::StartAnimationL() { - _AKNTRACE_FUNC_ENTER; if (iAnimation) { CBitmapAnimClientData *animClientData = iAnimation->BitmapAnimData(); @@ -2770,19 +2725,15 @@ iAnimation->StartAnimationL(); } - _AKNTRACE_FUNC_EXIT; } EXPORT_C TInt CAknQueryControl::CancelAnimation() { - _AKNTRACE_FUNC_ENTER; - TInt result(KErrGeneral); - if ( iAnimation ) + if ( iAnimation ) { - result = iAnimation->CancelAnimation(); + return iAnimation->CancelAnimation(); } - _AKNTRACE( "[%s][%s] return %d", "CAknQueryControl", "CancelAnimation", result); - return result; + return KErrGeneral; } @@ -3029,16 +2980,13 @@ // Callback for doing a redraw when animating pictographs TInt CAknQueryControl::StaticPictographCallBack( TAny* aPtr ) { - _AKNTRACE_FUNC_ENTER; CAknQueryControl* me = static_cast( aPtr ); me->PictographCallBack(); - _AKNTRACE_FUNC_EXIT; return KErrNone; } void CAknQueryControl::PictographCallBack() { - _AKNTRACE_FUNC_ENTER; MAknsSkinInstance* skin = AknsUtils::SkinInstance(); MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); @@ -3072,15 +3020,11 @@ DeactivateGc(); // Draw the label after the background. - TRAPD(err, iPrompt->Line( i )->ActivateL()); // Never leaves - if (err == KErrNone) - { - iPrompt->Line( i )->DrawNow(); - } + iPrompt->Line( i )->ActivateL(); // Never leaves + iPrompt->Line( i )->DrawNow(); iPrompt->SetLineModified( i, EFalse ); } } - _AKNTRACE_FUNC_EXIT; } TBool CAknQueryControl::EmbeddedVirtualInput() const @@ -3116,12 +3060,10 @@ CEikDialog* CAknQueryControl::Dialog() const { - _AKNTRACE_FUNC_ENTER; CAknQueryControl* control = const_cast( this ); CEikDialog* dialog = NULL; control->MopGetObject( dialog ); - _AKNTRACE_FUNC_EXIT; return dialog; } @@ -3388,34 +3330,32 @@ EXPORT_C void CAknQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) { - if ( iHasEditor && iEditorFrame.Valid() - && iEditorFrame.Rect().Contains( aPointerEvent.iPosition ) ) - { - /*For the events happening inside editor frame's rect, query control will forward - the events to editors to handle.This is added to fix bug ESLM-85YFCH:Text editor is hard - to open in input dialog (usability). The valid area is enlarged to editor frame rect, - instead of text's rect, because text rect is too small for user to tap*/ - CCoeControl* ctrl = ControlByLayoutOrNull( iQueryType ); - if( ctrl ) - { - TPointerEvent pointerEvent( aPointerEvent ); - if( !ctrl->Rect().Contains( aPointerEvent.iPosition ) && ( NbrOfEditorLines() == 1 ) ) - { - // for the pointerevents happening in editor frame rect, - // query control forward events to editors after justification - pointerEvent.iPosition.iY = ctrl->Rect().iTl.iY + ctrl->Rect().Height()/2; - } - ctrl->HandlePointerEventL( pointerEvent ); - } - else - { - CAknControl::HandlePointerEventL( aPointerEvent ); - } - } + CEikMfne* edwin = NULL; + if ( iTimeEdwin ) + { + edwin = iTimeEdwin; + } + else if ( iDateEdwin ) + { + edwin = iDateEdwin; + } + else if ( LocationEd() ) + { + edwin = LocationEd(); + } + else if ( iDurationEdwin ) + { + edwin = iDurationEdwin; + } + + if ( edwin && iEditorFrame.Rect().Contains(aPointerEvent.iPosition) ) + { + edwin->HandlePointerEventL(aPointerEvent); + } else - { - CAknControl::HandlePointerEventL( aPointerEvent ); - } + { + CAknControl::HandlePointerEventL(aPointerEvent); + } } EXPORT_C void* CAknQueryControl::ExtensionInterface( TUid /*aInterface*/ ) @@ -3425,7 +3365,6 @@ EXPORT_C void CAknQueryControl::HandleResourceChange(TInt aType) { - _AKNTRACE_FUNC_ENTER; CCoeControl::HandleResourceChange(aType); if( aType == KAknsMessageSkinChange && iExtension->iAnimationId ) @@ -3438,7 +3377,6 @@ SizeChanged(); TRAP_IGNORE(DoSetPromptL()); } - _AKNTRACE_FUNC_EXIT; } // --------------------------------------------------------------------------- @@ -3472,7 +3410,6 @@ // void CAknQueryControl::SetEcsCbaVisibleL( TBool aVisible ) { - _AKNTRACE( "[%s][%s] aVisible:%d ", "CAknQueryControl", __FUNCTION__,aVisible); if ( iExtension && !COMPARE_BOOLS( aVisible, iExtension->iEcsCbaShown ) && iFlags.IsSet( EEmergencyCallsCBASupport ) ) @@ -3507,7 +3444,6 @@ } } } - _AKNTRACE_FUNC_EXIT; } @@ -3517,11 +3453,9 @@ // void CAknQueryControl::AttemptEmergencyCallL() { - _AKNTRACE_FUNC_ENTER; if ( iEcsDetector ) { - if ( iEcsDetector->State() == CAknEcsDetector::ECompleteMatch || - iEcsDetector->State() == CAknEcsDetector::EServiceNumMatch ) + if ( iEcsDetector->State() == CAknEcsDetector::ECompleteMatch ) { // Further check to ensure that the matched number is the // entire buffer. Get the matched text and see if is the same @@ -3536,7 +3470,6 @@ } } } - _AKNTRACE_FUNC_EXIT; } @@ -3574,7 +3507,6 @@ void CAknExtQueryControl::ConstructQueryL(TResourceReader& aRes) { - _AKNTRACE_FUNC_ENTER; if ( iQueryType == EIpLayout) { iIpEditor = new(ELeave)CAknIpFieldEditor; @@ -3604,7 +3536,6 @@ { extension->CreateEditorContextL(); } - _AKNTRACE_FUNC_EXIT; } @@ -3682,7 +3613,7 @@ EXPORT_C void CAknExtQueryControl::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) { //CAknQueryControl::HandleControlEventL(NULL, aEventType); - _AKNTRACE( "[%s][%s] aEventType:%d ", "CAknExtQueryControl", "HandleControlEventL",aEventType); + if(iQueryControlObserver && aEventType == EEventStateChanged) { if(GetTextLength()) @@ -3694,7 +3625,6 @@ iQueryControlObserver->HandleQueryEditorStateEventL(this,MAknQueryControlObserver::EQueryControlEditorStateChanging, MAknQueryControlObserver::EEditorEmpty); } } - _AKNTRACE( "[%s][%s] EXIT ", "CAknExtQueryControl", "HandleControlEventL"); } @@ -3792,34 +3722,14 @@ EXPORT_C void CAknExtQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) { - if ( iHasEditor && iEditorFrame.Valid() - && iEditorFrame.Rect().Contains( aPointerEvent.iPosition ) ) - { - /*For the events happening inside editor frame's rect, query control will forward - the events to editors to handle.This is added to fix bug ESLM-85YFCH:Text editor is hard - to open in input dialog (usability). The valid area is enlarged to editor frame rect, - instead of text's rect, because text rect is too small for user to tap*/ - CCoeControl* ctrl = ControlByLayoutOrNull( iQueryType ); - if( ctrl ) - { - TPointerEvent pointerEvent( aPointerEvent ); - if( !ctrl->Rect().Contains( aPointerEvent.iPosition ) && ( NbrOfEditorLines() == 1 ) ) - { - // for the pointerevents happening in editor frame rect, - // query control forward events to editors after justification - pointerEvent.iPosition.iY = ctrl->Rect().iTl.iY + ctrl->Rect().Height()/2; - } - ctrl->HandlePointerEventL( pointerEvent ); - } - else - { - CAknControl::HandlePointerEventL( aPointerEvent ); - } - } - else - { - CAknControl::HandlePointerEventL( aPointerEvent ); - } + if ( iIpEditor && iEditorFrame.Rect().Contains(aPointerEvent.iPosition) ) + { + iIpEditor->HandlePointerEventL(aPointerEvent); + } + else + { + CAknQueryControl::HandlePointerEventL(aPointerEvent); + } } EXPORT_C void* CAknExtQueryControl::ExtensionInterface( TUid /*aInterface*/ ) @@ -4036,16 +3946,13 @@ // Callback for doing a redraw when animating pictographs TInt CAknExtQueryControl::StaticPictographCallBack( TAny* aPtr ) { - _AKNTRACE_FUNC_ENTER; CAknExtQueryControl* me = static_cast( aPtr ); me->PictographCallBack(); - _AKNTRACE_FUNC_EXIT; return KErrNone; } void CAknExtQueryControl::PictographCallBack() { - _AKNTRACE_FUNC_ENTER; MAknsSkinInstance* skin = AknsUtils::SkinInstance(); MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); @@ -4079,15 +3986,11 @@ DeactivateGc(); // Draw the label after the background. - TRAPD(err, iPrompt->Line( i )->ActivateL()); // Never leaves - if (err == KErrNone) - { - iPrompt->Line( i )->DrawNow(); - } + iPrompt->Line( i )->ActivateL(); // Never leaves + iPrompt->Line( i )->DrawNow(); iPrompt->SetLineModified( i, EFalse ); } } - _AKNTRACE_FUNC_EXIT; } // End of File