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