phonebookui/Phonebook2/UIControls/src/CPbk2PrependDlg.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-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: 
       
    15 *       Provides methods for Prepend dialog.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPbk2PrependDlg.h"  // This class' declaration
       
    22 
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 inline CPbk2PrependDlg::CPbk2PrependDlg(TDes& aDataText) :
       
    27     CAknTextQueryDialog(aDataText)
       
    28     {
       
    29     }
       
    30 
       
    31 EXPORT_C CPbk2PrependDlg* CPbk2PrependDlg::NewL(TDes& aDataText)
       
    32     {
       
    33     CPbk2PrependDlg* self = new(ELeave) CPbk2PrependDlg(aDataText);
       
    34     return self;
       
    35     }
       
    36 
       
    37 CPbk2PrependDlg::~CPbk2PrependDlg()
       
    38     {
       
    39     }
       
    40 
       
    41 TBool CPbk2PrependDlg::OkToExitL(TInt aButtonId)
       
    42     {
       
    43     TBool result(EFalse);
       
    44     
       
    45     if (aButtonId == EAknSoftkeyCall)
       
    46         {
       
    47         // With send key we can exit..
       
    48         CAknQueryControl* control = QueryControl();
       
    49         if (control)
       
    50             {
       
    51             // Save the text
       
    52             control->GetText(iDataText);
       
    53             }
       
    54 
       
    55         result = ETrue;
       
    56         }
       
    57     else
       
    58         {
       
    59         // ..otherwise, ask from base class
       
    60         result = CAknTextQueryDialog::OkToExitL(aButtonId);
       
    61         }
       
    62 
       
    63     return result;
       
    64     }
       
    65 
       
    66 TKeyResponse CPbk2PrependDlg::OfferKeyEventL
       
    67         (const TKeyEvent& aKeyEvent, TEventCode aType)
       
    68     {
       
    69     TKeyResponse ret(EKeyWasNotConsumed);
       
    70     
       
    71     // guards to prevent second call 
       
    72     if ( ( aType == EEventKeyDown || aType == EEventKeyUp )
       
    73         && aKeyEvent.iScanCode == EStdKeyYes )
       
    74         {
       
    75         return EKeyWasConsumed;
       
    76         }
       
    77     
       
    78     if (aKeyEvent.iCode == EKeyPhoneSend)
       
    79         {
       
    80         // If send key is pressed and the text is valid ,
       
    81         // exit and make the call (from calling class)
       
    82         if ( CheckIfEntryTextOk() )
       
    83             {
       
    84             TryExitL(EAknSoftkeyCall);
       
    85             }    
       
    86         ret = EKeyWasConsumed;
       
    87         }
       
    88     else
       
    89         {
       
    90 	    // Let the base class handle the event
       
    91 	    ret = CAknDialog::OfferKeyEventL(aKeyEvent, aType);
       
    92         }
       
    93 
       
    94     return ret;
       
    95     }
       
    96 
       
    97 //  End of File