uifw/AvKon/src/AknSettingPage.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
    43 #include <aknlayoutscalable_avkon.cdl.h>
    43 #include <aknlayoutscalable_avkon.cdl.h>
    44 #include <layoutmetadata.cdl.h>
    44 #include <layoutmetadata.cdl.h>
    45 //For MCoeCaptionRetrieverForFep
    45 //For MCoeCaptionRetrieverForFep
    46 #include <fepbase.h>
    46 #include <fepbase.h>
    47 #include <AknPopupFader.h>
    47 #include <AknPopupFader.h>
       
    48 #include <gfxtranseffect/gfxtranseffect.h>
       
    49 #include <akntransitionutils.h>
       
    50 #include <touchfeedback.h>
       
    51 #include <akntranseffect.h>
    48 #include "aknitemactionmenuregister.h"
    52 #include "aknitemactionmenuregister.h"
    49 #include "aknqueryeditorindicator.h"
    53 #include "aknqueryeditorindicator.h"
       
    54 
       
    55 
       
    56 
       
    57 //
       
    58 // the function's definition is in the AknNoteDialog.cpp
       
    59 //
       
    60 TBool IsFocusedWindowGroup( const CCoeControl* aControl );
       
    61 
    50 
    62 
    51 // This determines the maximum number of digits in the optional number displayed on the
    63 // This determines the maximum number of digits in the optional number displayed on the
    52 // top left of the setting page
    64 // top left of the setting page
    53 const TInt KAknSettingPageMaxOrdinalDigits = 3;
    65 const TInt KAknSettingPageMaxOrdinalDigits = 3;
    54 
    66 
   566  *
   578  *
   567  */
   579  */
   568 EXPORT_C CAknSettingPage::~CAknSettingPage()
   580 EXPORT_C CAknSettingPage::~CAknSettingPage()
   569 	{
   581 	{
   570 	AKNTASHOOK_REMOVE();
   582 	AKNTASHOOK_REMOVE();
       
   583 
       
   584     StopActiveScheduler();
       
   585 
       
   586     // If navi pane context is not poped out yet, pop it now.
       
   587 	PopNaviDecoratorIfRequired();
       
   588     if ( GfxTransEffect::IsRegistered( this ) )
       
   589         {
       
   590         GfxTransEffect::Deregister( this );
       
   591         }
       
   592 
   571 	iEikonEnv->EikAppUi()->RemoveFromStack(this);
   593 	iEikonEnv->EikAppUi()->RemoveFromStack(this);
   572 
   594 
   573     AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( NULL );
   595     TRAP_IGNORE(AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( NULL ));
   574     
   596     
   575 	if (iMenuBar)
   597 	if (iMenuBar)
   576 		{
   598 		{
   577 		iEikonEnv->EikAppUi()->RemoveFromStack(iMenuBar);
   599 		iEikonEnv->EikAppUi()->RemoveFromStack(iMenuBar);
   578 		delete iMenuBar;
   600 		delete iMenuBar;
   583 	delete iEditorControl;
   605 	delete iEditorControl;
   584 	delete iSettingText;
   606 	delete iSettingText;
   585 	delete iHintText;
   607 	delete iHintText;
   586 	delete iCba;
   608 	delete iCba;
   587 	delete iExtension;
   609 	delete iExtension;
   588 
   610     iExtension = NULL;
   589     // If navi pane context is not poped out yet, pop it now.
   611 
   590 	PopNaviDecoratorIfRequired();
       
   591 	delete iNaviDecorator;
   612 	delete iNaviDecorator;
   592 
       
   593 	StopActiveScheduler();
       
   594 	}
   613 	}
   595 
   614 
   596 void CAknSettingPage::StopActiveScheduler()
   615 void CAknSettingPage::StopActiveScheduler()
   597 	{
   616 	{
   598     SetStopActiveSchedulerFlag( ETrue );
   617     SetStopActiveSchedulerFlag( ETrue );
   767 *
   786 *
   768 */
   787 */
   769 EXPORT_C void CAknSettingPage::ConstructFromResourceL(TResourceReader &aRes)
   788 EXPORT_C void CAknSettingPage::ConstructFromResourceL(TResourceReader &aRes)
   770 	{
   789 	{
   771 	CreateWindowL();
   790 	CreateWindowL();
   772 
       
   773 	SetGloballyCapturing( ETrue );
       
   774     SetPointerCapture(ETrue);
       
   775 
   791 
   776     if( NULL == iExtension )
   792     if( NULL == iExtension )
   777         {
   793         {
   778         iExtension = CAknSettingPageExtension::NewL( this );
   794         iExtension = CAknSettingPageExtension::NewL( this );
   779         }
   795         }
   884 	        {
   900 	        {
   885 	        iExtension->iEmbeddedSoftkeys = EFalse;
   901 	        iExtension->iEmbeddedSoftkeys = EFalse;
   886 	        }
   902 	        }
   887 	    }
   903 	    }
   888 	
   904 	
       
   905 	if(iExtension->iEmbeddedSoftkeys)
       
   906 		{
       
   907 		SetGloballyCapturing( ETrue );
       
   908     	SetPointerCapture(ETrue);	
       
   909 		}
       
   910 
   889     AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( this );
   911     AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( this );
   890 
   912 
   891 	if ( !iExtension->iEmbeddedSoftkeys )
   913 	if ( !iExtension->iEmbeddedSoftkeys )
   892 	    {
   914 	    {
   893 	    iCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
   915 	    iCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
   897 	else
   919 	else
   898 	    {
   920 	    {
   899         iCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba,
   921         iCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba,
   900             CEikButtonGroupContainer::EHorizontal, 
   922             CEikButtonGroupContainer::EHorizontal, 
   901             this, resourceId, *this, CEikButtonGroupContainer::EIsEmbedded | 
   923             this, resourceId, *this, CEikButtonGroupContainer::EIsEmbedded | 
   902             CEikButtonGroupContainer::EAddToStack );
   924             CEikButtonGroupContainer::EAddToStack | 
       
   925             CEikButtonGroupContainer::EAlwaysShown );
   903 	    }
   926 	    }
   904 	
   927 	
   905 	iExtension->CreateBackgroundContextL();
   928 	iExtension->CreateBackgroundContextL();
   906 
   929 
   907     if ( iExtension->iEmbeddedSoftkeys && 
   930     if ( iExtension->iEmbeddedSoftkeys )
   908             CAknEnv::Static()->TransparencyEnabled() )
       
   909         {
   931         {
   910         EnableWindowTransparency();
   932         EnableWindowTransparency();
       
   933         GfxTransEffect::Register( this, KGfxPopupDefaultControlUid );
   911         }
   934         }
   912 
   935 
   913 	// Make the menu bar
   936 	// Make the menu bar
   914 	iMenuBar = new (ELeave) CEikMenuBar() ;
   937 	iMenuBar = new (ELeave) CEikMenuBar() ;
   915 	iMenuBar->ConstructL( this, NULL, iMenuBarId ) ;
   938 	iMenuBar->ConstructL( this, NULL, iMenuBarId ) ;
   916 	iEikonEnv->EikAppUi()->AddToStackL(iMenuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
   939 	iEikonEnv->EikAppUi()->AddToStackL(iMenuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
   917 	
   940 	
   918 
       
   919 	iTextLabel = new(ELeave) CEikLabel( );
   941 	iTextLabel = new(ELeave) CEikLabel( );
   920     iTextLabel->UseLogicalToVisualConversion(ETrue);
   942     iTextLabel->UseLogicalToVisualConversion(ETrue);
   921 	iTextLabel->SetContainerWindowL(*this);
   943 	iTextLabel->SetContainerWindowL(*this);
   922     
   944     
   923     iExtension->iShadowText = new(ELeave) CEikLabel( );
   945     iExtension->iShadowText = new(ELeave) CEikLabel( );
  1376  *
  1398  *
  1377  * @param	aAccept ETrue to accept the current value; EFalse otherwise
  1399  * @param	aAccept ETrue to accept the current value; EFalse otherwise
  1378  */
  1400  */
  1379 EXPORT_C void CAknSettingPage::DismissL(TBool aAccept)
  1401 EXPORT_C void CAknSettingPage::DismissL(TBool aAccept)
  1380 	{
  1402 	{
       
  1403     if ( AknLayoutUtils::PenEnabled() )
       
  1404         {
       
  1405         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1406         if ( feedback )
       
  1407             {
       
  1408             TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp;
       
  1409             if ( CAknTransitionUtils::TransitionsEnabled(
       
  1410                     AknTransEffect::EComponentTransitionsOff ) )
       
  1411                 {
       
  1412                 fbLogicalType = ETouchFeedbackDecreasingPopUp;
       
  1413                 }
       
  1414             feedback->InstantFeedback(
       
  1415                                    this,
       
  1416                                    fbLogicalType,
       
  1417                                    ETouchFeedbackVibra,
       
  1418                                    TPointerEvent() );
       
  1419             }
       
  1420         }
       
  1421     
  1381     AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( NULL );
  1422     AknItemActionMenuRegister::SetOverridingMenuBarOwnerL( NULL );
  1382     MakeVisible( EFalse );
       
  1383 
  1423 
  1384 	if ( aAccept )
  1424 	if ( aAccept )
  1385 		{
  1425 		{
  1386 		AcceptSettingL();
  1426 		AcceptSettingL();
  1387 		if ( iSettingPageObserver )
  1427 		if ( iSettingPageObserver )
  1391 		{
  1431 		{
  1392 		RestoreOriginalSettingL();
  1432 		RestoreOriginalSettingL();
  1393 		if ( iSettingPageObserver )
  1433 		if ( iSettingPageObserver )
  1394 			iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingCancelled);
  1434 			iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingCancelled);
  1395 		}
  1435 		}
       
  1436 	
       
  1437 	if ( GfxTransEffect::IsRegistered( this ) && IsFocusedWindowGroup( this ) && IsVisible() )
       
  1438 	    {
       
  1439         GfxTransEffect::Begin( this, KGfxControlDisappearAction );
       
  1440         MakeVisible( EFalse );
       
  1441         GfxTransEffect::End( this );
       
  1442 	    }
       
  1443 	else
       
  1444 	    {
       
  1445         MakeVisible( EFalse );
       
  1446 	    }
  1396 
  1447 
  1397 	iEikonEnv->RemoveFromStack(iCba);
  1448 	iEikonEnv->RemoveFromStack(iCba);
  1398 	delete iCba;
  1449 	delete iCba;
  1399 	iCba = 0;
  1450 	iCba = 0;
  1400 
  1451 
  1631 	iUpdateMode = aMode;
  1682 	iUpdateMode = aMode;
  1632 
  1683 
  1633 // Ensure we have a menu bar by this point
  1684 // Ensure we have a menu bar by this point
  1634 	__ASSERT_DEBUG( iMenuBar, Panic( EAknPanicSettingPageNoMenuBar ) ) ;
  1685 	__ASSERT_DEBUG( iMenuBar, Panic( EAknPanicSettingPageNoMenuBar ) ) ;
  1635 
  1686 
       
  1687     if ( AknLayoutUtils::PenEnabled() )
       
  1688         {
       
  1689         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
  1690         if ( feedback )
       
  1691             {
       
  1692             TTouchLogicalFeedback fbLogicalType = ETouchFeedbackPopUp;
       
  1693             if ( CAknTransitionUtils::TransitionsEnabled(
       
  1694                     AknTransEffect::EComponentTransitionsOff ) )
       
  1695                 {
       
  1696                 fbLogicalType = ETouchFeedbackIncreasingPopUp;
       
  1697                 }
       
  1698             feedback->InstantFeedback(
       
  1699                                    this,
       
  1700                                    fbLogicalType,
       
  1701                                    ETouchFeedbackVibra,
       
  1702                                    TPointerEvent() );
       
  1703             }
       
  1704         }
       
  1705     
       
  1706 	//
       
  1707   	// Set editor control to be invisible
       
  1708   	//
       
  1709 	iEditorControl->MakeVisible( EFalse );
       
  1710 
  1636 	DynamicInitL();
  1711 	DynamicInitL();
  1637 	ActivateL();
  1712 	ActivateL();
  1638 
  1713 
  1639 	if ( iExtension->iEmbeddedSoftkeys )
  1714 	if ( iExtension->iEmbeddedSoftkeys )
  1640 	    {
  1715 	    {
  1641 	    iExtension->iFader.FadeBehindPopup( iExtension, this, ETrue );
  1716 	    iExtension->iFader.FadeBehindPopup( iExtension, this, ETrue );
  1642 	    }
  1717 	    }
  1643 	
  1718 
  1644 	// Catch up with editor's brute draw (in editor setting page)
  1719     if ( GfxTransEffect::IsRegistered( this ) )
  1645 	DrawNow();   //  EECO-7QYCR4 and TSAA-7Q3D2J is conflict , so make an extra draw operation here
  1720         {
  1646     DrawDeferred();
  1721         GfxTransEffect::Begin( this, KGfxControlAppearAction );
       
  1722 
       
  1723         TRect demarcation;
       
  1724         CAknTransitionUtils::GetDemarcation( CAknTransitionUtils::EPopup, 
       
  1725                 demarcation );
       
  1726         GfxTransEffect::SetDemarcation( this, demarcation );
       
  1727 
       
  1728 		iEditorControl->MakeVisible( ETrue );
       
  1729         MakeVisible( ETrue );
       
  1730         GfxTransEffect::End( this );
       
  1731         }
       
  1732     else
       
  1733         {
       
  1734         iEditorControl->MakeVisible( ETrue );
       
  1735         MakeVisible( ETrue );
       
  1736         }
  1647 
  1737 
  1648 	iEditorControl->SetObserver( this );
  1738 	iEditorControl->SetObserver( this );
  1649 	iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityDialog);
  1739 	iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityDialog);
  1650 
  1740 
  1651     if( !iExtension->iEmbeddedSoftkeys )
  1741     if( !iExtension->iEmbeddedSoftkeys )
  1701 	if ( PostDisplayCheckL() )
  1791 	if ( PostDisplayCheckL() )
  1702 		{
  1792 		{
  1703 		StartActiveScheduler();
  1793 		StartActiveScheduler();
  1704 		}
  1794 		}
  1705 	else
  1795 	else
  1706 		AttemptExitL(EFalse);
  1796 		{
       
  1797         AttemptExitL(EFalse);	
       
  1798         }
  1707 	
  1799 	
  1708 	iEikonEnv->EikAppUi()->RemoveFromStack(this);
  1800 	iEikonEnv->EikAppUi()->RemoveFromStack(this);
  1709 	CleanupStack::Pop(); // this
  1801 	CleanupStack::Pop(); // this
  1710 
  1802 
  1711 	if ( iExtension->iEmbeddedSoftkeys )
  1803 	if ( iExtension->iEmbeddedSoftkeys )
  2056     else if ( aId.iUid == MAknEditingStateIndicator::ETypeId &&
  2148     else if ( aId.iUid == MAknEditingStateIndicator::ETypeId &&
  2057               iExtension->iEditIndicator )
  2149               iExtension->iEditIndicator )
  2058         {
  2150         {
  2059         return SupplyMopObject( aId, iExtension->iEditIndicator );
  2151         return SupplyMopObject( aId, iExtension->iEditIndicator );
  2060         }
  2152         }
       
  2153     else if( aId.iUid == MAknsControlContext::ETypeId)
       
  2154         {
       
  2155         return MAknsControlContext::SupplyMopObject(aId, iExtension->iSettingPageBgContext);
       
  2156         } 
  2061 
  2157 
  2062     return SupplyMopObject( aId, iCba, iMenuBar );
  2158     return SupplyMopObject( aId, iCba, iMenuBar );
  2063 	}
  2159 	}
  2064 
  2160 
  2065 EXPORT_C void CAknSettingPage::SetEditState(const TBool aEditable)
  2161 EXPORT_C void CAknSettingPage::SetEditState(const TBool aEditable)
  2119     }
  2215     }
  2120 
  2216 
  2121 
  2217 
  2122 void CAknSettingPage::PopNaviDecoratorIfRequired()
  2218 void CAknSettingPage::PopNaviDecoratorIfRequired()
  2123     {
  2219     {
  2124     if ( iNaviPane && !iExtension->iEmbeddedSoftkeys )
  2220     if ( iNaviPane && iExtension && !iExtension->iEmbeddedSoftkeys )
  2125         {
  2221         {
  2126         iNaviPane->Pop( iNaviDecorator ); // iNaviDecorator is not to be detroyed yet
  2222         iNaviPane->Pop( iNaviDecorator ); // iNaviDecorator is not to be detroyed yet
  2127 
  2223 
  2128         // This is only a reference. Set to zero only to ensure invariant that we have 
  2224         // This is only a reference. Set to zero only to ensure invariant that we have 
  2129         // poped out iNaviPane context already.
  2225         // poped out iNaviPane context already.