1 /* |
1 /* |
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
75 #include <StringLoader.h> |
75 #include <StringLoader.h> |
76 |
76 |
77 #include <AknTasHook.h> // for testability hooks |
77 #include <AknTasHook.h> // for testability hooks |
78 #include <tacticon.h> |
78 #include <tacticon.h> |
79 |
79 |
|
80 #include "akntrace.h" |
80 const TInt KPinCodeTacticonInterval = 30000000; // 30s |
81 const TInt KPinCodeTacticonInterval = 30000000; // 30s |
81 const TInt KPinCodeMaxTacticons = 10; |
82 const TInt KPinCodeMaxTacticons = 5; |
82 /******* |
83 /******* |
83 * CAknQueryControlExtension |
84 * CAknQueryControlExtension |
84 */ |
85 */ |
85 |
86 |
86 NONSHARABLE_CLASS(CAknQueryControlExtension) : public CBase |
87 NONSHARABLE_CLASS(CAknQueryControlExtension) : public CBase |
108 TInt iPinTacticonsPlayed; |
109 TInt iPinTacticonsPlayed; |
109 }; |
110 }; |
110 |
111 |
111 CAknQueryControlExtension::~CAknQueryControlExtension() |
112 CAknQueryControlExtension::~CAknQueryControlExtension() |
112 { |
113 { |
|
114 _AKNTRACE_FUNC_ENTER; |
113 delete iOriginalPrompt; |
115 delete iOriginalPrompt; |
114 delete iBackspaceButton; |
116 delete iBackspaceButton; |
115 delete iKeypad; |
117 delete iKeypad; |
116 |
118 |
117 delete iPinTacticonTimer; |
119 delete iPinTacticonTimer; |
118 iPinTacticonTimer = NULL; |
120 iPinTacticonTimer = NULL; |
|
121 _AKNTRACE_FUNC_EXIT; |
119 } |
122 } |
120 |
123 |
121 CAknLocationEditor *CAknQueryControl::LocationEd() const |
124 CAknLocationEditor *CAknQueryControl::LocationEd() const |
122 { |
125 { |
123 if (iExtension) |
126 if (iExtension) |
135 * CAknQueryExtension |
138 * CAknQueryExtension |
136 *****************************/ |
139 *****************************/ |
137 |
140 |
138 void CAknQueryExtension::CreateEditorContextL() |
141 void CAknQueryExtension::CreateEditorContextL() |
139 { |
142 { |
|
143 _AKNTRACE_FUNC_ENTER; |
140 delete iEditorContext; |
144 delete iEditorContext; |
141 iEditorContext = NULL; |
145 iEditorContext = NULL; |
142 iEditorContext = CAknsFrameBackgroundControlContext::NewL( |
146 iEditorContext = CAknsFrameBackgroundControlContext::NewL( |
143 KAknsIIDQsnFrInput, TRect(0,0,1,1), TRect(0,0,1,1), EFalse ); |
147 KAknsIIDQsnFrInput, TRect(0,0,1,1), TRect(0,0,1,1), EFalse ); |
|
148 _AKNTRACE_FUNC_EXIT; |
144 } |
149 } |
145 |
150 |
146 CAknsFrameBackgroundControlContext* CAknQueryExtension::EditorContext() |
151 CAknsFrameBackgroundControlContext* CAknQueryExtension::EditorContext() |
147 { |
152 { |
148 return iEditorContext; |
153 return iEditorContext; |
157 } |
162 } |
158 |
163 |
159 void CAknQueryExtension::CreateExtensionL( |
164 void CAknQueryExtension::CreateExtensionL( |
160 const CAknQueryControl* aQueryControl ) |
165 const CAknQueryControl* aQueryControl ) |
161 { |
166 { |
|
167 _AKNTRACE_FUNC_ENTER; |
162 CAknQueryExtension* extension = CAknQueryExtension::NewL(); |
168 CAknQueryExtension* extension = CAknQueryExtension::NewL(); |
163 CleanupStack::PushL( extension ); |
169 CleanupStack::PushL( extension ); |
164 AknsPointerStore::StorePointerL( |
170 AknsPointerStore::StorePointerL( |
165 static_cast<const CBase*>(aQueryControl), extension ); |
171 static_cast<const CBase*>(aQueryControl), extension ); |
166 CleanupStack::Pop(); // extension |
172 CleanupStack::Pop(); // extension |
|
173 _AKNTRACE_FUNC_EXIT; |
167 } |
174 } |
168 |
175 |
169 void CAknQueryExtension::DestroyExtension( |
176 void CAknQueryExtension::DestroyExtension( |
170 const CAknQueryControl* aQueryControl ) |
177 const CAknQueryControl* aQueryControl ) |
171 { |
178 { |
|
179 _AKNTRACE_FUNC_ENTER; |
172 delete Instance( aQueryControl ); |
180 delete Instance( aQueryControl ); |
173 AknsPointerStore::RemovePointer( |
181 AknsPointerStore::RemovePointer( |
174 static_cast<const CBase*>(aQueryControl) ); |
182 static_cast<const CBase*>(aQueryControl) ); |
|
183 _AKNTRACE_FUNC_EXIT; |
175 } |
184 } |
176 |
185 |
177 CAknQueryExtension* CAknQueryExtension::NewL() |
186 CAknQueryExtension* CAknQueryExtension::NewL() |
178 { |
187 { |
179 return new (ELeave) CAknQueryExtension(); |
188 return new (ELeave) CAknQueryExtension(); |
180 } |
189 } |
181 |
190 |
182 CAknQueryExtension::~CAknQueryExtension() |
191 CAknQueryExtension::~CAknQueryExtension() |
183 { |
192 { |
184 delete iEditorContext; |
193 delete iEditorContext; |
|
194 _AKNTRACE( "[%s][%s]exit", "CAknQueryExtension", "~CAknQueryExtension" ); |
185 } |
195 } |
186 |
196 |
187 /***************************** |
197 /***************************** |
188 * TAknQueryEcsObserver |
198 * TAknQueryEcsObserver |
189 *****************************/ |
199 *****************************/ |
212 |
222 |
213 |
223 |
214 EXPORT_C void TAknQueryEcsObserver::HandleEcsEvent( CAknEcsDetector* /*aDetector*/, |
224 EXPORT_C void TAknQueryEcsObserver::HandleEcsEvent( CAknEcsDetector* /*aDetector*/, |
215 CAknEcsDetector::TState aUpdatedState ) |
225 CAknEcsDetector::TState aUpdatedState ) |
216 { |
226 { |
217 TRAP_IGNORE( iParent->SetEcsCbaVisibleL( aUpdatedState == CAknEcsDetector::ECompleteMatch ) ); |
227 _AKNTRACE( "[%s][%s] aUpdatedState: %d", "TAknQueryEcsObserver", __FUNCTION__,aUpdatedState); |
|
228 TRAP_IGNORE( iParent->SetEcsCbaVisibleL( aUpdatedState == CAknEcsDetector::ECompleteMatch || |
|
229 aUpdatedState == CAknEcsDetector::EServiceNumMatch ) ); |
218 |
230 |
219 // Hide the emergency call number again. |
231 // Hide the emergency call number again. |
220 // Number should be visible only in Partial or Complete match state |
232 // Number should be visible only in Partial or Complete match state |
221 if ( aUpdatedState != CAknEcsDetector::EPartialMatch && |
233 if ( aUpdatedState != CAknEcsDetector::EPartialMatch && |
222 aUpdatedState != CAknEcsDetector::ECompleteMatch ) |
234 aUpdatedState != CAknEcsDetector::ECompleteMatch && |
|
235 aUpdatedState != CAknEcsDetector::EServiceNumMatch ) |
223 { |
236 { |
224 if ( iParent->QueryType() == EPinLayout ) |
237 if ( iParent->QueryType() == EPinLayout ) |
225 { |
238 { |
226 static_cast<CAknNumericSecretEditor*> |
239 _AKNTRACE( "[%s][%s] ", "RevealSecretText( EFalse )", __FUNCTION__); |
227 ( iParent->ControlByLayoutOrNull( EPinLayout ) )->RevealSecretText( EFalse ); |
240 if( iParent->ControlByLayoutOrNull( EPinLayout ) ) |
|
241 { |
|
242 static_cast<CAknNumericSecretEditor*> |
|
243 ( iParent->ControlByLayoutOrNull( EPinLayout ) )->RevealSecretText( EFalse ); |
|
244 } |
228 } |
245 } |
229 } |
246 } |
230 |
247 |
231 // This check must be last action in the routine. |
248 // This check must be last action in the routine. |
232 // If the query is cancelled, the iParent is deleted! |
249 // If the query is cancelled, the iParent is deleted! |
233 if ( aUpdatedState == CAknEcsDetector::ECallAttempted ) |
250 if ( aUpdatedState == CAknEcsDetector::ECallAttempted ) |
234 { |
251 { |
|
252 _AKNTRACE( "[%s][%s] ", "cancel query", __FUNCTION__); |
235 TRAP_IGNORE( iParent->CancelQueryL() ); |
253 TRAP_IGNORE( iParent->CancelQueryL() ); |
236 } |
254 } |
|
255 _AKNTRACE_FUNC_EXIT; |
237 } |
256 } |
238 |
257 |
239 |
258 |
240 const TInt KMaxLinesInQuery=5; |
259 const TInt KMaxLinesInQuery=5; |
241 |
260 |
292 /** |
311 /** |
293 * |
312 * |
294 */ |
313 */ |
295 EXPORT_C CAknQueryControl::~CAknQueryControl() |
314 EXPORT_C CAknQueryControl::~CAknQueryControl() |
296 { |
315 { |
|
316 _AKNTRACE( "[%s][%s] enter", "CAknQueryControl", "~CAknQueryControl"); |
297 AKNTASHOOK_REMOVE(); |
317 AKNTASHOOK_REMOVE(); |
298 if (iEdwin) |
318 if (iEdwin) |
299 AknsUtils::DeregisterControlPosition(iEdwin); |
319 AknsUtils::DeregisterControlPosition(iEdwin); |
300 else if (iNumberEdwin) |
320 else if (iNumberEdwin) |
301 AknsUtils::DeregisterControlPosition(iNumberEdwin); |
321 AknsUtils::DeregisterControlPosition(iNumberEdwin); |
348 |
368 |
349 #if defined( RD_SCALABLE_UI_V2) |
369 #if defined( RD_SCALABLE_UI_V2) |
350 delete iIncreaseValueButton; |
370 delete iIncreaseValueButton; |
351 delete iDecreaseValueButton; |
371 delete iDecreaseValueButton; |
352 #endif //defined( RD_SCALABLE_UI_V2) |
372 #endif //defined( RD_SCALABLE_UI_V2) |
|
373 _AKNTRACE( "[%s][%s] exit", "CAknQueryControl", "~CAknQueryControl"); |
353 } |
374 } |
354 |
375 |
355 /** |
376 /** |
356 * Construct from resource |
377 * Construct from resource |
357 */ |
378 */ |
358 EXPORT_C void CAknQueryControl::ConstructFromResourceL(TResourceReader &aRes) |
379 EXPORT_C void CAknQueryControl::ConstructFromResourceL(TResourceReader &aRes) |
359 { |
380 { |
|
381 _AKNTRACE_FUNC_ENTER; |
360 // Construct extension |
382 // Construct extension |
361 CAknQueryExtension::CreateExtensionL( this ); |
383 CAknQueryExtension::CreateExtensionL( this ); |
362 iExtension = new (ELeave)CAknQueryControlExtension; |
384 iExtension = new (ELeave)CAknQueryControlExtension; |
363 |
385 |
364 iEcsObserver = new (ELeave) TAknQueryEcsObserver(this); |
386 iEcsObserver = new (ELeave) TAknQueryEcsObserver(this); |
365 iEditIndicator = CAknQueryEditIndicator::NewL(this); |
387 iEditIndicator = CAknQueryEditIndicator::NewL(this); |
366 iEditIndicator->SetObserver(this); |
388 iEditIndicator->SetObserver(this); |
367 |
389 |
401 cba->SetPosition( TPoint( 0, 0 ) ); |
423 cba->SetPosition( TPoint( 0, 0 ) ); |
402 |
424 |
403 iExtension->iKeypad = CAknKeypad::NewL( *this, iQueryType ); |
425 iExtension->iKeypad = CAknKeypad::NewL( *this, iQueryType ); |
404 } |
426 } |
405 } |
427 } |
|
428 _AKNTRACE_FUNC_EXIT; |
406 } |
429 } |
407 |
430 |
408 void CAknQueryControl::ConstructQueryL(TResourceReader& aRes) |
431 void CAknQueryControl::ConstructQueryL(TResourceReader& aRes) |
409 { |
432 { |
|
433 _AKNTRACE( "[%s][%s] iQueryType : %d", "CAknQueryControl", "ConstructQueryL", iQueryType ); |
410 switch(iQueryType) |
434 switch(iQueryType) |
411 { |
435 { |
412 case EConfirmationQueryLayout: |
436 case EConfirmationQueryLayout: |
413 { |
437 { |
414 TPtrC bmpFile=aRes.ReadTPtrC(); |
438 TPtrC bmpFile=aRes.ReadTPtrC(); |
718 CAknQueryExtension* extension = QueryExtension(); |
742 CAknQueryExtension* extension = QueryExtension(); |
719 if( extension ) |
743 if( extension ) |
720 { |
744 { |
721 extension->CreateEditorContextL(); |
745 extension->CreateEditorContextL(); |
722 } |
746 } |
|
747 _AKNTRACE_FUNC_EXIT; |
723 } |
748 } |
724 |
749 |
725 TInt CAknQueryControl::PinCodeTimeoutCallback( TAny* aThis ) |
750 TInt CAknQueryControl::PinCodeTimeoutCallback( TAny* aThis ) |
726 { |
751 { |
|
752 _AKNTRACE_FUNC_ENTER; |
727 // play tacticon |
753 // play tacticon |
728 static_cast<CAknQueryControl*>( aThis )->PlayPinCodeTacticon(); |
754 static_cast<CAknQueryControl*>( aThis )->PlayPinCodeTacticon(); |
729 |
755 _AKNTRACE_FUNC_EXIT; |
730 return KErrNone; |
756 return KErrNone; |
731 } |
757 } |
732 |
758 |
733 void CAknQueryControl::PlayPinCodeTacticon() |
759 void CAknQueryControl::PlayPinCodeTacticon() |
734 { |
760 { |
|
761 _AKNTRACE_FUNC_ENTER; |
735 // play tacticon |
762 // play tacticon |
736 RTacticon client; |
763 RTacticon client; |
737 if ( KErrNone == client.Connect() ) |
764 if ( KErrNone == client.Connect() ) |
738 { |
765 { |
739 client.PlayTacticon( ENeutralTacticon ); |
766 client.PlayTacticon( ENeutralTacticon ); |
775 iExtension->iPinTacticonTimer->Start( |
804 iExtension->iPinTacticonTimer->Start( |
776 KPinCodeTacticonInterval, KPinCodeTacticonInterval, |
805 KPinCodeTacticonInterval, KPinCodeTacticonInterval, |
777 TCallBack( PinCodeTimeoutCallback, this ) ); |
806 TCallBack( PinCodeTimeoutCallback, this ) ); |
778 } |
807 } |
779 } |
808 } |
|
809 _AKNTRACE_FUNC_EXIT; |
780 } |
810 } |
781 |
811 |
782 void CAknQueryControl::StopPinCodeTacticonTimer() |
812 void CAknQueryControl::StopPinCodeTacticonTimer() |
783 { |
813 { |
|
814 _AKNTRACE_FUNC_ENTER; |
784 if ( iExtension ) |
815 if ( iExtension ) |
785 { |
816 { |
786 // delete timer |
817 // delete timer |
787 delete iExtension->iPinTacticonTimer; |
818 delete iExtension->iPinTacticonTimer; |
788 |
819 |
789 // set the timer null, so that it will not be used again |
820 // set the timer null, so that it will not be used again |
790 iExtension->iPinTacticonTimer = NULL; |
821 iExtension->iPinTacticonTimer = NULL; |
791 } |
822 } |
|
823 _AKNTRACE_FUNC_EXIT; |
792 } |
824 } |
793 |
825 |
794 /// |
826 /// |
795 /// CCoeControl methods |
827 /// CCoeControl methods |
796 /// |
828 /// |
923 /** |
955 /** |
924 * Forward key event to the editor |
956 * Forward key event to the editor |
925 */ |
957 */ |
926 EXPORT_C TKeyResponse CAknQueryControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType) |
958 EXPORT_C TKeyResponse CAknQueryControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType) |
927 { |
959 { |
|
960 _AKNTRACE( "[%s][%s] aKeyEvent.iCode :%d, aType:%d ", "CAknQueryControl", __FUNCTION__, aKeyEvent.iCode, aType); |
928 TKeyResponse response( EKeyWasNotConsumed ); |
961 TKeyResponse response( EKeyWasNotConsumed ); |
929 |
962 |
930 // Send key handling for emergency call support |
963 // Send key handling for emergency call support |
931 if ( aKeyEvent.iCode == EKeyYes ) |
964 if ( aKeyEvent.iCode == EKeyYes ) |
932 { |
965 { |
1107 // Manage appearance of the PIN query |
1141 // Manage appearance of the PIN query |
1108 // If match is complete, or complete + Send key, show the number |
1142 // If match is complete, or complete + Send key, show the number |
1109 TBool reveal = EFalse; |
1143 TBool reveal = EFalse; |
1110 TInt ecsState( iEcsDetector->State() ); |
1144 TInt ecsState( iEcsDetector->State() ); |
1111 if ( ( ecsState == CAknEcsDetector::ECompleteMatch ) || |
1145 if ( ( ecsState == CAknEcsDetector::ECompleteMatch ) || |
|
1146 ( ecsState == CAknEcsDetector::EServiceNumMatch ) || |
1112 ( ecsState == CAknEcsDetector::ECompleteMatchThenSendKey ) ) |
1147 ( ecsState == CAknEcsDetector::ECompleteMatchThenSendKey ) ) |
1113 { |
1148 { |
1114 // Further check to ensure that the matched number is the entire buffer |
1149 // Further check to ensure that the matched number is the entire buffer |
1115 // Get the matched text and see if is the same length as the current query length |
1150 // Get the matched text and see if is the same length as the current query length |
1116 if ( GetTextLength() == iEcsDetector->CurrentMatch().Length() ) |
1151 if ( GetTextLength() == iEcsDetector->CurrentMatch().Length() ) |
1117 { |
1152 { |
1118 reveal = ETrue; |
1153 reveal = ETrue; |
1119 |
1154 |
1120 if ( ecsState == CAknEcsDetector::ECompleteMatch ) |
1155 if ( ecsState == CAknEcsDetector::ECompleteMatch || |
|
1156 ecsState == CAknEcsDetector::EServiceNumMatch ) |
1121 { |
1157 { |
1122 SetEcsCbaVisibleL( ETrue ); |
1158 SetEcsCbaVisibleL( ETrue ); |
1123 } |
1159 } |
1124 } |
1160 } |
1125 } |
1161 } |
|
1162 _AKNTRACE( "[%s][%s] iPinEdwin->RevealSecretText( %d )", "CAknQueryControl", __FUNCTION__, reveal); |
1126 iPinEdwin->RevealSecretText( reveal ); |
1163 iPinEdwin->RevealSecretText( reveal ); |
1127 } |
1164 } |
1128 } |
1165 } |
1129 } |
1166 } |
1130 |
1167 |
2529 * from within some other non-key event that subsequently does not require references to the object |
2566 * from within some other non-key event that subsequently does not require references to the object |
2530 * |
2567 * |
2531 */ |
2568 */ |
2532 void CAknQueryControl::CancelQueryL() |
2569 void CAknQueryControl::CancelQueryL() |
2533 { |
2570 { |
|
2571 _AKNTRACE_FUNC_ENTER; |
2534 if (iQueryControlObserver) |
2572 if (iQueryControlObserver) |
2535 { |
2573 { |
2536 iQueryControlObserver->HandleQueryEditorStateEventL(this, MAknQueryControlObserver::EEmergencyCallAttempted, MAknQueryControlObserver::EEditorValueValid); |
2574 iQueryControlObserver->HandleQueryEditorStateEventL(this, MAknQueryControlObserver::EEmergencyCallAttempted, MAknQueryControlObserver::EEditorValueValid); |
2537 } |
2575 } |
2538 else |
2576 else |
2541 key.iCode=EKeyEscape; |
2579 key.iCode=EKeyEscape; |
2542 key.iModifiers=0; |
2580 key.iModifiers=0; |
2543 key.iScanCode = EStdKeyNull; |
2581 key.iScanCode = EStdKeyNull; |
2544 iEikonEnv->SimulateKeyEventL(key, EEventKey); |
2582 iEikonEnv->SimulateKeyEventL(key, EEventKey); |
2545 } |
2583 } |
|
2584 _AKNTRACE_FUNC_EXIT; |
2546 } |
2585 } |
2547 |
2586 |
2548 /** |
2587 /** |
2549 * This method looks at the flags that have been set in the query control and |
2588 * This method looks at the flags that have been set in the query control and |
2550 * acts upon them if possible |
2589 * acts upon them if possible |
2598 iEditIndicator->SetFlags( aFlags ); |
2637 iEditIndicator->SetFlags( aFlags ); |
2599 } |
2638 } |
2600 |
2639 |
2601 EXPORT_C void CAknQueryControl::SetImageL(CEikImage* aImage) |
2640 EXPORT_C void CAknQueryControl::SetImageL(CEikImage* aImage) |
2602 { // Gets ownership of the aImage |
2641 { // Gets ownership of the aImage |
2603 |
2642 _AKNTRACE_FUNC_ENTER; |
2604 if ( iImage && iImage->IsPictureOwnedExternally() ) |
2643 if ( iImage && iImage->IsPictureOwnedExternally() ) |
2605 { |
2644 { |
2606 delete ((CApaMaskedBitmap*) iImage->Bitmap()); |
2645 delete ((CApaMaskedBitmap*) iImage->Bitmap()); |
2607 } |
2646 } |
2608 |
2647 |
2616 |
2655 |
2617 delete iAnimation; |
2656 delete iAnimation; |
2618 iAnimation = NULL; |
2657 iAnimation = NULL; |
2619 |
2658 |
2620 Layout(); |
2659 Layout(); |
|
2660 _AKNTRACE_FUNC_EXIT; |
2621 } |
2661 } |
2622 |
2662 |
2623 EXPORT_C void CAknQueryControl::SetImageL(const TDesC& aImageFile, |
2663 EXPORT_C void CAknQueryControl::SetImageL(const TDesC& aImageFile, |
2624 TInt aBmpId, TInt aBmpMaskId) |
2664 TInt aBmpId, TInt aBmpMaskId) |
2625 { |
2665 { |
|
2666 _AKNTRACE_FUNC_ENTER; |
2626 CEikImage* image = new(ELeave) CEikImage; |
2667 CEikImage* image = new(ELeave) CEikImage; |
2627 CleanupStack::PushL( image ); |
2668 CleanupStack::PushL( image ); |
2628 |
2669 |
2629 TBool skinnedFound( EFalse ); |
2670 TBool skinnedFound( EFalse ); |
2630 if ( aImageFile.CompareF(KAvkonBitmapFile) == 0 ) // Skinning is supported only avkon bitmaps |
2671 if ( aImageFile.CompareF(KAvkonBitmapFile) == 0 ) // Skinning is supported only avkon bitmaps |
2651 image->CreatePictureFromFileL(aImageFile,aBmpId,aBmpMaskId); |
2692 image->CreatePictureFromFileL(aImageFile,aBmpId,aBmpMaskId); |
2652 } |
2693 } |
2653 |
2694 |
2654 CleanupStack::Pop(); //image |
2695 CleanupStack::Pop(); //image |
2655 SetImageL(image); // gets ownership |
2696 SetImageL(image); // gets ownership |
|
2697 _AKNTRACE_FUNC_EXIT; |
2656 } |
2698 } |
2657 |
2699 |
2658 EXPORT_C void CAknQueryControl::SetAnimationL(TInt aResource) |
2700 EXPORT_C void CAknQueryControl::SetAnimationL(TInt aResource) |
2659 { |
2701 { |
|
2702 _AKNTRACE_FUNC_ENTER; |
2660 delete iAnimation; |
2703 delete iAnimation; |
2661 iAnimation = NULL; |
2704 iAnimation = NULL; |
2662 iAnimation = CAknBitmapAnimation::NewL(); |
2705 iAnimation = CAknBitmapAnimation::NewL(); |
2663 iAnimation->SetContainerWindowL(*this); |
2706 iAnimation->SetContainerWindowL(*this); |
2664 |
2707 |
2675 // Save the animation resource id, because this function will be re-called |
2718 // Save the animation resource id, because this function will be re-called |
2676 // when handling resource change. |
2719 // when handling resource change. |
2677 iExtension->iAnimationId = aResource; |
2720 iExtension->iAnimationId = aResource; |
2678 |
2721 |
2679 Layout(); |
2722 Layout(); |
|
2723 _AKNTRACE_FUNC_EXIT; |
2680 } |
2724 } |
2681 |
2725 |
2682 EXPORT_C void CAknQueryControl::StartAnimationL() |
2726 EXPORT_C void CAknQueryControl::StartAnimationL() |
2683 { |
2727 { |
|
2728 _AKNTRACE_FUNC_ENTER; |
2684 if (iAnimation) |
2729 if (iAnimation) |
2685 { |
2730 { |
2686 CBitmapAnimClientData *animClientData = iAnimation->BitmapAnimData(); |
2731 CBitmapAnimClientData *animClientData = iAnimation->BitmapAnimData(); |
2687 if (animClientData != NULL && animClientData->FrameArray().Count() <= 1) |
2732 if (animClientData != NULL && animClientData->FrameArray().Count() <= 1) |
2688 { |
2733 { |
2723 CleanupStack::Pop(bitmap); |
2768 CleanupStack::Pop(bitmap); |
2724 } |
2769 } |
2725 |
2770 |
2726 iAnimation->StartAnimationL(); |
2771 iAnimation->StartAnimationL(); |
2727 } |
2772 } |
|
2773 _AKNTRACE_FUNC_EXIT; |
2728 } |
2774 } |
2729 |
2775 |
2730 EXPORT_C TInt CAknQueryControl::CancelAnimation() |
2776 EXPORT_C TInt CAknQueryControl::CancelAnimation() |
2731 { |
2777 { |
2732 if ( iAnimation ) |
2778 _AKNTRACE_FUNC_ENTER; |
2733 { |
2779 TInt result(KErrGeneral); |
2734 return iAnimation->CancelAnimation(); |
2780 if ( iAnimation ) |
2735 } |
2781 { |
2736 return KErrGeneral; |
2782 result = iAnimation->CancelAnimation(); |
|
2783 } |
|
2784 _AKNTRACE( "[%s][%s] return %d", "CAknQueryControl", "CancelAnimation", result); |
|
2785 return result; |
2737 } |
2786 } |
2738 |
2787 |
2739 |
2788 |
2740 |
2789 |
2741 /** |
2790 /** |
2978 } |
3027 } |
2979 |
3028 |
2980 // Callback for doing a redraw when animating pictographs |
3029 // Callback for doing a redraw when animating pictographs |
2981 TInt CAknQueryControl::StaticPictographCallBack( TAny* aPtr ) |
3030 TInt CAknQueryControl::StaticPictographCallBack( TAny* aPtr ) |
2982 { |
3031 { |
|
3032 _AKNTRACE_FUNC_ENTER; |
2983 CAknQueryControl* me = static_cast<CAknQueryControl*>( aPtr ); |
3033 CAknQueryControl* me = static_cast<CAknQueryControl*>( aPtr ); |
2984 me->PictographCallBack(); |
3034 me->PictographCallBack(); |
|
3035 _AKNTRACE_FUNC_EXIT; |
2985 return KErrNone; |
3036 return KErrNone; |
2986 } |
3037 } |
2987 |
3038 |
2988 void CAknQueryControl::PictographCallBack() |
3039 void CAknQueryControl::PictographCallBack() |
2989 { |
3040 { |
|
3041 _AKNTRACE_FUNC_ENTER; |
2990 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3042 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
2991 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
3043 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
2992 |
3044 |
2993 for ( TInt i = 0 ; i < iPrompt->NumberOfLines() ; i++ ) |
3045 for ( TInt i = 0 ; i < iPrompt->NumberOfLines() ; i++ ) |
2994 { |
3046 { |
3018 |
3070 |
3019 Window().EndRedraw(); |
3071 Window().EndRedraw(); |
3020 DeactivateGc(); |
3072 DeactivateGc(); |
3021 |
3073 |
3022 // Draw the label after the background. |
3074 // Draw the label after the background. |
3023 iPrompt->Line( i )->ActivateL(); // Never leaves |
3075 TRAPD(err, iPrompt->Line( i )->ActivateL()); // Never leaves |
3024 iPrompt->Line( i )->DrawNow(); |
3076 if (err == KErrNone) |
|
3077 { |
|
3078 iPrompt->Line( i )->DrawNow(); |
|
3079 } |
3025 iPrompt->SetLineModified( i, EFalse ); |
3080 iPrompt->SetLineModified( i, EFalse ); |
3026 } |
3081 } |
3027 } |
3082 } |
|
3083 _AKNTRACE_FUNC_EXIT; |
3028 } |
3084 } |
3029 |
3085 |
3030 TBool CAknQueryControl::EmbeddedVirtualInput() const |
3086 TBool CAknQueryControl::EmbeddedVirtualInput() const |
3031 { |
3087 { |
3032 if ( !QueryExtension()->iVirtualInputStatusFlags.IsSet( CAknQueryExtension::EVirtualInputCheckedAlready ) ) |
3088 if ( !QueryExtension()->iVirtualInputStatusFlags.IsSet( CAknQueryExtension::EVirtualInputCheckedAlready ) ) |
3058 } |
3114 } |
3059 |
3115 |
3060 |
3116 |
3061 CEikDialog* CAknQueryControl::Dialog() const |
3117 CEikDialog* CAknQueryControl::Dialog() const |
3062 { |
3118 { |
|
3119 _AKNTRACE_FUNC_ENTER; |
3063 CAknQueryControl* control = const_cast<CAknQueryControl*>( this ); |
3120 CAknQueryControl* control = const_cast<CAknQueryControl*>( this ); |
3064 |
3121 |
3065 CEikDialog* dialog = NULL; |
3122 CEikDialog* dialog = NULL; |
3066 control->MopGetObject( dialog ); |
3123 control->MopGetObject( dialog ); |
|
3124 _AKNTRACE_FUNC_EXIT; |
3067 return dialog; |
3125 return dialog; |
3068 } |
3126 } |
3069 |
3127 |
3070 |
3128 |
3071 void CAknQueryControl::CreateIncAndDecButtonsL() |
3129 void CAknQueryControl::CreateIncAndDecButtonsL() |
3328 AknLayoutUtils::LayoutLabel(iPrompt->Line(2), rect.Rect(), lineLayout ); |
3386 AknLayoutUtils::LayoutLabel(iPrompt->Line(2), rect.Rect(), lineLayout ); |
3329 } |
3387 } |
3330 |
3388 |
3331 EXPORT_C void CAknQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
3389 EXPORT_C void CAknQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
3332 { |
3390 { |
3333 CEikMfne* edwin = NULL; |
3391 if ( iHasEditor && iEditorFrame.Valid() |
3334 if ( iTimeEdwin ) |
3392 && iEditorFrame.Rect().Contains( aPointerEvent.iPosition ) ) |
3335 { |
3393 { |
3336 edwin = iTimeEdwin; |
3394 /*For the events happening inside editor frame's rect, query control will forward |
3337 } |
3395 the events to editors to handle.This is added to fix bug ESLM-85YFCH:Text editor is hard |
3338 else if ( iDateEdwin ) |
3396 to open in input dialog (usability). The valid area is enlarged to editor frame rect, |
3339 { |
3397 instead of text's rect, because text rect is too small for user to tap*/ |
3340 edwin = iDateEdwin; |
3398 CCoeControl* ctrl = ControlByLayoutOrNull( iQueryType ); |
3341 } |
3399 if( ctrl ) |
3342 else if ( LocationEd() ) |
3400 { |
3343 { |
3401 TPointerEvent pointerEvent( aPointerEvent ); |
3344 edwin = LocationEd(); |
3402 if( !ctrl->Rect().Contains( aPointerEvent.iPosition ) && ( NbrOfEditorLines() == 1 ) ) |
3345 } |
3403 { |
3346 else if ( iDurationEdwin ) |
3404 // for the pointerevents happening in editor frame rect, |
3347 { |
3405 // query control forward events to editors after justification |
3348 edwin = iDurationEdwin; |
3406 pointerEvent.iPosition.iY = ctrl->Rect().iTl.iY + ctrl->Rect().Height()/2; |
3349 } |
3407 } |
3350 |
3408 ctrl->HandlePointerEventL( pointerEvent ); |
3351 if ( edwin && iEditorFrame.Rect().Contains(aPointerEvent.iPosition) ) |
3409 } |
3352 { |
3410 else |
3353 edwin->HandlePointerEventL(aPointerEvent); |
3411 { |
3354 } |
3412 CAknControl::HandlePointerEventL( aPointerEvent ); |
|
3413 } |
|
3414 } |
3355 else |
3415 else |
3356 { |
3416 { |
3357 CAknControl::HandlePointerEventL(aPointerEvent); |
3417 CAknControl::HandlePointerEventL( aPointerEvent ); |
3358 } |
3418 } |
3359 } |
3419 } |
3360 |
3420 |
3361 EXPORT_C void* CAknQueryControl::ExtensionInterface( TUid /*aInterface*/ ) |
3421 EXPORT_C void* CAknQueryControl::ExtensionInterface( TUid /*aInterface*/ ) |
3362 { |
3422 { |
3363 return NULL; |
3423 return NULL; |
3364 } |
3424 } |
3365 |
3425 |
3366 EXPORT_C void CAknQueryControl::HandleResourceChange(TInt aType) |
3426 EXPORT_C void CAknQueryControl::HandleResourceChange(TInt aType) |
3367 { |
3427 { |
|
3428 _AKNTRACE_FUNC_ENTER; |
3368 CCoeControl::HandleResourceChange(aType); |
3429 CCoeControl::HandleResourceChange(aType); |
3369 |
3430 |
3370 if( aType == KAknsMessageSkinChange && iExtension->iAnimationId ) |
3431 if( aType == KAknsMessageSkinChange && iExtension->iAnimationId ) |
3371 { |
3432 { |
3372 TRAP_IGNORE(SetAnimationL( iExtension->iAnimationId )); |
3433 TRAP_IGNORE(SetAnimationL( iExtension->iAnimationId )); |
3375 else if( aType == KEikDynamicLayoutVariantSwitch ) |
3436 else if( aType == KEikDynamicLayoutVariantSwitch ) |
3376 { |
3437 { |
3377 SizeChanged(); |
3438 SizeChanged(); |
3378 TRAP_IGNORE(DoSetPromptL()); |
3439 TRAP_IGNORE(DoSetPromptL()); |
3379 } |
3440 } |
|
3441 _AKNTRACE_FUNC_EXIT; |
3380 } |
3442 } |
3381 |
3443 |
3382 // --------------------------------------------------------------------------- |
3444 // --------------------------------------------------------------------------- |
3383 // Return prompt text needed by FEP to query dialog |
3445 // Return prompt text needed by FEP to query dialog |
3384 // --------------------------------------------------------------------------- |
3446 // --------------------------------------------------------------------------- |
3408 // Sets the state of ECS number visibility in the query. |
3470 // Sets the state of ECS number visibility in the query. |
3409 // --------------------------------------------------------------------------- |
3471 // --------------------------------------------------------------------------- |
3410 // |
3472 // |
3411 void CAknQueryControl::SetEcsCbaVisibleL( TBool aVisible ) |
3473 void CAknQueryControl::SetEcsCbaVisibleL( TBool aVisible ) |
3412 { |
3474 { |
|
3475 _AKNTRACE( "[%s][%s] aVisible:%d ", "CAknQueryControl", __FUNCTION__,aVisible); |
3413 if ( iExtension && |
3476 if ( iExtension && |
3414 !COMPARE_BOOLS( aVisible, iExtension->iEcsCbaShown ) && |
3477 !COMPARE_BOOLS( aVisible, iExtension->iEcsCbaShown ) && |
3415 iFlags.IsSet( EEmergencyCallsCBASupport ) ) |
3478 iFlags.IsSet( EEmergencyCallsCBASupport ) ) |
3416 { |
3479 { |
3417 CEikDialog* dlg; |
3480 CEikDialog* dlg; |
3442 iExtension->iEcsCbaShown = EFalse; |
3505 iExtension->iEcsCbaShown = EFalse; |
3443 } |
3506 } |
3444 } |
3507 } |
3445 } |
3508 } |
3446 } |
3509 } |
|
3510 _AKNTRACE_FUNC_EXIT; |
3447 } |
3511 } |
3448 |
3512 |
3449 |
3513 |
3450 // --------------------------------------------------------------------------- |
3514 // --------------------------------------------------------------------------- |
3451 // Attempts an emergency call. |
3515 // Attempts an emergency call. |
3452 // --------------------------------------------------------------------------- |
3516 // --------------------------------------------------------------------------- |
3453 // |
3517 // |
3454 void CAknQueryControl::AttemptEmergencyCallL() |
3518 void CAknQueryControl::AttemptEmergencyCallL() |
3455 { |
3519 { |
|
3520 _AKNTRACE_FUNC_ENTER; |
3456 if ( iEcsDetector ) |
3521 if ( iEcsDetector ) |
3457 { |
3522 { |
3458 if ( iEcsDetector->State() == CAknEcsDetector::ECompleteMatch ) |
3523 if ( iEcsDetector->State() == CAknEcsDetector::ECompleteMatch || |
|
3524 iEcsDetector->State() == CAknEcsDetector::EServiceNumMatch ) |
3459 { |
3525 { |
3460 // Further check to ensure that the matched number is the |
3526 // Further check to ensure that the matched number is the |
3461 // entire buffer. Get the matched text and see if is the same |
3527 // entire buffer. Get the matched text and see if is the same |
3462 // length as the current query length. |
3528 // length as the current query length. |
3463 if ( GetTextLength() == iEcsDetector->CurrentMatch().Length() ) |
3529 if ( GetTextLength() == iEcsDetector->CurrentMatch().Length() ) |
3505 } |
3572 } |
3506 |
3573 |
3507 |
3574 |
3508 void CAknExtQueryControl::ConstructQueryL(TResourceReader& aRes) |
3575 void CAknExtQueryControl::ConstructQueryL(TResourceReader& aRes) |
3509 { |
3576 { |
|
3577 _AKNTRACE_FUNC_ENTER; |
3510 if ( iQueryType == EIpLayout) |
3578 if ( iQueryType == EIpLayout) |
3511 { |
3579 { |
3512 iIpEditor = new(ELeave)CAknIpFieldEditor; |
3580 iIpEditor = new(ELeave)CAknIpFieldEditor; |
3513 iIpEditor->SetContainerWindowL(*this); |
3581 iIpEditor->SetContainerWindowL(*this); |
3514 iIpEditor->ConstructFromResourceL(aRes); |
3582 iIpEditor->ConstructFromResourceL(aRes); |
3611 } |
3680 } |
3612 |
3681 |
3613 EXPORT_C void CAknExtQueryControl::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) |
3682 EXPORT_C void CAknExtQueryControl::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) |
3614 { |
3683 { |
3615 //CAknQueryControl::HandleControlEventL(NULL, aEventType); |
3684 //CAknQueryControl::HandleControlEventL(NULL, aEventType); |
3616 |
3685 _AKNTRACE( "[%s][%s] aEventType:%d ", "CAknExtQueryControl", "HandleControlEventL",aEventType); |
3617 if(iQueryControlObserver && aEventType == EEventStateChanged) |
3686 if(iQueryControlObserver && aEventType == EEventStateChanged) |
3618 { |
3687 { |
3619 if(GetTextLength()) |
3688 if(GetTextLength()) |
3620 { |
3689 { |
3621 iQueryControlObserver->HandleQueryEditorStateEventL(this,MAknQueryControlObserver::EQueryControlEditorStateChanging, MAknQueryControlObserver::EEditorValueValid); |
3690 iQueryControlObserver->HandleQueryEditorStateEventL(this,MAknQueryControlObserver::EQueryControlEditorStateChanging, MAknQueryControlObserver::EEditorValueValid); |
3720 } |
3790 } |
3721 } |
3791 } |
3722 |
3792 |
3723 EXPORT_C void CAknExtQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
3793 EXPORT_C void CAknExtQueryControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
3724 { |
3794 { |
3725 if ( iIpEditor && iEditorFrame.Rect().Contains(aPointerEvent.iPosition) ) |
3795 if ( iHasEditor && iEditorFrame.Valid() |
3726 { |
3796 && iEditorFrame.Rect().Contains( aPointerEvent.iPosition ) ) |
3727 iIpEditor->HandlePointerEventL(aPointerEvent); |
3797 { |
3728 } |
3798 /*For the events happening inside editor frame's rect, query control will forward |
3729 else |
3799 the events to editors to handle.This is added to fix bug ESLM-85YFCH:Text editor is hard |
3730 { |
3800 to open in input dialog (usability). The valid area is enlarged to editor frame rect, |
3731 CAknQueryControl::HandlePointerEventL(aPointerEvent); |
3801 instead of text's rect, because text rect is too small for user to tap*/ |
3732 } |
3802 CCoeControl* ctrl = ControlByLayoutOrNull( iQueryType ); |
|
3803 if( ctrl ) |
|
3804 { |
|
3805 TPointerEvent pointerEvent( aPointerEvent ); |
|
3806 if( !ctrl->Rect().Contains( aPointerEvent.iPosition ) && ( NbrOfEditorLines() == 1 ) ) |
|
3807 { |
|
3808 // for the pointerevents happening in editor frame rect, |
|
3809 // query control forward events to editors after justification |
|
3810 pointerEvent.iPosition.iY = ctrl->Rect().iTl.iY + ctrl->Rect().Height()/2; |
|
3811 } |
|
3812 ctrl->HandlePointerEventL( pointerEvent ); |
|
3813 } |
|
3814 else |
|
3815 { |
|
3816 CAknControl::HandlePointerEventL( aPointerEvent ); |
|
3817 } |
|
3818 } |
|
3819 else |
|
3820 { |
|
3821 CAknControl::HandlePointerEventL( aPointerEvent ); |
|
3822 } |
3733 } |
3823 } |
3734 |
3824 |
3735 EXPORT_C void* CAknExtQueryControl::ExtensionInterface( TUid /*aInterface*/ ) |
3825 EXPORT_C void* CAknExtQueryControl::ExtensionInterface( TUid /*aInterface*/ ) |
3736 { |
3826 { |
3737 return NULL; |
3827 return NULL; |
3944 |
4034 |
3945 |
4035 |
3946 // Callback for doing a redraw when animating pictographs |
4036 // Callback for doing a redraw when animating pictographs |
3947 TInt CAknExtQueryControl::StaticPictographCallBack( TAny* aPtr ) |
4037 TInt CAknExtQueryControl::StaticPictographCallBack( TAny* aPtr ) |
3948 { |
4038 { |
|
4039 _AKNTRACE_FUNC_ENTER; |
3949 CAknExtQueryControl* me = static_cast<CAknExtQueryControl*>( aPtr ); |
4040 CAknExtQueryControl* me = static_cast<CAknExtQueryControl*>( aPtr ); |
3950 me->PictographCallBack(); |
4041 me->PictographCallBack(); |
|
4042 _AKNTRACE_FUNC_EXIT; |
3951 return KErrNone; |
4043 return KErrNone; |
3952 } |
4044 } |
3953 |
4045 |
3954 void CAknExtQueryControl::PictographCallBack() |
4046 void CAknExtQueryControl::PictographCallBack() |
3955 { |
4047 { |
|
4048 _AKNTRACE_FUNC_ENTER; |
3956 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4049 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
3957 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
4050 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
3958 |
4051 |
3959 for ( TInt i = 0 ; i < iPrompt->NumberOfLines() ; i++ ) |
4052 for ( TInt i = 0 ; i < iPrompt->NumberOfLines() ; i++ ) |
3960 { |
4053 { |
3984 |
4077 |
3985 Window().EndRedraw(); |
4078 Window().EndRedraw(); |
3986 DeactivateGc(); |
4079 DeactivateGc(); |
3987 |
4080 |
3988 // Draw the label after the background. |
4081 // Draw the label after the background. |
3989 iPrompt->Line( i )->ActivateL(); // Never leaves |
4082 TRAPD(err, iPrompt->Line( i )->ActivateL()); // Never leaves |
3990 iPrompt->Line( i )->DrawNow(); |
4083 if (err == KErrNone) |
|
4084 { |
|
4085 iPrompt->Line( i )->DrawNow(); |
|
4086 } |
3991 iPrompt->SetLineModified( i, EFalse ); |
4087 iPrompt->SetLineModified( i, EFalse ); |
3992 } |
4088 } |
3993 } |
4089 } |
|
4090 _AKNTRACE_FUNC_EXIT; |
3994 } |
4091 } |
3995 |
4092 |
3996 // End of File |
4093 // End of File |