phonebookui/Phonebook2/ServerApplication/src/CPbk2KeyEventDealer.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Phonebook 2 key event dealer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CPbk2KeyEventDealer.h"
       
    20 
       
    21 // Phonebook 2
       
    22 #include <MPbk2KeyEventHandler.h>
       
    23 
       
    24 // System includes
       
    25 #include <coemain.h>
       
    26 #include <coeaui.h>
       
    27 
       
    28 // --------------------------------------------------------------------------
       
    29 // CPbk2KeyEventDealer::CPbk2KeyEventDealer
       
    30 // --------------------------------------------------------------------------
       
    31 //
       
    32 CPbk2KeyEventDealer::CPbk2KeyEventDealer
       
    33         ( MPbk2KeyEventHandler& aKeyEventHandler ) :
       
    34             iKeyEventHandler( aKeyEventHandler )
       
    35     {
       
    36     }
       
    37 
       
    38 // --------------------------------------------------------------------------
       
    39 // CPbk2KeyEventDealer::~CPbk2KeyEventDealer
       
    40 // --------------------------------------------------------------------------
       
    41 //
       
    42 CPbk2KeyEventDealer::~CPbk2KeyEventDealer()
       
    43     {
       
    44     CCoeAppUi* appUi = CCoeEnv::Static()->AppUi();
       
    45     if ( appUi )
       
    46         {
       
    47         appUi->RemoveFromStack( this );
       
    48         }
       
    49     }
       
    50 
       
    51 // --------------------------------------------------------------------------
       
    52 // CPbk2KeyEventDealer::ConstructL
       
    53 // --------------------------------------------------------------------------
       
    54 //
       
    55 inline void CPbk2KeyEventDealer::ConstructL()
       
    56     {
       
    57     // The priority must be greater than ECoeStackPriorityDialog
       
    58     // in order to be called by the stack before dialogs
       
    59     CCoeEnv::Static()->AppUi()->AddToStackL( this, ECoeStackPriorityCba );
       
    60     }
       
    61 
       
    62 // --------------------------------------------------------------------------
       
    63 // CPbk2KeyEventDealer::NewL
       
    64 // --------------------------------------------------------------------------
       
    65 //
       
    66 CPbk2KeyEventDealer* CPbk2KeyEventDealer::NewL
       
    67         ( MPbk2KeyEventHandler& aKeyEventHandler )
       
    68     {
       
    69     CPbk2KeyEventDealer* self =
       
    70         new ( ELeave ) CPbk2KeyEventDealer( aKeyEventHandler );
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL();
       
    73     CleanupStack::Pop( self );
       
    74     return self;
       
    75     }
       
    76 
       
    77 // --------------------------------------------------------------------------
       
    78 // CPbk2KeyEventDealer::OfferKeyEventL
       
    79 // --------------------------------------------------------------------------
       
    80 //
       
    81 TKeyResponse CPbk2KeyEventDealer::OfferKeyEventL
       
    82         ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
    83     {
       
    84     TKeyResponse result = EKeyWasNotConsumed;
       
    85 
       
    86     if  ( iKeyEventHandler.Pbk2ProcessKeyEventL( aKeyEvent, aType ) )
       
    87         {
       
    88         result = EKeyWasConsumed;
       
    89         }
       
    90 
       
    91     return result;
       
    92     }
       
    93 
       
    94 // End of File