44 #include <avkondomainpskeys.h> |
44 #include <avkondomainpskeys.h> |
45 #include <aknglobalpopupprioritycontroller.h> |
45 #include <aknglobalpopupprioritycontroller.h> |
46 #endif |
46 #endif |
47 |
47 |
48 #include <AknTasHook.h> // for testability hooks |
48 #include <AknTasHook.h> // for testability hooks |
|
49 #include "akntrace.h" |
49 const TInt EEikDialogFlagSleeping =0x20000; |
50 const TInt EEikDialogFlagSleeping =0x20000; |
|
51 |
|
52 |
50 |
53 |
51 // ----------------------------------------------------------------------------- |
54 // ----------------------------------------------------------------------------- |
52 // Finds out if this control belongs to the window group that is in focus. |
55 // Finds out if this control belongs to the window group that is in focus. |
53 // This information can be used to skip effects when the window group is |
56 // This information can be used to skip effects when the window group is not visible. |
54 // not visible. |
|
55 // |
57 // |
56 // @param aThis The control in question. |
58 // @param aControl The control in question. |
57 // |
59 // |
58 // @return ETrue if the window group is in focus, otherwise EFalse |
60 // @return ETrue if the window group is in focus, otherwise EFalse |
59 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
60 // |
62 // |
61 TBool IsFocusedWindowGroup( CAknNoteDialog* aThis ) |
63 TBool IsFocusedWindowGroup( const CCoeControl* aControl ) |
62 { |
64 { |
63 RWindowTreeNode* node = aThis->DrawableWindow(); |
65 if( !aControl ) |
|
66 { |
|
67 return EFalse; |
|
68 } |
|
69 |
|
70 RWindowTreeNode* node = aControl->DrawableWindow(); |
|
71 |
64 // this code finds out if this control belongs to window group |
72 // this code finds out if this control belongs to window group |
65 // that is in focus, there are some rare cases when the latest opened |
73 // that is in focus, there are some rare cases when the latest opened |
66 // popup goes behind another one (e.g. system lock query -> power key menu) |
74 // popup goes behind another one (e.g. system lock query -> power key menu) |
67 // we don't want transition in that case |
75 // we don't want transition in that case |
68 RWsSession& wsSession = CEikonEnv::Static()->WsSession(); |
76 RWsSession& wsSession = CEikonEnv::Static()->WsSession(); |
69 |
77 |
70 if ( !node ) |
78 if ( !node ) |
71 { |
79 { |
72 return EFalse; |
80 return EFalse; |
73 } |
81 } |
|
82 |
74 TInt nodeWindowGroupId = node->WindowGroupId(); |
83 TInt nodeWindowGroupId = node->WindowGroupId(); |
75 TInt focusedWindowGroupId = wsSession.GetFocusWindowGroup(); |
84 TInt focusedWindowGroupId = wsSession.GetFocusWindowGroup(); |
76 |
85 |
77 if ( nodeWindowGroupId == focusedWindowGroupId ) |
86 if ( nodeWindowGroupId == focusedWindowGroupId ) |
78 { |
87 { |
79 return ETrue; |
88 return aControl->IsFocused(); |
80 } |
89 } |
81 |
90 |
82 TInt count = wsSession.NumWindowGroups( 0 ); |
91 TInt count = wsSession.NumWindowGroups( 0 ); |
83 |
92 |
84 // because there is not leave here,so no need to use CleanupStack. |
93 // because there is not leave here,so no need to use CleanupStack. |
179 ////////////////////////////////////////////////////////////////////// |
189 ////////////////////////////////////////////////////////////////////// |
180 |
190 |
181 EXPORT_C CAknNoteDialog::CAknNoteDialog() : CEikDialog(), |
191 EXPORT_C CAknNoteDialog::CAknNoteDialog() : CEikDialog(), |
182 iTimeoutInMicroseconds(ENoTimeout), iTone(ENoTone) |
192 iTimeoutInMicroseconds(ENoTimeout), iTone(ENoTone) |
183 { |
193 { |
|
194 _AKNTRACE_FUNC_ENTER; |
184 AKNTASHOOK_ADD( this, "CAknNoteDialog" ); |
195 AKNTASHOOK_ADD( this, "CAknNoteDialog" ); |
|
196 _AKNTRACE_FUNC_EXIT; |
185 } |
197 } |
186 |
198 |
187 EXPORT_C CAknNoteDialog::CAknNoteDialog(const TTone& aTone, const TTimeout& aTimeout) : |
199 EXPORT_C CAknNoteDialog::CAknNoteDialog(const TTone& aTone, const TTimeout& aTimeout) : |
188 CEikDialog(), iTimeoutInMicroseconds(aTimeout), iTone(aTone) |
200 CEikDialog(), iTimeoutInMicroseconds(aTimeout), iTone(aTone) |
189 { |
201 { |
|
202 _AKNTRACE_FUNC_ENTER; |
|
203 _AKNTRACE("iTimeoutInMicroseconds = %d", aTimeout); |
190 AKNTASHOOK_ADD( this, "CAknNoteDialog" ); |
204 AKNTASHOOK_ADD( this, "CAknNoteDialog" ); |
|
205 _AKNTRACE_FUNC_EXIT; |
191 } |
206 } |
192 |
207 |
193 EXPORT_C CAknNoteDialog::CAknNoteDialog(CEikDialog** aSelfPtr,const TTone& aTone, const TTimeout& aTimeout) : |
208 EXPORT_C CAknNoteDialog::CAknNoteDialog(CEikDialog** aSelfPtr,const TTone& aTone, const TTimeout& aTimeout) : |
194 CEikDialog(), iTimeoutInMicroseconds(aTimeout), iSelfPtr(aSelfPtr), iTone(aTone) |
209 CEikDialog(), iTimeoutInMicroseconds(aTimeout), iSelfPtr(aSelfPtr), iTone(aTone) |
195 { |
210 { |
|
211 _AKNTRACE_FUNC_ENTER; |
|
212 _AKNTRACE("iTimeoutInMicroseconds = %d", aTimeout); |
196 AKNTASHOOK_ADD( this, "CAknNoteDialog" ); |
213 AKNTASHOOK_ADD( this, "CAknNoteDialog" ); |
|
214 _AKNTRACE_FUNC_EXIT; |
197 } |
215 } |
198 |
216 |
199 EXPORT_C CAknNoteDialog::~CAknNoteDialog() |
217 EXPORT_C CAknNoteDialog::~CAknNoteDialog() |
200 { |
218 { |
|
219 _AKNTRACE_FUNC_ENTER; |
201 AKNTASHOOK_REMOVE(); |
220 AKNTASHOOK_REMOVE(); |
202 // FIXME: Experimental heuristics for determining popup type |
221 // FIXME: Experimental heuristics for determining popup type |
203 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
222 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
204 |
223 |
205 if ( GfxTransEffect::IsRegistered( this ) ) |
224 if ( GfxTransEffect::IsRegistered( this ) ) |
391 // Tell the attributes that the note has been fully drawn. |
412 // Tell the attributes that the note has been fully drawn. |
392 // Optimized text drawing is allowed only after this. |
413 // Optimized text drawing is allowed only after this. |
393 CAknNoteAttributes* attr = ControlAttributes(); |
414 CAknNoteAttributes* attr = ControlAttributes(); |
394 if ( attr ) |
415 if ( attr ) |
395 { |
416 { |
396 RDebug::Print(_L("CAknNoteDialog allowing opt. draw, %d"), (TUint)this ); |
417 _AKNTRACE( "[%s][%s] allowing opt. draw,0x%x", "CAknNoteDialog", "LayoutAndDraw", this ); |
397 attr->AllowOptimizedDrawing(); |
418 attr->AllowOptimizedDrawing(); |
398 } |
419 } |
399 } |
420 } |
|
421 _AKNTRACE_FUNC_EXIT; |
400 } |
422 } |
401 |
423 |
402 EXPORT_C TInt CAknNoteDialog::RunLD() |
424 EXPORT_C TInt CAknNoteDialog::RunLD() |
403 { |
425 { |
|
426 _AKNTRACE_FUNC_ENTER; |
404 PlayTone(); |
427 PlayTone(); |
405 ReportUserActivity(); |
428 ReportUserActivity(); |
406 |
429 |
407 // FIXME: Experimental heuristics for finding out popup context from image/animation |
430 // FIXME: Experimental heuristics for finding out popup context from image/animation |
408 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
431 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
412 { |
435 { |
413 GfxTransEffect::Register( this, TUid::Uid( uid ) ); |
436 GfxTransEffect::Register( this, TUid::Uid( uid ) ); |
414 CAknTransitionUtils::RemoveData( ( TInt )NoteControl() ); |
437 CAknTransitionUtils::RemoveData( ( TInt )NoteControl() ); |
415 } |
438 } |
416 #endif |
439 #endif |
417 |
440 |
|
441 _AKNTRACE_FUNC_EXIT; |
418 return CEikDialog::RunLD(); |
442 return CEikDialog::RunLD(); |
419 } |
443 } |
420 |
444 |
421 EXPORT_C TInt CAknNoteDialog::StaticDeleteL(TAny *aThis) |
445 EXPORT_C TInt CAknNoteDialog::StaticDeleteL(TAny *aThis) |
422 { |
446 { |
|
447 _AKNTRACE_FUNC_ENTER; |
423 CAknNoteDialog* self = REINTERPRET_CAST(CAknNoteDialog*,aThis); |
448 CAknNoteDialog* self = REINTERPRET_CAST(CAknNoteDialog*,aThis); |
424 |
449 |
425 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
450 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
426 if ( self->IsVisible() && GfxTransEffect::IsRegistered( self ) && |
451 if ( self->IsVisible() && GfxTransEffect::IsRegistered( self ) && |
427 IsFocusedWindowGroup( self ) ) |
452 IsFocusedWindowGroup( self ) ) |
428 { |
453 { |
429 TBool rsWasEnabled( EFalse ); |
454 TBool rsWasEnabled( EFalse ); |
430 if( !CAknEnv::Static()->TransparencyEnabled() && self->DrawableWindow() && self->Window().IsRedrawStoreEnabled() ) |
455 if( !CAknEnv::Static()->TransparencyEnabled() && self->DrawableWindow() && self->Window().IsRedrawStoreEnabled() ) |
431 { |
456 { |
432 rsWasEnabled = ETrue; |
457 rsWasEnabled = ETrue; |
476 self->iTimer->Cancel(); |
501 self->iTimer->Cancel(); |
477 self->OkToExitL(KErrCancel); |
502 self->OkToExitL(KErrCancel); |
478 self->ExitSleepingDialog(); |
503 self->ExitSleepingDialog(); |
479 self->NoteControl()->Reset(); |
504 self->NoteControl()->Reset(); |
480 } |
505 } |
|
506 _AKNTRACE_FUNC_EXIT; |
481 return EFalse; |
507 return EFalse; |
482 } |
508 } |
483 |
509 |
484 |
510 |
485 EXPORT_C void CAknNoteDialog::SetSizeAndPosition( const TSize& aSize ) |
511 EXPORT_C void CAknNoteDialog::SetSizeAndPosition( const TSize& aSize ) |
486 { |
512 { |
|
513 _AKNTRACE_FUNC_ENTER; |
487 SetBorder( TGulBorder::ENone ); |
514 SetBorder( TGulBorder::ENone ); |
488 CAknNoteControl* note = NoteControl(); |
515 CAknNoteControl* note = NoteControl(); |
489 if (note) |
516 if (note) |
490 { |
517 { |
491 if (!ControlAttributes()->IsLayoutNeeded()) // if we have a note control, there must be attributes also |
518 if (!ControlAttributes()->IsLayoutNeeded()) // if we have a note control, there must be attributes also |
829 //------------------------------------------------------------------------------ |
859 //------------------------------------------------------------------------------ |
830 // |
860 // |
831 |
861 |
832 EXPORT_C void CAknNoteDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
862 EXPORT_C void CAknNoteDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
833 { |
863 { |
|
864 _AKNTRACE_FUNC_ENTER; |
834 if ( AknLayoutUtils::PenEnabled() ) |
865 if ( AknLayoutUtils::PenEnabled() ) |
835 { |
866 { |
836 CCoeControl* ctrl = GrabbingComponent(); |
867 CCoeControl* ctrl = GrabbingComponent(); |
837 CCoeControl::HandlePointerEventL(aPointerEvent); |
868 CCoeControl::HandlePointerEventL(aPointerEvent); |
838 |
869 // Add tactile feedbacup when tap can close note. |
839 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
870 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
840 { |
871 { |
841 if ( DialogFlags()&EEikDialogFlagCloseDialogWhenTapped ) |
872 if ( DialogFlags() & EEikDialogFlagCloseDialogWhenTapped ) |
842 { |
873 { |
843 //Touch release gives pop-up effect if note can be dismissed. |
874 if( Rect().Contains( aPointerEvent.iPosition ) ) |
|
875 { |
|
876 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
877 if ( feedback ) |
|
878 { |
|
879 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
|
880 } |
|
881 } |
|
882 } |
|
883 } |
|
884 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
885 { |
|
886 if ( DialogFlags() & EEikDialogFlagCloseDialogWhenTapped ) |
|
887 { |
844 if ( ctrl ) |
888 if ( ctrl ) |
845 { |
889 { |
846 // if grabbingComponent and dialog has 'close dialog when |
890 // if grabbingComponent and dialog has 'close dialog when |
847 // tapped flag', then close dialog here because tapping happened. |
891 // tapped flag', then close dialog here because tapping happened. |
848 if ( !IsBeingDestroyed() ) |
892 if ( !IsBeingDestroyed() ) |
849 { |
893 { |
850 StaticDeleteL( this ); |
894 StaticDeleteL( this ); |
851 } |
895 } |
852 |
896 |
853 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
854 if ( feedback ) |
|
855 { |
|
856 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
|
857 } |
|
858 } |
897 } |
859 } |
898 } |
860 } |
899 } |
861 } |
900 } |
|
901 _AKNTRACE_FUNC_EXIT; |
862 } |
902 } |
863 |
903 |
864 |
904 |
865 EXPORT_C void* CAknNoteDialog::ExtensionInterface( TUid /*aInterface*/ ) |
905 EXPORT_C void* CAknNoteDialog::ExtensionInterface( TUid /*aInterface*/ ) |
866 { |
906 { |