satui/satapp/SATUISrc/CSatUiViewAppUi.cpp
branchRCL_3
changeset 18 594d59766373
parent 12 71268bfa7aea
--- a/satui/satapp/SATUISrc/CSatUiViewAppUi.cpp	Thu Jul 15 19:16:18 2010 +0300
+++ b/satui/satapp/SATUISrc/CSatUiViewAppUi.cpp	Thu Aug 19 10:28:14 2010 +0300
@@ -1268,7 +1268,7 @@
         {
         TFLOGSTRING( "CSatUiViewAppUi::HandleForegroundEventL \
             need to display a dialog" )
-        if ( iForegroundControl )
+        if ( iForegroundControl && ForegroundAlive() )
             {
             iForegroundControl->SetFocus( ETrue, EDrawNow );
             }
@@ -3530,5 +3530,34 @@
         }
     TFLOGSTRING( "CSatUiViewAppUi::StopPlayToneL exiting" )
     }
+    
+// -----------------------------------------------------------------------------
+// CSatUiViewAppUi::ForegroundAlive
+// Check if foreground control is alive when HandleForegroundEventL is called.
+// -----------------------------------------------------------------------------
+//
+TBool CSatUiViewAppUi::ForegroundAlive() const
+    {
+    TFLOGSTRING( "CSatUiViewAppUi::ForegroundAlive called" )
+    
+    // Only if value of iForegroundControl equals to one of the following 8
+    // pointers, the alive value will be set to true. This will check if 
+    // the foreground control is alive.
+    TBool alive = 
+        iForegroundControl == static_cast<CCoeControl*>( iWaitNote ) 
+        || iForegroundControl == static_cast<CCoeControl*>( 
+           iDisplayTextIconDialog )
+        || iForegroundControl == static_cast<CCoeControl*>( 
+           iDisplayTextDialog )
+        || iForegroundControl == static_cast<CCoeControl*>( iGetInputDialog )
+        || iForegroundControl == static_cast<CCoeControl*>( iPermanentNote )
+        || iForegroundControl == static_cast<CCoeControl*>( iNoteDialog )
+        || iForegroundControl == static_cast<CCoeControl*>( iBipWaitNote )
+        || iForegroundControl == static_cast<CCoeControl*>( iQueryDialog );
+    
+    TFLOGSTRING2( "CSatUiViewAppUi::ForegroundAlive exiting alive=%d", alive )
+    
+    return alive;
+    }
 
 // End of File