uifw/AvKon/src/AknQueryDialog.cpp
changeset 0 2f259fa3e83a
child 3 8ca85d2f0db7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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 AVKON query dialogs.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <barsread.h>
       
    20 #include <eikbtgpc.h>
       
    21 #include <eikcapc.h>
       
    22 #include <eiktxlbm.h>
       
    23 
       
    24 #include "avkon.hrh"
       
    25 #include <avkon.rsg>
       
    26 #include <avkon.mbg>
       
    27 
       
    28 #include "AknQueryDialog.h" 
       
    29 #include "aknQueryControl.h"
       
    30 
       
    31 #include "aknmultilinequerycontrol.h"
       
    32 #include "aknPopupHeadingPane.h"
       
    33 #include "AknPanic.h"
       
    34 #include "aknborders.h"
       
    35 #include "aknpopuplayout.h"
       
    36 #include "aknenv.h"
       
    37 #include "aknconsts.h"
       
    38 #include "aknsoundsystem.h"
       
    39 
       
    40 #include <AknsDrawUtils.h>
       
    41 #include <AknsFrameBackgroundControlContext.h>
       
    42 #include "AknDebug.h"
       
    43 
       
    44 #include <layoutmetadata.cdl.h>
       
    45 #include <aknlayoutscalable_avkon.cdl.h>
       
    46 #include <akntouchpane.h>
       
    47 
       
    48 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
    49 #include <gfxtranseffect/gfxtranseffect.h>
       
    50 #include <akntransitionutils.h>
       
    51 #include <akntranseffect.h>
       
    52 #endif
       
    53 
       
    54 #include <AknTasHook.h> // for testability hooks
       
    55 /**
       
    56  *  CAknQueryDialogExtension  
       
    57  */
       
    58 NONSHARABLE_CLASS(CAknQueryDialogExtension) : public CBase, public MCoeCaptionRetrieverForFep
       
    59 {
       
    60 public:
       
    61     /**
       
    62      * Destructor.
       
    63      */
       
    64     ~CAknQueryDialogExtension();
       
    65     
       
    66     /**
       
    67      * Constructor.
       
    68      */
       
    69     CAknQueryDialogExtension(CAknQueryDialog* aQueryDialog);
       
    70     
       
    71 private:
       
    72     
       
    73     /**
       
    74      * from MCoeCaptionRetrieverForFep
       
    75      * fill aCaption with the target control's caption 
       
    76      */
       
    77   	IMPORT_C virtual void GetCaptionForFep(TDes& aCaption) const;
       
    78   	
       
    79 public:
       
    80     CAknQueryDialog* iParent;
       
    81 };
       
    82 
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // Destructor
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CAknQueryDialogExtension::~CAknQueryDialogExtension()
       
    89     {
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // Constructor
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 CAknQueryDialogExtension::CAknQueryDialogExtension
       
    98     (CAknQueryDialog* aQueryDialog) : iParent(aQueryDialog)
       
    99     {
       
   100     }
       
   101     
       
   102 // ---------------------------------------------------------------------------
       
   103 // GetCaptionForFep
       
   104 // Overrides MCoeCaptionRetrieverForFep::GetCaptionForFep
       
   105 // Responsible for retrieving the caption from query dialog to FEP
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C void CAknQueryDialogExtension::GetCaptionForFep(TDes& aCaption) const
       
   109     {
       
   110     aCaption = KNullDesC;
       
   111     
       
   112     CAknQueryControl* control = iParent->QueryControl();
       
   113     if ( control )
       
   114         {
       
   115         // Returns prompt of query control if it's available
       
   116         control->GetCaption(aCaption);
       
   117         }
       
   118     else
       
   119         {
       
   120         // Returns heading text if heading pane is available
       
   121         CAknPopupHeadingPane* controlHeading = iParent->QueryHeading();
       
   122         if ( controlHeading )
       
   123             {
       
   124             TPtr headTitle= controlHeading->PromptText();
       
   125             if ( headTitle != KNullDesC )
       
   126                 {
       
   127                 const TInt maximumLength = aCaption.MaxLength();
       
   128                 if ( headTitle.Length() > maximumLength )
       
   129                     {
       
   130                     aCaption=headTitle.Left(maximumLength);
       
   131                     }
       
   132                 else
       
   133                     {
       
   134                     aCaption= headTitle;
       
   135                     }
       
   136                 }
       
   137             }
       
   138         }
       
   139     }
       
   140 
       
   141 
       
   142 /**
       
   143  *  CAknMultilineQueryDialogExtension  
       
   144  */
       
   145 NONSHARABLE_CLASS(CAknMultilineQueryDialogExtension) : public CAknQueryDialogExtension
       
   146 {
       
   147 public:
       
   148     enum TQueryType
       
   149         {
       
   150         EMultDataQuery,
       
   151         EMultIPQuery
       
   152         };
       
   153     /**
       
   154      * Destructor.
       
   155      */
       
   156     ~CAknMultilineQueryDialogExtension();
       
   157     
       
   158     /**
       
   159      * Constructor.
       
   160      */
       
   161     CAknMultilineQueryDialogExtension(CAknQueryDialog* aQueryDialog, TInt aQueryType);
       
   162     
       
   163 private:
       
   164     
       
   165     /**
       
   166      * from MCoeCaptionRetrieverForFep
       
   167      * fill aCaption with the target control's caption 
       
   168      */
       
   169   	IMPORT_C void GetCaptionForFep(TDes& aCaption) const;
       
   170 
       
   171 public:
       
   172     TInt iQueryType;
       
   173 };
       
   174 
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // Destructor
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 CAknMultilineQueryDialogExtension::~CAknMultilineQueryDialogExtension()
       
   181     {
       
   182     }
       
   183 
       
   184 // ---------------------------------------------------------------------------
       
   185 // Constructor
       
   186 // ---------------------------------------------------------------------------
       
   187 //
       
   188 CAknMultilineQueryDialogExtension::CAknMultilineQueryDialogExtension
       
   189     (CAknQueryDialog* aQueryDialog, TInt aQueryType):CAknQueryDialogExtension(aQueryDialog),iQueryType(aQueryType)
       
   190     {
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // GetCaptionForFep
       
   195 // Overrides MCoeCaptionRetrieverForFep::GetCaptionForFep
       
   196 // Responsible for retrieving the caption from query dialog to FEP
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 EXPORT_C void CAknMultilineQueryDialogExtension::GetCaptionForFep(TDes& aCaption) const
       
   200     {
       
   201     switch(iQueryType)
       
   202         {
       
   203         case EMultDataQuery:
       
   204             {
       
   205             CAknMultiLineDataQueryDialog* dialog = static_cast<CAknMultiLineDataQueryDialog*>(iParent);
       
   206             if( dialog )
       
   207                 {
       
   208                 CAknMultilineQueryControl* control = NULL;
       
   209                 if( dialog->CurrentLine() == 0 )
       
   210                     {
       
   211                     control = dialog->FirstControl();
       
   212                     }
       
   213                 else if ( dialog->CurrentLine() == 1 )
       
   214                     {
       
   215                     control = dialog->SecondControl();
       
   216                     }
       
   217                 
       
   218                 if(control)
       
   219                     {
       
   220                     // Returns prompt of current focused control
       
   221                     control->GetCaption(aCaption);
       
   222                     }
       
   223                 }
       
   224             }
       
   225             break;
       
   226         case EMultIPQuery:
       
   227             {
       
   228             CAknMultiLineIpQueryDialog* dialog = static_cast<CAknMultiLineIpQueryDialog*>(iParent);
       
   229             if( dialog )
       
   230                 {
       
   231                 CAknExtMultilineQueryControl* control = NULL;
       
   232                 if( dialog->CurrentLine() == 0 )
       
   233                     {
       
   234                     control = dialog->FirstControl();
       
   235                     }
       
   236                 else if( dialog->CurrentLine() == 1 )
       
   237                     {
       
   238                     control = dialog->SecondControl();
       
   239                     }
       
   240                 
       
   241                 if( control )
       
   242                     {
       
   243                     // returns prompt of current focused control
       
   244                     control->GetCaption(aCaption);
       
   245                     }
       
   246                 }
       
   247             }
       
   248             break;
       
   249         default:
       
   250             break;
       
   251             
       
   252         }
       
   253     
       
   254     // if there's no prompt, then return heading text in heading pane
       
   255     if ( aCaption == KNullDesC )
       
   256         {
       
   257         // returns heading text if heading pane is available
       
   258         CAknPopupHeadingPane* controlHeading = iParent->QueryHeading();
       
   259         if ( controlHeading )
       
   260             {
       
   261             TPtr headTitle= controlHeading->PromptText();
       
   262             if ( headTitle != KNullDesC )
       
   263                 {
       
   264                 const TInt maximumLength = aCaption.MaxLength();
       
   265                 if ( headTitle.Length() > maximumLength )
       
   266                     {
       
   267                     aCaption=headTitle.Left(maximumLength);
       
   268                     }
       
   269                 else
       
   270                     {
       
   271                     aCaption= headTitle;
       
   272                     }
       
   273                 }
       
   274             }
       
   275         }
       
   276     
       
   277     }
       
   278 
       
   279 
       
   280 /**************************
       
   281  * CAknQueryDialog
       
   282  **************************/
       
   283 
       
   284 /**
       
   285  * Second phase construction required to align with multiline queries API
       
   286  * In future might use MAknQueryData mixin in the base class, hence requiring
       
   287  * second phase construction.
       
   288  */
       
   289 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(const TTone& aTone)
       
   290     {
       
   291     CAknQueryDialog* self = new (ELeave) CAknQueryDialog(aTone);
       
   292     AKNTASHOOK_ADDL( self, "CAknQueryDialog" );
       
   293     return self;
       
   294     }
       
   295 
       
   296 /**
       
   297  * Return pointer to CAknTextQueryDialog
       
   298  */
       
   299 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TDes& aText, const TTone& aTone)
       
   300     {
       
   301     return CAknTextQueryDialog::NewL(aText,aTone);
       
   302     }
       
   303 
       
   304 /**
       
   305  * Return pointer to CAknNumberQueryDialog
       
   306  */
       
   307 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TInt& aNumber, const TTone& aTone)
       
   308     {
       
   309     return CAknNumberQueryDialog::NewL(aNumber,aTone);
       
   310     }
       
   311 
       
   312 /**
       
   313  * Return pointer to CAknTimeQueryDialog
       
   314  */
       
   315 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TTime& aTime, const TTone& aTone)
       
   316     {
       
   317     return CAknTimeQueryDialog::NewL(aTime,aTone);
       
   318     }
       
   319 
       
   320 /**
       
   321  * Return pointer to CAknDurationQueryDialog
       
   322  */
       
   323 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TTimeIntervalSeconds& aDur, const TTone& aTone)
       
   324     {
       
   325     return CAknDurationQueryDialog::NewL(aDur,aTone);
       
   326     }
       
   327 
       
   328 /**
       
   329  * Return pointer to CAknFloatQueryDialog
       
   330  */
       
   331 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TReal& aNumber, const TTone& aTone)
       
   332     {
       
   333     return CAknFloatingPointQueryDialog::NewL(aNumber,aTone);
       
   334     }
       
   335 
       
   336 /**
       
   337  * Return pointer to CAknIpQueryDialog
       
   338  */
       
   339 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TInetAddr& aInetAddr, const TTone& aTone)
       
   340     {
       
   341     return CAknIpAddressQueryDialog::NewL(aInetAddr,aTone);
       
   342     }
       
   343 
       
   344 EXPORT_C CAknQueryDialog* CAknQueryDialog::NewL(TPosition &/*aPosition*/, const TTone& /*aTone*/)
       
   345 	{
       
   346 	//return CAknLocationQueryDialog::NewL(aPosition, aTone);
       
   347 	return NULL;
       
   348 	}
       
   349 
       
   350 EXPORT_C CAknQueryDialog::CAknQueryDialog(const TTone& aTone)
       
   351     {
       
   352 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
   353     GfxTransEffect::Register( this, KGfxQueryControlUid );
       
   354 #endif
       
   355     iTone = aTone;
       
   356     if (iEikonEnv->AppUi())
       
   357         {
       
   358          iSoundSystem = iAvkonAppUiBase->KeySounds();          
       
   359         }
       
   360     } 
       
   361 
       
   362 /**
       
   363  * deprecated
       
   364  */
       
   365 EXPORT_C CAknQueryDialog::CAknQueryDialog()
       
   366     {
       
   367     iTone = ENoTone;
       
   368     if (iEikonEnv->AppUi())
       
   369         {
       
   370          iSoundSystem = iAvkonAppUiBase->KeySounds();          
       
   371         }
       
   372     } 
       
   373 
       
   374 /**
       
   375  * deprecated
       
   376  */
       
   377 EXPORT_C CAknQueryDialog::CAknQueryDialog(TDesC& aPrompt,const TTone& aTone)
       
   378     {
       
   379     iTone = aTone;
       
   380     if (iEikonEnv->AppUi())
       
   381         {
       
   382         iSoundSystem = iAvkonAppUiBase->KeySounds();          
       
   383         }
       
   384     
       
   385     TRAP_IGNORE(SetPromptL(aPrompt));
       
   386     }
       
   387 
       
   388 EXPORT_C CAknQueryDialog::~CAknQueryDialog()
       
   389     {
       
   390     AKNTASHOOK_REMOVE();
       
   391     delete iPrompt;
       
   392     delete iExtension;
       
   393     
       
   394 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
   395     CAknTransitionUtils::RemoveData( ( TInt )this );
       
   396 #endif
       
   397     }
       
   398 
       
   399 
       
   400 EXPORT_C TInt CAknQueryDialog::RunLD()
       
   401     {
       
   402     CAknDialog::ConstructL( R_AVKON_MENUPANE_EMPTY) ;
       
   403     ReportUserActivity();
       
   404     PlayTone();
       
   405     CAknKeySoundSystem* soundSystem = NULL;
       
   406     if (iSoundSystem)
       
   407         {
       
   408         iSoundSystem->PushContextL(R_AVKON_DEFAULT_SKEY_LIST);
       
   409         // Need to store local copy of iSoundSystem, since it will have been
       
   410         // destroyed when RunLD returns
       
   411         soundSystem = iSoundSystem;
       
   412         }
       
   413 
       
   414     CAknsFrameBackgroundControlContext* cc = (CAknsFrameBackgroundControlContext*)AknsDrawUtils::ControlContext( this );
       
   415     cc->SetCenter(KAknsIIDQsnFrPopupCenterQuery);
       
   416 
       
   417     SetGloballyCapturing(ETrue); 
       
   418     TInt ret = CAknDialog::RunLD();
       
   419     if (soundSystem)
       
   420         {
       
   421         soundSystem->PopContext();
       
   422         }
       
   423     SetGloballyCapturing(EFalse); 
       
   424     return ret;
       
   425     }
       
   426 
       
   427 /**
       
   428  * deprecated
       
   429  */
       
   430 EXPORT_C TInt CAknQueryDialog::RunDlgLD(TInt aResourceId)
       
   431     {
       
   432     return ExecuteLD(aResourceId);
       
   433     }
       
   434 
       
   435 
       
   436 /**
       
   437  * Call PrepareLC and display dialog.
       
   438  *
       
   439  * Identical to version in CEikDialog but need to override 
       
   440  * this because of version with prompt,
       
   441  * compiler will complain if this is not implemented in
       
   442  * derived class as well
       
   443  */
       
   444 EXPORT_C TInt CAknQueryDialog::ExecuteLD(TInt aResourceId)
       
   445     {
       
   446     PrepareLC(aResourceId);
       
   447     return(RunLD());
       
   448     }
       
   449 
       
   450 /**
       
   451  * Call PrepareLC, set the prompt and display dialog.
       
   452  */
       
   453 EXPORT_C TInt CAknQueryDialog::ExecuteLD(TInt aResourceId,const TDesC& aPrompt)
       
   454     {
       
   455     PrepareLC(aResourceId);
       
   456     SetPromptL(aPrompt);
       
   457     return(RunLD());
       
   458     }
       
   459 /**
       
   460  * Get layout information from the control and use this layout
       
   461  * information to do layout. If there is a heading, add the 
       
   462  * heading height to the height returned by the control layout
       
   463  * as long as it still fits on the screen.
       
   464  *
       
   465  * Assume there is always a control panel present. If we used
       
   466  * iAvkonAppUi->ClientRect() this would return the correct size
       
   467  * available depending on whether the control pane is there or not.
       
   468  * However then global queries (drawn by eiksrv which has no control
       
   469  * pane) get confused because they appear on top of a focused apps
       
   470  * which does have a control pane.
       
   471  *
       
   472  * Therefore use iAvkonAppUi->ApplicationRect() minus the height 
       
   473  * of the control pane (KAknSoftkeyPaneHeight) instead of ClientRect().
       
   474  */
       
   475 EXPORT_C void CAknQueryDialog::SetSizeAndPosition( const TSize& /*aSize*/ )
       
   476     {
       
   477     CAknQueryControl* control = QueryControl();
       
   478     CAknPopupHeadingPane* controlHeading = QueryHeading();
       
   479     
       
   480     if(control)
       
   481         {
       
   482         //this is because prompt must be relayouted before setting dialog size
       
   483         //in case of a layout switch - adding HandleResourceChange to
       
   484         //dialog is not possible anymore
       
   485         control->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
   486         
       
   487 #ifdef RD_SCALABLE_UI_V2            
       
   488         if ( AknLayoutUtils::PenEnabled() )
       
   489             {
       
   490             CEikDialog* dialog = NULL;
       
   491     		control->MopGetObject( dialog );
       
   492        		if ( dialog && ( dialog->DialogFlags() & EEikDialogFlagVirtualInput ) )
       
   493        			{
       
   494        			TAknWindowLineLayout lay = AknLayoutScalable_Avkon::application_window(0);
       
   495        			TRect re(0, 0, lay.iW, lay.iH);
       
   496            		SetRect(re);
       
   497            		return;
       
   498        			}
       
   499             }
       
   500 #endif
       
   501         TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine();
       
   502         TRect rectZero = TRect(0,0,0,0);
       
   503         TAknLayoutRect layoutRect;
       
   504         layoutRect.LayoutRect( rectZero, windowLineLayoutScreen );
       
   505         TRect rectScreen( layoutRect.Rect() );
       
   506     	TSize maxSize = rectScreen.Size();
       
   507     	
       
   508         if ( AknLayoutUtils::PenEnabled() )
       
   509             {
       
   510             CAknDialog::SetSizeAndPosition( PreferredSize( maxSize ) );
       
   511             }
       
   512         else
       
   513             {
       
   514             TAknWindowLineLayout layout;
       
   515             control->WindowLayout( layout );
       
   516            
       
   517             TRect mainPane;
       
   518             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent,
       
   519                     mainPane );
       
   520               
       
   521         
       
   522             TAknLayoutRect layoutWindow;
       
   523             layoutWindow.LayoutRect( mainPane, layout); 
       
   524             TRect winRect(layoutWindow.Rect());
       
   525                     
       
   526             if (controlHeading)
       
   527             	{
       
   528                 TAknLayoutRect headingLayoutRect;
       
   529                 headingLayoutRect.LayoutRect(mainPane,
       
   530                         AknLayoutScalable_Avkon::heading_pane(0)); 
       
   531                 winRect.iTl.iY -= headingLayoutRect.Rect().Height();
       
   532                 }
       
   533             SetRect(winRect);
       
   534             }            
       
   535         }
       
   536     }
       
   537 
       
   538 /**
       
   539  *
       
   540  */
       
   541 EXPORT_C void CAknQueryDialog::PreLayoutDynInitL()
       
   542     {
       
   543     SetBorder( TGulBorder::ENone );
       
   544     SetEditableL( ETrue ) ;
       
   545     DoSetPromptL();
       
   546 
       
   547     CAknQueryControl* control = QueryControl();
       
   548     if(control)
       
   549         {
       
   550         control->SetQueryControlObserver(this);
       
   551         control->SetAndUseFlagsL( iFlags );
       
   552         }
       
   553 
       
   554     CAknPopupHeadingPane* controlHeading = QueryHeading();
       
   555     if (controlHeading)
       
   556         { 
       
   557         SetLineNonFocusing(EAknMessageQueryHeaderId); 
       
   558         
       
   559         if (control)
       
   560             control->SetNumberOfEditorLines(1);
       
   561         }
       
   562     
       
   563     // Create CaptionRetriever for FEP
       
   564     delete iExtension;
       
   565     iExtension = NULL;
       
   566     iExtension = new(ELeave) CAknQueryDialogExtension(this);
       
   567     }
       
   568 
       
   569 /**
       
   570  *
       
   571  */
       
   572 EXPORT_C void CAknQueryDialog::PostLayoutDynInitL()
       
   573     {
       
   574     CAknQueryControl* control = QueryControl();
       
   575     if (control)
       
   576         control->StartAnimationL();
       
   577 
       
   578     }
       
   579 
       
   580 /**
       
   581  *
       
   582  */
       
   583 EXPORT_C TKeyResponse CAknQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
   584                                                             TEventCode aType)
       
   585     {
       
   586     if( NeedToDismissQueryL(aKeyEvent) )
       
   587             return EKeyWasConsumed;
       
   588  	
       
   589 	if (aType == EEventKey && aKeyEvent.iCode == EKeyOK) 	
       
   590 		{
       
   591 		CAknQueryControl* control = QueryControl();
       
   592 		if (control)
       
   593 			{
       
   594 			if (IsLeftSoftkeyVisible())
       
   595 				{
       
   596 				TryExitL(EEikBidOk);
       
   597 				return EKeyWasConsumed;
       
   598 				}
       
   599             }
       
   600 		}
       
   601 	else if ( aType == EEventKey && aKeyEvent.iCode == EKeyEnter )	
       
   602         {
       
   603 		CAknQueryControl* control = QueryControl();
       
   604 		
       
   605 		if (control)
       
   606 			{
       
   607 			if (IsLeftSoftkeyVisible())
       
   608 				{
       
   609 				TryExitL(EEikBidOk);
       
   610 				return EKeyWasConsumed;
       
   611 				}
       
   612             }
       
   613 		}
       
   614 	
       
   615 
       
   616     return CAknDialog::OfferKeyEventL(aKeyEvent,aType);
       
   617     }
       
   618 
       
   619 /**
       
   620  * Allows dismissing of queries. Only mandatory requirement is that PIN
       
   621  * queries are dismissed by the # key. Clients can
       
   622  * override this and implement something different. 
       
   623  *
       
   624  */
       
   625 EXPORT_C TBool CAknQueryDialog::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
       
   626     {
       
   627     if (aKeyEvent.iScanCode == EStdKeyHash)
       
   628         {
       
   629         CAknQueryControl* control = QueryControl();
       
   630         if (control && control->QueryType() == EPinLayout)
       
   631             {
       
   632             DismissQueryL();
       
   633             return ETrue;
       
   634             }
       
   635         }
       
   636     return EFalse;
       
   637     }
       
   638 
       
   639 /**
       
   640  * Dismiss query. Query is accepted if the left softkey is displayed 
       
   641  * (left softkey is displayed only if there is valid data in the query).
       
   642  * Query is discarded if the left softkey is not displayed.
       
   643  * Clients can override this and implement something different.
       
   644  */
       
   645 EXPORT_C void CAknQueryDialog::DismissQueryL()
       
   646     {
       
   647     if (IsLeftSoftkeyVisible())
       
   648         {
       
   649         TryExitL(EEikBidOk);
       
   650         }
       
   651     else
       
   652         {
       
   653         TryExitL(EEikBidCancel);
       
   654         }
       
   655     }
       
   656 
       
   657 /**
       
   658  *
       
   659  */
       
   660 EXPORT_C TBool CAknQueryDialog::OkToExitL(TInt aButtonId)
       
   661     {
       
   662     if ( aButtonId == EAknSoftkeyEmergencyCall )
       
   663         {
       
   664         // ECS number entered and "call" softkey pressed,
       
   665         // send a key event to the query control to
       
   666         // initiate the call.
       
   667         CAknQueryControl* control = QueryControl();
       
   668         if ( control )
       
   669             {
       
   670             control->AttemptEmergencyCallL();
       
   671             }
       
   672         
       
   673         return ETrue;
       
   674         }
       
   675     else if((IsLeftSoftkeyVisible() && 
       
   676         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk))
       
   677         || aButtonId == GetRightCBAShortKeyPress() )
       
   678         {   
       
   679         return ETrue;
       
   680         }
       
   681     return EFalse;
       
   682     }
       
   683 
       
   684 /**
       
   685  * Return pointer to query heading or NULL (use QueryHeading())
       
   686  *
       
   687  * @deprecated - will be removed (use appropriate SetHeading methods instead)
       
   688  */
       
   689 EXPORT_C CAknPopupHeadingPane* CAknQueryDialog::Heading() const
       
   690     {
       
   691     return QueryHeading();
       
   692     }
       
   693 
       
   694 /**
       
   695  * Set prompt text for query. 
       
   696  */
       
   697 EXPORT_C void CAknQueryDialog::SetPromptL(const TDesC& aPrompt)
       
   698     {
       
   699     delete iPrompt;
       
   700     iPrompt = NULL;
       
   701     iPrompt = aPrompt.AllocL();
       
   702     DoSetPromptL();
       
   703     }
       
   704 
       
   705 EXPORT_C void CAknQueryDialog::DoSetPromptL()
       
   706     {
       
   707     CAknQueryControl* control = QueryControl();
       
   708     if( control && iPrompt && iPrompt->Length() )
       
   709         {
       
   710         control->SetPromptL( *iPrompt );
       
   711         }
       
   712     LayoutAndDraw();
       
   713     }
       
   714 
       
   715 /**
       
   716 CCoeControl* CAknQueryDialog::FindControlOnAnyPageWithControlType(TInt aControlType, TInt* aLineIndex, TInt* aPageIndex) const
       
   717 
       
   718   @ aControlType - Enum used to identify the control type on that CEikCaptionedControl Line
       
   719   @ aLineIndex - Optional argument, if used contains reference to an int which holds the initial
       
   720                 line to start searching on, and on finding a control of that type, is 
       
   721                 assigned the next position to start searching.
       
   722   @ aPageIndex - Optional argument, if used contains reference to an int which holds the initial
       
   723                 dialog page to start searching on, and on finding a control of that type, is 
       
   724                 assigned the page that the control was found on.
       
   725 
       
   726 To be used to go through every control in the dialog, on every page, 
       
   727 in Dialog-internal storage order, until a control with that type is found.
       
   728 If such a control is not found, a null pointer will be returned.
       
   729 */
       
   730 
       
   731 CCoeControl* CAknQueryDialog::FindControlOnAnyPageWithControlType(TInt aControlType, TInt* aLineIndex, TInt* aPageIndex) const
       
   732     {
       
   733     CEikCaptionedControl* controlPtr=NULL;
       
   734     const TInt KMaxNumPages= GetNumberOfPages();
       
   735     for (TInt pageCount= (!aPageIndex) ? 0 : (*aPageIndex);pageCount<KMaxNumPages ;pageCount++)
       
   736         {
       
   737         const TInt KMaxNumLinesOnThisPage= GetNumberOfLinesOnPage(pageCount);
       
   738         for (TInt lineCount=(!aLineIndex) ? 0 : (*aLineIndex);lineCount< KMaxNumLinesOnThisPage;lineCount++)
       
   739             {
       
   740             controlPtr = GetLineByLineAndPageIndex(lineCount, pageCount);
       
   741             if (controlPtr && controlPtr->iControlType == aControlType) 
       
   742                 {
       
   743 /*
       
   744 update the values passed
       
   745 if aLineIndex, update it with the next value, so it doesn't look in the same place twice.
       
   746 pass aPageIndex as per usual.
       
   747 */
       
   748                 if (aLineIndex) 
       
   749                     *aLineIndex=(lineCount+1); // set the restart value to the next line.
       
   750                 if (aPageIndex) // start at the same page.
       
   751                     *aPageIndex=(pageCount);
       
   752                 return controlPtr->iControl;
       
   753                 }
       
   754             }
       
   755         }
       
   756     return 0;
       
   757     }
       
   758 
       
   759 EXPORT_C CAknQueryControl* CAknQueryDialog::QueryControl() const
       
   760     {
       
   761     CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknCtQuery);
       
   762     if (controlPtr)
       
   763         return STATIC_CAST(CAknQueryControl*,controlPtr);
       
   764 /* 
       
   765 Must have reached limit of pages and lines without finding desired object
       
   766 This should not happen.
       
   767 */
       
   768     return 0;
       
   769     }
       
   770 
       
   771 EXPORT_C CAknPopupHeadingPane* CAknQueryDialog::QueryHeading() const
       
   772     {
       
   773     CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknCtPopupHeadingPane);
       
   774     if (controlPtr)
       
   775         return STATIC_CAST(CAknPopupHeadingPane*,controlPtr);
       
   776     return 0;
       
   777     }
       
   778 
       
   779 EXPORT_C void CAknQueryDialog::MakeLeftSoftkeyVisible(TBool aVisible)
       
   780     {  
       
   781     CEikButtonGroupContainer& btnGroupContainer = ButtonGroupContainer();
       
   782 
       
   783     // left softkey
       
   784     TBool isVisible = btnGroupContainer.IsCommandVisibleByPosition(CEikButtonGroupContainer::ELeftSoftkeyPosition);
       
   785     if ( isVisible != aVisible )
       
   786         {
       
   787         btnGroupContainer.MakeCommandVisibleByPosition(CEikButtonGroupContainer::ELeftSoftkeyPosition,aVisible);
       
   788         }
       
   789 
       
   790     // middle softkey
       
   791     if ( btnGroupContainer.ButtonGroup()->CommandId(0) == btnGroupContainer.ButtonGroup()->CommandId(3) )
       
   792         {
       
   793         isVisible = btnGroupContainer.IsCommandVisibleByPosition(CEikButtonGroupContainer::EMiddleSoftkeyPosition);
       
   794         if ( isVisible != aVisible )
       
   795             {
       
   796             btnGroupContainer.MakeCommandVisibleByPosition(CEikButtonGroupContainer::EMiddleSoftkeyPosition,aVisible);
       
   797             }
       
   798         }
       
   799     }
       
   800 
       
   801 
       
   802 
       
   803 void CAknQueryDialog::PlayTone()
       
   804     {
       
   805     if (iTone != 0 && iSoundSystem)
       
   806         {
       
   807         iSoundSystem->PlaySound(iTone);
       
   808         }
       
   809     }
       
   810 
       
   811 /** 
       
   812  * Reset timers monitoring user inactivity. Will make applications
       
   813  * using these timers react, e.g. if the screen saver is running,
       
   814  * this will disactivate it (as from screen saver specs)
       
   815  */ 
       
   816 void CAknQueryDialog::ReportUserActivity() const 
       
   817     {
       
   818 #ifdef AVKON_RDEBUG_INFO
       
   819     RDebug::Print(_L("Reset user inactivity"));
       
   820 #endif
       
   821     User::ResetInactivityTime();
       
   822     }
       
   823 
       
   824 TInt CAknQueryDialog::GetLeftCBAShortKeyPress()
       
   825     {
       
   826     return TInt16(0xffff & TInt16(ButtonGroupContainer().ButtonGroup()->CommandId(0)));
       
   827     }
       
   828   
       
   829 TInt CAknQueryDialog::GetRightCBAShortKeyPress()
       
   830     {
       
   831     return TInt16(0xffff & TInt16(ButtonGroupContainer().ButtonGroup()->CommandId(2)));
       
   832     }
       
   833 
       
   834 TBool CAknQueryDialog::IsLeftSoftkeyVisible()
       
   835     {
       
   836     return ButtonGroupContainer().ButtonGroup()->IsCommandVisible(
       
   837                       ButtonGroupContainer().ButtonGroup()->CommandId(0));
       
   838     }
       
   839 
       
   840 /**
       
   841  * Sets emergency call support enabled. Must be called prior to PreLayoutDynamicInitL
       
   842  */
       
   843 EXPORT_C void CAknQueryDialog::SetEmergencyCallSupport( TBool aOnOff )
       
   844     {
       
   845     iFlags.Assign(CAknQueryControl::EEmergencyCallsEnabledByAPI, aOnOff );
       
   846     }
       
   847 
       
   848 EXPORT_C void CAknQueryDialog::SetPredictiveTextInputPermitted( TBool aPermitted )
       
   849     {
       
   850     iFlags.Assign( CAknQueryControl::EPredictiveTextEntryPermitted, aPermitted );
       
   851     }
       
   852 
       
   853 EXPORT_C void CAknQueryDialog::RemoveEditorIndicator()
       
   854     {
       
   855     iFlags.Assign(CAknQueryControl::EEditorIndicatorOff,ETrue);
       
   856     }
       
   857 
       
   858 EXPORT_C void CAknQueryDialog::SetHeaderTextL(const TDesC& aHeader)
       
   859     {
       
   860     CAknPopupHeadingPane* controlHeading = QueryHeading();
       
   861     if (controlHeading)
       
   862         controlHeading->SetTextL(aHeader);
       
   863         
       
   864     LayoutAndDraw();
       
   865     }
       
   866 
       
   867 /** 
       
   868  * Show left CBA only if editor text is valid
       
   869  */ 
       
   870 EXPORT_C TBool CAknQueryDialog::HandleQueryEditorStateEventL
       
   871     (
       
   872     CAknQueryControl*       /*aQueryControl*/, 
       
   873     TQueryControlEvent      aEventType, 
       
   874     TQueryValidationStatus  /*aStatus*/
       
   875     )
       
   876     {
       
   877     if (aEventType == EEmergencyCallAttempted)
       
   878         {
       
   879         TryExitL(EEikBidCancel);
       
   880         }
       
   881     else
       
   882         {
       
   883         UpdateLeftSoftKeyL();
       
   884         }
       
   885     return EFalse;
       
   886     }
       
   887 
       
   888 
       
   889 EXPORT_C void CAknQueryDialog::SetHeaderImageL(CEikImage* aImage)
       
   890     {
       
   891     CAknPopupHeadingPane* controlHeading = Heading(); 
       
   892     if ( controlHeading )
       
   893         {
       
   894         controlHeading->SetHeaderImageL(aImage);
       
   895         }
       
   896     LayoutAndDraw();
       
   897     delete aImage;
       
   898     aImage = NULL;
       
   899     }
       
   900 
       
   901 
       
   902 /** 
       
   903  * If control text is ok then display left soft key
       
   904  * otherwise don't
       
   905  */ 
       
   906 EXPORT_C void CAknQueryDialog::UpdateLeftSoftKeyL()
       
   907     {
       
   908     CAknQueryControl* control = QueryControl();
       
   909     if ( control )
       
   910         {
       
   911         MakeLeftSoftkeyVisible( control->EditorContentIsValidL() );
       
   912         }
       
   913     }
       
   914 
       
   915 /** 
       
   916  * Handle editors size changes. This is called from CAknQueryControl 
       
   917  * when editor size changes.
       
   918  */ 
       
   919 EXPORT_C TBool CAknQueryDialog::HandleQueryEditorSizeEventL
       
   920     (
       
   921     CAknQueryControl*   /*aQueryControl*/, 
       
   922     TQueryControlEvent  /*aEventType*/
       
   923     )
       
   924     {
       
   925     return EFalse;
       
   926     }
       
   927 
       
   928 /**
       
   929  * Used to encapsulate the rules of how long the string is 
       
   930  * NB for a stringlength to be valid it must be <= Maxlength of descriptor.
       
   931  */
       
   932 EXPORT_C TInt CAknQueryDialog::MaxTextLength(const CAknQueryControl* aControl, const TDes& aDataText,TInt aApiValue) 
       
   933     {
       
   934     return GetMaxTextLength(aControl,aDataText,aApiValue);
       
   935     }
       
   936 
       
   937 EXPORT_C void CAknQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
   938     { 
       
   939     if ( AknLayoutUtils::PenEnabled() )
       
   940         {
       
   941 
       
   942         CAknTouchPane* touchPane = iAvkonAppUi->TouchPane();
       
   943         
       
   944         if ( !Rect().Contains( aPointerEvent.iPosition ) && touchPane
       
   945             && touchPane->IsVisible() )
       
   946             {
       
   947             // touchpane is a window-owning control -> Rect() cannot be used
       
   948             TRect touchPaneRect( touchPane->Position(), touchPane->Size() );
       
   949                 
       
   950             if ( touchPaneRect.Contains( aPointerEvent.iParentPosition ) )
       
   951                 {
       
   952                 TPointerEvent pointerEvent( aPointerEvent );
       
   953                    
       
   954                 // make event's coordinates touch pane relative
       
   955                 pointerEvent.iPosition = aPointerEvent.iParentPosition - 
       
   956                     touchPaneRect.iTl;
       
   957                     
       
   958                 static_cast<CCoeControl*>( touchPane )->HandlePointerEventL( 
       
   959                     pointerEvent );
       
   960                 }
       
   961             }
       
   962         else
       
   963             {
       
   964             // Forward also those pointerevents that the dialog rect does not contain
       
   965             CAknDialog::HandlePointerEventL( aPointerEvent );
       
   966             }
       
   967         }
       
   968     }
       
   969 
       
   970 EXPORT_C void* CAknQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
   971     { 
       
   972     return NULL;
       
   973     }
       
   974 
       
   975 /**
       
   976  * deprecated
       
   977  */
       
   978 EXPORT_C TInt CAknQueryDialog::MaxTextLength(const CAknQueryControl* aControl, const TDes* aDataText,TInt aApiValue) 
       
   979     {
       
   980     __ASSERT_DEBUG(aDataText,Panic(EAknPanicInvalidValue));     
       
   981     return MaxTextLength(aControl, *aDataText,aApiValue);
       
   982     }
       
   983 
       
   984 
       
   985 /**
       
   986  * If control is activiated re-do layout and draw
       
   987  * Typically called by methods that might cause a 
       
   988  * resize such as SetPrompL()
       
   989  */
       
   990 void CAknQueryDialog::LayoutAndDraw()
       
   991     {
       
   992     if (IsActivated())
       
   993         {
       
   994         MakeVisible(EFalse);
       
   995         TAknWindowLineLayout lay = AKN_LAYOUT_WINDOW_screen;
       
   996         TAknLayoutRect layoutR;
       
   997         layoutR.LayoutRect(Rect(), lay);
       
   998 		SetSizeAndPosition(PreferredSize(layoutR.Rect().Size()));
       
   999         MakeVisible(ETrue);
       
  1000         }
       
  1001     }
       
  1002 
       
  1003 EXPORT_C TPtrC CAknQueryDialog::Prompt() const
       
  1004     {
       
  1005     if (iPrompt)
       
  1006         return *iPrompt;
       
  1007     return TPtrC(0,0);
       
  1008     }
       
  1009 
       
  1010 EXPORT_C void CAknQueryDialog::CEikDialog_Reserved_1()
       
  1011     {
       
  1012     }
       
  1013 
       
  1014 EXPORT_C void CAknQueryDialog::CEikDialog_Reserved_2()
       
  1015     {
       
  1016     }
       
  1017 
       
  1018 EXPORT_C void CAknQueryDialog::CAknDialog_Reserved()
       
  1019     {
       
  1020     }
       
  1021 
       
  1022 EXPORT_C void CAknQueryDialog::CAknQueryDialog_Reserved()
       
  1023     {
       
  1024     }
       
  1025 
       
  1026 // ---------------------------------------------------------------------------
       
  1027 // Get InputCapabilities.  Overrides CoeControl::InputCapabilities
       
  1028 // ---------------------------------------------------------------------------
       
  1029 // 
       
  1030 EXPORT_C TCoeInputCapabilities CAknQueryDialog::InputCapabilities() const
       
  1031 	{
       
  1032 	return TCoeInputCapabilities(TCoeInputCapabilities::EAllText, NULL, iExtension);
       
  1033 	}
       
  1034 
       
  1035 
       
  1036 // ---------------------------------------------------------------------------
       
  1037 // Sets the CBA label changing support for ECS.
       
  1038 // If enabled, the LSK label is changed to "call" whenever an emergency
       
  1039 // number is entered to the query.
       
  1040 // ---------------------------------------------------------------------------
       
  1041 //
       
  1042 EXPORT_C void CAknQueryDialog::SetEmergencyCallSupportForCBA( TBool aOnOff )
       
  1043     {
       
  1044     if ( aOnOff )
       
  1045         {
       
  1046         // Ensure also that the EEmergencyCallsEnabledByAPI is set.
       
  1047         iFlags.Assign( CAknQueryControl::EEmergencyCallsEnabledByAPI, aOnOff );
       
  1048         }
       
  1049     iFlags.Assign( CAknQueryControl::EEmergencyCallsCBASupport, aOnOff );
       
  1050     }
       
  1051 
       
  1052 
       
  1053 
       
  1054 /************************
       
  1055  * CAknTextQueryDialog
       
  1056  ************************/
       
  1057 
       
  1058 /**
       
  1059  * Second phase construction required to align API with multiline queries 
       
  1060  * and because in future MAknQueryData will be used.
       
  1061  */
       
  1062 EXPORT_C CAknTextQueryDialog* CAknTextQueryDialog::NewL(TDes& aDataText, const TTone& aTone)
       
  1063     {
       
  1064     CAknTextQueryDialog* self = new (ELeave) CAknTextQueryDialog(aDataText, aTone);
       
  1065     AKNTASHOOK_ADDL( self, "CAknTextQueryDialog" );
       
  1066     return self;
       
  1067     }
       
  1068 
       
  1069 
       
  1070 EXPORT_C CAknTextQueryDialog::CAknTextQueryDialog
       
  1071     (TDes& aDataText,const TTone& aTone) : CAknQueryDialog(aTone), iDataText(aDataText)
       
  1072     {
       
  1073     }
       
  1074 
       
  1075 /**
       
  1076  * deprecated
       
  1077  */
       
  1078 EXPORT_C CAknTextQueryDialog::CAknTextQueryDialog(TDes& aDataText,TDesC& aPrompt,const TTone& aTone)
       
  1079 :CAknQueryDialog(aPrompt,aTone), iDataText(aDataText)
       
  1080     {
       
  1081     }
       
  1082 
       
  1083 EXPORT_C CAknTextQueryDialog::~CAknTextQueryDialog()
       
  1084     {
       
  1085     AKNTASHOOK_REMOVE();
       
  1086     }
       
  1087 
       
  1088 EXPORT_C TBool CAknTextQueryDialog::CheckIfEntryTextOk() const
       
  1089     {
       
  1090     CAknQueryControl* control = QueryControl();
       
  1091     if ( control )
       
  1092         {
       
  1093         TBool ret = EFalse;
       
  1094         TRAPD(err, ret = control->EditorContentIsValidL());
       
  1095         if (err == KErrNone)
       
  1096             return ret;
       
  1097         }
       
  1098     return EFalse;
       
  1099     }
       
  1100 
       
  1101 EXPORT_C void CAknTextQueryDialog::SetDefaultInputMode(TInt aInputMode)
       
  1102     {
       
  1103     CAknQueryControl* control = QueryControl();
       
  1104     if ( control )
       
  1105         {
       
  1106         CEikSecretEditor* secretEditor = STATIC_CAST(CEikSecretEditor*, control->ControlByLayoutOrNull( ECodeLayout ));
       
  1107         if (secretEditor)
       
  1108             {
       
  1109             secretEditor->SetDefaultInputMode(aInputMode);
       
  1110             }
       
  1111         }
       
  1112     }
       
  1113 
       
  1114 EXPORT_C void CAknTextQueryDialog::PreLayoutDynInitL()
       
  1115     {
       
  1116     CAknQueryDialog::PreLayoutDynInitL();
       
  1117 
       
  1118     SetControlTextL();
       
  1119     UpdateLeftSoftKeyL();
       
  1120     }
       
  1121 
       
  1122 
       
  1123 EXPORT_C void CAknTextQueryDialog::SetMaxLength(TInt aLength)
       
  1124     {
       
  1125     iTextMaxLength = aLength;
       
  1126     }
       
  1127     
       
  1128 /**
       
  1129  * Handle editor size change. 
       
  1130  *
       
  1131  * This is called from CAknQueryControl when the editor size changes.
       
  1132  */
       
  1133 EXPORT_C TBool CAknTextQueryDialog::HandleQueryEditorSizeEventL(
       
  1134                                         CAknQueryControl* /*aQueryControl*/, 
       
  1135                                         TQueryControlEvent /*aEventType*/)
       
  1136     { 
       
  1137     Layout();
       
  1138     DrawNow();
       
  1139     return EFalse;
       
  1140     }
       
  1141 
       
  1142 /**
       
  1143  * Accept or reject query.
       
  1144  *
       
  1145  * The query is approved if the pressed button is the left softkey or
       
  1146  * the selection key. The query is discarded if pressed button is
       
  1147  * the right softkey.
       
  1148  *
       
  1149  * In addition, for the query to be approved the left softkey must be
       
  1150  * visible. Left softkey being visible is equivalent to editor text
       
  1151  * being valid.
       
  1152  *
       
  1153  * @see IsLeftSoftkeyVisible
       
  1154  */
       
  1155 EXPORT_C TBool CAknTextQueryDialog::OkToExitL( TInt aButtonId )
       
  1156     {
       
  1157     if ( aButtonId == EAknSoftkeyEmergencyCall )
       
  1158         {
       
  1159         // ECS number entered and "call" softkey pressed,
       
  1160         // send a key event to the query control to
       
  1161         // initiate the call.
       
  1162         CAknQueryControl* control = QueryControl();
       
  1163         if ( control )
       
  1164             {
       
  1165             control->AttemptEmergencyCallL();
       
  1166             }
       
  1167         
       
  1168         return ETrue;
       
  1169         }
       
  1170     else if ( ( IsLeftSoftkeyVisible() && 
       
  1171               ( aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk ) ) )
       
  1172         {
       
  1173         CAknQueryControl* control = QueryControl();
       
  1174         if ( control )
       
  1175             {
       
  1176             control->GetText( iDataText );
       
  1177             }
       
  1178             
       
  1179         return ETrue;
       
  1180         }
       
  1181     else if( aButtonId == GetRightCBAShortKeyPress() )
       
  1182         {
       
  1183         return ETrue;
       
  1184         }
       
  1185  
       
  1186     return EFalse;
       
  1187     }
       
  1188 
       
  1189 void CAknTextQueryDialog::SetControlTextL()
       
  1190     {
       
  1191     CAknQueryControl* control = QueryControl();
       
  1192     if (control)
       
  1193         {
       
  1194         control->SetTextEntryLength( MaxTextLength(control, iDataText,iTextMaxLength));
       
  1195         control->SetTextL(iDataText);
       
  1196         }
       
  1197     }
       
  1198 
       
  1199 EXPORT_C void CAknTextQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  1200     { 
       
  1201     CAknQueryDialog::HandlePointerEventL(aPointerEvent); 
       
  1202     }
       
  1203 
       
  1204 EXPORT_C void* CAknTextQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
  1205     { 
       
  1206     return NULL;
       
  1207     }
       
  1208 
       
  1209 EXPORT_C void CAknTextQueryDialog::CEikDialog_Reserved_1()
       
  1210     {
       
  1211     }
       
  1212 
       
  1213 EXPORT_C void CAknTextQueryDialog::CEikDialog_Reserved_2()
       
  1214     {
       
  1215     }
       
  1216 
       
  1217 EXPORT_C void CAknTextQueryDialog::CAknDialog_Reserved()
       
  1218     {
       
  1219     }
       
  1220 
       
  1221 EXPORT_C void CAknTextQueryDialog::CAknQueryDialog_Reserved()
       
  1222     {
       
  1223     }
       
  1224 
       
  1225 /************************
       
  1226  * CAknNumberQueryDialog
       
  1227  ************************/
       
  1228 
       
  1229 /**
       
  1230  * Second phase construction required to align API with multiline queries 
       
  1231  * and because in future MAknQueryData will be used.
       
  1232  */
       
  1233 EXPORT_C CAknNumberQueryDialog* CAknNumberQueryDialog::NewL(TInt& aNumber, const TTone& aTone)
       
  1234     {
       
  1235     CAknNumberQueryDialog* self = new (ELeave) CAknNumberQueryDialog(aNumber, aTone);
       
  1236     AKNTASHOOK_ADDL( self, "CAknNumberQueryDialog" );
       
  1237     return self;
       
  1238     }
       
  1239 
       
  1240 
       
  1241 EXPORT_C CAknNumberQueryDialog::CAknNumberQueryDialog
       
  1242     (TInt& aNumber,const TTone& aTone) : CAknQueryDialog(aTone), iNumber(aNumber)
       
  1243     {
       
  1244     }
       
  1245 
       
  1246 EXPORT_C CAknNumberQueryDialog::~CAknNumberQueryDialog()
       
  1247     {
       
  1248     AKNTASHOOK_REMOVE();
       
  1249     }
       
  1250 
       
  1251 EXPORT_C void CAknNumberQueryDialog::PreLayoutDynInitL()
       
  1252     {
       
  1253     CAknQueryDialog::PreLayoutDynInitL();
       
  1254 
       
  1255     CAknQueryControl* control = QueryControl();
       
  1256     if (control)
       
  1257         control->SetNumberL(iNumber);
       
  1258     }
       
  1259 
       
  1260 EXPORT_C void CAknNumberQueryDialog::SetMinimumAndMaximum( TInt aMinimumValue,
       
  1261                                                            TInt aMaximumValue)
       
  1262 {
       
  1263     CAknQueryControl* control = QueryControl();
       
  1264     if ( control )
       
  1265         {
       
  1266         control->SetMinimumAndMaximum(aMinimumValue,aMaximumValue);
       
  1267         }
       
  1268 }
       
  1269 
       
  1270 EXPORT_C TBool CAknNumberQueryDialog::OkToExitL( TInt aButtonId )
       
  1271     {
       
  1272     if ( aButtonId == EAknSoftkeyEmergencyCall )
       
  1273         {
       
  1274         // ECS number entered and "call" softkey pressed,
       
  1275         // send a key event to the query control to
       
  1276         // initiate the call.
       
  1277         CAknQueryControl* control = QueryControl();
       
  1278         if ( control )
       
  1279             {
       
  1280             control->AttemptEmergencyCallL();
       
  1281             }
       
  1282         
       
  1283         return ETrue;
       
  1284         }
       
  1285     else if ( aButtonId == GetRightCBAShortKeyPress() )
       
  1286         {
       
  1287         return ETrue;
       
  1288         }
       
  1289     else if ( ( IsLeftSoftkeyVisible() && 
       
  1290               ( aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk ) ) )
       
  1291         {
       
  1292         TInt e = KErrNone;
       
  1293         CAknQueryControl* control = QueryControl();
       
  1294         if ( control && control->CheckNumber() )
       
  1295             {
       
  1296             TRAP( e, control->PrepareForFocusLossL() );
       
  1297             if ( e != KErrNone )
       
  1298                 {
       
  1299                 return EFalse;
       
  1300                 }
       
  1301             iNumber = control->GetNumber();
       
  1302             return ETrue;
       
  1303             }
       
  1304        }
       
  1305 
       
  1306     return EFalse;
       
  1307     }
       
  1308 
       
  1309 EXPORT_C void CAknNumberQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  1310     { 
       
  1311     CAknQueryDialog::HandlePointerEventL(aPointerEvent); 
       
  1312     }
       
  1313 
       
  1314 EXPORT_C void* CAknNumberQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
  1315     { 
       
  1316     return NULL;
       
  1317     }
       
  1318 
       
  1319 EXPORT_C void CAknNumberQueryDialog::CEikDialog_Reserved_1()
       
  1320     {
       
  1321     }
       
  1322 
       
  1323 EXPORT_C void CAknNumberQueryDialog::CEikDialog_Reserved_2()
       
  1324     {
       
  1325     }
       
  1326 
       
  1327 EXPORT_C void CAknNumberQueryDialog::CAknDialog_Reserved()
       
  1328     {
       
  1329     }
       
  1330 
       
  1331 EXPORT_C void CAknNumberQueryDialog::CAknQueryDialog_Reserved()
       
  1332     {
       
  1333     }
       
  1334 
       
  1335 
       
  1336 /************************
       
  1337  * CAknTimeQueryDialog
       
  1338  ************************/
       
  1339 
       
  1340 /**
       
  1341  * Second phase construction required to align API with multiline queries 
       
  1342  * and because in future MAknQueryData will be used.
       
  1343  */
       
  1344 EXPORT_C CAknTimeQueryDialog* CAknTimeQueryDialog::NewL(TTime& aTime, const TTone& aTone)
       
  1345     {
       
  1346     CAknTimeQueryDialog* self = new (ELeave) CAknTimeQueryDialog(aTime, aTone);
       
  1347     AKNTASHOOK_ADDL( self, "CAknTimeQueryDialog" );
       
  1348     return self;
       
  1349     }
       
  1350 
       
  1351 EXPORT_C CAknTimeQueryDialog::CAknTimeQueryDialog
       
  1352     (TTime& aTime, const TTone& aTone) : CAknQueryDialog(aTone), iTime(aTime)
       
  1353     {
       
  1354     }
       
  1355 
       
  1356 /**
       
  1357  * deprecated
       
  1358  */
       
  1359 EXPORT_C CAknTimeQueryDialog::CAknTimeQueryDialog(TTime& aTime,TDesC& aPrompt,const TTone& aTone)
       
  1360     : CAknQueryDialog(aPrompt,aTone), iTime(aTime)
       
  1361     {
       
  1362     }
       
  1363 
       
  1364 EXPORT_C CAknTimeQueryDialog::~CAknTimeQueryDialog()
       
  1365     {
       
  1366     AKNTASHOOK_REMOVE();
       
  1367     }
       
  1368 
       
  1369 EXPORT_C void CAknTimeQueryDialog::PreLayoutDynInitL()
       
  1370     {
       
  1371     CAknQueryDialog::PreLayoutDynInitL();
       
  1372     CAknQueryControl* control = QueryControl();
       
  1373     if (control)
       
  1374         control->SetTime(iTime);
       
  1375     }
       
  1376 
       
  1377 EXPORT_C void CAknTimeQueryDialog::SetMinimumAndMaximum( const TTime& aMinimum, 
       
  1378                                                          const TTime& aMaximum)
       
  1379 {
       
  1380     CAknQueryControl* control = QueryControl();
       
  1381     if ( control )
       
  1382         {
       
  1383         control->SetMinimumAndMaximum(aMinimum,aMaximum);
       
  1384         }
       
  1385 }
       
  1386 
       
  1387 EXPORT_C TBool CAknTimeQueryDialog::OkToExitL(TInt aButtonId)
       
  1388     {
       
  1389     if((IsLeftSoftkeyVisible() && 
       
  1390         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  1391         {   
       
  1392         CAknQueryControl* control = QueryControl();
       
  1393         if ( control )
       
  1394             {
       
  1395             iTime = control->GetTime();
       
  1396             }
       
  1397         return ETrue;
       
  1398         }
       
  1399     else if(aButtonId == GetRightCBAShortKeyPress())
       
  1400         return ETrue;
       
  1401 
       
  1402     return EFalse;
       
  1403     }
       
  1404 
       
  1405 EXPORT_C void CAknTimeQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  1406     { 
       
  1407     CAknQueryDialog::HandlePointerEventL(aPointerEvent); 
       
  1408     }
       
  1409 
       
  1410 EXPORT_C void* CAknTimeQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
  1411     { 
       
  1412     return NULL;
       
  1413     }
       
  1414 
       
  1415 EXPORT_C void CAknTimeQueryDialog::CEikDialog_Reserved_1()
       
  1416     {
       
  1417     }
       
  1418 
       
  1419 EXPORT_C void CAknTimeQueryDialog::CEikDialog_Reserved_2()
       
  1420     {
       
  1421     }
       
  1422 
       
  1423 EXPORT_C void CAknTimeQueryDialog::CAknDialog_Reserved()
       
  1424     {
       
  1425     }
       
  1426 
       
  1427 EXPORT_C void CAknTimeQueryDialog::CAknQueryDialog_Reserved()
       
  1428     {
       
  1429     }
       
  1430 
       
  1431 /************************
       
  1432  * CAknDurationQueryDialog
       
  1433  ************************/
       
  1434 
       
  1435 /**
       
  1436  * Second phase construction required to align API with multiline queries 
       
  1437  * and because in future MAknQueryData will be used.
       
  1438  */
       
  1439 EXPORT_C CAknDurationQueryDialog* CAknDurationQueryDialog::NewL(TTimeIntervalSeconds& aDuration, const TTone& aTone)
       
  1440     {
       
  1441     CAknDurationQueryDialog* self = new (ELeave) CAknDurationQueryDialog(aDuration, aTone);
       
  1442     AKNTASHOOK_ADDL( self, "CAknDurationQueryDialog" );
       
  1443     return self;
       
  1444     }
       
  1445 
       
  1446 EXPORT_C CAknDurationQueryDialog::CAknDurationQueryDialog
       
  1447     (TTimeIntervalSeconds& aDuration, const TTone& aTone) : CAknQueryDialog(aTone), iDuration(aDuration)
       
  1448     {
       
  1449     }
       
  1450 
       
  1451 EXPORT_C CAknDurationQueryDialog::~CAknDurationQueryDialog()
       
  1452     {
       
  1453     AKNTASHOOK_REMOVE();
       
  1454     }
       
  1455 
       
  1456 EXPORT_C void CAknDurationQueryDialog::PreLayoutDynInitL()
       
  1457     {
       
  1458     CAknQueryDialog::PreLayoutDynInitL();
       
  1459     CAknQueryControl* control = QueryControl();
       
  1460     
       
  1461     if (control)
       
  1462         control->SetDuration(iDuration);
       
  1463     }
       
  1464 
       
  1465 EXPORT_C void CAknDurationQueryDialog::SetMinimumAndMaximum( const TTimeIntervalSeconds& aMinimumDuration, 
       
  1466                                                              const TTimeIntervalSeconds& aMaximumDuration)
       
  1467 {
       
  1468     CAknQueryControl* control = QueryControl();
       
  1469     if ( control )
       
  1470         {
       
  1471         control->SetMinimumAndMaximum(aMinimumDuration, aMaximumDuration);
       
  1472         }
       
  1473 }
       
  1474 
       
  1475 EXPORT_C TBool CAknDurationQueryDialog::OkToExitL(TInt aButtonId)
       
  1476     {
       
  1477     if((IsLeftSoftkeyVisible() && 
       
  1478         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  1479         {   
       
  1480         CAknQueryControl* control = QueryControl();
       
  1481         if ( control )
       
  1482             {
       
  1483             iDuration = control->GetDuration();
       
  1484             }
       
  1485         return ETrue;
       
  1486         }
       
  1487     else if(aButtonId == GetRightCBAShortKeyPress())
       
  1488         {
       
  1489         return ETrue;
       
  1490         }
       
  1491     return EFalse;
       
  1492     }
       
  1493     
       
  1494 EXPORT_C void CAknDurationQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  1495     { 
       
  1496     CAknQueryDialog::HandlePointerEventL(aPointerEvent); 
       
  1497     }
       
  1498 
       
  1499 EXPORT_C void* CAknDurationQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
  1500     { 
       
  1501     return NULL;
       
  1502     }
       
  1503 
       
  1504 EXPORT_C void CAknDurationQueryDialog::CEikDialog_Reserved_1()
       
  1505     {
       
  1506     }
       
  1507 
       
  1508 EXPORT_C void CAknDurationQueryDialog::CEikDialog_Reserved_2()
       
  1509     {
       
  1510     }
       
  1511 
       
  1512 EXPORT_C void CAknDurationQueryDialog::CAknDialog_Reserved()
       
  1513     {
       
  1514     }
       
  1515 
       
  1516 EXPORT_C void CAknDurationQueryDialog::CAknQueryDialog_Reserved()
       
  1517     {
       
  1518     }
       
  1519 
       
  1520 /**************************************
       
  1521  * CAknFloatingPointQueryDialog
       
  1522  **************************************/
       
  1523 
       
  1524 /**
       
  1525  * Second phase construction required to align API with multiline queries 
       
  1526  * and because in future MAknQueryData will be used.
       
  1527  */
       
  1528 EXPORT_C CAknFloatingPointQueryDialog* CAknFloatingPointQueryDialog::NewL(TReal& aNumber, const TTone& aTone)
       
  1529     {
       
  1530     CAknFloatingPointQueryDialog* self = new (ELeave) CAknFloatingPointQueryDialog(aNumber, aTone);
       
  1531     AKNTASHOOK_ADDL( self, "CAknFloatingPointQueryDialog" );
       
  1532     return self;
       
  1533     }
       
  1534 
       
  1535 EXPORT_C CAknFloatingPointQueryDialog::CAknFloatingPointQueryDialog
       
  1536     (TReal& aNumber, const TTone& aTone) : CAknQueryDialog(aTone), iNumber(aNumber)
       
  1537     {
       
  1538     }
       
  1539 
       
  1540 EXPORT_C CAknFloatingPointQueryDialog::~CAknFloatingPointQueryDialog()
       
  1541     {
       
  1542     AKNTASHOOK_REMOVE();
       
  1543     }
       
  1544 
       
  1545 EXPORT_C void CAknFloatingPointQueryDialog::PreLayoutDynInitL()
       
  1546     {
       
  1547     CAknQueryDialog::PreLayoutDynInitL();
       
  1548     CAknQueryControl* control = QueryControl();
       
  1549   
       
  1550     if ( control )
       
  1551         {
       
  1552         control->SetQueryControlObserver(this);
       
  1553         control->SetFloatingPointNumberL(&iNumber);
       
  1554         DoSetPromptL();
       
  1555         }
       
  1556     }
       
  1557 
       
  1558 EXPORT_C void CAknFloatingPointQueryDialog::SetMinimumAndMaximum( const TReal& aMinimumNumber, 
       
  1559                                                              const TReal& aMaximumNumber)
       
  1560 {
       
  1561     CAknQueryControl* control = QueryControl();
       
  1562     if ( control )
       
  1563         {
       
  1564         control->SetMinimumAndMaximum(aMinimumNumber, aMaximumNumber);
       
  1565         }
       
  1566 }
       
  1567 
       
  1568 EXPORT_C TBool CAknFloatingPointQueryDialog::OkToExitL(TInt aButtonId)
       
  1569     {
       
  1570     if((IsLeftSoftkeyVisible() && 
       
  1571         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  1572         {   
       
  1573         CAknQueryControl* control = QueryControl();
       
  1574         if ( control )
       
  1575             {
       
  1576             iNumber = control->GetFloatingPointNumberL();
       
  1577             }
       
  1578         return ETrue;
       
  1579         }
       
  1580     else if(aButtonId == GetRightCBAShortKeyPress())
       
  1581         {
       
  1582         return ETrue;
       
  1583         }
       
  1584     return EFalse;
       
  1585     }
       
  1586     
       
  1587 EXPORT_C void CAknFloatingPointQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  1588     { 
       
  1589     CAknQueryDialog::HandlePointerEventL(aPointerEvent); 
       
  1590     }    
       
  1591 
       
  1592 EXPORT_C void* CAknFloatingPointQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
  1593     { 
       
  1594     return NULL;
       
  1595     }
       
  1596 
       
  1597 EXPORT_C void CAknFloatingPointQueryDialog::CEikDialog_Reserved_1()
       
  1598     {
       
  1599     }
       
  1600 
       
  1601 EXPORT_C void CAknFloatingPointQueryDialog::CEikDialog_Reserved_2()
       
  1602     {
       
  1603     }
       
  1604 
       
  1605 EXPORT_C void CAknFloatingPointQueryDialog::CAknDialog_Reserved()
       
  1606     {
       
  1607     }
       
  1608 
       
  1609 EXPORT_C void CAknFloatingPointQueryDialog::CAknQueryDialog_Reserved()
       
  1610     {
       
  1611     }
       
  1612 
       
  1613 
       
  1614 /**************************************
       
  1615  * CAknMultiLineDataQueryDialog
       
  1616  **************************************/
       
  1617 
       
  1618 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TTime& aTime1, TTime& aTime2, TTone aTone)
       
  1619     {return DoNewL(aTime1,aTime2,aTone);}
       
  1620 
       
  1621 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TDes&  aText1, TDes&  aText2, TTone aTone)
       
  1622     {return DoNewL(aText1,aText2,aTone);}
       
  1623 
       
  1624 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TDes&  aText1, TTime& aTime2, TTone aTone)
       
  1625     {return DoNewL(aText1,aTime2,aTone);}
       
  1626 
       
  1627 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TDes&  aText1, TInt&  aNum2,  TTone aTone)
       
  1628     {return DoNewL(aText1,aNum2,aTone);}
       
  1629 
       
  1630 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TDes& aText1,  TTimeIntervalSeconds& aDur2, TTone aTone)
       
  1631     {return DoNewL(aText1,aDur2,aTone);}
       
  1632 
       
  1633 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TTime& aTime1, TTimeIntervalSeconds& aDur2, TTone aTone)
       
  1634     {return DoNewL(aTime1,aDur2,aTone);}
       
  1635 
       
  1636 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TInt&  aNum1,  TInt&  aNum2, TTone aTone)
       
  1637     {return DoNewL(aNum1,aNum2,aTone);}
       
  1638 
       
  1639 EXPORT_C CAknMultiLineDataQueryDialog* CAknMultiLineDataQueryDialog::NewL(TPosition &aPos, TTone aTone)
       
  1640 	{
       
  1641 	return DoNewL(aPos, aPos, aTone);
       
  1642 	}
       
  1643 
       
  1644 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog(const TTone& aTone) 
       
  1645     : CAknQueryDialog(aTone)
       
  1646     {
       
  1647     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  1648     }
       
  1649 
       
  1650 EXPORT_C CAknMultiLineDataQueryDialog::~CAknMultiLineDataQueryDialog()
       
  1651     {
       
  1652     AKNTASHOOK_REMOVE();
       
  1653     delete iFirstData;
       
  1654     delete iSecondData;
       
  1655 
       
  1656     delete iSecondPrompt;
       
  1657     }
       
  1658 
       
  1659 EXPORT_C CAknMultilineQueryControl* CAknMultiLineDataQueryDialog::FirstControl() const
       
  1660     {
       
  1661 /* It's very important that lineIndexCount and pageIndexCount are zero initialised 
       
  1662 as they are used as a way of remembering how far the search has traversed.
       
  1663 */
       
  1664     TInt lineIndexCount=0;
       
  1665     TInt pageIndexCount=0;
       
  1666 
       
  1667     FOREVER
       
  1668         {
       
  1669         CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknCtMultilineQuery,&lineIndexCount,&pageIndexCount);
       
  1670         if (controlPtr)
       
  1671             {
       
  1672             CAknMultilineQueryControl* multiLineQueryPtr = STATIC_CAST(CAknMultilineQueryControl*,controlPtr);
       
  1673             if (multiLineQueryPtr->IsFirst())
       
  1674                 return multiLineQueryPtr;
       
  1675 /*
       
  1676 if not the first line, continue searching, with new values of lineIndexCount and pageIndexCount 
       
  1677 updated by FindControlOnAnyPageWithControlType
       
  1678 */
       
  1679             }
       
  1680         else 
       
  1681 /* 
       
  1682 Must have reached limit of pages and lines without finding desired object
       
  1683 This should not happen.
       
  1684 */
       
  1685             return 0;
       
  1686         }
       
  1687     }
       
  1688 
       
  1689 EXPORT_C CAknMultilineQueryControl* CAknMultiLineDataQueryDialog::SecondControl() const
       
  1690     {
       
  1691 /* It's very important that lineIndexCount and pageIndexCount are zero initialised 
       
  1692 as they are used as a way of remembering how far the search has traversed.
       
  1693 */
       
  1694     TInt lineIndexCount=0;
       
  1695     TInt pageIndexCount=0;
       
  1696 
       
  1697     FOREVER
       
  1698         {
       
  1699         CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknCtMultilineQuery,&lineIndexCount,&pageIndexCount);
       
  1700         if (controlPtr)
       
  1701             {
       
  1702             CAknMultilineQueryControl* multiLineQueryPtr = STATIC_CAST(CAknMultilineQueryControl*,controlPtr);
       
  1703             if (multiLineQueryPtr->IsSecond())
       
  1704                 return multiLineQueryPtr;
       
  1705 /*
       
  1706 if not the second line, continue searching, with new values of lineIndexCount and pageIndexCount 
       
  1707 updated by FindControlOnAnyPageWithControlType
       
  1708 */
       
  1709             }
       
  1710         else 
       
  1711 /* 
       
  1712 Must have reached limit of pages and lines without finding desired object
       
  1713 This should not happen.
       
  1714 */
       
  1715             return 0;
       
  1716         }
       
  1717     }
       
  1718     
       
  1719 EXPORT_C CAknQueryControl* CAknMultiLineDataQueryDialog::QueryControl() const
       
  1720     {
       
  1721 	if (!FirstLineEnabled() && SecondLineEnabled()) return SecondControl();
       
  1722     return FirstControl();
       
  1723     }
       
  1724 
       
  1725 /**
       
  1726  * According to the Eur LAF specs, v. 3.3, combined data-code queries cannot
       
  1727  * have a heading. Returning NULL here guarantees that the heading is not
       
  1728  * layed out even if there is a heading in the resource file.
       
  1729  */
       
  1730 EXPORT_C CAknPopupHeadingPane* CAknMultiLineDataQueryDialog::QueryHeading() const
       
  1731     {
       
  1732     return NULL;
       
  1733     }
       
  1734 
       
  1735 
       
  1736 EXPORT_C void CAknMultiLineDataQueryDialog::PreLayoutDynInitL()
       
  1737     {
       
  1738     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1739         {
       
  1740         SetBorder( TGulBorder::ENone );
       
  1741         }
       
  1742 	SetMultilineQuery(ETrue);
       
  1743     SetEditableL( ETrue );
       
  1744     DoSetPromptL();
       
  1745     
       
  1746     CAknMultilineQueryControl* firstControl = FirstControl();
       
  1747     CAknMultilineQueryControl* secondControl = SecondControl();
       
  1748 
       
  1749     firstControl->SetNbrOfPromptLines( firstControl->NbrOfPromptLines(), 
       
  1750                                         secondControl->NbrOfPromptLines());
       
  1751     secondControl->SetNbrOfPromptLines( firstControl->NbrOfPromptLines(), 
       
  1752                                         secondControl->NbrOfPromptLines());
       
  1753     
       
  1754     firstControl->SetQueryControlObserver(this);
       
  1755     secondControl->SetQueryControlObserver(this);
       
  1756     
       
  1757     // Set and then deploy the flags
       
  1758     firstControl->SetAndUseFlagsL( iFlags );
       
  1759     secondControl->SetAndUseFlagsL( iFlags );
       
  1760 
       
  1761     if (iFirstData) 
       
  1762         iFirstData->SetL(firstControl,iFirstEditorMaxLength);
       
  1763     if (iSecondData) 
       
  1764         iSecondData->SetL(secondControl,iSecondEditorMaxLength);
       
  1765     
       
  1766 	SetInitialCurrentLine();
       
  1767 	UpdateLeftSoftKeyL();
       
  1768     HandleOrientationSwitch();
       
  1769     
       
  1770     // Create CaptionRetriever for FEP
       
  1771     delete iExtension;
       
  1772     iExtension = NULL;
       
  1773     iExtension = new(ELeave) CAknMultilineQueryDialogExtension(this, CAknMultilineQueryDialogExtension::EMultDataQuery);
       
  1774     }
       
  1775 
       
  1776 EXPORT_C void CAknMultiLineDataQueryDialog::SetPromptL(const TDesC& aFP, const TDesC& aSP)
       
  1777 //
       
  1778 //Store new prompt values
       
  1779 //
       
  1780     {
       
  1781     delete iSecondPrompt;
       
  1782     iSecondPrompt = NULL;
       
  1783     iSecondPrompt = aSP.AllocL();
       
  1784 
       
  1785     CAknQueryDialog::SetPromptL(aFP);
       
  1786     }
       
  1787 
       
  1788 EXPORT_C void CAknMultiLineDataQueryDialog::DoSetPromptL()
       
  1789     {
       
  1790 //
       
  1791 //Set prompt in query controls, called during layout
       
  1792 //
       
  1793     CAknMultilineQueryControl* secondControl = SecondControl();
       
  1794     if(secondControl && iSecondPrompt && iSecondPrompt->Length())
       
  1795         secondControl->SetPromptL(*iSecondPrompt);
       
  1796     
       
  1797     CAknQueryDialog::DoSetPromptL();        
       
  1798     }
       
  1799 
       
  1800 /**
       
  1801 * Allows dismissing of queries. Same as base class implementation only take into
       
  1802 * consideration both controls
       
  1803 */
       
  1804 EXPORT_C TBool CAknMultiLineDataQueryDialog::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
       
  1805     {
       
  1806     if (aKeyEvent.iScanCode == EStdKeyHash)
       
  1807         {
       
  1808         CAknMultilineQueryControl* firstControl = FirstControl();
       
  1809         CAknMultilineQueryControl* secondControl = SecondControl();
       
  1810         
       
  1811         //second component control is the editor
       
  1812         if ( (firstControl && firstControl->ComponentControl(1)->IsFocused() 
       
  1813               &&(firstControl->QueryType() == EMultiDataFirstPinEd) ) ||
       
  1814              (secondControl && secondControl->ComponentControl(1)->IsFocused() 
       
  1815               && (secondControl->QueryType() == EMultiDataSecondPinEd) ) )
       
  1816             {
       
  1817             DismissQueryL();
       
  1818             return ETrue;
       
  1819             }
       
  1820         }
       
  1821 
       
  1822 	if (aKeyEvent.iCode == EKeyTab && (!(FirstLineEnabled()&&SecondLineEnabled())) )
       
  1823 		{
       
  1824 
       
  1825 		int line = 0;
       
  1826 	    CAknMultilineQueryControl* firstControl = FirstControl();
       
  1827     	CAknMultilineQueryControl* secondControl = SecondControl();	
       
  1828 		TInt line1 = FindLineIndex(*firstControl);
       
  1829 		TInt line2 = FindLineIndex(*secondControl);
       
  1830 
       
  1831 		if (CurrentLine()==0) line = line2;
       
  1832 		if (CurrentLine()==1) line = line1;
       
  1833 
       
  1834         if ( CAknEnv::Static()->TransparencyEnabled() )
       
  1835             {
       
  1836             // Another case of missed RD_NO_DIALOG_BORDERS?  	    
       
  1837             SetBorder( TGulBorder::ENone );
       
  1838             }
       
  1839         else
       
  1840             {
       
  1841         	if (line == line1)
       
  1842 		      	{
       
  1843         	    SetBorder( TGulBorder::ENone );
       
  1844 			    }
       
  1845 		    else
       
  1846 			    {
       
  1847         	    SetBorder(AknBorderId::EAknBorderNotePopup);
       
  1848 			    }
       
  1849             }
       
  1850 
       
  1851 		CEikCaptionedControl *ctrl = GetLineByLineAndPageIndex(line, 0);
       
  1852 		TryChangeFocusToL(ctrl->iId);
       
  1853         HandleOrientationSwitch();
       
  1854 
       
  1855         UpdateLeftSoftKeyL();
       
  1856 		return ETrue;
       
  1857 		}
       
  1858 
       
  1859 
       
  1860     return EFalse;
       
  1861     }
       
  1862 
       
  1863 
       
  1864 TBool CAknMultiLineDataQueryDialog::FirstLineEnabled() const
       
  1865 {
       
  1866 	return (CurrentLine()==0 && Layout_Meta_Data::IsLandscapeOrientation())
       
  1867 		|| !Layout_Meta_Data::IsLandscapeOrientation();
       
  1868 }
       
  1869 
       
  1870 TBool CAknMultiLineDataQueryDialog::SecondLineEnabled() const
       
  1871 {
       
  1872 	return (CurrentLine()==1 && Layout_Meta_Data::IsLandscapeOrientation())
       
  1873 		|| !Layout_Meta_Data::IsLandscapeOrientation();
       
  1874 }
       
  1875 
       
  1876 TInt CAknMultiLineDataQueryDialog::CurrentLine() const
       
  1877 {
       
  1878    CAknMultilineQueryControl* secondControl = SecondControl();
       
  1879         CAknMultilineQueryControl* firstControl = FirstControl();  
       
  1880    if (firstControl && firstControl->IsFocused()) return 0;
       
  1881    if (secondControl && secondControl->IsFocused()) return 1;
       
  1882    return -1;
       
  1883 }
       
  1884 
       
  1885 void CAknMultiLineDataQueryDialog::HandleOrientationSwitch()
       
  1886 {
       
  1887 	TBool firstLineEnabled = FirstLineEnabled();
       
  1888 	TBool secondLineEnabled = SecondLineEnabled();
       
  1889 
       
  1890     if (!firstLineEnabled && !secondLineEnabled)
       
  1891     {
       
  1892 	    TInt controlID = IdOfFocusControl();
       
  1893 	    if (controlID  )
       
  1894 	    {
       
  1895 	        Line(controlID)->SetFocus(ETrue, EDrawNow);
       
  1896 	    	firstLineEnabled = FirstLineEnabled();
       
  1897 	        secondLineEnabled = SecondLineEnabled();
       
  1898 	    }	
       
  1899 	    else
       
  1900 	        firstLineEnabled = ETrue;      
       
  1901     }
       
  1902 
       
  1903     CAknMultilineQueryControl* firstControl = FirstControl();
       
  1904     CAknMultilineQueryControl* secondControl = SecondControl();	
       
  1905 	TInt line1 = FindLineIndex(*firstControl);
       
  1906 	TInt line2 = FindLineIndex(*secondControl);
       
  1907 	CEikCaptionedControl *ctrl1 = GetLineByLineAndPageIndex(line1, 0);
       
  1908 	CEikCaptionedControl *ctrl2 = GetLineByLineAndPageIndex(line2, 0);
       
  1909 	ctrl1->SetLatent(!firstLineEnabled);
       
  1910 	ctrl2->SetLatent(!secondLineEnabled);
       
  1911 	ctrl1->SetLatentGroupLineFollows(!firstLineEnabled);
       
  1912 	ctrl2->SetLatentGroupLineFollows(!secondLineEnabled);
       
  1913 	ctrl1->SetFocusing(firstLineEnabled);
       
  1914 	ctrl2->SetFocusing(secondLineEnabled);
       
  1915 	Layout();
       
  1916 }
       
  1917 
       
  1918 EXPORT_C void CAknMultiLineDataQueryDialog::HandleResourceChange(TInt aType)
       
  1919 {
       
  1920 	CAknQueryDialog::HandleResourceChange(aType);
       
  1921 	if (aType == KEikDynamicLayoutVariantSwitch)
       
  1922 		{
       
  1923         if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1924             {
       
  1925             SetBorder( TGulBorder::ENone );
       
  1926             }        	
       
  1927         else
       
  1928             {
       
  1929             SetBorder(AknBorderId::EAknBorderNotePopup);
       
  1930             }
       
  1931 		HandleOrientationSwitch();
       
  1932 		TRAP_IGNORE( UpdateLeftSoftKeyL() );
       
  1933 		}
       
  1934 }
       
  1935 
       
  1936 EXPORT_C TBool CAknMultiLineDataQueryDialog::OkToExitL(TInt aButtonId)
       
  1937     {
       
  1938     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1939     	{
       
  1940     if((IsLeftSoftkeyVisible() && 
       
  1941         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  1942         {
       
  1943         CAknMultilineQueryControl* firstControl = FirstControl();
       
  1944         CAknMultilineQueryControl* secondControl = SecondControl();
       
  1945         	if ( FirstControl()->EditorContentIsValidL() && FirstControl()->IsFocused() )
       
  1946         		{
       
  1947                 if ( !CAknEnv::Static()->TransparencyEnabled() )
       
  1948                     {
       
  1949                     // It may be that this should be under the RD_NO_DIALOG_BORDERS?
       
  1950                     // Anyway, multiline query's second query in landscape bugged
       
  1951                     // if the EAknBorderNotePopup was set.. Maybe the alternate
       
  1952                     // code path should set TGulBorder::ENone?
       
  1953                     SetBorder(AknBorderId::EAknBorderNotePopup);
       
  1954                     }
       
  1955 				TInt line1 = FindLineIndex(*firstControl);
       
  1956 				TInt line2 = FindLineIndex(*secondControl);
       
  1957 				CEikCaptionedControl *ctrl1 = GetLineByLineAndPageIndex(line1, 0);
       
  1958 				CEikCaptionedControl *ctrl2 = GetLineByLineAndPageIndex(line2, 0);
       
  1959 				TryChangeFocusToL(ctrl2->iId);
       
  1960                 HandleOrientationSwitch();
       
  1961 
       
  1962                 UpdateLeftSoftKeyL();
       
  1963 
       
  1964         		return EFalse;      		        		        		
       
  1965         		}
       
  1966         	}
       
  1967     	}
       
  1968     if((IsLeftSoftkeyVisible() && 
       
  1969         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  1970         {
       
  1971         CAknMultilineQueryControl* firstControl = FirstControl();
       
  1972         CAknMultilineQueryControl* secondControl = SecondControl();
       
  1973         
       
  1974         if (iFirstData)
       
  1975             iFirstData->Get(firstControl);
       
  1976         
       
  1977         if(iSecondData)
       
  1978             iSecondData->Get(secondControl);
       
  1979 
       
  1980         if(iText)
       
  1981             {
       
  1982             TInt len = firstControl->GetTextLength();
       
  1983             if ( len != -1 )
       
  1984                 {
       
  1985                 HBufC* text = HBufC::NewLC( len );
       
  1986                 TPtr ptext = text->Des();
       
  1987                 firstControl->GetText( ptext );
       
  1988                 iText->Copy( *text );                        
       
  1989                 CleanupStack::PopAndDestroy( text );   	
       
  1990                 }
       
  1991             }
       
  1992         if(iSecondText)
       
  1993             {
       
  1994             TInt len = secondControl->GetTextLength();
       
  1995             if ( len != -1 )
       
  1996                 {
       
  1997                 HBufC* text = HBufC::NewLC( len );
       
  1998                 TPtr ptext = text->Des();
       
  1999                 secondControl->GetText( ptext );
       
  2000                 iSecondText->Copy( *text );                        
       
  2001                 CleanupStack::PopAndDestroy( text );   	
       
  2002                 }
       
  2003             }
       
  2004 
       
  2005         return ETrue;
       
  2006         }
       
  2007     else if(aButtonId == GetRightCBAShortKeyPress())
       
  2008         {
       
  2009         return ETrue;
       
  2010         }
       
  2011     
       
  2012     return EFalse;
       
  2013     }
       
  2014 
       
  2015 EXPORT_C void CAknMultiLineDataQueryDialog::UpdateLeftSoftKeyL()
       
  2016     {
       
  2017     
       
  2018     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  2019     	{
       
  2020 	    if ( (FirstControl()->EditorContentIsValidL() && FirstControl()->IsFocused()) || (SecondControl()->EditorContentIsValidL() && FirstControl()->EditorContentIsValidL()) )
       
  2021 	        {
       
  2022 	        MakeLeftSoftkeyVisible(ETrue);
       
  2023 	        }
       
  2024 	    else
       
  2025 	        {
       
  2026 	        MakeLeftSoftkeyVisible(EFalse);
       
  2027 	        }	        
       
  2028 	    return;
       
  2029     	}
       
  2030     	
       
  2031     if ( FirstControl()->EditorContentIsValidL() &&
       
  2032          SecondControl()->EditorContentIsValidL())
       
  2033         {
       
  2034         MakeLeftSoftkeyVisible(ETrue);
       
  2035         }
       
  2036     else
       
  2037         {
       
  2038         MakeLeftSoftkeyVisible(EFalse);
       
  2039         }
       
  2040     }
       
  2041 
       
  2042 EXPORT_C void CAknMultiLineDataQueryDialog::SetMaxLengthOfFirstEditor(TInt aFirstTextEditorMaxLength)
       
  2043     {
       
  2044     iFirstEditorMaxLength = aFirstTextEditorMaxLength;
       
  2045     };
       
  2046 
       
  2047 EXPORT_C void CAknMultiLineDataQueryDialog::SetMaxLengthOfSecondEditor(TInt aSecondTextEditorMaxLength)
       
  2048     {
       
  2049     iSecondEditorMaxLength=aSecondTextEditorMaxLength;
       
  2050     };
       
  2051 
       
  2052 EXPORT_C TPtrC CAknMultiLineDataQueryDialog::SecondPrompt() const
       
  2053     { if (iSecondPrompt)
       
  2054         return *iSecondPrompt; 
       
  2055       return TPtrC(0,0);    
       
  2056     }
       
  2057 
       
  2058 /**
       
  2059  * Deprecated constructors
       
  2060  */
       
  2061 
       
  2062 inline const TDesC& DesOrNull(const TDesC* aDes) 
       
  2063     {return aDes ? *aDes : KNullDesC();}
       
  2064 
       
  2065 
       
  2066 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TTime* aTime, 
       
  2067                                                                     TTime* aTime2,
       
  2068                                                                     TDesC* aPrompt,
       
  2069                                                                     TDesC* aPrompt2,
       
  2070                                                                     const TTone& aTone)
       
  2071                                                                     : CAknQueryDialog(aTone)
       
  2072     {
       
  2073     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2074     TRAP(ignore,SetDataL(*aTime,*aTime2));
       
  2075     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2076     }
       
  2077 
       
  2078 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TDes* aDataText,
       
  2079                                                                     TDes* aDataText2,
       
  2080                                                                     TDesC* aPrompt,
       
  2081                                                                     TDesC* aPrompt2,
       
  2082                                                                     const TTone& aTone)
       
  2083                                                                     : CAknQueryDialog(aTone)
       
  2084     {
       
  2085     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2086     TRAP(ignore,SetDataL(*aDataText,*aDataText2));
       
  2087 
       
  2088     iText = aDataText;
       
  2089     iSecondText = aDataText2;
       
  2090     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2091     }
       
  2092 
       
  2093 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TDes* aDataText, 
       
  2094                                                                     TTime* aTime,
       
  2095                                                                     TDesC* aPrompt,
       
  2096                                                                     TDesC* aPrompt2,
       
  2097                                                                     const TTone& aTone)
       
  2098                                                                     : CAknQueryDialog(aTone)
       
  2099     {
       
  2100     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2101     TRAP(ignore,SetDataL(*aDataText,*aTime));
       
  2102 
       
  2103     iText = aDataText;
       
  2104     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2105     }
       
  2106 
       
  2107 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TDes* aDataText, 
       
  2108                                                                     TInt* aNumber,
       
  2109                                                                     TDesC* aPrompt,
       
  2110                                                                     TDesC* aPrompt2,
       
  2111                                                                     const TTone& aTone)
       
  2112                                                                     : CAknQueryDialog(aTone)
       
  2113     {
       
  2114     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2115     TRAP(ignore,SetDataL(*aDataText,*aNumber));
       
  2116 
       
  2117     iText = aDataText;
       
  2118     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2119     }
       
  2120 
       
  2121 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TInt* aNumber, 
       
  2122                                                                     TInt* aNumber2,
       
  2123                                                                     TDesC* aPrompt,
       
  2124                                                                     TDesC* aPrompt2,
       
  2125                                                                     const TTone& aTone)
       
  2126                                                                     : CAknQueryDialog(aTone)
       
  2127     {
       
  2128     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2129     TRAP(ignore,SetDataL(*aNumber,*aNumber2));
       
  2130     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2131     }
       
  2132 
       
  2133 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TDes* aDataText, 
       
  2134                                                                     TTimeIntervalSeconds* aDuration,
       
  2135                                                                     TDesC* aPrompt,
       
  2136                                                                     TDesC* aPrompt2,
       
  2137                                                                     const TTone& aTone)
       
  2138                                                                     : CAknQueryDialog(aTone)
       
  2139     {
       
  2140     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2141     TRAP(ignore,SetDataL(*aDataText,*aDuration));
       
  2142     
       
  2143     iText = aDataText;
       
  2144     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2145     }
       
  2146 
       
  2147 EXPORT_C CAknMultiLineDataQueryDialog::CAknMultiLineDataQueryDialog( TTime* aTime, 
       
  2148                                                                     TTimeIntervalSeconds* aDuration,
       
  2149                                                                     TDesC* aPrompt,
       
  2150                                                                     TDesC* aPrompt2,
       
  2151                                                                     const TTone& aTone)
       
  2152                                                                     : CAknQueryDialog(aTone)
       
  2153     {
       
  2154     TRAPD(ignore, SetPromptL(DesOrNull(aPrompt), DesOrNull(aPrompt2)));
       
  2155     TRAP(ignore,SetDataL(*aTime,*aDuration));
       
  2156     AKNTASHOOK_ADD( this, "CAknMultiLineDataQueryDialog" );
       
  2157     }
       
  2158     
       
  2159 EXPORT_C void CAknMultiLineDataQueryDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
  2160     { 
       
  2161     CAknQueryDialog::HandlePointerEventL(aPointerEvent); 
       
  2162     }
       
  2163 
       
  2164 EXPORT_C void* CAknMultiLineDataQueryDialog::ExtensionInterface( TUid /*aInterface*/ ) 
       
  2165     { 
       
  2166     return NULL;
       
  2167     }
       
  2168 
       
  2169 EXPORT_C void CAknMultiLineDataQueryDialog::CEikDialog_Reserved_1()
       
  2170     {
       
  2171     }
       
  2172 
       
  2173 EXPORT_C void CAknMultiLineDataQueryDialog::CEikDialog_Reserved_2()
       
  2174     {
       
  2175     }
       
  2176 
       
  2177 EXPORT_C void CAknMultiLineDataQueryDialog::CAknDialog_Reserved()
       
  2178     {
       
  2179     }
       
  2180 
       
  2181 EXPORT_C void CAknMultiLineDataQueryDialog::CAknQueryDialog_Reserved()
       
  2182     {
       
  2183     }
       
  2184 
       
  2185 
       
  2186 /**************************************
       
  2187  * CAknIpAddressQueryDialog
       
  2188  **************************************/
       
  2189 
       
  2190 
       
  2191 /**
       
  2192  * Second phase construction required to align API with multiline queries 
       
  2193  * and because in future MAknQueryData will be used.
       
  2194  */
       
  2195 EXPORT_C CAknIpAddressQueryDialog* CAknIpAddressQueryDialog::NewL(TInetAddr& aInetAddr, const TTone& aTone)
       
  2196     {
       
  2197     CAknIpAddressQueryDialog* self = new (ELeave) CAknIpAddressQueryDialog(aInetAddr, aTone);
       
  2198     AKNTASHOOK_ADDL( self, "CAknIpAddressQueryDialog" );
       
  2199     return self;
       
  2200     }
       
  2201 
       
  2202 CAknIpAddressQueryDialog::CAknIpAddressQueryDialog
       
  2203     (TInetAddr& aInetAddr, const TTone& aTone) : CAknQueryDialog(aTone), iInetAddr(aInetAddr)
       
  2204     {
       
  2205     }
       
  2206 
       
  2207 EXPORT_C CAknIpAddressQueryDialog::~CAknIpAddressQueryDialog()
       
  2208     {
       
  2209     AKNTASHOOK_REMOVE();
       
  2210     }
       
  2211 EXPORT_C void CAknIpAddressQueryDialog::SetSizeAndPosition(
       
  2212         const TSize& aSize )
       
  2213     {
       
  2214     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());    
       
  2215     if(control)
       
  2216         {
       
  2217         if ( AknLayoutUtils::PenEnabled() )
       
  2218             {
       
  2219             CAknQueryDialog::SetSizeAndPosition( aSize );
       
  2220             }
       
  2221         else
       
  2222             {
       
  2223             TRect mainPane;
       
  2224             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent,
       
  2225                     mainPane );
       
  2226 
       
  2227             TAknWindowLineLayout layout;
       
  2228             control->WindowLayout( layout );
       
  2229 
       
  2230             CAknPopupHeadingPane* controlHeading = QueryHeading();
       
  2231 
       
  2232             TAknLayoutRect layoutWindow;
       
  2233             layoutWindow.LayoutRect( mainPane, layout); 
       
  2234             TRect winRect(layoutWindow.Rect());
       
  2235                     
       
  2236             if (controlHeading)
       
  2237                 {
       
  2238                 TAknWindowLineLayout headingL =
       
  2239                 AKN_LAYOUT_WINDOW_popup_list_heading_pane( control->Rect() );
       
  2240 
       
  2241                 TAknLayoutRect layoutHeading;
       
  2242                 layoutHeading.LayoutRect(mainPane, headingL); 
       
  2243                 TRect headRect(layoutHeading.Rect());
       
  2244 
       
  2245                 winRect.iTl.iY -= headRect.Height();
       
  2246                 }
       
  2247             
       
  2248             SetRect(winRect);
       
  2249             }
       
  2250         }
       
  2251     }
       
  2252 
       
  2253 EXPORT_C CAknQueryControl* CAknIpAddressQueryDialog::QueryControl() const
       
  2254     {
       
  2255     CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknExtCtQuery);
       
  2256     if (controlPtr)
       
  2257         return STATIC_CAST(CAknQueryControl*,controlPtr);
       
  2258 /* 
       
  2259 Must have reached limit of pages and lines without finding desired object
       
  2260 This should not happen.
       
  2261 */
       
  2262     return 0;
       
  2263     }
       
  2264 
       
  2265 EXPORT_C void CAknIpAddressQueryDialog::PreLayoutDynInitL()
       
  2266     {
       
  2267 #ifndef RD_NO_DIALOG_BORDERS
       
  2268     SetBorder(AknBorderId::EAknBorderNotePopup);
       
  2269 #else
       
  2270     SetBorder(TGulBorder::ENone);
       
  2271 #endif
       
  2272     SetEditableL( ETrue ) ;
       
  2273     DoSetPromptL();
       
  2274 
       
  2275     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2276     if(control)
       
  2277         {
       
  2278         control->SetQueryControlObserver(this);
       
  2279         control->SetAndUseFlagsL( iFlags );
       
  2280         control->SetInetAddress(iInetAddr);
       
  2281         }
       
  2282 
       
  2283     CAknPopupHeadingPane* controlHeading = QueryHeading();
       
  2284     if (controlHeading)
       
  2285         { 
       
  2286         SetLineNonFocusing(EAknMessageQueryHeaderId); 
       
  2287         
       
  2288         if (control)
       
  2289             control->SetNumberOfEditorLines(1);
       
  2290         }
       
  2291     // Create CaptionRetriever for FEP
       
  2292     delete iExtension;
       
  2293     iExtension = NULL;
       
  2294     iExtension = new(ELeave) CAknQueryDialogExtension(this);
       
  2295     }
       
  2296 
       
  2297 EXPORT_C void CAknIpAddressQueryDialog::PostLayoutDynInitL()
       
  2298     {
       
  2299     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2300     if (control)
       
  2301         control->StartAnimationL();
       
  2302     }
       
  2303 
       
  2304 EXPORT_C TBool CAknIpAddressQueryDialog::NeedToDismissQueryL(const TKeyEvent& /*aKeyEvent*/)
       
  2305     {   
       
  2306     return EFalse;
       
  2307     }
       
  2308 
       
  2309 EXPORT_C void CAknIpAddressQueryDialog::SetMinimumAndMaximum( const TInetAddr& aMinimumAddress,                                                              const TInetAddr& aMaximumAddress)
       
  2310 {
       
  2311     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2312     if ( control )
       
  2313         {
       
  2314         control->SetMinimumAndMaximum(aMinimumAddress, aMaximumAddress);
       
  2315         }
       
  2316 }
       
  2317 
       
  2318 EXPORT_C TBool CAknIpAddressQueryDialog::OkToExitL(TInt aButtonId)
       
  2319     {
       
  2320     if((IsLeftSoftkeyVisible() && 
       
  2321         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  2322         {   
       
  2323         CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2324         if ( control )
       
  2325             {
       
  2326             iInetAddr = control->GetInetAddress();
       
  2327             }
       
  2328         return ETrue;
       
  2329         }
       
  2330     else if(aButtonId == GetRightCBAShortKeyPress())
       
  2331         {
       
  2332         return ETrue;
       
  2333         }
       
  2334     return EFalse;
       
  2335     }
       
  2336 
       
  2337 
       
  2338 EXPORT_C void CAknIpAddressQueryDialog::UpdateLeftSoftKeyL()
       
  2339     {
       
  2340     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2341     if ( control )
       
  2342         {
       
  2343         MakeLeftSoftkeyVisible( control->EditorContentIsValidL() );
       
  2344         }
       
  2345     }
       
  2346 
       
  2347 EXPORT_C void CAknIpAddressQueryDialog::DoSetPromptL()
       
  2348     {
       
  2349     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2350     if( control && iPrompt && iPrompt->Length() )
       
  2351         {
       
  2352         control->SetPromptL( *iPrompt );
       
  2353         }
       
  2354     LayoutAndDraw();
       
  2355     }
       
  2356 
       
  2357 
       
  2358 EXPORT_C void CAknIpAddressQueryDialog::CEikDialog_Reserved_1()
       
  2359     {
       
  2360     }
       
  2361 
       
  2362 EXPORT_C void CAknIpAddressQueryDialog::CEikDialog_Reserved_2()
       
  2363     {
       
  2364     }
       
  2365 
       
  2366 EXPORT_C void CAknIpAddressQueryDialog::CAknDialog_Reserved()
       
  2367     {
       
  2368     }
       
  2369 
       
  2370 EXPORT_C void CAknIpAddressQueryDialog::CAknQueryDialog_Reserved()
       
  2371     {
       
  2372     }
       
  2373 
       
  2374 
       
  2375 
       
  2376 /**************************************
       
  2377  * CAknFixedPointQueryDialog
       
  2378  **************************************/
       
  2379 
       
  2380 
       
  2381 /**
       
  2382  * Second phase construction required to align API with multiline queries 
       
  2383  * and because in future MAknQueryData will be used.
       
  2384  */
       
  2385 EXPORT_C CAknFixedPointQueryDialog* CAknFixedPointQueryDialog::NewL(TInt& aNumber, const TTone& aTone)
       
  2386     {
       
  2387     CAknFixedPointQueryDialog* self = new (ELeave) CAknFixedPointQueryDialog(aNumber, aTone);
       
  2388     AKNTASHOOK_ADDL( self, "CAknFixedPointQueryDialog" );
       
  2389     return self;
       
  2390     }
       
  2391 
       
  2392 CAknFixedPointQueryDialog::CAknFixedPointQueryDialog
       
  2393     (TInt& aNumber, const TTone& aTone) : CAknQueryDialog(aTone), iNumber(aNumber)
       
  2394     {
       
  2395     }
       
  2396 
       
  2397 EXPORT_C CAknFixedPointQueryDialog::~CAknFixedPointQueryDialog()
       
  2398     {
       
  2399     AKNTASHOOK_REMOVE();
       
  2400     }
       
  2401 EXPORT_C void CAknFixedPointQueryDialog::SetSizeAndPosition(
       
  2402         const TSize& aSize )
       
  2403     {
       
  2404     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());    
       
  2405     if(control)
       
  2406         {
       
  2407         if ( AknLayoutUtils::PenEnabled() )
       
  2408             {
       
  2409             CAknQueryDialog::SetSizeAndPosition( aSize );
       
  2410             }
       
  2411         else
       
  2412             {
       
  2413             TRect mainPane;
       
  2414             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent,
       
  2415                     mainPane );
       
  2416             
       
  2417             TAknWindowLineLayout layout;
       
  2418             control->WindowLayout( layout );
       
  2419 
       
  2420             CAknPopupHeadingPane* controlHeading = QueryHeading();
       
  2421 
       
  2422             TAknLayoutRect layoutWindow;
       
  2423             layoutWindow.LayoutRect( mainPane, layout); 
       
  2424             TRect winRect(layoutWindow.Rect());
       
  2425                     
       
  2426             if (controlHeading)
       
  2427                 {
       
  2428                 TAknWindowLineLayout headingL =
       
  2429                     AKN_LAYOUT_WINDOW_popup_list_heading_pane( control->Rect() );
       
  2430 
       
  2431                 TAknLayoutRect layoutHeading;
       
  2432                 layoutHeading.LayoutRect(mainPane, headingL); 
       
  2433                 TRect headRect(layoutHeading.Rect());
       
  2434 
       
  2435                 winRect.iTl.iY -= headRect.Height();
       
  2436                 }
       
  2437             
       
  2438             SetRect(winRect);
       
  2439             }
       
  2440         }
       
  2441     }
       
  2442 
       
  2443 EXPORT_C CAknQueryControl* CAknFixedPointQueryDialog::QueryControl() const
       
  2444     {
       
  2445     CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknExtCtQuery);
       
  2446     if (controlPtr)
       
  2447         return STATIC_CAST(CAknQueryControl*,controlPtr);
       
  2448 /* 
       
  2449 Must have reached limit of pages and lines without finding desired object
       
  2450 This should not happen.
       
  2451 */
       
  2452     return 0;
       
  2453     }
       
  2454 
       
  2455 EXPORT_C void CAknFixedPointQueryDialog::PreLayoutDynInitL()
       
  2456     {
       
  2457 #ifndef RD_NO_DIALOG_BORDERS
       
  2458     SetBorder(AknBorderId::EAknBorderNotePopup);
       
  2459 #else
       
  2460     SetBorder(TGulBorder::ENone);
       
  2461 #endif
       
  2462     SetEditableL( ETrue ) ;
       
  2463     DoSetPromptL();
       
  2464 
       
  2465     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2466     if(control)
       
  2467         {
       
  2468         control->SetQueryControlObserver(this);
       
  2469         control->SetAndUseFlagsL( iFlags );
       
  2470         control->SetFixedPointNumberL(&iNumber);
       
  2471         }
       
  2472 
       
  2473     CAknPopupHeadingPane* controlHeading = QueryHeading();
       
  2474     if (controlHeading)
       
  2475         { 
       
  2476         SetLineNonFocusing(EAknMessageQueryHeaderId); 
       
  2477         
       
  2478         if (control)
       
  2479             control->SetNumberOfEditorLines(1);
       
  2480         }
       
  2481     // Create CaptionRetriever for FEP
       
  2482     delete iExtension;
       
  2483     iExtension = NULL;
       
  2484     iExtension = new(ELeave) CAknQueryDialogExtension(this);
       
  2485     }
       
  2486 
       
  2487 EXPORT_C void CAknFixedPointQueryDialog::PostLayoutDynInitL()
       
  2488     {
       
  2489     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2490     if (control)
       
  2491         control->StartAnimationL();
       
  2492     }
       
  2493 
       
  2494 EXPORT_C TBool CAknFixedPointQueryDialog::NeedToDismissQueryL(const TKeyEvent& /*aKeyEvent*/)
       
  2495     {   
       
  2496     return EFalse;
       
  2497     }
       
  2498 
       
  2499 EXPORT_C void CAknFixedPointQueryDialog::SetMinimumAndMaximum( TInt aMinimumValue, TInt aMaximumValue)                                                             
       
  2500 {
       
  2501     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2502     if ( control )
       
  2503         {
       
  2504         control->SetMinimumAndMaximum(aMinimumValue, aMaximumValue);
       
  2505         }
       
  2506 }
       
  2507 
       
  2508 EXPORT_C TBool CAknFixedPointQueryDialog::OkToExitL(TInt aButtonId)
       
  2509     {
       
  2510     if((IsLeftSoftkeyVisible() && 
       
  2511         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  2512         {   
       
  2513         CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2514         if ( control )
       
  2515             {
       
  2516             iNumber = control->GetFixedPointNumber();
       
  2517             }
       
  2518         return ETrue;
       
  2519         }
       
  2520     else if(aButtonId == GetRightCBAShortKeyPress())
       
  2521         {
       
  2522         return ETrue;
       
  2523         }
       
  2524     return EFalse;
       
  2525     }
       
  2526 
       
  2527 
       
  2528 EXPORT_C void CAknFixedPointQueryDialog::UpdateLeftSoftKeyL()
       
  2529     {
       
  2530     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2531     if ( control )
       
  2532         {
       
  2533         MakeLeftSoftkeyVisible( control->EditorContentIsValidL() );
       
  2534         }
       
  2535     }
       
  2536 
       
  2537 EXPORT_C void CAknFixedPointQueryDialog::DoSetPromptL()
       
  2538     {
       
  2539     CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,QueryControl());
       
  2540     if( control && iPrompt && iPrompt->Length() )
       
  2541         {
       
  2542         control->SetPromptL( *iPrompt );
       
  2543         }
       
  2544     LayoutAndDraw();
       
  2545     }
       
  2546 
       
  2547 
       
  2548 EXPORT_C void CAknFixedPointQueryDialog::CEikDialog_Reserved_1()
       
  2549     {
       
  2550     }
       
  2551 
       
  2552 EXPORT_C void CAknFixedPointQueryDialog::CEikDialog_Reserved_2()
       
  2553     {
       
  2554     }
       
  2555 
       
  2556 EXPORT_C void CAknFixedPointQueryDialog::CAknDialog_Reserved()
       
  2557     {
       
  2558     }
       
  2559 
       
  2560 EXPORT_C void CAknFixedPointQueryDialog::CAknQueryDialog_Reserved()
       
  2561     {
       
  2562     }
       
  2563 
       
  2564 
       
  2565 
       
  2566 /**************************************
       
  2567  * CAknMultiLineIpQueryDialog
       
  2568  **************************************/
       
  2569 
       
  2570 EXPORT_C CAknMultiLineIpQueryDialog* CAknMultiLineIpQueryDialog::NewL(TInetAddr&  aAddress1,  TInetAddr&  aAddress2, TTone aTone)
       
  2571     {return DoNewL(aAddress1,aAddress2,aTone);}
       
  2572 
       
  2573 
       
  2574 
       
  2575 CAknMultiLineIpQueryDialog::CAknMultiLineIpQueryDialog(const TTone& aTone) 
       
  2576     : CAknMultiLineDataQueryDialog(aTone)
       
  2577     {
       
  2578     AKNTASHOOK_ADD( this, "CAknMultiLineIpQueryDialog" );
       
  2579     }
       
  2580 
       
  2581 EXPORT_C CAknMultiLineIpQueryDialog::~CAknMultiLineIpQueryDialog()
       
  2582     {
       
  2583     AKNTASHOOK_REMOVE();
       
  2584     delete iFirstData;
       
  2585     delete iSecondData;
       
  2586 
       
  2587     delete iSecondPrompt;
       
  2588     }
       
  2589 
       
  2590 EXPORT_C CAknExtMultilineQueryControl* CAknMultiLineIpQueryDialog::FirstControl() const
       
  2591     {
       
  2592 /* It's very important that lineIndexCount and pageIndexCount are zero initialised 
       
  2593 as they are used as a way of remembering how far the search has traversed.
       
  2594 */
       
  2595     TInt lineIndexCount=0;
       
  2596     TInt pageIndexCount=0;
       
  2597 
       
  2598     FOREVER
       
  2599         {
       
  2600         CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknExtCtMultilineQuery,&lineIndexCount,&pageIndexCount);
       
  2601         if (controlPtr)
       
  2602             {
       
  2603             CAknExtMultilineQueryControl* multiLineQueryPtr = STATIC_CAST(CAknExtMultilineQueryControl*,controlPtr);
       
  2604             if (multiLineQueryPtr->IsFirst())
       
  2605                 return multiLineQueryPtr;
       
  2606 /*
       
  2607 if not the first line, continue searching, with new values of lineIndexCount and pageIndexCount 
       
  2608 updated by FindControlOnAnyPageWithControlType
       
  2609 */
       
  2610             }
       
  2611         else 
       
  2612 /* 
       
  2613 Must have reached limit of pages and lines without finding desired object
       
  2614 This should not happen.
       
  2615 */
       
  2616             return 0;
       
  2617         }
       
  2618     }
       
  2619 
       
  2620 EXPORT_C CAknExtMultilineQueryControl* CAknMultiLineIpQueryDialog::SecondControl() const
       
  2621     {
       
  2622 /* It's very important that lineIndexCount and pageIndexCount are zero initialised 
       
  2623 as they are used as a way of remembering how far the search has traversed.
       
  2624 */
       
  2625     TInt lineIndexCount=0;
       
  2626     TInt pageIndexCount=0;
       
  2627 
       
  2628     FOREVER
       
  2629         {
       
  2630         CCoeControl* controlPtr = FindControlOnAnyPageWithControlType(EAknExtCtMultilineQuery,&lineIndexCount,&pageIndexCount);
       
  2631         if (controlPtr)
       
  2632             {
       
  2633             CAknExtMultilineQueryControl* multiLineQueryPtr = STATIC_CAST(CAknExtMultilineQueryControl*,controlPtr);
       
  2634             if (multiLineQueryPtr->IsSecond())
       
  2635                 return multiLineQueryPtr;
       
  2636 /*
       
  2637 if not the second line, continue searching, with new values of lineIndexCount and pageIndexCount 
       
  2638 updated by FindControlOnAnyPageWithControlType
       
  2639 */
       
  2640             }
       
  2641         else 
       
  2642 /* 
       
  2643 Must have reached limit of pages and lines without finding desired object
       
  2644 This should not happen.
       
  2645 */
       
  2646             return 0;
       
  2647         }
       
  2648     }
       
  2649     
       
  2650 EXPORT_C CAknQueryControl* CAknMultiLineIpQueryDialog::QueryControl() const
       
  2651     {
       
  2652     if (!FirstLineEnabled() && SecondLineEnabled()) return SecondControl();
       
  2653     return FirstControl();  
       
  2654     }
       
  2655 
       
  2656 
       
  2657 EXPORT_C void CAknMultiLineIpQueryDialog::PreLayoutDynInitL()
       
  2658     {
       
  2659     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  2660         {
       
  2661         SetBorder( TGulBorder::ENone );
       
  2662         }
       
  2663     SetEditableL( ETrue );
       
  2664     DoSetPromptL();
       
  2665     
       
  2666     CAknExtMultilineQueryControl* firstControl = FirstControl();
       
  2667     CAknExtMultilineQueryControl* secondControl = SecondControl();
       
  2668 
       
  2669     firstControl->SetNbrOfPromptLines( firstControl->NbrOfPromptLines(), 
       
  2670                                         secondControl->NbrOfPromptLines());
       
  2671     secondControl->SetNbrOfPromptLines( firstControl->NbrOfPromptLines(), 
       
  2672                                         secondControl->NbrOfPromptLines());
       
  2673     
       
  2674     firstControl->SetQueryControlObserver(this);
       
  2675     secondControl->SetQueryControlObserver(this);
       
  2676     
       
  2677     // Set and then deploy the flags
       
  2678     firstControl->SetAndUseFlagsL( iFlags );
       
  2679     secondControl->SetAndUseFlagsL( iFlags );
       
  2680 
       
  2681     if (iFirstData) 
       
  2682         iFirstData->SetL(firstControl,iFirstEditorMaxLength);
       
  2683     if (iSecondData) 
       
  2684         iSecondData->SetL(secondControl,iSecondEditorMaxLength);
       
  2685 
       
  2686     UpdateLeftSoftKeyL();
       
  2687     HandleOrientationSwitch();
       
  2688     
       
  2689     // Create CaptionRetriever for FEP
       
  2690     delete iExtension;
       
  2691     iExtension = NULL;
       
  2692     iExtension = new(ELeave) CAknMultilineQueryDialogExtension(this, CAknMultilineQueryDialogExtension::EMultIPQuery);
       
  2693     }
       
  2694 
       
  2695 EXPORT_C void CAknMultiLineIpQueryDialog::SetPromptL(const TDesC& aFP, const TDesC& aSP)
       
  2696 //
       
  2697 //Store new prompt values
       
  2698 //
       
  2699     {
       
  2700     delete iSecondPrompt;
       
  2701     iSecondPrompt = NULL;
       
  2702     iSecondPrompt = aSP.AllocL();
       
  2703 
       
  2704     CAknQueryDialog::SetPromptL(aFP);
       
  2705     }
       
  2706 
       
  2707 EXPORT_C void CAknMultiLineIpQueryDialog::DoSetPromptL()
       
  2708     {
       
  2709 //
       
  2710 //Set prompt in query controls, called during layout
       
  2711 //
       
  2712     CAknExtMultilineQueryControl* secondControl = SecondControl();
       
  2713     if(secondControl && iSecondPrompt && iSecondPrompt->Length())
       
  2714         secondControl->SetPromptL(*iSecondPrompt);
       
  2715     
       
  2716     CAknQueryDialog::DoSetPromptL();        
       
  2717     }
       
  2718 
       
  2719 /**
       
  2720 * Allows dismissing of queries. Same as base class implementation only take into
       
  2721 * consideration both controls
       
  2722 */
       
  2723 EXPORT_C TBool CAknMultiLineIpQueryDialog::NeedToDismissQueryL(const TKeyEvent& /*aKeyEvent*/)
       
  2724     {
       
  2725     return EFalse;
       
  2726     }
       
  2727 
       
  2728 TBool CAknMultiLineIpQueryDialog::FirstLineEnabled() const
       
  2729     {
       
  2730     return (CurrentLine()==0 && Layout_Meta_Data::IsLandscapeOrientation())
       
  2731         || !Layout_Meta_Data::IsLandscapeOrientation();
       
  2732     }
       
  2733 
       
  2734 TBool CAknMultiLineIpQueryDialog::SecondLineEnabled() const
       
  2735     {
       
  2736     return (CurrentLine()==1 && Layout_Meta_Data::IsLandscapeOrientation())
       
  2737         || !Layout_Meta_Data::IsLandscapeOrientation();
       
  2738     }
       
  2739 
       
  2740 TInt CAknMultiLineIpQueryDialog::CurrentLine() const
       
  2741     {
       
  2742     CAknExtMultilineQueryControl* secondControl = SecondControl();
       
  2743     CAknExtMultilineQueryControl* firstControl = FirstControl();  
       
  2744    
       
  2745     if (firstControl && firstControl->IsFocused()) return 0;
       
  2746     if (secondControl && secondControl->IsFocused()) return 1;
       
  2747     return -1;
       
  2748     }
       
  2749 
       
  2750 void CAknMultiLineIpQueryDialog::HandleOrientationSwitch()
       
  2751     {
       
  2752     TBool firstLineEnabled = FirstLineEnabled();
       
  2753     TBool secondLineEnabled = SecondLineEnabled();
       
  2754 
       
  2755     if (!firstLineEnabled && !secondLineEnabled)
       
  2756     {
       
  2757 	    TInt controlID = IdOfFocusControl();
       
  2758 	    if (controlID  )
       
  2759 	    {
       
  2760 	        Line(controlID)->SetFocus(ETrue, EDrawNow);
       
  2761 	    	firstLineEnabled = FirstLineEnabled();
       
  2762 	        secondLineEnabled = SecondLineEnabled();
       
  2763 	    }	
       
  2764 	    else
       
  2765 	        firstLineEnabled = ETrue;      
       
  2766     }
       
  2767 
       
  2768     CAknExtMultilineQueryControl* firstControl = FirstControl();
       
  2769     CAknExtMultilineQueryControl* secondControl = SecondControl();	
       
  2770     TInt line1 = FindLineIndex(*firstControl);
       
  2771     TInt line2 = FindLineIndex(*secondControl);
       
  2772     CEikCaptionedControl *ctrl1 = GetLineByLineAndPageIndex(line1, 0);
       
  2773     CEikCaptionedControl *ctrl2 = GetLineByLineAndPageIndex(line2, 0);
       
  2774     ctrl1->SetLatent(!firstLineEnabled);
       
  2775     ctrl2->SetLatent(!secondLineEnabled);
       
  2776     ctrl1->SetLatentGroupLineFollows(!firstLineEnabled);
       
  2777     ctrl2->SetLatentGroupLineFollows(!secondLineEnabled);
       
  2778     ctrl1->SetFocusing(firstLineEnabled);
       
  2779     ctrl2->SetFocusing(secondLineEnabled);
       
  2780     Layout();
       
  2781     }
       
  2782 
       
  2783 
       
  2784 EXPORT_C void CAknMultiLineIpQueryDialog::HandleResourceChange(TInt aType)
       
  2785     {
       
  2786     CAknQueryDialog::HandleResourceChange(aType);
       
  2787     if (aType == KEikDynamicLayoutVariantSwitch)
       
  2788         {
       
  2789         if (Layout_Meta_Data::IsLandscapeOrientation())
       
  2790             {
       
  2791             SetBorder( TGulBorder::ENone );
       
  2792             }        	
       
  2793         else
       
  2794             {
       
  2795             SetBorder(AknBorderId::EAknBorderNotePopup);
       
  2796             }
       
  2797         HandleOrientationSwitch();
       
  2798         TRAP_IGNORE( UpdateLeftSoftKeyL() );
       
  2799         }
       
  2800     }
       
  2801     
       
  2802 EXPORT_C TBool CAknMultiLineIpQueryDialog::OkToExitL(TInt aButtonId)
       
  2803     {    
       
  2804     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  2805         {
       
  2806         if((IsLeftSoftkeyVisible() && (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  2807             {
       
  2808             CAknExtMultilineQueryControl* firstControl = FirstControl();
       
  2809             CAknExtMultilineQueryControl* secondControl = SecondControl();
       
  2810             if ( FirstControl()->EditorContentIsValidL() && FirstControl()->IsFocused() )
       
  2811         	    {
       
  2812                 if ( !CAknEnv::Static()->TransparencyEnabled() )
       
  2813                     {
       
  2814                     // Another case of missed RD_NO_DIALOG_BORDERS?  	    
       
  2815         	        SetBorder(AknBorderId::EAknBorderNotePopup);
       
  2816                     }
       
  2817                 TInt line1 = FindLineIndex(*firstControl);
       
  2818                 TInt line2 = FindLineIndex(*secondControl);
       
  2819                 CEikCaptionedControl *ctrl1 = GetLineByLineAndPageIndex(line1, 0);
       
  2820                 CEikCaptionedControl *ctrl2 = GetLineByLineAndPageIndex(line2, 0);
       
  2821                 ctrl1->SetFocusing(ETrue);
       
  2822                 ctrl2->SetFocusing(ETrue);
       
  2823                 TryChangeFocusToL(ctrl2->iId);
       
  2824                 HandleOrientationSwitch();
       
  2825 				
       
  2826 				UpdateLeftSoftKeyL();
       
  2827        		    return EFalse;      		        		        		
       
  2828         		}
       
  2829         	}
       
  2830     	}
       
  2831     	
       
  2832     if((IsLeftSoftkeyVisible() && 
       
  2833         (aButtonId == GetLeftCBAShortKeyPress() || aButtonId == EEikBidOk)))
       
  2834         {
       
  2835         CAknExtMultilineQueryControl* firstControl = FirstControl();
       
  2836         CAknExtMultilineQueryControl* secondControl = SecondControl();
       
  2837         
       
  2838         if (iFirstData)
       
  2839             iFirstData->Get(firstControl);
       
  2840         
       
  2841         if(iSecondData)
       
  2842             iSecondData->Get(secondControl);
       
  2843 
       
  2844         if(iText)
       
  2845             {
       
  2846             TInt len = firstControl->GetTextLength();
       
  2847             if ( len != -1 )
       
  2848                 {
       
  2849                 HBufC* text = HBufC::NewLC( len );
       
  2850                 TPtr ptext = text->Des();
       
  2851                 firstControl->GetText( ptext );
       
  2852                 iText->Copy( *text );                        
       
  2853                 CleanupStack::PopAndDestroy( text );   	
       
  2854                 }
       
  2855             }
       
  2856         if(iSecondText)
       
  2857             {
       
  2858             TInt len = secondControl->GetTextLength();
       
  2859             if ( len != -1 )
       
  2860                 {
       
  2861                 HBufC* text = HBufC::NewLC( len );
       
  2862                 TPtr ptext = text->Des();
       
  2863                 secondControl->GetText( ptext );
       
  2864                 iSecondText->Copy( *text );                        
       
  2865                 CleanupStack::PopAndDestroy( text );   	
       
  2866                 }
       
  2867             }
       
  2868 
       
  2869         return ETrue;
       
  2870         }
       
  2871     else if(aButtonId == GetRightCBAShortKeyPress())
       
  2872         {
       
  2873         return ETrue;
       
  2874         }
       
  2875     
       
  2876     return EFalse;
       
  2877     }
       
  2878 
       
  2879 EXPORT_C void CAknMultiLineIpQueryDialog::UpdateLeftSoftKeyL()
       
  2880     {
       
  2881     if (Layout_Meta_Data::IsLandscapeOrientation())
       
  2882     	{
       
  2883 	    if ( (FirstControl()->EditorContentIsValidL() && FirstControl()->IsFocused()) || (SecondControl()->EditorContentIsValidL() && FirstControl()->EditorContentIsValidL()) )
       
  2884 	        {
       
  2885 	        MakeLeftSoftkeyVisible(ETrue);
       
  2886 	        }
       
  2887 	    else
       
  2888 	        {
       
  2889 	        MakeLeftSoftkeyVisible(EFalse);
       
  2890 	        }	        
       
  2891 	    return;
       
  2892     	}
       
  2893     	
       
  2894     if ( FirstControl()->EditorContentIsValidL() &&
       
  2895          SecondControl()->EditorContentIsValidL())
       
  2896         {
       
  2897         MakeLeftSoftkeyVisible(ETrue);
       
  2898         }
       
  2899     else
       
  2900         {
       
  2901         MakeLeftSoftkeyVisible(EFalse);
       
  2902         }
       
  2903     }
       
  2904 
       
  2905 EXPORT_C void CAknMultiLineIpQueryDialog::SetMaxLengthOfFirstEditor(TInt aFirstTextEditorMaxLength)
       
  2906     {
       
  2907     iFirstEditorMaxLength = aFirstTextEditorMaxLength;
       
  2908     };
       
  2909 
       
  2910 EXPORT_C void CAknMultiLineIpQueryDialog::SetMaxLengthOfSecondEditor(TInt aSecondTextEditorMaxLength)
       
  2911     {
       
  2912     iSecondEditorMaxLength=aSecondTextEditorMaxLength;
       
  2913     };
       
  2914 
       
  2915 EXPORT_C TPtrC CAknMultiLineIpQueryDialog::SecondPrompt() const
       
  2916     { if (iSecondPrompt)
       
  2917         return *iSecondPrompt; 
       
  2918       return TPtrC(0,0);    
       
  2919     }
       
  2920 
       
  2921 // End of File