connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQuery.cpp
branchRCL_3
changeset 8 2e6c4614c58e
parent 1 40cb640ef159
child 17 c14618f9de99
--- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQuery.cpp	Tue Feb 02 00:24:11 2010 +0200
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQuery.cpp	Fri Feb 19 23:12:51 2010 +0200
@@ -39,6 +39,7 @@
 //
 // ---------------------------------------------------------
 // CConfirmationQuery::CConfirmationQuery
+// HOME NETWORK
 // ---------------------------------------------------------
 //
 CConfirmationQuery::CConfirmationQuery( CConfirmationQueryNotif* aNotif )
@@ -47,8 +48,7 @@
   iButtonGroupPreviouslyChanged( EFalse )
    {
    }
-    
-    
+
 // ---------------------------------------------------------
 // CConfirmationQuery::~CConfirmationQuery
 // ---------------------------------------------------------
@@ -60,8 +60,6 @@
     delete iExpiryTimer;
     }
 
-
-
 // ---------------------------------------------------------
 // CConfirmationQuery::OkToExitL
 // ---------------------------------------------------------
@@ -96,7 +94,6 @@
     return result;  
     }
     
-    
 // ---------------------------------------------------------
 // CConfirmationQuery::PreLayoutDynInitL()
 // ---------------------------------------------------------
@@ -112,7 +109,6 @@
     iExpiryTimer->Start();
     }
 
-
 // ---------------------------------------------------------
 // CConfirmationQuery::TryExitL()
 // ---------------------------------------------------------
@@ -159,4 +155,117 @@
     }
 
 
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// CConfirmationQueryVisitor::CConfirmationQueryVisitor
+// VISITOR NETWORK
+// ---------------------------------------------------------
+//
+CConfirmationQueryVisitor::CConfirmationQueryVisitor( 
+        CConfirmationQueryNotif* aNotif )
+    : 
+    iNotif( aNotif )
+    {
+    }
+    
+// ---------------------------------------------------------
+// CConfirmationQueryVisitor::~CConfirmationQueryVisitor
+// ---------------------------------------------------------
+//
+CConfirmationQueryVisitor::~CConfirmationQueryVisitor()
+    {
+    STATIC_CAST( CEikServAppUi*, 
+        CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
+    delete iExpiryTimer;
+    }
+
+// ---------------------------------------------------------
+// CConfirmationQueryVisitor::OkToExitL
+// ---------------------------------------------------------
+//
+TBool CConfirmationQueryVisitor::OkToExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CConfirmationQueryVisitor::OkToExitL" );
+    TBool result( EFalse );
+    TInt status = KErrCancel;
+    
+    if ( aButtonId == EAknSoftkeySelect || 
+         aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk )
+        {
+        iNotif->SetSelectedChoiceL( EMsgQueryThisTime );
+        result = ETrue;
+        status = KErrNone;
+        }
+    else if ( aButtonId == EAknSoftkeyCancel )
+        {
+        status = KErrCancel;
+        result = ETrue;
+        }
+
+    if ( result )
+        {
+        CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId );
+        if ( iNotif )
+            {
+            iNotif->CompleteL( status );
+            }
+        }
+
+    CLOG_LEAVEFN( "CConfirmationQueryVisitor::OkToExitL" );
+
+    return result;  
+    }
+    
+// ---------------------------------------------------------
+// CConfirmationQueryVisitor::PreLayoutDynInitL()
+// ---------------------------------------------------------
+//
+void CConfirmationQueryVisitor::PreLayoutDynInitL()
+    {      
+    CAknMessageQueryDialog::PreLayoutDynInitL();
+
+    STATIC_CAST( CEikServAppUi*, 
+                CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
+
+    iExpiryTimer = CExpiryTimer::NewL( *this );
+    iExpiryTimer->Start();
+    }
+
+// ---------------------------------------------------------
+// CConfirmationQueryVisitor::TryExitL()
+// ---------------------------------------------------------
+//
+void CConfirmationQueryVisitor::TryExitL( TInt aButtonId )
+    {
+    CLOG_ENTERFN( "CConfirmationQueryVisitor::TryExitL" );
+    CAknMessageQueryDialog::TryExitL( aButtonId );
+    CLOG_LEAVEFN( "CConfirmationQueryVisitor::TryExitL" );
+    }
+
+// ---------------------------------------------------------
+// CConfirmationQueryVisitor::OfferKeyEventL
+// ---------------------------------------------------------
+//
+TKeyResponse CConfirmationQueryVisitor::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                                 TEventCode aType)
+    {
+    if( aType == EEventKey && aKeyEvent.iCode == EKeyPhoneSend )
+        {
+        // Let's not obscure the Dialer in the background
+        if ( iExpiryTimer )
+            {
+            iExpiryTimer->Cancel();
+            iExpiryTimer->StartShort();    
+            }
+        }
+    
+    return CAknMessageQueryDialog::OfferKeyEventL( aKeyEvent,aType ); 
+    } 
+
+void CConfirmationQueryVisitor::HandleTimedOut()
+    {
+    TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
+    }
+
 // End of File