camerauis/cameraapp/generic/src/CamStandbyContainer.cpp
branchRCL_3
changeset 13 38fb6f7eacd5
parent 10 8c55c525d5d7
child 17 8f559c47d7fd
equal deleted inserted replaced
12:51dda465e618 13:38fb6f7eacd5
    27 #include "CamTimer.h"
    27 #include "CamTimer.h"
    28 #include "Cam.hrh"
    28 #include "Cam.hrh"
    29 #include "CamUtility.h"
    29 #include "CamUtility.h"
    30 #include "CamAppUi.h"
    30 #include "CamAppUi.h"
    31 #include "CamViewBase.h"
    31 #include "CamViewBase.h"
       
    32 #include "CamPanic.h"
    32 #include <cameraapp.rsg>
    33 #include <cameraapp.rsg>
    33 #include <vgacamsettings.rsg>
    34 #include <vgacamsettings.rsg>
    34 #include <ctsydomainpskeys.h>
    35 #include <ctsydomainpskeys.h>
    35 
    36 
    36 // CONSTANTS
    37 // CONSTANTS
    95     // conversion (Arabic right to left) because the app 
    96     // conversion (Arabic right to left) because the app 
    96     // will do it via 
    97     // will do it via 
    97     // AknBidiTextUtils::ConvertToVisualAndWrapToStringL
    98     // AknBidiTextUtils::ConvertToVisualAndWrapToStringL
    98     iText->UseLogicalToVisualConversion( EFalse );
    99     iText->UseLogicalToVisualConversion( EFalse );
    99 
   100 
   100     // Get label text from resource
   101     SetStandbyErrorL( aError );
       
   102     
       
   103 
       
   104     // Initialise foreground timer - used to delay the exit
       
   105     // from standby when foreground is gained
       
   106     iForegroundTimer = CCamTimer::NewL( KForegroundDelayTimeout,
       
   107                   TCallBack( CCamStandbyContainer::ForegroundTimeout, this ) );
       
   108 
       
   109     // Make sure fixed toolbar is on top of this window
       
   110     DrawableWindow()->SetOrdinalPosition( KCamPreCaptureWindowOrdinalPos );
       
   111     }
       
   112     
       
   113 // ---------------------------------------------------------------------------
       
   114 // CCamStandbyContainer::CCamStandbyContainer
       
   115 // C++ constructor
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CCamStandbyContainer::CCamStandbyContainer( CCamAppController& aController,
       
   119                                                         CAknView& aView, TInt aError )
       
   120 : CCamContainerBase( aController, aView ), iStandbyError( aError )
       
   121     {
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------
       
   125 // CCamStandbyContainer::CountComponentControls
       
   126 // Returns the number of controls owned
       
   127 // ---------------------------------------------------------
       
   128 //
       
   129 TInt CCamStandbyContainer::CountComponentControls() const
       
   130     {
       
   131     TInt count = 1;
       
   132     return count; // Return the number of controls inside this container
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------
       
   136 // CCamStandbyContainer::ComponentControl
       
   137 // Return pointer to a contained control
       
   138 // ---------------------------------------------------------
       
   139 //
       
   140 CCoeControl* CCamStandbyContainer::ComponentControl( TInt aIndex ) const
       
   141     {
       
   142     switch ( aIndex )
       
   143         {
       
   144         case 0:
       
   145             {
       
   146             return iText;
       
   147             }
       
   148         default:
       
   149             {
       
   150             return NULL;
       
   151             }
       
   152         }
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------
       
   156 // CCamStandbyContainer::Draw
       
   157 // Draw control
       
   158 // ---------------------------------------------------------
       
   159 //
       
   160 void CCamStandbyContainer::Draw( const TRect& /*aRect*/ ) const
       
   161     {
       
   162     PRINT( _L("Camera => CCamStandbyContainer::Draw"))
       
   163     CWindowGc& gc = SystemGc();
       
   164     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   165     AknsDrawUtils::Background( skin, iBgContext, gc, Rect() );
       
   166 
       
   167     // override the label color
       
   168     TRgb color;
       
   169     AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
       
   170                                             EAknsCIQsnTextColorsCG6 );
       
   171     TRAPD( ignore, AknLayoutUtils::OverrideControlColorL( *iText, 
       
   172         EColorLabelText, color ) );
       
   173     if ( ignore )
       
   174         { 
       
   175         // Do nothing ( removes build warning )
       
   176         }     
       
   177     }
       
   178 
       
   179 // ----------------------------------------------------------------
       
   180 // CCamStandbyContainer::OfferKeyEventL
       
   181 // Handles this application view's command keys
       
   182 // ----------------------------------------------------------------
       
   183 //
       
   184 TKeyResponse CCamStandbyContainer::OfferKeyEventL( 
       
   185     const TKeyEvent& aKeyEvent,
       
   186     TEventCode aType )
       
   187     {
       
   188     if ( iStandbyError != KErrNone )
       
   189         {
       
   190         return EKeyWasConsumed;
       
   191         }
       
   192 
       
   193     // if the select (OK) key is pressed
       
   194     if ( ( aType == EEventKey && aKeyEvent.iCode == EKeyOK )
       
   195         // if shutter key is pressed in main camera
       
   196         || ( aType == EEventKey && 
       
   197            ( aKeyEvent.iScanCode == iPrimaryCameraCaptureKeys[0] ||
       
   198                CCamContainerBase::IsShutterKeyL(aKeyEvent, aType) ) &&
       
   199                !static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled() )
       
   200         || ( IsCaptureKeyL(aKeyEvent, aType)) )
       
   201         {
       
   202         // in case we receive an enter key or MSK key event in standby mode
       
   203         // we should not call HandleCommandL function with ECamCmdExitStandby
       
   204         // because by default application will get a left softkey command id
       
   205         // when MSK is pressed. In standby mode left softkey command id is
       
   206         // ECamCmdExitStandby
       
   207         if ( !( ( aType == EEventKey || 
       
   208                   aType == EEventKeyDown || 
       
   209                   aType == EEventKeyUp ) && 
       
   210                 ( aKeyEvent.iScanCode == EStdKeyDevice3 ||
       
   211                   aKeyEvent.iScanCode == EStdKeyEnter ) ) )
       
   212              {
       
   213              iView.HandleCommandL( ECamCmdExitStandby );
       
   214              }
       
   215         return EKeyWasConsumed;
       
   216         }
       
   217     // handle navi-key up/down, left/right
       
   218     else if ( aType == EEventKey &&
       
   219         ( aKeyEvent.iScanCode == EStdKeyDownArrow ||
       
   220           aKeyEvent.iScanCode == EStdKeyUpArrow ||
       
   221           aKeyEvent.iScanCode == EStdKeyLeftArrow ||
       
   222           aKeyEvent.iScanCode == EStdKeyRightArrow ) )
       
   223         {
       
   224         iView.HandleCommandL( ECamCmdExitStandby );
       
   225         return EKeyWasConsumed;
       
   226         }
       
   227     else if ( ( aType == EEventKeyDown || aType == EEventKeyUp ) && 
       
   228     	      ( aKeyEvent.iScanCode != EStdKeyYes ) )
       
   229         {
       
   230         if ( aType == EEventKeyDown )
       
   231             {
       
   232             if( IsZoomKeyL(aKeyEvent, aType ) )
       
   233             	{
       
   234             	iView.HandleCommandL( ECamCmdExitStandby );
       
   235             	}
       
   236             }           
       
   237         // consume key up/down presses
       
   238         return EKeyWasConsumed;
       
   239         }
       
   240     else
       
   241         {
       
   242         return CCamContainerBase::OfferKeyEventL( aKeyEvent, aType );
       
   243         }
       
   244     }
       
   245 
       
   246 // ----------------------------------------------------------------
       
   247 // CCamStandbyContainer::HandleForegroundEvent
       
   248 // Handle foreground event
       
   249 // ----------------------------------------------------------------
       
   250 //
       
   251 void CCamStandbyContainer::HandleForegroundEventL( TBool aForeground )
       
   252     {
       
   253     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi());
       
   254     if( appUi && !appUi->IsRecoverableStatus() )
       
   255         {
       
   256         return;
       
   257         }
       
   258     if ( aForeground )
       
   259         {
       
   260         // start timer to delay exit from standby
       
   261         if ( !iForegroundTimer->IsActive() )
       
   262             {
       
   263             iForegroundTimer->StartTimer();
       
   264             }
       
   265         }
       
   266     else
       
   267         {
       
   268         // set text label as blank
       
   269         //TRAP_IGNORE( iText->SetTextL( KNullDesC ) );
       
   270         
       
   271         // cancel timer if active
       
   272         if ( iForegroundTimer->IsActive() )
       
   273             {
       
   274             iForegroundTimer->Cancel();
       
   275             }
       
   276         }
       
   277     }
       
   278     
       
   279 // ----------------------------------------------------------------
       
   280 // CCamStandbyContainer::GetStandbyError
       
   281 // Returns the current error
       
   282 // ----------------------------------------------------------------
       
   283 //
       
   284 TInt CCamStandbyContainer::GetStandbyError() const
       
   285     {
       
   286     return iStandbyError;
       
   287     }    
       
   288 
       
   289 // ----------------------------------------------------------------
       
   290 // CCamStandbyContainer::ForegroundTimeout
       
   291 // static callback function for foreground gain timeout
       
   292 // ----------------------------------------------------------------
       
   293 //
       
   294 TInt CCamStandbyContainer::ForegroundTimeout( TAny *aPtr )
       
   295     {
       
   296     return static_cast<CCamStandbyContainer*>( aPtr )->DoForegroundTimeout();
       
   297     }
       
   298 
       
   299 // ----------------------------------------------------------------
       
   300 // CCamStandbyContainer::DoForegroundTimeout
       
   301 // Implementation function for foreground gain timeout
       
   302 // ----------------------------------------------------------------
       
   303 //
       
   304 TInt CCamStandbyContainer::DoForegroundTimeout()
       
   305     {
       
   306     TRAPD( ignore, iView.HandleCommandL( ECamCmdExitStandby ) );
       
   307     if ( ignore )
       
   308         { 
       
   309         // Do nothing ( removes build warning )
       
   310         }             
       
   311     
       
   312     return EFalse;
       
   313     }
       
   314 
       
   315 // ----------------------------------------------------------------
       
   316 // CCamStandbyContainer::HandlePointerEventL
       
   317 // ----------------------------------------------------------------
       
   318 //
       
   319 void CCamStandbyContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   320     {
       
   321     RDebug::Print(_L("CCamStandbyContainer::HandlePointerEventL iType=%d iPosition=(%d, %d)"),
       
   322         aPointerEvent.iType,
       
   323         aPointerEvent.iPosition.iX,
       
   324         aPointerEvent.iPosition.iY );
       
   325       CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi());  
       
   326       if(appUi && !appUi->IsRecoverableStatus())
       
   327           return;
       
   328       TInt callType( EPSCTsyCallTypeUninitialized );
       
   329       RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
       
   330        if ( callType != EPSCTsyCallTypeH324Multimedia)
       
   331          {
       
   332     static_cast<CCamViewBase&>( iView ).HandleCommandAoL( ECamCmdExitStandby );
       
   333          }
       
   334          else
       
   335          {
       
   336          }
       
   337     }
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CCamStandbyContainer::CreateBackgroundContextL
       
   341 // -----------------------------------------------------------------------------
       
   342 //     
       
   343 void CCamStandbyContainer::CreateBackgroundContextL()
       
   344     {
       
   345     iBgContext = CAknsBasicBackgroundControlContext::NewL( 
       
   346         KAknsIIDQsnBgAreaMain, Rect(), EFalse );
       
   347     }
       
   348 
       
   349 void CCamStandbyContainer::SetStandbyErrorL( TInt aError )
       
   350     {
       
   351     iStandbyError = aError;
       
   352     __ASSERT_DEBUG( iText, CamPanic( ECamPanicNullPointer ) );
       
   353     
   101     HBufC* labelText;
   354     HBufC* labelText;
   102     if ( static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsConstructionComplete() )
   355     if ( static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsConstructionComplete() )
   103         {
   356         {
   104 	    switch( aError )
   357         switch( aError )
   105 	        {
   358             {
   106 	        case KErrNone:
   359             case KErrNone:
   107 	            labelText = StringLoader::LoadLC( R_CAM_STANDBY_TEXT );
   360                 labelText = StringLoader::LoadLC( R_CAM_STANDBY_TEXT );
   108 	            break;
   361                 break;
   109 	        case KErrInUse:
   362             case KErrInUse:
   110 	            labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_IN_USE_TEXT );
   363                 labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_IN_USE_TEXT );
   111 	            break;
   364                 break;
   112 	        case KErrNoMemory:
   365             case KErrNoMemory:
   113 	        	labelText = StringLoader::LoadLC( R_CAM_MEMLO_NOT_ENOUGH_MEMORY );
   366                 labelText = StringLoader::LoadLC( R_CAM_MEMLO_NOT_ENOUGH_MEMORY );
   114 	            break;
   367                 break;
   115 	        case KErrPermissionDenied:
   368             case KErrPermissionDenied:
   116 	            labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_DISABLED_TEXT );
   369                 labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_DISABLED_TEXT );
   117                 break;
   370                 break;
   118 	        default: // any other error
   371             case ECamErrMassStorageMode:
   119 	            labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_UNAVAILABLE_TEXT );
   372                 labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_STORAGE_INACCESSIBLE );
   120 	            break;
   373                 break;
   121 	        }
   374             case ECamErrMemoryCardNotInserted:
   122         }
   375                 labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_INSERT_MMC );
   123 	 else
   376                 break;
       
   377             default: // any other error
       
   378                 labelText = StringLoader::LoadLC( R_CAM_STANDBY_CAMERA_UNAVAILABLE_TEXT );
       
   379                 break;
       
   380             }
       
   381         }
       
   382      else
   124         {
   383         {
   125         labelText = StringLoader::LoadLC( R_CAM_STANDBY_EMPTY_TEXT );
   384         labelText = StringLoader::LoadLC( R_CAM_STANDBY_EMPTY_TEXT );
   126         }        
   385         }        
   127 
   386 
   128 
   387 
   129     iText->SetTextL( *labelText );
   388     //iText->SetTextL( *labelText );
   130     // Wrap the text, where it doesn't fit.
   389     // Wrap the text, where it doesn't fit.
   131     // ...Create the line width array necessary for ConvertToVisual..()
   390     // ...Create the line width array necessary for ConvertToVisual..()
   132     const TInt KLabelMaxLines = 5;
   391     const TInt KLabelMaxLines = 5;
   133     CArrayFix<TInt>* lineWidths = 
   392     CArrayFix<TInt>* lineWidths = 
   134         new ( ELeave ) CArrayFixFlat<TInt> ( KLabelMaxLines );
   393         new ( ELeave ) CArrayFixFlat<TInt> ( KLabelMaxLines );
   135     CleanupStack::PushL( lineWidths );
   394     CleanupStack::PushL( lineWidths );
   136     for (TInt i = 0; i < KLabelMaxLines; ++i )
   395     for (TInt i = 0; i < KLabelMaxLines; ++i )
   137         {
   396         {
   138         lineWidths->AppendL( aRect.Width() );            
   397         lineWidths->AppendL( Rect().Width() );            
   139         }
   398         }
   140     // ...Create the text buffer that will receive the wrapped text.
   399     // ...Create the text buffer that will receive the wrapped text.
       
   400     if( iWrappedLabelText )
       
   401         {
       
   402         delete iWrappedLabelText;
       
   403         iWrappedLabelText = NULL;
       
   404         }
   141     iWrappedLabelText = HBufC::NewL(
   405     iWrappedLabelText = HBufC::NewL(
   142         labelText->Length() + KLabelMaxLines * ( KAknBidiExtraSpacePerLine + 1 ) );
   406         labelText->Length() + KLabelMaxLines * ( KAknBidiExtraSpacePerLine + 1 ) );
   143     TPtr ptr = iWrappedLabelText->Des();
   407     TPtr ptr = iWrappedLabelText->Des();
   144     // ...Get the wrapped text conversion.
   408     // ...Get the wrapped text conversion.
   145     AknBidiTextUtils::ConvertToVisualAndWrapToStringL(
   409     AknBidiTextUtils::ConvertToVisualAndWrapToStringL(
   153     CleanupStack::PopAndDestroy( lineWidths );  
   417     CleanupStack::PopAndDestroy( lineWidths );  
   154     CleanupStack::PopAndDestroy( labelText );
   418     CleanupStack::PopAndDestroy( labelText );
   155 
   419 
   156     // Set the wrapped text to the label.
   420     // Set the wrapped text to the label.
   157     iText->SetTextL( *iWrappedLabelText );
   421     iText->SetTextL( *iWrappedLabelText );
   158 
   422     iText->DrawNow();
   159     // Initialise foreground timer - used to delay the exit
       
   160     // from standby when foreground is gained
       
   161     iForegroundTimer = CCamTimer::NewL( KForegroundDelayTimeout,
       
   162                   TCallBack( CCamStandbyContainer::ForegroundTimeout, this ) );
       
   163 
       
   164     // Make sure fixed toolbar is on top of this window
       
   165     DrawableWindow()->SetOrdinalPosition( KCamPreCaptureWindowOrdinalPos );
       
   166     }
       
   167     
       
   168 // ---------------------------------------------------------------------------
       
   169 // CCamStandbyContainer::CCamStandbyContainer
       
   170 // C++ constructor
       
   171 // ---------------------------------------------------------------------------
       
   172 //
       
   173 CCamStandbyContainer::CCamStandbyContainer( CCamAppController& aController,
       
   174                                                         CAknView& aView, TInt aError )
       
   175 : CCamContainerBase( aController, aView ), iStandbyError( aError )
       
   176     {
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------
       
   180 // CCamStandbyContainer::CountComponentControls
       
   181 // Returns the number of controls owned
       
   182 // ---------------------------------------------------------
       
   183 //
       
   184 TInt CCamStandbyContainer::CountComponentControls() const
       
   185     {
       
   186     TInt count = 1;
       
   187     return count; // Return the number of controls inside this container
       
   188     }
       
   189 
       
   190 // ---------------------------------------------------------
       
   191 // CCamStandbyContainer::ComponentControl
       
   192 // Return pointer to a contained control
       
   193 // ---------------------------------------------------------
       
   194 //
       
   195 CCoeControl* CCamStandbyContainer::ComponentControl( TInt aIndex ) const
       
   196     {
       
   197     switch ( aIndex )
       
   198         {
       
   199         case 0:
       
   200             {
       
   201             return iText;
       
   202             }
       
   203         default:
       
   204             {
       
   205             return NULL;
       
   206             }
       
   207         }
       
   208     }
       
   209 
       
   210 // ---------------------------------------------------------
       
   211 // CCamStandbyContainer::Draw
       
   212 // Draw control
       
   213 // ---------------------------------------------------------
       
   214 //
       
   215 void CCamStandbyContainer::Draw( const TRect& /*aRect*/ ) const
       
   216     {
       
   217     PRINT( _L("Camera => CCamStandbyContainer::Draw"))
       
   218     CWindowGc& gc = SystemGc();
       
   219     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   220     AknsDrawUtils::Background( skin, iBgContext, gc, Rect() );
       
   221 
       
   222     // override the label color
       
   223     TRgb color;
       
   224     AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
       
   225                                             EAknsCIQsnTextColorsCG6 );
       
   226     TRAPD( ignore, AknLayoutUtils::OverrideControlColorL( *iText, 
       
   227         EColorLabelText, color ) );
       
   228     if ( ignore )
       
   229         { 
       
   230         // Do nothing ( removes build warning )
       
   231         }     
       
   232     }
       
   233 
       
   234 // ----------------------------------------------------------------
       
   235 // CCamStandbyContainer::OfferKeyEventL
       
   236 // Handles this application view's command keys
       
   237 // ----------------------------------------------------------------
       
   238 //
       
   239 TKeyResponse CCamStandbyContainer::OfferKeyEventL( 
       
   240     const TKeyEvent& aKeyEvent,
       
   241     TEventCode aType )
       
   242     {
       
   243     if ( iStandbyError != KErrNone )
       
   244         {
       
   245         return EKeyWasConsumed;
       
   246         }
       
   247 
       
   248     // if the select (OK) key is pressed
       
   249     if ( ( aType == EEventKey && aKeyEvent.iCode == EKeyOK )
       
   250         // if shutter key is pressed in main camera
       
   251         || ( aType == EEventKey && 
       
   252            ( aKeyEvent.iScanCode == iPrimaryCameraCaptureKeys[0] ||
       
   253                CCamContainerBase::IsShutterKeyL(aKeyEvent, aType) ) &&
       
   254                !static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsSecondCameraEnabled() )
       
   255         || ( IsCaptureKeyL(aKeyEvent, aType)) )
       
   256         {
       
   257         // in case we receive an enter key or MSK key event in standby mode
       
   258         // we should not call HandleCommandL function with ECamCmdExitStandby
       
   259         // because by default application will get a left softkey command id
       
   260         // when MSK is pressed. In standby mode left softkey command id is
       
   261         // ECamCmdExitStandby
       
   262         if ( !( ( aType == EEventKey || 
       
   263                   aType == EEventKeyDown || 
       
   264                   aType == EEventKeyUp ) && 
       
   265                 ( aKeyEvent.iScanCode == EStdKeyDevice3 ||
       
   266                   aKeyEvent.iScanCode == EStdKeyEnter ) ) )
       
   267              {
       
   268              iView.HandleCommandL( ECamCmdExitStandby );
       
   269              }
       
   270         return EKeyWasConsumed;
       
   271         }
       
   272     // handle navi-key up/down, left/right
       
   273     else if ( aType == EEventKey &&
       
   274         ( aKeyEvent.iScanCode == EStdKeyDownArrow ||
       
   275           aKeyEvent.iScanCode == EStdKeyUpArrow ||
       
   276           aKeyEvent.iScanCode == EStdKeyLeftArrow ||
       
   277           aKeyEvent.iScanCode == EStdKeyRightArrow ) )
       
   278         {
       
   279         iView.HandleCommandL( ECamCmdExitStandby );
       
   280         return EKeyWasConsumed;
       
   281         }
       
   282     else if ( ( aType == EEventKeyDown || aType == EEventKeyUp ) && 
       
   283     	      ( aKeyEvent.iScanCode != EStdKeyYes ) )
       
   284         {
       
   285         if ( aType == EEventKeyDown )
       
   286             {
       
   287             if( IsZoomKeyL(aKeyEvent, aType ) )
       
   288             	{
       
   289             	iView.HandleCommandL( ECamCmdExitStandby );
       
   290             	}
       
   291             }           
       
   292         // consume key up/down presses
       
   293         return EKeyWasConsumed;
       
   294         }
       
   295     else
       
   296         {
       
   297         return CCamContainerBase::OfferKeyEventL( aKeyEvent, aType );
       
   298         }
       
   299     }
       
   300 
       
   301 // ----------------------------------------------------------------
       
   302 // CCamStandbyContainer::HandleForegroundEvent
       
   303 // Handle foreground event
       
   304 // ----------------------------------------------------------------
       
   305 //
       
   306 void CCamStandbyContainer::HandleForegroundEventL( TBool aForeground )
       
   307     {
       
   308     if ( aForeground )
       
   309         {
       
   310         // start timer to delay exit from standby
       
   311         if ( !iForegroundTimer->IsActive() )
       
   312             {
       
   313             iForegroundTimer->StartTimer();
       
   314             }
       
   315         }
       
   316     else
       
   317         {
       
   318         // set text label as blank
       
   319         //TRAP_IGNORE( iText->SetTextL( KNullDesC ) );
       
   320         
       
   321         // cancel timer if active
       
   322         if ( iForegroundTimer->IsActive() )
       
   323             {
       
   324             iForegroundTimer->Cancel();
       
   325             }
       
   326         }
       
   327     }
       
   328     
       
   329 // ----------------------------------------------------------------
       
   330 // CCamStandbyContainer::GetStandbyError
       
   331 // Returns the current error
       
   332 // ----------------------------------------------------------------
       
   333 //
       
   334 TInt CCamStandbyContainer::GetStandbyError() const
       
   335     {
       
   336     return iStandbyError;
       
   337     }    
       
   338 
       
   339 // ----------------------------------------------------------------
       
   340 // CCamStandbyContainer::ForegroundTimeout
       
   341 // static callback function for foreground gain timeout
       
   342 // ----------------------------------------------------------------
       
   343 //
       
   344 TInt CCamStandbyContainer::ForegroundTimeout( TAny *aPtr )
       
   345     {
       
   346     return static_cast<CCamStandbyContainer*>( aPtr )->DoForegroundTimeout();
       
   347     }
       
   348 
       
   349 // ----------------------------------------------------------------
       
   350 // CCamStandbyContainer::DoForegroundTimeout
       
   351 // Implementation function for foreground gain timeout
       
   352 // ----------------------------------------------------------------
       
   353 //
       
   354 TInt CCamStandbyContainer::DoForegroundTimeout()
       
   355     {
       
   356     TRAPD( ignore, iView.HandleCommandL( ECamCmdExitStandby ) );
       
   357     if ( ignore )
       
   358         { 
       
   359         // Do nothing ( removes build warning )
       
   360         }             
       
   361     
       
   362     return EFalse;
       
   363     }
       
   364 
       
   365 // ----------------------------------------------------------------
       
   366 // CCamStandbyContainer::HandlePointerEventL
       
   367 // ----------------------------------------------------------------
       
   368 //
       
   369 void CCamStandbyContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   370     {
       
   371     RDebug::Print(_L("CCamStandbyContainer::HandlePointerEventL iType=%d iPosition=(%d, %d)"),
       
   372         aPointerEvent.iType,
       
   373         aPointerEvent.iPosition.iX,
       
   374         aPointerEvent.iPosition.iY );
       
   375 
       
   376       TInt callType( EPSCTsyCallTypeUninitialized );
       
   377       RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
       
   378        if ( callType != EPSCTsyCallTypeH324Multimedia)
       
   379          {
       
   380     static_cast<CCamViewBase&>( iView ).HandleCommandAoL( ECamCmdExitStandby );
       
   381          }
       
   382          else
       
   383          {
       
   384          }
       
   385     }
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 // CCamStandbyContainer::CreateBackgroundContextL
       
   389 // -----------------------------------------------------------------------------
       
   390 //     
       
   391 void CCamStandbyContainer::CreateBackgroundContextL()
       
   392     {
       
   393     iBgContext = CAknsBasicBackgroundControlContext::NewL( 
       
   394         KAknsIIDQsnBgAreaMain, Rect(), EFalse );
       
   395     }
   423     }
   396 
   424 
   397 // End of File  
   425 // End of File