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