uifw/AvKon/src/AknNoteDialog.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
--- a/uifw/AvKon/src/AknNoteDialog.cpp	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/AvKon/src/AknNoteDialog.cpp	Wed Sep 01 12:16:19 2010 +0100
@@ -46,21 +46,29 @@
 #endif
 
 #include <AknTasHook.h> // for testability hooks
+#include "akntrace.h"
 const TInt EEikDialogFlagSleeping   =0x20000;
 
+
+
 // -----------------------------------------------------------------------------
 // Finds out if this control belongs to the window group that is in focus.
-// This information can be used to skip effects when the window group is
-// not visible.
+// This information can be used to skip effects when the window group is not visible.
 //
-// @param aThis The control in question.
+// @param aControl The control in question.
 //
 // @return ETrue if the window group is in focus, otherwise EFalse
 // -----------------------------------------------------------------------------
 //
-TBool IsFocusedWindowGroup( CAknNoteDialog* aThis )
+TBool IsFocusedWindowGroup( const CCoeControl* aControl )
     {
-    RWindowTreeNode* node = aThis->DrawableWindow();
+    if( !aControl )
+    	{
+    	return EFalse;	
+    	}
+
+    RWindowTreeNode* node = aControl->DrawableWindow();
+
     // this code finds out if this control belongs to window group
     // that is in focus, there are some rare cases when the latest opened
     // popup goes behind another one (e.g. system lock query -> power key menu)
@@ -71,12 +79,13 @@
         {
         return EFalse;
         }
+        
     TInt nodeWindowGroupId = node->WindowGroupId();
     TInt focusedWindowGroupId = wsSession.GetFocusWindowGroup();
     
     if ( nodeWindowGroupId == focusedWindowGroupId )
         {
-        return ETrue;
+        return aControl->IsFocused();
         }
 
     TInt count = wsSession.NumWindowGroups( 0 );
@@ -100,7 +109,8 @@
             }
         }
     return EFalse;
-    }
+    }  
+    
 
 //////////////////////////////////////////////////////////////////////
 // CAknNoteDialogExtension
@@ -181,23 +191,32 @@
 EXPORT_C CAknNoteDialog::CAknNoteDialog() : CEikDialog(),
     iTimeoutInMicroseconds(ENoTimeout), iTone(ENoTone)
     {
+    _AKNTRACE_FUNC_ENTER;
     AKNTASHOOK_ADD( this, "CAknNoteDialog" );
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C CAknNoteDialog::CAknNoteDialog(const TTone& aTone, const TTimeout& aTimeout) :
     CEikDialog(), iTimeoutInMicroseconds(aTimeout), iTone(aTone)
     {
+    _AKNTRACE_FUNC_ENTER;
+    _AKNTRACE("iTimeoutInMicroseconds = %d", aTimeout);
     AKNTASHOOK_ADD( this, "CAknNoteDialog" );
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C CAknNoteDialog::CAknNoteDialog(CEikDialog** aSelfPtr,const TTone& aTone, const TTimeout& aTimeout) :
     CEikDialog(), iTimeoutInMicroseconds(aTimeout), iSelfPtr(aSelfPtr), iTone(aTone)
      {
+     _AKNTRACE_FUNC_ENTER;
+     _AKNTRACE("iTimeoutInMicroseconds = %d", aTimeout);
      AKNTASHOOK_ADD( this, "CAknNoteDialog" );
+     _AKNTRACE_FUNC_EXIT;
      }
 
 EXPORT_C CAknNoteDialog::~CAknNoteDialog()
     {
+    _AKNTRACE_FUNC_ENTER;
     AKNTASHOOK_REMOVE();
 // FIXME: Experimental heuristics for determining popup type
 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
@@ -225,6 +244,7 @@
 
     delete iControlAttributes;
     delete iNoteExtension;
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void CAknNoteDialog::SetTimeout(const TTimeout& aTimeout)
@@ -382,6 +402,7 @@
 
 EXPORT_C void CAknNoteDialog::LayoutAndDraw()
     {
+    _AKNTRACE_FUNC_ENTER;
     if (IsActivated())
         {
         TRect screenRect = iAvkonAppUi->ApplicationRect();
@@ -393,14 +414,16 @@
         CAknNoteAttributes* attr = ControlAttributes();
         if ( attr )
             {
-            RDebug::Print(_L("CAknNoteDialog allowing opt. draw, %d"), (TUint)this );            
+            _AKNTRACE( "[%s][%s] allowing opt. draw,0x%x", "CAknNoteDialog", "LayoutAndDraw", this );
             attr->AllowOptimizedDrawing();
             }
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C TInt CAknNoteDialog::RunLD()
     {
+    _AKNTRACE_FUNC_ENTER;
     PlayTone();
     ReportUserActivity();
 
@@ -414,17 +437,19 @@
         CAknTransitionUtils::RemoveData( ( TInt )NoteControl() );
         }
 #endif
-        
+
+    _AKNTRACE_FUNC_EXIT;    
     return CEikDialog::RunLD();
     }
 
 EXPORT_C TInt CAknNoteDialog::StaticDeleteL(TAny *aThis)
     {
+    _AKNTRACE_FUNC_ENTER;
     CAknNoteDialog* self = REINTERPRET_CAST(CAknNoteDialog*,aThis);
         
 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS           
     if ( self->IsVisible() && GfxTransEffect::IsRegistered( self ) &&
-        IsFocusedWindowGroup( self ) )
+         IsFocusedWindowGroup( self ) )
 		{
         TBool rsWasEnabled( EFalse );
         if( !CAknEnv::Static()->TransparencyEnabled() && self->DrawableWindow() && self->Window().IsRedrawStoreEnabled() )
@@ -478,12 +503,14 @@
         self->ExitSleepingDialog();
         self->NoteControl()->Reset();
         }
+    _AKNTRACE_FUNC_EXIT;
     return EFalse;
     }
 
 
 EXPORT_C void CAknNoteDialog::SetSizeAndPosition( const TSize& aSize )
     {
+    _AKNTRACE_FUNC_ENTER;
     SetBorder( TGulBorder::ENone );
     CAknNoteControl* note = NoteControl();
     if (note)
@@ -509,6 +536,7 @@
    
         ControlAttributes()->SetLayoutDone();                
         }
+    _AKNTRACE_FUNC_EXIT;
     }
 
 EXPORT_C void CAknNoteDialog::PreLayoutDynInitL()
@@ -661,6 +689,7 @@
 
 EXPORT_C void CAknNoteDialog::HandleResourceChange(TInt aType)
     {
+    _AKNTRACE_FUNC_ENTER;
     if(aType==KEikDynamicLayoutVariantSwitch)
         {
         if (!IsVisible())
@@ -697,6 +726,7 @@
         }
 
     CEikDialog::HandleResourceChange(aType);
+    _AKNTRACE_FUNC_EXIT;
     }
 
 /**
@@ -831,16 +861,30 @@
 
 EXPORT_C void CAknNoteDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent)
     {
+    _AKNTRACE_FUNC_ENTER;
     if ( AknLayoutUtils::PenEnabled() )
         {
         CCoeControl* ctrl = GrabbingComponent();
         CCoeControl::HandlePointerEventL(aPointerEvent);
-        
-        if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+        // Add tactile feedbacup when tap can close note.
+        if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
             {
-            if ( DialogFlags()&EEikDialogFlagCloseDialogWhenTapped )
+            if ( DialogFlags() & EEikDialogFlagCloseDialogWhenTapped )
                 {
-                //Touch release gives pop-up effect if note can be dismissed.
+                if( Rect().Contains( aPointerEvent.iPosition ) )
+                    {
+                    MTouchFeedback* feedback = MTouchFeedback::Instance();
+                    if ( feedback )
+                        {
+                        feedback->InstantFeedback( ETouchFeedbackPopUp );
+                        }
+                    }
+                }
+            }
+        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+            {
+            if ( DialogFlags() & EEikDialogFlagCloseDialogWhenTapped )
+                {
                 if ( ctrl )
                     {
                     // if grabbingComponent and dialog has 'close dialog when 
@@ -850,15 +894,11 @@
                         StaticDeleteL( this );
                         }
                     
-                    MTouchFeedback* feedback = MTouchFeedback::Instance();
-                    if ( feedback )
-                        {
-                        feedback->InstantFeedback( ETouchFeedbackPopUp );
-                        }
                     }
                 }
             }
         }
+    _AKNTRACE_FUNC_EXIT;
     }