engines/vmbxengine/src/vmdialog.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2002 - 2009 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: Implementation of CVmTextQueryDialog class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <AknQueryDialog.h>
       
    21 #include <featmgr.h>
       
    22 #include "vmdialog.h"
       
    23 #include <vmbx.rsg>
       
    24 #include "vmblogger.h"
       
    25 
       
    26 
       
    27 // MEMBER FUNCTIONS
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CVmTextQueryDialog::CVmTextQueryDialog
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CVmTextQueryDialog::CVmTextQueryDialog( TDes& aDataText, 
       
    36                                         const TBool aSearchEnabled )
       
    37                              : CAknTextQueryDialog( aDataText ),
       
    38                                          iSearchEnabled( aSearchEnabled )
       
    39     {
       
    40     // no tone as default
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CVmTextQueryDialog::~CVmTextQueryDialog
       
    45 // Destructor
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CVmTextQueryDialog::~CVmTextQueryDialog()
       
    49 {
       
    50 
       
    51 }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CVmTextQueryDialog::NewL
       
    55 // Two-phased constructor
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CVmTextQueryDialog* CVmTextQueryDialog::NewL( TDes& aDataText, 
       
    59                                                 const TDesC& aPrompt, 
       
    60                                                   const TBool aSearchEnabled )
       
    61     {
       
    62     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::NewL =>" );
       
    63     CVmTextQueryDialog* query = new( ELeave ) CVmTextQueryDialog( aDataText,
       
    64                                                                aSearchEnabled );
       
    65     CleanupStack::PushL( query );
       
    66     query->SetPromptL( aPrompt );
       
    67     CleanupStack::Pop( query );
       
    68     VMBLOGSTRING( "VMBX: CVmTextQueryDialog: <=:NewL " );
       
    69     return query;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CVmTextQueryDialog::PreLayoutDynInitL
       
    74 // Pre-layout dialog initialisation
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CVmTextQueryDialog::PreLayoutDynInitL()
       
    78     {
       
    79     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL =>" );
       
    80     CAknTextQueryDialog::PreLayoutDynInitL();
       
    81 
       
    82     // Change command buttons if needed
       
    83     if ( iSearchEnabled && !QueryControl()->GetTextLength() )
       
    84         {
       
    85         ButtonGroupContainer().SetCommandSetL( 
       
    86                                         R_VMBX_SOFTKEYS_SEARCH_CANCEL_SELECT );
       
    87         }
       
    88 
       
    89     MakeLeftSoftkeyVisible( ETrue );
       
    90                     
       
    91     // Set Pen support flags.
       
    92     if ( FeatureManager::FeatureSupported( KFeatureIdPenSupport ) )
       
    93         {
       
    94         VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL Pen" );
       
    95         CAknQueryControl* control = QueryControl();
       
    96         if( control )
       
    97             {
       
    98             VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL ctr" );
       
    99             CCoeControl *controlByLayout = 
       
   100                 control->ControlByLayoutOrNull( control->QueryType() );
       
   101             if ( controlByLayout )
       
   102                 {         
       
   103                 VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL\
       
   104                     edit" );
       
   105                 CEikEdwin* numberEditor = 
       
   106                     static_cast< CEikEdwin* > ( controlByLayout );
       
   107                 VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL\
       
   108                     cast" );
       
   109                 TInt flags = numberEditor->AknEdwinFlags() 
       
   110                     | EAknEditorFlagDeliverVirtualKeyEventsToApplication;
       
   111                 VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL\
       
   112                     flag" );
       
   113                 numberEditor->SetAknEditorFlags( flags );
       
   114                 VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL\
       
   115                     set done" );                
       
   116                 }
       
   117             }
       
   118         }
       
   119 
       
   120     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::PreLayoutDynInitL <=" );
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CVmTextQueryDialog::HandleQueryEditorStateEventL
       
   125 // Called when query editor event happens
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 TBool CVmTextQueryDialog::HandleQueryEditorStateEventL( 
       
   129                                             CAknQueryControl* /*aQueryControl*/,
       
   130                                             TQueryControlEvent /*aEventType*/,
       
   131                                             TQueryValidationStatus /*aStatus*/ )
       
   132     {
       
   133     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::HandleQueryEditorStateEventL =>" );
       
   134     MakeLeftSoftkeyVisible( ETrue );
       
   135     if ( iSearchEnabled )
       
   136         {
       
   137         if ( !QueryControl()->GetTextLength() )
       
   138             {
       
   139             ButtonGroupContainer().SetCommandSetL( 
       
   140                                        R_VMBX_SOFTKEYS_SEARCH_CANCEL_SELECT );
       
   141             }
       
   142         else
       
   143             {
       
   144             ButtonGroupContainer().SetCommandSetL( 
       
   145                                              R_AVKON_SOFTKEYS_OK_CANCEL__OK );
       
   146             }
       
   147         ButtonGroupContainer().DrawDeferred();
       
   148         }
       
   149     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::HandleQueryEditorStateEventL <=" );
       
   150     return EFalse;
       
   151     }
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CVmTextQueryDialog::OfferKeyEventL
       
   155 // Handles key events
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 TKeyResponse CVmTextQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   159                                                             TEventCode aType )
       
   160     {
       
   161     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::OfferKeyEventL =>" );
       
   162     TKeyResponse response = EKeyWasConsumed;
       
   163     switch( aKeyEvent.iScanCode )
       
   164         {
       
   165         case EStdKeyYes:
       
   166             // Catch this key event. EStdKeyYes would leak to other controls.
       
   167             break;
       
   168                 
       
   169         default:
       
   170             response = CAknTextQueryDialog::OfferKeyEventL( aKeyEvent, aType );
       
   171         break; 
       
   172         }
       
   173 
       
   174     VMBLOGSTRING( "VMBX: CVmTextQueryDialog::OfferKeyEventL <=" );
       
   175     return response;
       
   176     }
       
   177 
       
   178 // -----------------------------------------------------------------------------    
       
   179 // CVmTextQueryDialog::DissmissQueryDlg
       
   180 // Dissmiss the query with cancel
       
   181 // -----------------------------------------------------------------------------       
       
   182 //
       
   183 void CVmTextQueryDialog::DismissQueryDlg()
       
   184      {
       
   185      // try to dismiss query,leave will be ignored
       
   186      TRAP_IGNORE( TryExitL( EAknSoftkeyCancel ) );
       
   187      }
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // CVMSimQueryDilaog::NewL
       
   191 // Two-phased constructor.
       
   192 // -----------------------------------------------------------------------------    
       
   193 //
       
   194 CVMSimQueryDilaog* CVMSimQueryDilaog::NewL()
       
   195     {
       
   196     CVMSimQueryDilaog* query = new( ELeave )CVMSimQueryDilaog( );
       
   197     CleanupStack::PushL( query );
       
   198     
       
   199     CleanupStack::Pop( query );
       
   200     return query;    
       
   201     }
       
   202 
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CVMSimQueryDilaog::CVMSimQueryDilaog
       
   206 // C++ default constructor can NOT contain any code, that
       
   207 // might leave.
       
   208 // -----------------------------------------------------------------------------
       
   209 // 
       
   210 CVMSimQueryDilaog::CVMSimQueryDilaog(): CAknQueryDialog( 
       
   211                                         CAknQueryDialog::EConfirmationTone )
       
   212     {
       
   213     // no tone as default
       
   214     }
       
   215 
       
   216 // -----------------------------------------------------------------------------
       
   217 // CVMSimQueryDilaog:: ~CVMSimQueryDilaog
       
   218 // Destructor
       
   219 // -----------------------------------------------------------------------------
       
   220 //
       
   221 CVMSimQueryDilaog:: ~CVMSimQueryDilaog()
       
   222     {
       
   223         
       
   224     }
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // CVMSimQueryDilaog::SetVMSimPromptL
       
   228 // Sets query caption on the screen asking for confirmation to copy voice
       
   229 // mailbox number from sim. 
       
   230 // -----------------------------------------------------------------------------
       
   231 //
       
   232 void CVMSimQueryDilaog::SetVMSimPromptL( const TDesC& aDesC )
       
   233     {
       
   234     SetPromptL( aDesC );
       
   235     }
       
   236 
       
   237 // -----------------------------------------------------------------------------
       
   238 // CVMSimQueryDilaog::VMSimDismissDialogL
       
   239 // Destroys the query dialog
       
   240 // -----------------------------------------------------------------------------
       
   241 //
       
   242 void CVMSimQueryDilaog::VMSimDismissDialogL()
       
   243     {
       
   244     TryExitL( EEikBidCancel );
       
   245     }
       
   246  
       
   247 
       
   248 //  End of File