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