gssettingsuis/Gs/GSAutoKeyguardPlugin/Src/GSAutoKeyguardPluginAutoKeyguardTimeQuery.cpp
branchRCL_3
changeset 53 8ee96d21d9bf
parent 51 8bda91a87a00
child 54 7e0eff37aedb
equal deleted inserted replaced
51:8bda91a87a00 53:8ee96d21d9bf
     1 /*
       
     2 * Copyright (c) 2006 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:  Time query for setting Autokeyguard period.
       
    15 *           
       
    16 *           
       
    17 *           
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include "GSAutoKeyguardPluginAutoKeyguardTimeQuery.h"
       
    25 
       
    26 // ========================= MEMBER FUNCTIONS ================================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CAutoKeyguardTimeQuery::CAutoKeyguardTimeQuery
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CAutoKeyguardTimeQuery::CAutoKeyguardTimeQuery( TTime& aTime, const TTone aTone ) :
       
    35     CAknTimeQueryDialog( aTime, aTone )
       
    36     {
       
    37     }
       
    38 
       
    39 // Destructor
       
    40 CAutoKeyguardTimeQuery::~CAutoKeyguardTimeQuery()
       
    41     {
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CAutoKeyguardTimeQuery::OfferKeyEventL
       
    46 // (other items were commented in a header).
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 TKeyResponse CAutoKeyguardTimeQuery::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 // CAutoKeyguardTimeQuery::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 CAutoKeyguardTimeQuery::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
       
    67     {
       
    68     if (aKeyEvent.iCode == EKeyPhoneSend)
       
    69         {
       
    70         DismissQueryL();
       
    71         return ETrue;
       
    72         }
       
    73     return EFalse;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CAutoKeyguardTimeQuery::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 CAutoKeyguardTimeQuery::DismissQueryL()
       
    86     {
       
    87     if (IsLeftSoftkeyVisible())
       
    88         {
       
    89         TryExitL(EEikBidOk);
       
    90         }
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CAutoKeyguardTimeQuery::IsLeftSoftkeyVisible
       
    95 // (other items were commented in a header).
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 TBool CAutoKeyguardTimeQuery::IsLeftSoftkeyVisible()
       
    99     {
       
   100     return ButtonGroupContainer().ButtonGroup()->IsCommandVisible(
       
   101                       ButtonGroupContainer().ButtonGroup()->CommandId(0));
       
   102     }
       
   103 
       
   104 // End of file