imageeditor/ImageEditorUI/src/CMultiLineQueryDialog.cpp
changeset 1 edfc90759b9f
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 * Class implementation.
       
    17 *
       
    18 */
       
    19 /*
       
    20 * ============================================================================
       
    21 *  Name     : CMultiLineQueryDialog.cpp
       
    22 *  Part of  : Video Editor
       
    23 *  Interface : 
       
    24 *  Description:
       
    25 *     Class implementation.
       
    26 *  Version  :
       
    27 * ============================================================================
       
    28 */
       
    29 
       
    30 // INCLUDES
       
    31 #include "CMultiLineQueryDialog.h"
       
    32 //#include "VideoEditorCommon.h"
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 _LIT( KNewLine, "\n" );
       
    37 
       
    38 // MEMBER FUNCTIONS
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CMultiLineQueryDialog::CMultiLineQueryDialog
       
    42 // C++ default constructor can NOT contain any code, that
       
    43 // might leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 EXPORT_C CMultiLineQueryDialog::CMultiLineQueryDialog( TDes& aDataText, 
       
    47                                         const TTone& aTone /*= ENoTone*/ )
       
    48     : CAknTextQueryDialog( aDataText, aTone )
       
    49     {
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CMultiLineQueryDialog::NewL
       
    54 // Two-phased constructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C CMultiLineQueryDialog* CMultiLineQueryDialog::NewL( TDes& aDataText, 
       
    58                                               const TTone& aTone /*= ENoTone*/ )
       
    59     {
       
    60     CMultiLineQueryDialog* self = new( ELeave ) CMultiLineQueryDialog( aDataText, aTone );
       
    61     return self;
       
    62     }
       
    63 
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 //  Destructor
       
    67 // -----------------------------------------------------------------------------
       
    68 //    
       
    69 
       
    70 EXPORT_C CMultiLineQueryDialog::~CMultiLineQueryDialog()
       
    71     {    
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CMultiLineQueryDialog::OfferKeyEventL
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 EXPORT_C TKeyResponse CMultiLineQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
    79                                          TEventCode aType )
       
    80     { 
       
    81     TKeyResponse response;
       
    82 	if ( aType == EEventKey && aKeyEvent.iCode == EKeyEnter )
       
    83 		{
       
    84 		CAknQueryControl* control = static_cast<CAknQueryControl*>( ControlOrNull( EGeneralQuery ) );
       
    85 		CEikEdwin* edWin = static_cast<CEikEdwin*>( control->ControlByLayoutOrNull( EDataLayout ) );
       
    86 		if (edWin)
       
    87 	    	{
       
    88 	    	edWin->GetText( iDataText );
       
    89 	    	iDataText.Append( KNewLine );
       
    90 	    	edWin->SetTextL( &iDataText );
       
    91 	    	edWin->ClearSelectionL();
       
    92 	    	}
       
    93         response = EKeyWasConsumed;
       
    94 		}
       
    95 	else
       
    96 		{
       
    97 		response = CAknTextQueryDialog::OfferKeyEventL( aKeyEvent, aType );
       
    98 		}
       
    99 	
       
   100 	return response;
       
   101     }
       
   102