uifw/EikStd/dlgsrc/EIKDIALG.CPP
branchRCL_3
changeset 3 8ca85d2f0db7
parent 0 2f259fa3e83a
child 6 9f56a4e1b8ab
equal deleted inserted replaced
0:2f259fa3e83a 3:8ca85d2f0db7
    67 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
    67 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
    68 #include <akntranseffect.h>
    68 #include <akntranseffect.h>
    69 #endif
    69 #endif
    70 #include <AknQueryDialog.h>
    70 #include <AknQueryDialog.h>
    71 #include <aknQueryControl.h>
    71 #include <aknQueryControl.h>
       
    72 #include <aknitemactionmenuregister.h>
    72 
    73 
    73 #include "akncbacontentobserver.h"
    74 #include "akncbacontentobserver.h"
       
    75 #include "akntrace.h"
    74 
    76 
    75 TBool IsBlankScreenDisplayed();
    77 TBool IsBlankScreenDisplayed();
    76 
    78 
    77 
    79 
    78 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
   118 // @return ETrue if the window group is in focus, otherwise EFalse
   120 // @return ETrue if the window group is in focus, otherwise EFalse
   119 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   120 //
   122 //
   121 TBool IsFocusedWindowGroup( CEikDialog* aThis )
   123 TBool IsFocusedWindowGroup( CEikDialog* aThis )
   122     {
   124     {
       
   125 	_AKNTRACE_FUNC_ENTER;
   123     RWindowTreeNode* node = aThis->DrawableWindow();
   126     RWindowTreeNode* node = aThis->DrawableWindow();
   124     // this code finds out if this control belongs to window group
   127     // this code finds out if this control belongs to window group
   125     // that is in focus, there are some rare cases when the latest opened
   128     // that is in focus, there are some rare cases when the latest opened
   126     // popup goes behind another one (e.g. system lock query -> power key menu)
   129     // popup goes behind another one (e.g. system lock query -> power key menu)
   127     // we don't want transition in that case
   130     // we don't want transition in that case
   150 
   153 
   151         delete wgIds;
   154         delete wgIds;
   152 
   155 
   153         if ( focusedWindowGroupId == wgId )
   156         if ( focusedWindowGroupId == wgId )
   154             {
   157             {
       
   158             _AKNTRACE( "return ETrue;");
       
   159             _AKNTRACE_FUNC_EXIT;
   155             return ETrue;
   160             return ETrue;
   156             }
   161             }
   157         }
   162         }
       
   163     _AKNTRACE( "return EFalse;");
       
   164     _AKNTRACE_FUNC_EXIT;
   158     return EFalse;
   165     return EFalse;
   159     }
   166     }
   160 
   167 
   161 GLDEF_C void Panic(TEikDialogPanic aPanic)
   168 GLDEF_C void Panic(TEikDialogPanic aPanic)
   162 	{
   169 	{
   207 
   214 
   208 #endif
   215 #endif
   209 
   216 
   210 EXPORT_C CEikDialog::CEikDialog()
   217 EXPORT_C CEikDialog::CEikDialog()
   211     {
   218     {
       
   219 	_AKNTRACE_FUNC_ENTER;
   212 //	__DECLARE_NAME(_S("CEikDialog"));
   220 //	__DECLARE_NAME(_S("CEikDialog"));
   213 //	No border in Avkon
   221 //	No border in Avkon
   214 	iBorder=TGulBorder(TGulBorder::ENone);
   222 	iBorder=TGulBorder(TGulBorder::ENone);
   215     SetMopParent(iEikonEnv->EikAppUi());
   223     SetMopParent(iEikonEnv->EikAppUi());
   216 #if defined (__DEBUG__)
   224 #if defined (__DEBUG__)
   219 #endif
   227 #endif
   220 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   228 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   221     GfxTransEffect::Register(this,KGfxPopupDefaultControlUid);
   229     GfxTransEffect::Register(this,KGfxPopupDefaultControlUid);
   222 #endif
   230 #endif
   223     AKNTASHOOK_ADD( this, "CEikDialog" );
   231     AKNTASHOOK_ADD( this, "CEikDialog" );
       
   232 	_AKNTRACE_FUNC_EXIT;
   224     }
   233     }
   225 
   234 
   226 EXPORT_C CEikDialog::~CEikDialog()
   235 EXPORT_C CEikDialog::~CEikDialog()
   227     {
   236     {
       
   237 	_AKNTRACE_FUNC_ENTER;
   228     AKNTASHOOK_REMOVE();
   238     AKNTASHOOK_REMOVE();
       
   239 
       
   240     AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( NULL );
   229 
   241 
   230     EnableContentObserver( EFalse );
   242     EnableContentObserver( EFalse );
   231 
   243 
   232     if ( GfxTransEffect::IsRegistered( this ) )
   244     if ( GfxTransEffect::IsRegistered( this ) )
   233         {
   245         {
   251 	delete iPageSelector;
   263 	delete iPageSelector;
   252 	delete iButtonGroupContainer;
   264 	delete iButtonGroupContainer;
   253 	delete iExtension ;
   265 	delete iExtension ;
   254 	iExtension = NULL;
   266 	iExtension = NULL;
   255 	StopWaitingAsRequired();
   267 	StopWaitingAsRequired();
       
   268 	_AKNTRACE_FUNC_EXIT;
   256     }
   269     }
   257 
   270 
   258 void CEikDialog::DynamicConstructL()
   271 void CEikDialog::DynamicConstructL()
   259 	{
   272 	{
       
   273 	_AKNTRACE_FUNC_ENTER;
   260     PreLayoutDynInitL();
   274     PreLayoutDynInitL();
   261 
   275 
   262     if ( iPageSelector && iPageSelector->IsForm() && Extension() )
   276     if ( iPageSelector && iPageSelector->IsForm() && Extension() )
   263         {
   277         {
   264         Extension()->iPublicFlags.Set( CEikDialogExtension::EFullyConstructed );
   278         Extension()->iPublicFlags.Set( CEikDialogExtension::EFullyConstructed );
   266 
   280 
   267     EnableContentObserver( ETrue );
   281     EnableContentObserver( ETrue );
   268 
   282 
   269     Layout();
   283     Layout();
   270     PostLayoutDynInitL();
   284     PostLayoutDynInitL();
       
   285     _AKNTRACE_FUNC_EXIT;
   271 	}
   286 	}
   272 
   287 
   273 /**
   288 /**
   274  * Prepares the dialog, constructing it from the resource with id aResourceId.
   289  * Prepares the dialog, constructing it from the resource with id aResourceId.
   275  *
   290  *
   277  * of the stack in RunLD,  the purpose is to be able to display note dialogs in OOM
   292  * of the stack in RunLD,  the purpose is to be able to display note dialogs in OOM
   278  * situations.
   293  * situations.
   279  */
   294  */
   280 EXPORT_C void CEikDialog::PrepareLC(TInt aResourceId)
   295 EXPORT_C void CEikDialog::PrepareLC(TInt aResourceId)
   281     {
   296     {
       
   297 	_AKNTRACE_FUNC_ENTER;
   282     CleanupStack::PushL(this);
   298     CleanupStack::PushL(this);
   283 	BaseConstructL();
   299 	BaseConstructL();
   284     StaticConstructL(aResourceId);
   300     StaticConstructL(aResourceId);
   285 	
   301 	
   286 	if (!(iDialogFlags&EEikDialogFlagModeless))
   302 	if (!(iDialogFlags&EEikDialogFlagModeless))
   287 		{
   303 		{
   288 		AknGlobalPopupPriorityController::AddPopupToControlStackL(*this,ECoeStackPriorityDialog,ECoeStackFlagRefusesAllKeys);
   304 		AknGlobalPopupPriorityController::AddPopupToControlStackL(*this,ECoeStackPriorityDialog,ECoeStackFlagRefusesAllKeys);
   289 		}
   305 		}
       
   306 	_AKNTRACE_FUNC_EXIT;
   290     }
   307     }
   291 
   308 
   292 /**
   309 /**
   293  * Reads the dialog resources into the dialog, constructing it from the specified resource.
   310  * Reads the dialog resources into the dialog, constructing it from the specified resource.
   294  * The function is only to help loading dialog resources and 
   311  * The function is only to help loading dialog resources and 
   308  * it. The dialog is constructed from the resource with id aResourceId and is destroyed
   325  * it. The dialog is constructed from the resource with id aResourceId and is destroyed
   309  * on exit.
   326  * on exit.
   310  */
   327  */
   311 EXPORT_C TInt CEikDialog::ExecuteLD(TInt aResourceId)
   328 EXPORT_C TInt CEikDialog::ExecuteLD(TInt aResourceId)
   312     {
   329     {
       
   330 	_AKNTRACE_FUNC_ENTER;
   313 	PrepareLC(aResourceId);
   331 	PrepareLC(aResourceId);
       
   332 	_AKNTRACE_FUNC_EXIT;
   314 	return(RunLD());
   333 	return(RunLD());
   315     }
   334     }
   316 
   335 
   317 void CEikDialog::BaseConstructL()
   336 void CEikDialog::BaseConstructL()
   318 	{
   337 	{
       
   338 	_AKNTRACE_FUNC_ENTER;
   319     CreateWindowL();
   339     CreateWindowL();
   320 	Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this));
   340 	Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this));
   321 	EnableDragEvents();
   341 	EnableDragEvents();
   322 	Window().SetPointerGrab(ETrue);
   342 	Window().SetPointerGrab(ETrue);
   323     iContext=this;
   343     iContext=this;
   326 	iButtonCommandObserver=CEikDialogButtonCommandObserver::NewL(*this);
   346 	iButtonCommandObserver=CEikDialogButtonCommandObserver::NewL(*this);
   327     if (!iExtension)
   347     if (!iExtension)
   328         {
   348         {
   329 	    iExtension = CEikDialogExtension::NewL( *this ) ;        
   349 	    iExtension = CEikDialogExtension::NewL( *this ) ;        
   330         }
   350         }
       
   351     _AKNTRACE_FUNC_EXIT;
   331 	}
   352 	}
   332 
   353 
   333 void CEikDialog::StaticConstructL(TInt aResourceId)
   354 void CEikDialog::StaticConstructL(TInt aResourceId)
   334     {
   355     {
       
   356 	_AKNTRACE_FUNC_ENTER;
       
   357     AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( this );
       
   358 
   335     TResourceReader reader;
   359     TResourceReader reader;
   336     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
   360     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
   337     ConstructFromResourceL(reader);
   361     ConstructFromResourceL(reader);
   338 	CleanupStack::PopAndDestroy();
   362 	CleanupStack::PopAndDestroy();
   339 	
   363 	
   349                 {
   373                 {
   350                 Window().SetBackgroundColor(~0);
   374                 Window().SetBackgroundColor(~0);
   351                 }
   375                 }
   352             }
   376             }
   353         }
   377         }
       
   378     _AKNTRACE_FUNC_EXIT;
   354     }
   379     }
   355 
   380 
   356 /**
   381 /**
   357  * Constructs a sleeping dialog from the resources identified by aResourceId.
   382  * Constructs a sleeping dialog from the resources identified by aResourceId.
   358  * A sleeping dialog is one which can be displayed at any time since its memorey
   383  * A sleeping dialog is one which can be displayed at any time since its memorey
   377 void CEikDialog::CommonConstructSleepingDialogL(TInt aResourceId)
   402 void CEikDialog::CommonConstructSleepingDialogL(TInt aResourceId)
   378 	//
   403 	//
   379 	// code common to both ConstructSleepingDialogL & ConstructSleepingAlertDialogL
   404 	// code common to both ConstructSleepingDialogL & ConstructSleepingAlertDialogL
   380 	//
   405 	//
   381 	{
   406 	{
       
   407 	_AKNTRACE_FUNC_ENTER;
   382 	iDialogFlags|=EEikDialogFlagSleeping;
   408 	iDialogFlags|=EEikDialogFlagSleeping;
   383 	BaseConstructL();
   409 	BaseConstructL();
   384 	StaticConstructL(aResourceId);
   410 	StaticConstructL(aResourceId);
   385 	MakeVisible(EFalse);
   411 	MakeVisible(EFalse);
   386 	if (iButtonGroupContainer)
   412 	if (iButtonGroupContainer)
   387 		{
   413 		{
   388 		// non visible CBA's do not recieve keys
   414 		// non visible CBA's do not recieve keys
   389 		iButtonGroupContainer->MakeVisible(EFalse);
   415 		iButtonGroupContainer->MakeVisible(EFalse);
   390 		}
   416 		}
       
   417     _AKNTRACE_FUNC_EXIT;
   391 	}
   418 	}
   392 
   419 
   393 TInt CEikDialog::WaitAsRequired()
   420 TInt CEikDialog::WaitAsRequired()
   394     {
   421     {
       
   422 	_AKNTRACE_FUNC_ENTER;
   395     TInt exitConfirmed=0;
   423     TInt exitConfirmed=0;
   396 #if defined (__DEBUG__)
   424 #if defined (__DEBUG__)
   397 	RDebug::ProfileEnd(PROFILE_POINT_EIKON_DIALOG_LOAD);
   425 	RDebug::ProfileEnd(PROFILE_POINT_EIKON_DIALOG_LOAD);
   398 	TProfile profile;
   426 	TProfile profile;
   399 	RDebug::ProfileResult(&profile,PROFILE_POINT_EIKON_DIALOG_LOAD,1);
   427 	RDebug::ProfileResult(&profile,PROFILE_POINT_EIKON_DIALOG_LOAD,1);
   406     if (iDialogFlags&EEikDialogFlagWait)
   434     if (iDialogFlags&EEikDialogFlagWait)
   407         {
   435         {
   408 		iExitConfirmed=(&exitConfirmed);
   436 		iExitConfirmed=(&exitConfirmed);
   409         iWait.Start();
   437         iWait.Start();
   410         }
   438         }
   411 
   439     _AKNTRACE_FUNC_EXIT;
   412 	return(exitConfirmed);
   440 	return(exitConfirmed);
   413     }
   441     }
   414 
   442 
   415 void CEikDialog::StopWaitingAsRequired()
   443 void CEikDialog::StopWaitingAsRequired()
   416 	{
   444 	{
   421  * Rouses a sleeping dialog by dynamically constructing it and then 
   449  * Rouses a sleeping dialog by dynamically constructing it and then 
   422  * bringing it to the front.
   450  * bringing it to the front.
   423  */
   451  */
   424 EXPORT_C TInt CEikDialog::RouseSleepingDialog()
   452 EXPORT_C TInt CEikDialog::RouseSleepingDialog()
   425 	{ // none of following ...L calls to Leave
   453 	{ // none of following ...L calls to Leave
       
   454 	_AKNTRACE_FUNC_ENTER;
   426 	if (IsVisible())
   455 	if (IsVisible())
   427 		ExitSleepingDialog(); // eg for rousing an already roused Alert dialog
   456 		ExitSleepingDialog(); // eg for rousing an already roused Alert dialog
   428 
   457 
   429 
   458 
   430     #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   459     #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   539 			static_cast<CEikCba*>(cba)->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlPopup );
   568 			static_cast<CEikCba*>(cba)->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlPopup );
   540 			cba->MakeVisible(ETrue);
   569 			cba->MakeVisible(ETrue);
   541 			cba->DrawNow();
   570 			cba->DrawNow();
   542 			}
   571 			}
   543 		}
   572 		}
   544 
   573 	_AKNTRACE_FUNC_EXIT;
   545     return(WaitAsRequired());
   574     return(WaitAsRequired());
   546 	}
   575 	}
   547 
   576 
   548 /**
   577 /**
   549  * Exits a sleeping dialog without deleteing it.
   578  * Exits a sleeping dialog without deleteing it.
   550  */
   579  */
   551 EXPORT_C void CEikDialog::ExitSleepingDialog()
   580 EXPORT_C void CEikDialog::ExitSleepingDialog()
   552 	{
   581 	{
       
   582 	_AKNTRACE_FUNC_ENTER;
   553 	FadeBehindPopup(EFalse);
   583 	FadeBehindPopup(EFalse);
   554 
   584 
   555     EnableContentObserver( EFalse );
   585     EnableContentObserver( EFalse );
   556 
   586 
   557 	if(GfxTransEffect::IsRegistered(this) && IsVisible() 
   587 	if(GfxTransEffect::IsRegistered(this) && IsVisible() 
   613         {   
   643         {   
   614 	    iExtension->iSleepDialogExitBeginCalled = EFalse;
   644 	    iExtension->iSleepDialogExitBeginCalled = EFalse;
   615 	    }
   645 	    }
   616 #endif
   646 #endif
   617     CancelMediatorCommand(this);	
   647     CancelMediatorCommand(this);	
       
   648 	_AKNTRACE_FUNC_EXIT;
   618 	}
   649 	}
   619 
   650 
   620 /**
   651 /**
   621  * Returns the id of the control in the line with focus.
   652  * Returns the id of the control in the line with focus.
   622  */
   653  */
   636 /**
   667 /**
   637  * Constructs the dialog from resources using the resource reader aReader.
   668  * Constructs the dialog from resources using the resource reader aReader.
   638  */
   669  */
   639 EXPORT_C void CEikDialog::ConstructFromResourceL(TResourceReader& aReader)
   670 EXPORT_C void CEikDialog::ConstructFromResourceL(TResourceReader& aReader)
   640     {
   671     {
       
   672 	_AKNTRACE_FUNC_ENTER;
   641     iDialogFlags |=aReader.ReadInt32();
   673     iDialogFlags |=aReader.ReadInt32();
   642             
   674             
   643 #ifdef RD_SCALABLE_UI_V2            
   675 #ifdef RD_SCALABLE_UI_V2            
   644     if ( AknLayoutUtils::PenEnabled() )
   676     if ( AknLayoutUtils::PenEnabled() )
   645     {
   677     {
   665 		}
   697 		}
   666 	else
   698 	else
   667 		ASSERT(aReader.ReadInt16()==0);
   699 		ASSERT(aReader.ReadInt16()==0);
   668 	
   700 	
   669 	SetBorderStyle();  // Moved to the end of construction to allow access to individual lines.
   701 	SetBorderStyle();  // Moved to the end of construction to allow access to individual lines.
       
   702 	_AKNTRACE_FUNC_EXIT;
   670 	}
   703 	}
   671 
   704 
   672 void CEikDialog::SetBorderStyle()
   705 void CEikDialog::SetBorderStyle()
   673 	{
   706 	{
   674 	if (!((iDialogFlags&EEikDialogFlagFillAppClientRect) || 
   707 	if (!((iDialogFlags&EEikDialogFlagFillAppClientRect) || 
   684 		}
   717 		}
   685 	}
   718 	}
   686 
   719 
   687 void CEikDialog::CreatePageSelectorL()
   720 void CEikDialog::CreatePageSelectorL()
   688 	{
   721 	{
       
   722 	_AKNTRACE_FUNC_ENTER;
   689 	iPageSelector=CEikDialogPageSelector::NewL(*this,this);
   723 	iPageSelector=CEikDialogPageSelector::NewL(*this,this);
   690 	iPageSelector->SetObserver(this);
   724 	iPageSelector->SetObserver(this);
   691 	RegisterDialgWithPageSelector(); // Added JIn
   725 	RegisterDialgWithPageSelector(); // Added JIn
       
   726 	_AKNTRACE_FUNC_EXIT;
   692 	}
   727 	}
   693 
   728 
   694 void CEikDialog::CreatePageSelectorL(TInt aResourceId)
   729 void CEikDialog::CreatePageSelectorL(TInt aResourceId)
   695 	{
   730 	{
       
   731 	_AKNTRACE_FUNC_ENTER;
   696 	if (aResourceId)
   732 	if (aResourceId)
   697 		{
   733 		{
   698 		TResourceReader reader;
   734 		TResourceReader reader;
   699 		iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
   735 		iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
   700 		iPageSelector=CEikDialogPageSelector::NewL(*this,reader,this);
   736 		iPageSelector=CEikDialogPageSelector::NewL(*this,reader,this);
   702 		CleanupStack::PopAndDestroy();
   738 		CleanupStack::PopAndDestroy();
   703 		if (iDialogFlags&EEikDialogFlagDensePacking)
   739 		if (iDialogFlags&EEikDialogFlagDensePacking)
   704 			iPageSelector->SetAllPagesDensePacked(ETrue);
   740 			iPageSelector->SetAllPagesDensePacked(ETrue);
   705 		RegisterDialgWithPageSelector(); // Added JIn
   741 		RegisterDialgWithPageSelector(); // Added JIn
   706 		}
   742 		}
       
   743 	_AKNTRACE_FUNC_EXIT;
   707 	}
   744 	}
   708 
   745 
   709 void CEikDialog::CreateButtonGroupContainerL(TInt aResourceId)
   746 void CEikDialog::CreateButtonGroupContainerL(TInt aResourceId)
   710 	{
   747 	{
   711 	// Avkon simplification: Always use CBA; always set buttons 
   748 	// Avkon simplification: Always use CBA; always set buttons 
   712     // Flags:      
   749     // Flags:      
   713     // buttons are keen on drawing even if not actually visible yet,
   750     // buttons are keen on drawing even if not actually visible yet,
   714 	// don't activate them in case of sleeping dialog 
   751 	// don't activate them in case of sleeping dialog 
   715     // yet so extra drawings are suppressed until dialog is really
   752     // yet so extra drawings are suppressed until dialog is really
   716 	// roused to screen
   753 	// roused to screen
   717     
   754 	_AKNTRACE_FUNC_ENTER;
   718     TUint flags = ( iDialogFlags & EEikDialogFlagSleeping ) ?
   755     TUint flags = ( iDialogFlags & EEikDialogFlagSleeping ) ?
   719                     ( CEikButtonGroupContainer::EAddToStack |
   756                     ( CEikButtonGroupContainer::EAddToStack |
   720                     CEikButtonGroupContainer::EDelayActivation ) :
   757                     CEikButtonGroupContainer::EDelayActivation ) :
   721                     CEikButtonGroupContainer::EAddToStack;
   758                     CEikButtonGroupContainer::EAddToStack;
   722     
   759     
   737 
   774 
   738     EnableContentObserver( ETrue );
   775     EnableContentObserver( ETrue );
   739 	
   776 	
   740 	AknGlobalPopupPriorityController::AddSubPopupL(*this, *iButtonGroupContainer->ButtonGroup()->AsControl());
   777 	AknGlobalPopupPriorityController::AddSubPopupL(*this, *iButtonGroupContainer->ButtonGroup()->AsControl());
   741 	AknGlobalPopupPriorityController::AddPopupToControlStackL(*iButtonGroupContainer->ButtonGroup()->AsControl(), ECoeStackPriorityCba, ECoeStackFlagRefusesFocus);
   778 	AknGlobalPopupPriorityController::AddPopupToControlStackL(*iButtonGroupContainer->ButtonGroup()->AsControl(), ECoeStackPriorityCba, ECoeStackFlagRefusesFocus);
       
   779 	_AKNTRACE_FUNC_EXIT;
   742 	}
   780 	}
   743 
   781 
   744 void CEikDialog::CreateTitleBarL()
   782 void CEikDialog::CreateTitleBarL()
   745 	{
   783 	{
   746 	iTitleBar=new(ELeave) CEikMover;
   784 	iTitleBar=new(ELeave) CEikMover;
   768  * The parameter is ignored if the FlagFillAppClientRect is set.
   806  * The parameter is ignored if the FlagFillAppClientRect is set.
   769  * Otherwise it it centred and given the size asked for
   807  * Otherwise it it centred and given the size asked for
   770  */
   808  */
   771 EXPORT_C void CEikDialog::SetSizeAndPosition(const TSize& aSize)
   809 EXPORT_C void CEikDialog::SetSizeAndPosition(const TSize& aSize)
   772     {
   810     {
       
   811 	_AKNTRACE_FUNC_ENTER;
   773 	if (iDialogFlags&EEikDialogFlagFillAppClientRect)
   812 	if (iDialogFlags&EEikDialogFlagFillAppClientRect)
   774 	    {
   813 	    {
   775         // if this is a view app then ask client rect from the currently active view
   814         // if this is a view app then ask client rect from the currently active view
   776         TVwsViewId uid;    
   815         TVwsViewId uid;    
   777         if ( iAvkonAppUi->GetActiveViewId( uid ) == KErrNone )
   816         if ( iAvkonAppUi->GetActiveViewId( uid ) == KErrNone )
   800 	    }
   839 	    }
   801 	else
   840 	else
   802         {
   841         {
   803         SetRect( TRect( AknPopupUtils::Position( aSize, this ), aSize ) );
   842         SetRect( TRect( AknPopupUtils::Position( aSize, this ), aSize ) );
   804         }
   843         }
       
   844 	_AKNTRACE_FUNC_EXIT;
   805     }
   845     }
   806 
   846 
   807 /**
   847 /**
   808  * Returns the border style for this dialog.
   848  * Returns the border style for this dialog.
   809  */
   849  */
   819 /**
   859 /**
   820  * Returns the minimum size of the area that the contents of the dialog should occupy.
   860  * Returns the minimum size of the area that the contents of the dialog should occupy.
   821  */
   861  */
   822 EXPORT_C TSize CEikDialog::MinimumSize()
   862 EXPORT_C TSize CEikDialog::MinimumSize()
   823     {
   863     {
       
   864 	_AKNTRACE_FUNC_ENTER;
   824 	if (iDialogFlags&EEikDialogFlagFillScreen)
   865 	if (iDialogFlags&EEikDialogFlagFillScreen)
   825         {
   866         {
   826         TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine();
   867         TAknWindowLineLayout windowLineLayoutScreen = AknLayoutScalable_Avkon::Screen().LayoutLine();
   827         TRect rectZero = TRect(0,0,0,0);
   868         TRect rectZero = TRect(0,0,0,0);
   828         TAknLayoutRect layoutRect;
   869         TAknLayoutRect layoutRect;
   859             SetRect( iEikonEnv->EikAppUi()->ClientRect() );
   900             SetRect( iEikonEnv->EikAppUi()->ClientRect() );
   860             }
   901             }
   861         }
   902         }
   862 
   903 
   863 	TSize pageSelectorSize(iPageSelector->MinimumSize());
   904 	TSize pageSelectorSize(iPageSelector->MinimumSize());
   864 
   905 	_AKNTRACE_FUNC_EXIT;
   865 	return pageSelectorSize;
   906 	return pageSelectorSize;
   866     }
   907     }
   867 
   908 
   868 /**
   909 /**
   869  * Returns the preferred size of the dialog given that it must fit in a maximum size of aMaxSize.
   910  * Returns the preferred size of the dialog given that it must fit in a maximum size of aMaxSize.
   959  * For Avkon, the DPSEL always stays the same size as the CEikDialog minus an optional title 
  1000  * For Avkon, the DPSEL always stays the same size as the CEikDialog minus an optional title 
   960  * bar. 
  1001  * bar. 
   961  */
  1002  */
   962 EXPORT_C void CEikDialog::SizeChanged()
  1003 EXPORT_C void CEikDialog::SizeChanged()
   963     {
  1004     {
       
  1005 	_AKNTRACE_FUNC_ENTER;
   964 	__ASSERT_DEBUG( iButtonGroupContainer->Location() == CEikButtonGroupContainer::EExternal, 
  1006 	__ASSERT_DEBUG( iButtonGroupContainer->Location() == CEikButtonGroupContainer::EExternal, 
   965 		Panic( EEikDialogPanicIllegalOption ) );
  1007 		Panic( EEikDialogPanicIllegalOption ) );
   966 
  1008 
   967 	TInt excludeCbaHeight = -1;
  1009 	TInt excludeCbaHeight = -1;
   968 
  1010 
  1045 		currentPage->SetFormFlag( CEikDialogPage::EFormResizeOptimisationFlag,  EFalse ) ;
  1087 		currentPage->SetFormFlag( CEikDialogPage::EFormResizeOptimisationFlag,  EFalse ) ;
  1046 
  1088 
  1047 	// <SKIN>
  1089 	// <SKIN>
  1048 	iExtension->iBgContext->SetParentPos( PositionRelativeToScreen() ) ;
  1090 	iExtension->iBgContext->SetParentPos( PositionRelativeToScreen() ) ;
  1049 	iExtension->iBgContext->SetRect( Rect() ) ;
  1091 	iExtension->iBgContext->SetRect( Rect() ) ;
       
  1092 	_AKNTRACE_FUNC_EXIT;
  1050 	}
  1093 	}
  1051 
  1094 
  1052 /**
  1095 /**
  1053  * Sets the title text for the dialog to aText.
  1096  * Sets the title text for the dialog to aText.
  1054  */
  1097  */
  1097  * Makes the dialog line containing the control identified by aControlId visible, i.e. sets it
  1140  * Makes the dialog line containing the control identified by aControlId visible, i.e. sets it
  1098  * to draw itself, if aVisible is ETrue.
  1141  * to draw itself, if aVisible is ETrue.
  1099  */
  1142  */
  1100 EXPORT_C void CEikDialog::MakeLineVisible(TInt aControlId,TBool aVisible)
  1143 EXPORT_C void CEikDialog::MakeLineVisible(TInt aControlId,TBool aVisible)
  1101     {
  1144     {
       
  1145 	_AKNTRACE_FUNC_ENTER;
  1102     CEikCaptionedControl* line=Line(aControlId);
  1146     CEikCaptionedControl* line=Line(aControlId);
  1103 	CCoeControl* control=line->iControl;
  1147 	CCoeControl* control=line->iControl;
  1104 	if (control->IsVisible()==aVisible)
  1148 	if (control->IsVisible()==aVisible)
  1105 		return;
  1149 		return;
  1106     control->MakeVisible(aVisible);
  1150     control->MakeVisible(aVisible);
  1107     line->CheckDimmedDisplayState();
  1151     line->CheckDimmedDisplayState();
       
  1152     _AKNTRACE_FUNC_EXIT;
  1108     }
  1153     }
  1109 
  1154 
  1110 /**
  1155 /**
  1111  * Makes the whole dialog line containing the control identified by aControlId visible, i.e. sets it
  1156  * Makes the whole dialog line containing the control identified by aControlId visible, i.e. sets it
  1112  * to draw itself, if aVisible is ETrue.
  1157  * to draw itself, if aVisible is ETrue.
  1113  */
  1158  */
  1114 EXPORT_C void CEikDialog::MakeWholeLineVisible(TInt aControlId,TBool aVisible)
  1159 EXPORT_C void CEikDialog::MakeWholeLineVisible(TInt aControlId,TBool aVisible)
  1115     {
  1160     {
       
  1161 	_AKNTRACE_FUNC_ENTER;
  1116     CEikCaptionedControl* line=Line(aControlId);
  1162     CEikCaptionedControl* line=Line(aControlId);
  1117 	if (line->IsVisible()==aVisible)
  1163 	if (line->IsVisible()==aVisible)
  1118 		return;
  1164 		return;
  1119 	CCoeControl* control=line->iControl;
  1165 	CCoeControl* control=line->iControl;
  1120     if (line->iCaption)
  1166     if (line->iCaption)
  1121 		line->iCaption->MakeVisible(aVisible);
  1167 		line->iCaption->MakeVisible(aVisible);
  1122 	if (line->iTrailer)
  1168 	if (line->iTrailer)
  1123 		line->iTrailer->MakeVisible(aVisible);
  1169 		line->iTrailer->MakeVisible(aVisible);
  1124     control->MakeVisible(aVisible);
  1170     control->MakeVisible(aVisible);
  1125 	line->MakeVisible(aVisible);
  1171 	line->MakeVisible(aVisible);
       
  1172 	_AKNTRACE_FUNC_EXIT;
  1126     }
  1173     }
  1127 
  1174 
  1128 /**
  1175 /**
  1129  * Lays out the dialog, setting it to take its preferred size and position
  1176  * Lays out the dialog, setting it to take its preferred size and position
  1130  * for the screen.
  1177  * for the screen.
  1377  *
  1424  *
  1378  * @since ER5U
  1425  * @since ER5U
  1379  */
  1426  */
  1380 EXPORT_C void CEikDialog::SetEditableL( TBool aEditable ) 
  1427 EXPORT_C void CEikDialog::SetEditableL( TBool aEditable ) 
  1381     {
  1428     {
       
  1429 	_AKNTRACE_FUNC_ENTER;
       
  1430 	_AKNTRACE( "CEikDialog::SetEditableL()  aEditable: [%d]", aEditable );
  1382     if ( !iExtension->iFlags[CEikDialogExtension::EEditableStateInitialised] ||
  1431     if ( !iExtension->iFlags[CEikDialogExtension::EEditableStateInitialised] ||
  1383          iIsEditable != aEditable )
  1432          iIsEditable != aEditable )
  1384         {
  1433         {
  1385         iExtension->iFlags.Set(CEikDialogExtension::EEditableStateInitialised);
  1434         iExtension->iFlags.Set(CEikDialogExtension::EEditableStateInitialised);
  1386         iIsEditable = aEditable ;
  1435         iIsEditable = aEditable ;
  1387         // tell each of the pages on the dialog about the editable state...
  1436         // tell each of the pages on the dialog about the editable state...
  1388         iPageSelector->SetEditableL( aEditable );
  1437         iPageSelector->SetEditableL( aEditable );
  1389         DrawNow();
  1438         DrawNow();
  1390         }
  1439         }
       
  1440     _AKNTRACE_FUNC_EXIT;
  1391     }
  1441     }
  1392 
  1442 
  1393 /**
  1443 /**
  1394  * Returns the Editable state.  This exists to support forms
  1444  * Returns the Editable state.  This exists to support forms
  1395  *
  1445  *
  1396  * @since ER5U
  1446  * @since ER5U
  1397  */	
  1447  */	
  1398 EXPORT_C TBool CEikDialog::IsEditable() const 
  1448 EXPORT_C TBool CEikDialog::IsEditable() const 
  1399 	{
  1449 	{
       
  1450 	_AKNTRACE( "CEikDialog::IsEditable(): [%d]", iIsEditable );;
  1400 	return ( iIsEditable ) ;
  1451 	return ( iIsEditable ) ;
  1401 	}
  1452 	}
  1402 
  1453 
  1403 /**
  1454 /**
  1404  * Returns the line index of the control aControl or KErrNotFound if the control
  1455  * Returns the line index of the control aControl or KErrNotFound if the control
  1450  * Runs the dialog and returns the id of the button used to dismiss it.
  1501  * Runs the dialog and returns the id of the button used to dismiss it.
  1451  * The dialog is destroyed on exit.
  1502  * The dialog is destroyed on exit.
  1452  */
  1503  */
  1453 EXPORT_C TInt CEikDialog::RunLD()
  1504 EXPORT_C TInt CEikDialog::RunLD()
  1454 	{
  1505 	{
       
  1506 	_AKNTRACE_FUNC_ENTER;
  1455     // Moved BringForwards in the beginning to enable 1-frame animations.
  1507     // Moved BringForwards in the beginning to enable 1-frame animations.
  1456 	iEikonEnv->BringForwards(ETrue); // before call to EnableBackup()
  1508 	iEikonEnv->BringForwards(ETrue); // before call to EnableBackup()
  1457 	AknGlobalPopupPriorityController::ShowPopup(*this, ETrue);
  1509 	AknGlobalPopupPriorityController::ShowPopup(*this, ETrue);
  1458 	iDialogFlags|=EEikDialogFlagBroughtForward;
  1510 	iDialogFlags|=EEikDialogFlagBroughtForward;
  1459 
  1511 
  1571         }
  1623         }
  1572         
  1624         
  1573 	// Claim pointer grab and send the pointer up event to the
  1625 	// Claim pointer grab and send the pointer up event to the
  1574 	// control that otherwise would be receiving the drag events.
  1626 	// control that otherwise would be receiving the drag events.
  1575 	Window().ClaimPointerGrab(ETrue);
  1627 	Window().ClaimPointerGrab(ETrue);
  1576 	
  1628 	_AKNTRACE_FUNC_EXIT;
  1577     return(WaitAsRequired());
  1629     return(WaitAsRequired());
  1578 	}
  1630 	}
  1579 
  1631 
  1580 
  1632 
  1581 EXPORT_C void CEikDialog::Draw(const TRect& /*aRect*/) const
  1633 EXPORT_C void CEikDialog::Draw(const TRect& /*aRect*/) const
  1582     {
  1634     {
       
  1635 	_AKNTRACE_FUNC_ENTER;
  1583     TRect rect=Rect();
  1636     TRect rect=Rect();
  1584     CWindowGc& gc=SystemGc(); //No reason to demote the gc, CWindowGc is more usable.
  1637     CWindowGc& gc=SystemGc(); //No reason to demote the gc, CWindowGc is more usable.
  1585 
  1638 
  1586     if ( iExtension->LayoutCategory() == CEikDialogExtension::EPopupLayout )
  1639     if ( iExtension->LayoutCategory() == CEikDialogExtension::EPopupLayout )
  1587         {
  1640         {
  1665             {
  1718             {
  1666             AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
  1719             AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
  1667                 KAknsIIDQsnFrPopup,KAknsIIDQsnFrPopupCenter);
  1720                 KAknsIIDQsnFrPopup,KAknsIIDQsnFrPopupCenter);
  1668             }    
  1721             }    
  1669         }
  1722         }
       
  1723     _AKNTRACE_FUNC_EXIT;
  1670     }
  1724     }
  1671     
  1725     
  1672 EXPORT_C void CEikDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
  1726 EXPORT_C void CEikDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
  1673     { 
  1727     { 
  1674     CEikBorderedControl::HandlePointerEventL(aPointerEvent); 
  1728     CEikBorderedControl::HandlePointerEventL(aPointerEvent); 
  1679     return NULL;
  1733     return NULL;
  1680     }   
  1734     }   
  1681 
  1735 
  1682 TKeyResponse CEikDialog::TryAnimateButtonAndExitL(TInt aKeycode)
  1736 TKeyResponse CEikDialog::TryAnimateButtonAndExitL(TInt aKeycode)
  1683 	{
  1737 	{
       
  1738 	_AKNTRACE_FUNC_ENTER;
  1684 	TInt buttonId=EEikBidCancel;
  1739 	TInt buttonId=EEikBidCancel;
  1685 	switch (aKeycode)
  1740 	switch (aKeycode)
  1686 		{
  1741 		{
  1687 	case EKeyEnter:
  1742 	case EKeyEnter:
  1688 	case EKeyOK:
  1743 	case EKeyOK:
  1703 	CCoeControl* button = buttonGroupContainer.ControlOrNull(buttonId);
  1758 	CCoeControl* button = buttonGroupContainer.ControlOrNull(buttonId);
  1704 
  1759 
  1705 	if (button)
  1760 	if (button)
  1706 		{
  1761 		{
  1707 		if (button->IsDimmed() || !button->IsVisible())
  1762 		if (button->IsDimmed() || !button->IsVisible())
  1708 			return EKeyWasNotConsumed;
  1763 			{
       
  1764 			_AKNTRACE_FUNC_EXIT;
       
  1765 			return EKeyWasNotConsumed;		
       
  1766 			}
  1709 		buttonGroupContainer.AnimateCommand(buttonId);
  1767 		buttonGroupContainer.AnimateCommand(buttonId);
  1710 		}
  1768 		}
  1711 
  1769 
  1712 	if (button || buttonId==EEikBidCancel || buttonId==EEikBidOk)
  1770 	if (button || buttonId==EEikBidCancel || buttonId==EEikBidOk)
  1713 		{
  1771 		{
  1714 		TryExitL(buttonId);
  1772 		TryExitL(buttonId);
       
  1773 		_AKNTRACE_FUNC_EXIT;
  1715 		return EKeyWasConsumed;
  1774 		return EKeyWasConsumed;
  1716 		}
  1775 		}
  1717 
  1776 	_AKNTRACE_FUNC_EXIT;
  1718 	return EKeyWasNotConsumed;
  1777 	return EKeyWasNotConsumed;
  1719 	}
  1778 	}
  1720 
  1779 
  1721 /**
  1780 /**
  1722  * Prepares for a transistion in focus in the dialog. By default, calls the currently
  1781  * Prepares for a transistion in focus in the dialog. By default, calls the currently
  1733  * Handles the key event aKeyEvent with code aType. Returns EKeyWasConsumed if the control
  1792  * Handles the key event aKeyEvent with code aType. Returns EKeyWasConsumed if the control
  1734  * takes action on the key event or EKeyWasNotConsumed otherwise.
  1793  * takes action on the key event or EKeyWasNotConsumed otherwise.
  1735  */
  1794  */
  1736 EXPORT_C TKeyResponse CEikDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
  1795 EXPORT_C TKeyResponse CEikDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
  1737     {
  1796     {
  1738 
  1797 	_AKNTRACE_FUNC_ENTER;
  1739 
  1798 
  1740 	// Hide the tool tip (if there is one!)
  1799 	// Hide the tool tip (if there is one!)
  1741 	if ( ( iPageSelector->NumPages() == 1 ) && ( CurrentLine() ) && ( CurrentLine()->ToolTipText( ) ) )
  1800 	if ( ( iPageSelector->NumPages() == 1 ) && ( CurrentLine() ) && ( CurrentLine()->ToolTipText( ) ) )
  1742 		{
  1801 		{
  1743 		switch ( aKeyEvent.iScanCode )
  1802 		switch ( aKeyEvent.iScanCode )
  1748 			}
  1807 			}
  1749 		}
  1808 		}
  1750     if (!(iDialogFlags&EEikDialogFlagDontEatUpDownEvents) && aKeyEvent.iScanCode != EStdKeyYes)
  1809     if (!(iDialogFlags&EEikDialogFlagDontEatUpDownEvents) && aKeyEvent.iScanCode != EStdKeyYes)
  1751 	{
  1810 	{
  1752 	if (aType!=EEventKey)
  1811 	if (aType!=EEventKey)
  1753 	    return(EKeyWasConsumed);
  1812 		{
       
  1813 		_AKNTRACE_FUNC_EXIT;
       
  1814 	    return(EKeyWasConsumed);	
       
  1815 		}
  1754 	}
  1816 	}
  1755 
  1817 
  1756 	TInt code=aKeyEvent.iCode;
  1818 	TInt code=aKeyEvent.iCode;
  1757 	const TUint modifiers = aKeyEvent.iModifiers;
  1819 	const TUint modifiers = aKeyEvent.iModifiers;
  1758 	TKeyResponse response;
  1820 	TKeyResponse response;
  1761 
  1823 
  1762 	if (iDialogFlags&EEikDialogFlagAllKeysToButtons || ((modifiers & EAllStdModifiers) == EModifierCtrl) )
  1824 	if (iDialogFlags&EEikDialogFlagAllKeysToButtons || ((modifiers & EAllStdModifiers) == EModifierCtrl) )
  1763 		{
  1825 		{
  1764 		response = iButtonGroupContainer->OfferKeyEventL(aKeyEvent,aType);
  1826 		response = iButtonGroupContainer->OfferKeyEventL(aKeyEvent,aType);
  1765 		if(response==EKeyWasConsumed)
  1827 		if(response==EKeyWasConsumed)
  1766 			return EKeyWasConsumed;
  1828 			{
       
  1829 			_AKNTRACE_FUNC_EXIT;
       
  1830 			return EKeyWasConsumed;		
       
  1831 			}
  1767 		}
  1832 		}
  1768 
  1833 
  1769 	//
  1834 	//
  1770 
  1835 
  1771     switch (code)
  1836     switch (code)
  1784     case EKeyEscape:
  1849     case EKeyEscape:
  1785 		if (modifiers&EModifierShift)
  1850 		if (modifiers&EModifierShift)
  1786 			iPageSelector->OfferKeyEventL(aKeyEvent, aType);
  1851 			iPageSelector->OfferKeyEventL(aKeyEvent, aType);
  1787 // Add to remove repeated keypress return event of OK key
  1852 // Add to remove repeated keypress return event of OK key
  1788 		if (aKeyEvent.iRepeats&&EKeyOK==code)
  1853 		if (aKeyEvent.iRepeats&&EKeyOK==code)
  1789 			return EKeyWasConsumed;
  1854 			{
       
  1855 			_AKNTRACE_FUNC_EXIT;
       
  1856 			return EKeyWasConsumed;		
       
  1857 			}
  1790 		if ((!(modifiers&EModifierCtrl) || modifiers&EModifierPureKeycode) &&
  1858 		if ((!(modifiers&EModifierCtrl) || modifiers&EModifierPureKeycode) &&
  1791 			!(iDialogFlags&EEikDialogFlagModeless))
  1859 			!(iDialogFlags&EEikDialogFlagModeless))
  1792 			TryAnimateButtonAndExitL(code);
  1860 			TryAnimateButtonAndExitL(code);
  1793         break;
  1861         break;
  1794 	case EKeyTab:
  1862 	case EKeyTab:
  1806     default:
  1874     default:
  1807 		iPageSelector->OfferKeyEventL(aKeyEvent, aType);
  1875 		iPageSelector->OfferKeyEventL(aKeyEvent, aType);
  1808 		break;
  1876 		break;
  1809 	KeyToFocus:
  1877 	KeyToFocus:
  1810 		if(iPageSelector->OfferHotKeysKeyEventL(aKeyEvent,aType)==EKeyWasConsumed)
  1878 		if(iPageSelector->OfferHotKeysKeyEventL(aKeyEvent,aType)==EKeyWasConsumed)
  1811 			return EKeyWasConsumed;
  1879 			{
  1812 
  1880 		    _AKNTRACE_FUNC_EXIT;
  1813 		}
  1881 			return EKeyWasConsumed;		
  1814 
  1882 			}
       
  1883 		}
       
  1884     _AKNTRACE_FUNC_EXIT;
  1815 	return (aKeyEvent.iScanCode == EStdKeyYes ? EKeyWasNotConsumed:EKeyWasConsumed);
  1885 	return (aKeyEvent.iScanCode == EStdKeyYes ? EKeyWasNotConsumed:EKeyWasConsumed);
  1816     }
  1886     }
  1817 
  1887 
  1818 /**
  1888 /**
  1819 * Hands focus to current dialog line.
  1889 * Hands focus to current dialog line.
  1820 */
  1890 */
  1821 EXPORT_C void CEikDialog::FocusChanged(TDrawNow aDrawNow)
  1891 EXPORT_C void CEikDialog::FocusChanged(TDrawNow aDrawNow)
  1822     {
  1892     {
       
  1893 	_AKNTRACE_FUNC_ENTER;
  1823     CEikBorderedControl::FocusChanged( aDrawNow );
  1894     CEikBorderedControl::FocusChanged( aDrawNow );
  1824 
  1895 
  1825     TInt controlID = IdOfFocusControl();
  1896     TInt controlID = IdOfFocusControl();
  1826     if (controlID)
  1897     if (controlID)
  1827         {
  1898         {
  1828         Line(controlID)->SetFocus(IsFocused(), aDrawNow);
  1899         Line(controlID)->SetFocus(IsFocused(), aDrawNow);
  1829         }
  1900         }
       
  1901     _AKNTRACE_FUNC_EXIT;
  1830     }
  1902     }
  1831 
  1903 
  1832 /**
  1904 /**
  1833  * Tries to initiate user exit of the dialog when the button identified
  1905  * Tries to initiate user exit of the dialog when the button identified
  1834  * by aButtonId is pressed, if this button should exit the dialog. See OkToExitL to
  1906  * by aButtonId is pressed, if this button should exit the dialog. See OkToExitL to
  1838  * If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it
  1910  * If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it
  1839  * immediately deletes itself. 
  1911  * immediately deletes itself. 
  1840  */
  1912  */
  1841 EXPORT_C void CEikDialog::TryExitL(TInt aButtonId)
  1913 EXPORT_C void CEikDialog::TryExitL(TInt aButtonId)
  1842     {
  1914     {
       
  1915 	_AKNTRACE_FUNC_ENTER;
  1843     if ( iDialogFlags & EEikDialogFlagNoUserExit )
  1916     if ( iDialogFlags & EEikDialogFlagNoUserExit )
  1844         {
  1917         {
       
  1918         _AKNTRACE_FUNC_EXIT;
  1845 		return;
  1919 		return;
  1846         }
  1920         }
  1847         
  1921         
  1848     // use delayed exit if pointer event handling is in progress
  1922     // use delayed exit if pointer event handling is in progress
  1849     if ( Extension()->iPublicFlags.IsSet( CEikDialogExtension::EDelayedExit ) )
  1923     if ( Extension()->iPublicFlags.IsSet( CEikDialogExtension::EDelayedExit ) )
  1850         {
  1924         {
  1851         Extension()->iButtonId = aButtonId;
  1925         Extension()->iButtonId = aButtonId;
  1852         Extension()->StartDelayedExit();
  1926         Extension()->StartDelayedExit();
       
  1927         _AKNTRACE_FUNC_EXIT;
  1853         return;
  1928         return;
  1854         }
  1929         }
  1855         
  1930         
  1856     TBool effectTriggered = EFalse;
  1931     TBool effectTriggered = EFalse;
  1857     TBool effectButton = aButtonId == EEikBidCancel
  1932     TBool effectButton = aButtonId == EEikBidCancel
  1893             {
  1968             {
  1894             GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort,
  1969             GfxTransEffect::NotifyExternalState( ECaptureComponentsAbort,
  1895                                                  ( const TDesC8* ) this );
  1970                                                  ( const TDesC8* ) this );
  1896             GfxTransEffect::Abort( this );
  1971             GfxTransEffect::Abort( this );
  1897             }
  1972             }
       
  1973             _AKNTRACE_FUNC_EXIT;
  1898    			return;
  1974    			return;
  1899             }
  1975             }
  1900 
  1976 
  1901 	if (aButtonId!=EEikBidCancel)
  1977 	if (aButtonId!=EEikBidCancel)
  1902 		GetAutoValues();
  1978 		GetAutoValues();
  1934                                                  ( const TDesC8* ) this );
  2010                                                  ( const TDesC8* ) this );
  1935 		    	GfxTransEffect::Abort(this);
  2011 		    	GfxTransEffect::Abort(this);
  1936 			}
  2012 			}
  1937 	    delete(this);
  2013 	    delete(this);
  1938 		}
  2014 		}
       
  2015 	_AKNTRACE_FUNC_EXIT;
  1939     }
  2016     }
  1940 
  2017 
  1941 /**
  2018 /**
  1942  * Returns the input capabilites of the dialog. By default, the dialog is
  2019  * Returns the input capabilites of the dialog. By default, the dialog is
  1943  * capable of handling all text input.
  2020  * capable of handling all text input.
  2061  * dialog by default. Reimplementations of this method must
  2138  * dialog by default. Reimplementations of this method must
  2062  * activate a page before doing anything else.
  2139  * activate a page before doing anything else.
  2063  */
  2140  */
  2064 EXPORT_C void CEikDialog::SetInitialCurrentLine()
  2141 EXPORT_C void CEikDialog::SetInitialCurrentLine()
  2065     {
  2142     {
       
  2143 	_AKNTRACE_FUNC_ENTER;
  2066 	if ( !iExtension->iInitialMade )
  2144 	if ( !iExtension->iInitialMade )
  2067 	    {
  2145 	    {
  2068 	    TRAP_IGNORE(iPageSelector->ActivateFirstPageL());
  2146 	    TRAP_IGNORE(iPageSelector->ActivateFirstPageL());
  2069 	    }
  2147 	    }
  2070 	if( !iIsEditable )
  2148 	if( !iIsEditable )
  2071 	    {
  2149 	    {
  2072 	    iPageSelector->SetInitialFocus();
  2150 	    iPageSelector->SetInitialFocus();
  2073 	    }
  2151 	    }
       
  2152 	_AKNTRACE_FUNC_EXIT;
  2074     }
  2153     }
  2075 
  2154 
  2076 /**
  2155 /**
  2077  * Handles a dialog button press for the button with id aButtonId.
  2156  * Handles a dialog button press for the button with id aButtonId.
  2078  * The cancel button press is not passed to the handler unless EEikDialogFlagNotifyEsc
  2157  * The cancel button press is not passed to the handler unless EEikDialogFlagNotifyEsc
  2197  *
  2276  *
  2198  * @since ER5U
  2277  * @since ER5U
  2199  */
  2278  */
  2200 EXPORT_C void CEikDialog::HandleResourceChange(TInt aType)
  2279 EXPORT_C void CEikDialog::HandleResourceChange(TInt aType)
  2201     {
  2280     {
  2202         
  2281 	_AKNTRACE_FUNC_ENTER;    
  2203     if(aType==KEikDynamicLayoutVariantSwitch)
  2282     if(aType==KEikDynamicLayoutVariantSwitch)
  2204         {
  2283         {
  2205         if (IsVisible())
  2284         if (IsVisible())
  2206 			DoResourceChangeLayout();
  2285 			DoResourceChangeLayout();
  2207         else if (iExtension)
  2286         else if (iExtension)
  2208         	iExtension->iFlags.Set(CEikDialogExtension::ELayoutChangeWhileInvisible);
  2287         	iExtension->iFlags.Set(CEikDialogExtension::ELayoutChangeWhileInvisible);
  2209 
  2288 
  2210         CCoeControl::HandleResourceChange(aType);
  2289         CCoeControl::HandleResourceChange(aType);
       
  2290         _AKNTRACE_FUNC_EXIT;
  2211         return;
  2291         return;
  2212         }
  2292         }
  2213     else
  2293     else
  2214     	{
  2294     	{
  2215     	CCoeControl::HandleResourceChange(aType);
  2295     	CCoeControl::HandleResourceChange(aType);
  2217     
  2297     
  2218     if( !CAknEnv::Static()->TransparencyEnabled() && aType==KEikColorResourceChange)
  2298     if( !CAknEnv::Static()->TransparencyEnabled() && aType==KEikColorResourceChange)
  2219         {
  2299         {
  2220         Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this));
  2300         Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorDialogBackground,*this));
  2221         }
  2301         }
       
  2302     _AKNTRACE_FUNC_EXIT;
  2222     }
  2303     }
  2223 
  2304 
  2224 void CEikDialog::DoResourceChangeLayout()
  2305 void CEikDialog::DoResourceChangeLayout()
  2225 	{
  2306 	{
  2226     // Layout must be forced through - bypass optimisations
  2307     // Layout must be forced through - bypass optimisations
  2227     // Must work through all pages
  2308     // Must work through all pages
  2228     
  2309 	_AKNTRACE_FUNC_ENTER;
  2229     Layout();
  2310     Layout();
  2230     SizeChanged();
  2311     SizeChanged();
  2231     
  2312     
  2232     TInt lastPage =  ( iPageSelector->PageContainer()->NumPages() - 1 );
  2313     TInt lastPage =  ( iPageSelector->PageContainer()->NumPages() - 1 );
  2233     TInt pageIndex = 0;
  2314     TInt pageIndex = 0;
  2239         page->HandleResourceChange( KEikDynamicLayoutVariantSwitch );
  2320         page->HandleResourceChange( KEikDynamicLayoutVariantSwitch );
  2240         }
  2321         }
  2241 
  2322 
  2242    	if (iExtension)
  2323    	if (iExtension)
  2243    		iExtension->iFlags.Clear(CEikDialogExtension::ELayoutChangeWhileInvisible);
  2324    		iExtension->iFlags.Clear(CEikDialogExtension::ELayoutChangeWhileInvisible);
       
  2325    	_AKNTRACE_FUNC_EXIT;
  2244 	}
  2326 	}
  2245 
  2327 
  2246 /**
  2328 /**
  2247  * Returns a pointer to the dialog's internal button command observer. This is required when creating a
  2329  * Returns a pointer to the dialog's internal button command observer. This is required when creating a
  2248  * new button group container for the dialog.
  2330  * new button group container for the dialog.
  2282 EXPORT_C void CEikDialog::CEikDialog_Reserved_2()
  2364 EXPORT_C void CEikDialog::CEikDialog_Reserved_2()
  2283 	{}
  2365 	{}
  2284 
  2366 
  2285 EXPORT_C void CEikDialog::MakeVisible(TBool aVisible)
  2367 EXPORT_C void CEikDialog::MakeVisible(TBool aVisible)
  2286 	{
  2368 	{
       
  2369 	_AKNTRACE_FUNC_ENTER;
       
  2370 	_AKNTRACE( "CEikDialog::MakeVisible(): [%d]", aVisible );
  2287    	if (iExtension && iExtension->iFlags[CEikDialogExtension::ELayoutChangeWhileInvisible])
  2371    	if (iExtension && iExtension->iFlags[CEikDialogExtension::ELayoutChangeWhileInvisible])
  2288    		DoResourceChangeLayout();
  2372    		DoResourceChangeLayout();
  2289 
  2373 
  2290 	// only for popup dialogs
  2374 	// only for popup dialogs
  2291 	if ( aVisible )
  2375 	if ( aVisible )
  2299             AknGlobalPopupPriorityController::FadeBehindPopup(*this, iPopupFader, *this, aVisible);
  2383             AknGlobalPopupPriorityController::FadeBehindPopup(*this, iPopupFader, *this, aVisible);
  2300     	    }
  2384     	    }
  2301         }
  2385         }
  2302     
  2386     
  2303 	CEikBorderedControl::MakeVisible(aVisible);
  2387 	CEikBorderedControl::MakeVisible(aVisible);
  2304 
  2388 	_AKNTRACE_FUNC_EXIT;
  2305 	}
  2389 	}
  2306 
  2390 
  2307 void CEikDialog::FadeBehindPopup(TBool aFade)
  2391 void CEikDialog::FadeBehindPopup(TBool aFade)
  2308 	{
  2392 	{
  2309 	// record the requested fade state
  2393 	// record the requested fade state
  2502 		}
  2586 		}
  2503 	}
  2587 	}
  2504 
  2588 
  2505 EXPORT_C void CEikDialog::UpdatePageL(TBool aRedraw)
  2589 EXPORT_C void CEikDialog::UpdatePageL(TBool aRedraw)
  2506 	{
  2590 	{
       
  2591 	_AKNTRACE_FUNC_ENTER;
  2507 	if (Rect().Height())
  2592 	if (Rect().Height())
  2508 		{
  2593 		{
  2509 		if (iPageSelector)
  2594 		if (iPageSelector)
  2510 			if (iPageSelector->IsForm())
  2595 			if (iPageSelector->IsForm())
  2511 				if (iPageSelector->PageContainer())
  2596 				if (iPageSelector->PageContainer())
  2515 						TryChangeFocusToL(CurrentLine()->iId);
  2600 						TryChangeFocusToL(CurrentLine()->iId);
  2516 					if (aRedraw)
  2601 					if (aRedraw)
  2517 						DrawDeferred();
  2602 						DrawDeferred();
  2518 					}
  2603 					}
  2519 		}
  2604 		}
       
  2605 	_AKNTRACE_FUNC_EXIT;
  2520 	}
  2606 	}
  2521 
  2607 
  2522 
  2608 
  2523 EXPORT_C TInt CEikDialog::GetNumberOfLinesOnPage(TInt aPageIndex) const
  2609 EXPORT_C TInt CEikDialog::GetNumberOfLinesOnPage(TInt aPageIndex) const
  2524 	{
  2610 	{
       
  2611 	_AKNTRACE_FUNC_ENTER;
  2525 	if (iPageSelector)
  2612 	if (iPageSelector)
  2526 		{
  2613 		{
  2527 		CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer();
  2614 		CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer();
  2528 		if (pageContainer)
  2615 		if (pageContainer)
  2529 			{
  2616 			{
  2530 			CEikDialogPage* page = pageContainer->Page(aPageIndex);
  2617 			CEikDialogPage* page = pageContainer->Page(aPageIndex);
  2531 			if (page)
  2618 			if (page)
  2532 				return page->NumberOfLines();
  2619 				{
       
  2620 				_AKNTRACE( "CEikDialog::GetNumberOfLinesOnPage(): [%d]", page->NumberOfLines() );
       
  2621 				_AKNTRACE_FUNC_EXIT;
       
  2622 				return page->NumberOfLines();			
       
  2623 				}
  2533 			}
  2624 			}
  2534 		}
  2625 		}
       
  2626 	_AKNTRACE( "CEikDialog::GetNumberOfLinesOnPage(): 0");
       
  2627 	_AKNTRACE_FUNC_EXIT;
  2535 	return 0;
  2628 	return 0;
  2536 	}
  2629 	}
  2537 
  2630 
  2538 EXPORT_C TInt CEikDialog::GetNumberOfPages() const
  2631 EXPORT_C TInt CEikDialog::GetNumberOfPages() const
  2539 	{
  2632 	{
       
  2633 	_AKNTRACE_FUNC_ENTER;
  2540 	if (iPageSelector)
  2634 	if (iPageSelector)
  2541 		{
  2635 		{
  2542 		CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer();
  2636 		CEikDialogPageContainer* pageContainer = iPageSelector->PageContainer();
  2543 		if (pageContainer)
  2637 		if (pageContainer)
  2544 			return pageContainer->NumPages();
  2638 			{
  2545 		}
  2639 		    _AKNTRACE( "CEikDialog::GetNumberOfPages(): [%d]", pageContainer->NumPages() );
       
  2640 		    _AKNTRACE_FUNC_EXIT;
       
  2641 		    return pageContainer->NumPages();
       
  2642 			}
       
  2643 		}
       
  2644 	_AKNTRACE( "CEikDialog::GetNumberOfPages(): return 0;" );
       
  2645 	_AKNTRACE_FUNC_EXIT;
  2546 	return 0;
  2646 	return 0;
  2547     }
  2647     }
  2548     
  2648     
  2549 //--------------------------------------------------------------------------------
  2649 //--------------------------------------------------------------------------------
  2550 // CEikDialog::HandleDialogPageEventL(TInt aEventID) 
  2650 // CEikDialog::HandleDialogPageEventL(TInt aEventID) 
  3121 // Checking if the blank screen is being displayed.
  3221 // Checking if the blank screen is being displayed.
  3122 // If so, the blank screen will cover everything.
  3222 // If so, the blank screen will cover everything.
  3123 const TInt KWgPriorityOfBlankScreen = 10000; // copied from akncapserverentry.cpp
  3223 const TInt KWgPriorityOfBlankScreen = 10000; // copied from akncapserverentry.cpp
  3124 TBool IsBlankScreenDisplayed()
  3224 TBool IsBlankScreenDisplayed()
  3125     {
  3225     {
       
  3226 	_AKNTRACE_FUNC_ENTER;
  3126     TBool isBlankScreenDisplayed(EFalse);
  3227     TBool isBlankScreenDisplayed(EFalse);
  3127     RWsSession& wsSession = CEikonEnv::Static()->WsSession();
  3228     RWsSession& wsSession = CEikonEnv::Static()->WsSession();
  3128     
  3229     
  3129     CArrayFixFlat<TInt> *wgIds = new CArrayFixFlat<TInt>(2);
  3230     CArrayFixFlat<TInt> *wgIds = new CArrayFixFlat<TInt>(2);
  3130     if (wgIds != NULL)
  3231     if (wgIds != NULL)
  3131         {
  3232         {
  3132         if (KErrNone == wsSession.WindowGroupList(wgIds) && wgIds->Count() > 0)
  3233         if (KErrNone == wsSession.WindowGroupList(wgIds) && wgIds->Count() > 0)
  3133             {
  3234             {
  3134             TInt priority = wsSession.GetWindowGroupOrdinalPriority(wgIds->At(0));
  3235             TInt priority = wsSession.GetWindowGroupOrdinalPriority(wgIds->At(0));
  3135             RDebug::Printf("IsBlankScreenDisplayed():priority:%d",priority);
  3236             _AKNTRACE( "IsBlankScreenDisplayed():priority: [%d]", priority );
  3136             if (priority == KWgPriorityOfBlankScreen)
  3237             if (priority == KWgPriorityOfBlankScreen)
  3137                 {
  3238                 {
  3138                 isBlankScreenDisplayed = ETrue;
  3239                 isBlankScreenDisplayed = ETrue;
  3139                 }
  3240                 }
  3140             }
  3241             }
  3141         }
  3242         }
  3142     delete wgIds;
  3243     delete wgIds;
  3143     RDebug::Printf("IsBlankScreenDisplayed():isBlankScreenDisplayed:%d",isBlankScreenDisplayed);
  3244     _AKNTRACE( "IsBlankScreenDisplayed():isBlankScreenDisplayed: [%d]", isBlankScreenDisplayed );
       
  3245     _AKNTRACE_FUNC_EXIT;
  3144     return isBlankScreenDisplayed;
  3246     return isBlankScreenDisplayed;
  3145     }
  3247     }
  3146     
  3248