uifw/AvKon/src/AknAppUi.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 18 fcdfafb36fe7
child 20 d48ab3b357f1
equal deleted inserted replaced
18:fcdfafb36fe7 19:aecbbf00d063
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002 - 2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    67 #include <akntranseffect.h> // for Transition effect enumerations
    67 #include <akntranseffect.h> // for Transition effect enumerations
    68 #include <aknlayoutscalable_avkon.cdl.h>
    68 #include <aknlayoutscalable_avkon.cdl.h>
    69 #include <gfxtranseffect/gfxtranseffect.h>
    69 #include <gfxtranseffect/gfxtranseffect.h>
    70 
    70 
    71 #include <aknSDData.h>
    71 #include <aknSDData.h>
    72 #include <secondarydisplay/AknSecondaryDisplayDefs.h>
    72 #include <AknNotifyStd.h>
       
    73 #include <SecondaryDisplay/AknSecondaryDisplayDefs.h>
    73 #include <startupdomainpskeys.h>
    74 #include <startupdomainpskeys.h>
    74 
    75 
    75 #include "transitionmanager.h"
    76 #include "transitionmanager.h"
    76 #include <PtiEngine.h>   
    77 #include <PtiEngine.h>   
    77 #include <PtiKeyMappings.h> 
    78 #include <PtiKeyMappings.h> 
    78 
    79 
    79 #include <akntoolbar.h>
    80 #include <akntoolbar.h>
    80 #include <akntoolbarextension.h>
       
    81 #include <eikdialg.h>
    81 #include <eikdialg.h>
    82 
    82 
    83 #ifdef RD_SCALABLE_UI_V2
    83 #ifdef RD_SCALABLE_UI_V2
    84 #include <AknPriv.hrh>
    84 #include <AknPriv.hrh>
    85 #include <akntouchpane.h>
    85 #include <akntouchpane.h>
    87 
    87 
    88 #include <touchfeedbackadaptation.h>
    88 #include <touchfeedbackadaptation.h>
    89 #include <touchfeedback.h>
    89 #include <touchfeedback.h>
    90 
    90 
    91 #include <aknpointereventmodifier.h>
    91 #include <aknpointereventmodifier.h>
    92 #include <aknitemactionmenuregister.h>
       
    93 
    92 
    94 // UIDS for dialler view
    93 // UIDS for dialler view
    95 const TUid KPhoneAppUid = { 0x100058B3 };
    94 const TUid KPhoneAppUid = { 0x100058B3 };
    96 const TUid KAknDiallerViewUid = {0x10282D81};
    95 const TUid KAknDiallerViewUid = {0x10282D81};
    97 const TUid KDiallerVievCommand = {0x1};
    96 const TUid KDiallerVievCommand = {0x1};
   555     {
   554     {
   556     }
   555     }
   557 
   556 
   558 EXPORT_C CAknAppUiBase::~CAknAppUiBase()
   557 EXPORT_C CAknAppUiBase::~CAknAppUiBase()
   559     {
   558     {
   560     AknItemActionMenuRegister::RemoveConstructingMenuBarOwner( this );
       
   561 
       
   562     if (iAppUiBaseExtension)
   559     if (iAppUiBaseExtension)
   563         {
   560         {
   564         MTouchFeedback::DestroyInstance();
   561         MTouchFeedback::DestroyInstance();
   565         iAppUiBaseExtension->iFeedbackAdaptation = NULL;
   562         iAppUiBaseExtension->iFeedbackAdaptation = NULL;
   566         RemoveFromStack( iAppUiBaseExtension->iDiallerLauncher );
   563         RemoveFromStack( iAppUiBaseExtension->iDiallerLauncher );
   662             orientationFlags = value;
   659             orientationFlags = value;
   663             }
   660             }
   664         delete defaultOrientationCr;
   661         delete defaultOrientationCr;
   665         defaultOrientationCr = NULL;
   662         defaultOrientationCr = NULL;
   666         }
   663         }
   667 
       
   668     iAknFlags.Assign(EOrientationSpecified, orientationFlags&EAppOrientationSpecifiedFlag);
   664     iAknFlags.Assign(EOrientationSpecified, orientationFlags&EAppOrientationSpecifiedFlag);
   669     iAknFlags.Assign(EOrientationLandscape, orientationFlags&EAppOrientationLandscapeFlag);
   665     iAknFlags.Assign(EOrientationLandscape, orientationFlags&EAppOrientationLandscapeFlag);
   670     iAknFlags.Assign(EOrientationAutomatic, orientationFlags&EAppOrientationAutomaticFlag);
   666     iAknFlags.Assign(EOrientationAutomatic, orientationFlags&EAppOrientationAutomaticFlag);
   671     iAknFlags.Assign(EMSKEnabled, aAppUiFlags&EAknEnableMSKflag);
   667     iAknFlags.Assign(EMSKEnabled, aAppUiFlags&EAknEnableMSKflag);
   672     iAknFlags.Assign( ESingleClickCompatible,
   668     iAknFlags.Assign( ESingleClickCompatible,
   674 
   670 
   675     if ( aAppUiFlags & EAknTouchCompatibleFlag )
   671     if ( aAppUiFlags & EAknTouchCompatibleFlag )
   676         {
   672         {
   677         iAknFlags.Set( ETouchCompatible );
   673         iAknFlags.Set( ETouchCompatible );
   678         }
   674         }
   679     else if ( aAppUiFlags & EAknSingleClickCompatibleFlag )
       
   680         {
       
   681         // If application is single click compatible then it needs to
       
   682         // be also touch compatible, so set that flag also if application
       
   683         // has forgotten.
       
   684         iAknFlags.Set( ETouchCompatible );
       
   685         }
       
   686     else
   675     else
   687         {
   676         {
   688         // Set the touch compatible flag for all applications that
       
   689         // reside on the ROM, since all platform applications should
       
   690         // be touch compatible. 
       
   691         RProcess process;
   677         RProcess process;
   692         TFileName fileName = process.FileName();
   678         TFileName fileName = process.FileName();
   693         _LIT( KRomDrive, "z:" );
   679         _LIT(KRomDrive,"z:");
   694         
   680         
   695         if ( fileName.FindF( KRomDrive ) == 0 )
   681         if ( fileName.FindF( KRomDrive ) == 0 )
   696             {
   682             {
   697             iAknFlags.Set( ETouchCompatible );
   683             iAknFlags.Set( ETouchCompatible );
   698             }
   684             }
   699         }
   685         }
   700 
       
   701     AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( this );
       
   702 
   686 
   703 #ifdef AVKON_RDEBUG_INFO
   687 #ifdef AVKON_RDEBUG_INFO
   704     RDebug::Print(_L("Entering CEikAppUi::BaseConstructL()"));    
   688     RDebug::Print(_L("Entering CEikAppUi::BaseConstructL()"));    
   705 #endif
   689 #endif
   706 
   690 
  1409 
  1393 
  1410     if( (aAppUiFlags & EAknDisableHighlightAnimationFlag) != 0 )
  1394     if( (aAppUiFlags & EAknDisableHighlightAnimationFlag) != 0 )
  1411         {
  1395         {
  1412         AknsUtils::SetAvkonHighlightAnimationEnabledL( EFalse );
  1396         AknsUtils::SetAvkonHighlightAnimationEnabledL( EFalse );
  1413         }
  1397         }
  1414     
       
  1415     if (( aAppUiFlags & EAknDisableAnimationBackground ) != 0)
       
  1416         {
       
  1417         AknsUtils::SetAnimationBackgroundDisabledL( ETrue );
       
  1418         
       
  1419         }
       
  1420 
  1398 
  1421 #ifdef RD_SCALABLE_UI_V2
  1399 #ifdef RD_SCALABLE_UI_V2
  1422     if ( CAknTouchPane* tp = TouchPane() )
  1400     if ( CAknTouchPane* tp = TouchPane() )
  1423         {
  1401         {
  1424         tp->SetObserver( this );
  1402         tp->SetObserver( this );
  1568         // Solving the application name asing AppArc.lib
  1546         // Solving the application name asing AppArc.lib
  1569         RApaLsSession apparcSession;
  1547         RApaLsSession apparcSession;
  1570         User::LeaveIfError( apparcSession.Connect() );
  1548         User::LeaveIfError( apparcSession.Connect() );
  1571         CleanupClosePushL( apparcSession );
  1549         CleanupClosePushL( apparcSession );
  1572         TApaAppInfo appInfo;
  1550         TApaAppInfo appInfo;
  1573 
  1551         TInt err = apparcSession.GetAppInfo( appInfo, this->Application()->AppDllUid() );
       
  1552         
  1574         // +2 for colon and line end
  1553         // +2 for colon and line end
  1575         HBufC* captionBuffer = HBufC::NewLC(KApaMaxAppCaption + KAknBidiExtraSpacePerLine + 2);
  1554         HBufC* captionBuffer = 
       
  1555             HBufC::NewLC( KApaMaxAppCaption + KAknBidiExtraSpacePerLine + 2 ); 
       
  1556 
       
  1557 //        CleanupStack::PushL( captionBuffer );
  1576         TPtr caption = captionBuffer->Des();
  1558         TPtr caption = captionBuffer->Des();
  1577 
  1559 
  1578         CEikApplication *application = this->Application();
  1560         if ( err == KErrNone )
  1579         if (NULL != application)
  1561             {
  1580             {
  1562             caption = appInfo.iCaption;
  1581             if (KErrNone == apparcSession.GetAppInfo(appInfo, application->AppDllUid()))
  1563             }
  1582                 {
  1564 
  1583                 caption = appInfo.iCaption;
       
  1584                 }
       
  1585             }
       
  1586         
       
  1587         // Lets remove trailing spaces
  1565         // Lets remove trailing spaces
  1588         caption.TrimRight();
  1566         caption.TrimRight();
  1589         
  1567         
  1590         // Insert the application name into the beginning of the error string
  1568         // Insert the application name into the beginning of the error string
  1591         if ( caption.Length() != 0 ) 
  1569         if ( caption.Length() != 0 ) 
  1814     iAvkonEnv->CloseAllIntermediateStates();
  1792     iAvkonEnv->CloseAllIntermediateStates();
  1815     }
  1793     }
  1816 
  1794 
  1817 EXPORT_C void CAknAppUi::PrepareToExit()
  1795 EXPORT_C void CAknAppUi::PrepareToExit()
  1818     {
  1796     {
  1819     //
       
  1820     // Hide application toolbar extension view (by toolbar extension)
       
  1821     //
       
  1822     if ( CurrentFixedToolbar() )
       
  1823         {
       
  1824         CAknToolbarExtension* toolbarExt = CurrentFixedToolbar()->ToolbarExtension();
       
  1825         if ( toolbarExt && toolbarExt->IsShown() )
       
  1826             {
       
  1827             toolbarExt->SetShown( EFalse );
       
  1828             }
       
  1829         }
       
  1830 
       
  1831     if( IsForeground() && Document() )
  1797     if( IsForeground() && Document() )
  1832         {
  1798         {
  1833         //only if focused, otherwise next app HandleForeground may never come.
  1799         //only if focused, otherwise next app HandleForeground may never come.
  1834         iAvkonEnv->TransitionEvent(AknTransEffect::EApplicationExit, Application()->AppDllUid());
  1800         iAvkonEnv->TransitionEvent(AknTransEffect::EApplicationExit, Application()->AppDllUid());
  1835         }
  1801         }
  1885         return;
  1851         return;
  1886         }
  1852         }
  1887 
  1853 
  1888     // This method call practically adds a shift modifier to hash key + joystick events.
  1854     // This method call practically adds a shift modifier to hash key + joystick events.
  1889     // This is because of marking in lists and editors when edit there is no edit key in device.
  1855     // This is because of marking in lists and editors when edit there is no edit key in device.
  1890     if (SimulateHashKeyMarkingEventL(aEvent))
  1856     if (SimulateHashKeyMarkingEvent(aEvent))
  1891         {
  1857         {
  1892         return;
  1858         return;
  1893         }
  1859         }
  1894 
  1860 
  1895     // ---- To turn on key code conversion by default -----            
  1861     // ---- To turn on key code conversion by default -----            
  2116     
  2082     
  2117 // This method watches for hash key presses, and adds a shift modifier to all arrow key 
  2083 // This method watches for hash key presses, and adds a shift modifier to all arrow key 
  2118 // and ok key events, if hash key is simultaneously down. This is done because of making the 
  2084 // and ok key events, if hash key is simultaneously down. This is done because of making the 
  2119 // edit key optional in the device. Therefore, hash key with joystick (or single hash press, 
  2085 // edit key optional in the device. Therefore, hash key with joystick (or single hash press, 
  2120 // see eiklbx.cpp) can be used for marking in lists and editors.    
  2086 // see eiklbx.cpp) can be used for marking in lists and editors.    
  2121 TBool CAknAppUi::SimulateHashKeyMarkingEventL(const TWsEvent& aEvent)
  2087 TBool CAknAppUi::SimulateHashKeyMarkingEvent(const TWsEvent& aEvent)
  2122     {
  2088     {
  2123     TInt eventType = aEvent.Type();        
  2089     TInt eventType = aEvent.Type();        
  2124         
  2090         
  2125     if (iExtension && 
  2091     if (iExtension && 
  2126         iExtension->iFlags[CAknAppUiExtension::EHashKeyMarking] &&
  2092         iExtension->iFlags[CAknAppUiExtension::EHashKeyMarking] &&