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