codhandler/codui/src/CodWaitDialog.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of class CCodWaitDialog.   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include "CodWaitDialog.h"
       
    22 #include "CodUi.hrh"
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 // ---------------------------------------------------------
       
    27 // CCodWaitDialog::CCodWaitDialog()
       
    28 // ---------------------------------------------------------
       
    29 //
       
    30 CCodWaitDialog::CCodWaitDialog
       
    31 ( CEikDialog** aSelfPtr, MCodDialogCommandObserver& aObserver )
       
    32 : CAknWaitDialog( aSelfPtr, /*aVisibilityDelayOff=*/ ETrue )
       
    33     {
       
    34     iObserver = &aObserver;
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CCodWaitDialog::SetTextL()
       
    39 // ---------------------------------------------------------
       
    40 //
       
    41 void CCodWaitDialog::SetTextL( TInt aResourceId )
       
    42     {
       
    43     HBufC* prompt = iCoeEnv->AllocReadResourceLC( aResourceId );
       
    44     CAknWaitDialog::SetTextL( *prompt );
       
    45     CleanupStack::PopAndDestroy( prompt );
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // CCodWaitDialog::OfferKeyEventL()
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 TKeyResponse CCodWaitDialog::OfferKeyEventL
       
    53 ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
    54     {
       
    55     TKeyResponse response = EKeyWasNotConsumed;
       
    56     if ( aKeyEvent.iCode == EKeyPhoneEnd )
       
    57         {
       
    58         // Red key press -> Cancel.
       
    59         TryExitL( ECodUiCmdCancel );
       
    60         response = EKeyWasConsumed;
       
    61         }
       
    62     else
       
    63         {
       
    64         response = CAknWaitDialog::OfferKeyEventL( aKeyEvent, aType );
       
    65         }
       
    66     return response;
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------
       
    70 // CCodWaitDialog::OkToExitL()
       
    71 // ---------------------------------------------------------
       
    72 //
       
    73 TBool CCodWaitDialog::OkToExitL( TInt aButtonId )
       
    74     {
       
    75     if ( aButtonId == EAknSoftkeyCancel )
       
    76         {
       
    77         // CAknShutter simulates ESC key events; this causes Cancel command.
       
    78         return ETrue;
       
    79         }
       
    80     else
       
    81         {
       
    82         iObserver->HandleDialogCommandL( aButtonId );
       
    83         return EFalse;
       
    84         }
       
    85     }