startupservices/Startup/src/StartupQueryDialog.cpp
branchRCL_3
changeset 19 924385140d98
parent 18 0818dd463d41
child 20 c2c61fdca848
equal deleted inserted replaced
18:0818dd463d41 19:924385140d98
     1 /*
       
     2 * Copyright (c) 2002 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 "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:  
       
    15 *           This class adds send-key to acknowledge the time/date query.
       
    16 *           Feature is implemented to needs of the PET-chamber in production tests.
       
    17 *           More information can be found in Change Request-database.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include "StartupQueryDialog.h"
       
    25 
       
    26 // ========================= MEMBER FUNCTIONS ================================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CStartupQueryDialog::CStartupQueryDialog
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CStartupQueryDialog::CStartupQueryDialog( TTime& aTime, const TTone aTone ) :
       
    35     CAknTimeQueryDialog( aTime, aTone )
       
    36     {
       
    37     }
       
    38 
       
    39 // Destructor
       
    40 CStartupQueryDialog::~CStartupQueryDialog()
       
    41     {
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CStartupQueryDialog::OfferKeyEventL
       
    46 // (other items were commented in a header).
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 TKeyResponse CStartupQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
    50                                                             TEventCode aType)
       
    51     {
       
    52     if( aType != EEventKey )
       
    53         return EKeyWasNotConsumed;
       
    54 
       
    55     if( NeedToDismissQueryL( aKeyEvent ) )
       
    56             return EKeyWasConsumed;
       
    57     return CAknDialog::OfferKeyEventL(aKeyEvent,aType);
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CStartupQueryDialog::NeedToDismissQueryL
       
    62 // Allows user to acknowledge time and date queries with the send key.
       
    63 // (other items were commented in a header).
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 TBool CStartupQueryDialog::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
       
    67     {
       
    68     if (aKeyEvent.iCode == EKeyPhoneSend)
       
    69         {
       
    70         DismissQueryL();
       
    71         return ETrue;
       
    72         }
       
    73     return EFalse;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CStartupQueryDialog::DismissQueryL
       
    78 // Query is accepted if the left softkey is displayed 
       
    79 // (left softkey is displayed only if there is valid data in the query).
       
    80 // Query is discarded if the left softkey is not displayed.
       
    81 // Clients can override this and implement something different.
       
    82 // (other items were commented in a header).
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CStartupQueryDialog::DismissQueryL()
       
    86     {
       
    87     if (IsLeftSoftkeyVisible())
       
    88         {
       
    89         TryExitL(EEikBidOk);
       
    90         }
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CStartupQueryDialog::IsLeftSoftkeyVisible
       
    95 // (other items were commented in a header).
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 TBool CStartupQueryDialog::IsLeftSoftkeyVisible()
       
    99     {
       
   100     return ButtonGroupContainer().ButtonGroup()->IsCommandVisible(
       
   101                       ButtonGroupContainer().ButtonGroup()->CommandId(0));
       
   102     }
       
   103 
       
   104 // End of file