camerauis/cameraapp/generic/src/CamStillPostCaptureView.cpp
branchRCL_3
changeset 24 bac7acad7cb3
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Still image Post-capture view class for Camera application*
       
    15 */
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 #include "CamAppUiBase.h"
       
    21 #include "CamAppController.h"
       
    22 #include "CamStillPostCaptureView.h"
       
    23 #include "CamPostCaptureContainer.h"
       
    24 #include "CamLogger.h"
       
    25 #include "CamAppUi.h"
       
    26 #include <eikmenub.h>
       
    27 #include <StringLoader.h>
       
    28 #include <AknQueryDialog.h>
       
    29 #include <AiwCommon.hrh>
       
    30 #include <akntoolbar.h>
       
    31 #include <aknbutton.h>
       
    32 #include "CamUtility.h"
       
    33 
       
    34 #include "Cam.hrh"
       
    35 
       
    36 #include <cameraapp.rsg>
       
    37 #include <vgacamsettings.rsg>
       
    38 
       
    39 #include <sendnorm.rsg>
       
    40 #include <sendui.h>
       
    41 #ifndef __WINS__
       
    42 //#include <SFIUtilsAppInterface.h>
       
    43 
       
    44 #include <aknnotewrappers.h>  // CAknInformationNote
       
    45 #endif
       
    46 
       
    47 #include "camactivepalettehandler.h"
       
    48 #include "camoneclickuploadutility.h"
       
    49 #include "CameraUiConfigManager.h"
       
    50 #include "OstTraceDefinitions.h"
       
    51 #ifdef OST_TRACE_COMPILER_IN_USE
       
    52 #include "CamStillPostCaptureViewTraces.h"
       
    53 #endif
       
    54 
       
    55 
       
    56 //CONSTANTS
       
    57 _LIT( KCamImageMimeType, "image/jpeg" );
       
    58 
       
    59 // ========================= MEMBER FUNCTIONS ================================
       
    60 
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CCamStillPostCaptureView::NewLC
       
    64 // Symbian OS two-phased constructor
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CCamStillPostCaptureView* CCamStillPostCaptureView::NewLC( CCamAppController& aController )
       
    68     {
       
    69     CCamStillPostCaptureView* self = 
       
    70         new( ELeave ) CCamStillPostCaptureView( aController );
       
    71 
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL();
       
    74 
       
    75     return self;
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CCamStillPostCaptureView destructor
       
    80 // 
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 CCamStillPostCaptureView::~CCamStillPostCaptureView()
       
    84   {
       
    85   }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CCamStillPostCaptureView::Id
       
    89 // Returns UID of view
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 TUid CCamStillPostCaptureView::Id() const
       
    93     {
       
    94     return TUid::Uid( ECamViewIdStillPostCapture );
       
    95     }
       
    96   
       
    97 // -----------------------------------------------------------------------------
       
    98 // CCamStillPostCaptureView::HandleCommandL
       
    99 // Handle commands
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CCamStillPostCaptureView::HandleCommandL( TInt aCommand )
       
   103     {
       
   104     PRINT1( _L("Camera => CCamStillPostCaptureView::HandleCommandL (%d)"), aCommand )
       
   105     switch ( aCommand )
       
   106         {
       
   107         case EAknSoftkeySelect: 
       
   108             {
       
   109             CCamAppUiBase* appUi =  static_cast<CCamAppUiBase*>( AppUi() );    
       
   110             if ( ECamImageCaptureTimeLapse == appUi->CurrentBurstMode() )     
       
   111                 {
       
   112                 CCamPostCaptureViewBase::HandleCommandL( aCommand );
       
   113                 }        
       
   114             // In post-capture select key is disabled when embedded 
       
   115             else if ( !iEmbedded ) 
       
   116                 {
       
   117                 CEikMenuBar* menuBar = MenuBar();
       
   118                 if ( menuBar )
       
   119                     {
       
   120                     menuBar->SetMenuTitleResourceId( ROID(R_CAM_STILL_POST_CAPTURE_OK_MENUBAR_ID));
       
   121                     menuBar->TryDisplayMenuBarL();
       
   122                     menuBar->SetMenuTitleResourceId( ROID(R_CAM_STILL_POST_CAPTURE_MENUBAR_ID));
       
   123                     }
       
   124                 CCamPostCaptureViewBase::HandleCommandL( aCommand );
       
   125                 }
       
   126             else
       
   127                 {
       
   128                 AppUi()->HandleCommandL( ECamCmdSelect );
       
   129                 }
       
   130             }
       
   131             break;
       
   132         case ECamCmdDeleteSequence:
       
   133             {
       
   134             if ( DisplayDeleteSequenceNoteL() )
       
   135                 {
       
   136                 HandleCommandL( ECamCmdNewPhoto );
       
   137                 }
       
   138             }
       
   139             break;
       
   140         case ECamCmdSendToCallerMultimedia:
       
   141 /* In-Call-Send no longer used, skip to case ECamQuickSend.
       
   142             {
       
   143 #ifndef __WINS__
       
   144             DoInCallSendL();
       
   145 #endif
       
   146             }
       
   147             break;
       
   148 */
       
   149     case ECamCmdQuickSend:
       
   150       {
       
   151 /*#ifndef __WINS__
       
   152       if( iSFIUtils->IsCLIValidL() )
       
   153         { 
       
   154         DoInCallSendL();
       
   155         }
       
   156       else
       
   157 #endif // __WINS__*/
       
   158         //{
       
   159         DoSendAsL();
       
   160         //}
       
   161       }
       
   162       break;
       
   163             
       
   164         case ECamCmdRenameImage:
       
   165             {
       
   166             CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );;
       
   167             QueryRenameL( ECamControllerImage );
       
   168             // inform the Media gallery of name change
       
   169             TRAPD( ignore,
       
   170                 appUi->HandleControllerEventL( ECamEventMediaFileChanged, KErrNone ) );
       
   171             if ( ignore )
       
   172                 {
       
   173                 // Do nothing (removes build warning)
       
   174                 }           
       
   175             break;
       
   176             }
       
   177 
       
   178     case ECamCmdPrint:
       
   179           {
       
   180           PRINT( _L("Camera => CCamStillPostCaptureView::HandleCommandL PRINT"))
       
   181 
       
   182       CAiwGenericParamList& inParams  = iAiwServiceHandler->InParamListL();
       
   183             CAiwGenericParamList& outParams = iAiwServiceHandler->OutParamListL();
       
   184             // Add file path to AIW parameters
       
   185             TAiwVariant variant( iController.CurrentFullFileName() );
       
   186             TAiwGenericParam param( EGenericParamFile, variant );
       
   187             inParams.AppendL( param );
       
   188 
       
   189             iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdPrint, inParams, outParams );
       
   190             // we are 'embedding' Edit & Print apps
       
   191             static_cast<CCamAppUiBase*>( AppUi() ) ->SetEmbedding( ETrue );
       
   192             }
       
   193       break;
       
   194         case ECamCmdPrintPlugin:
       
   195             {
       
   196             // we are 'embedding' Edit & Print apps
       
   197             PRINT( _L("Camera => CCamStillPostCaptureView::HandleCommandL ECamCmdPrintPlugin"))
       
   198             static_cast<CCamAppUiBase*>( AppUi() ) ->SetEmbedding( ETrue );            
       
   199             }
       
   200             break;
       
   201          
       
   202         case ECamCmdPrintIntent:
       
   203             {
       
   204             // we are 'embedding' Edit & Print apps
       
   205             PRINT( _L("Camera => CCamStillPostCaptureView::HandleCommandL ECamCmdPrintIntent"))
       
   206             static_cast<CCamAppUiBase*>( AppUi() ) ->SetEmbedding( ETrue );            
       
   207             }
       
   208             break;
       
   209 
       
   210         default:
       
   211             {
       
   212             PRINT1( _L("Camera => CCamStillPostCaptureView::HandleCommandL default cmd (%d)"), aCommand )
       
   213             // Handle AIW commands
       
   214             TInt aiwServiceCmd = iAiwServiceHandler->ServiceCmdByMenuCmd( aCommand );
       
   215             if ( aiwServiceCmd != KAiwCmdNone )
       
   216                 {
       
   217                 PRINT( _L("CCamStillPostCaptureView::HandleCommandL AIW command enabling prevention of timeout") );
       
   218 
       
   219                 CAiwGenericParamList& inParams  = iAiwServiceHandler->InParamListL();
       
   220                 CAiwGenericParamList& outParams = iAiwServiceHandler->OutParamListL();
       
   221                 // Add file path to AIW parameters
       
   222                 TAiwVariant variant( iController.CurrentFullFileName() );
       
   223                 TAiwGenericParam param( EGenericParamFile, variant );
       
   224                 inParams.AppendL( param );
       
   225 
       
   226                 TCamOrientation orientation = static_cast<CCamAppUiBase*>( AppUi() )->CamOrientation();              
       
   227 
       
   228                 // Don't add the mime type if uploading, since Share client 
       
   229                 // will figure it out from the file
       
   230                 if ( aiwServiceCmd != KAiwCmdUpload ) 
       
   231                     {
       
   232                     // Set as contact call image needs image MIME type as AIW param
       
   233                     // Set as wall paper requires MIME type also.
       
   234                     TAiwVariant variant2( KCamImageMimeType );
       
   235                     TAiwGenericParam param2( EGenericParamMIMEType, variant2 );
       
   236                     inParams.AppendL( param2 );
       
   237                     }
       
   238                 
       
   239                 iAiwServiceHandler->ExecuteMenuCmdL( aCommand, inParams, outParams, 0, this );
       
   240                 PRINT( _L("CCamStillPostCaptureView::HandleCommandL AIW command") );
       
   241 
       
   242                 // To let camera draw the captured image after assigning an image 
       
   243                 // to contact from postcapture view, don't set iEmbedding to ETrue 
       
   244                 // when assign an image to contact from postcapture view.
       
   245                 if (  ECamCmdEditVideo != aCommand  ) 
       
   246                     { 
       
   247                     // We are 'embedding' Edit & Print apps
       
   248                     static_cast<CCamAppUiBase*>( AppUi() ) ->SetEmbedding( ETrue );
       
   249                     }
       
   250                 }
       
   251             else
       
   252                 {
       
   253                 CCamPostCaptureViewBase::HandleCommandL( aCommand );
       
   254                 }
       
   255             }
       
   256         }
       
   257     }
       
   258 
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // CCamStillPostCaptureView::DoActivateL
       
   262 // Activates the view
       
   263 // -----------------------------------------------------------------------------
       
   264 //
       
   265 void CCamStillPostCaptureView::DoActivateL(
       
   266         const TVwsViewId& aPreViewId,
       
   267         TUid aCustomMessageId,
       
   268         const TDesC8& aCustomMessage )
       
   269     {
       
   270     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMSTILLPOSTCAPTUREVIEW_DOACTIVATEL, "e_CCamStillPostCaptureView_DoActivateL 1" );
       
   271     PRINT( _L("Camera => CCamStillPostCaptureView::DoActivateL"))
       
   272     PERF_EVENT_START_L2( EPerfEventStillPostCaptureViewActivation );
       
   273     CCamAppUi* appUi =  static_cast<CCamAppUi*>( AppUi() );
       
   274 
       
   275     TBool timeLapseOn = (ECamImageCaptureTimeLapse == appUi->CurrentBurstMode());
       
   276 
       
   277     // Ensure the correct menu is used for the current mode.
       
   278     CEikMenuBar* menuBar = MenuBar();
       
   279     if ( menuBar )
       
   280         {
       
   281         if ( timeLapseOn )
       
   282             {
       
   283             menuBar->SetMenuTitleResourceId(
       
   284                     ROID(R_CAM_TIMELAPSE_POST_CAPTURE_MENUBAR_ID));
       
   285             }
       
   286         else        
       
   287             {
       
   288             menuBar->SetMenuTitleResourceId(
       
   289                     ROID(R_CAM_STILL_POST_CAPTURE_MENUBAR_ID));
       
   290             }
       
   291         }
       
   292     /*if ( iController.IsTouchScreenSupported() )
       
   293         {
       
   294         if ( appUi->IsSecondCameraEnabled() )
       
   295             {
       
   296             if ( iOneClickUploadUtility->OneClickUploadSupported() )
       
   297                 {
       
   298                 TInt resourceId = appUi->IsQwerty2ndCamera()? 
       
   299                               R_CAM_STILL_POSTCAPTURE_TOOLBAR_LANDSCAPE_UPLOAD:
       
   300                               R_CAM_STILL_POSTCAPTURE_TOOLBAR_PORTRAIT_UPLOAD; 
       
   301                 //CreateAndSetToolbarL( resourceId );
       
   302                 }
       
   303             else
       
   304                 {
       
   305                 TInt resourceId = appUi->IsQwerty2ndCamera()? 
       
   306                               R_CAM_STILL_POSTCAPTURE_TOOLBAR_LANDSCAPE:
       
   307                               R_CAM_STILL_POSTCAPTURE_TOOLBAR_PORTRAIT; 
       
   308                 CreateAndSetToolbarL( resourceId );
       
   309                 }
       
   310             }
       
   311         else
       
   312             {
       
   313             if ( iOneClickUploadUtility->OneClickUploadSupported() )
       
   314                 {
       
   315                 CreateAndSetToolbarL(
       
   316                         R_CAM_STILL_POSTCAPTURE_TOOLBAR_UPLOAD );
       
   317                 }
       
   318             else
       
   319                 {
       
   320                 CreateAndSetToolbarL(
       
   321                         R_CAM_STILL_POSTCAPTURE_TOOLBAR );                   
       
   322                 }
       
   323             }
       
   324         }*/
       
   325 
       
   326     iAiwServiceHandler->Reset();
       
   327     CCamPostCaptureViewBase::DoActivateL(
       
   328             aPreViewId, aCustomMessageId, aCustomMessage );
       
   329 
       
   330     PERF_EVENT_END_L2( EPerfEventStillPostCaptureViewActivation );    
       
   331     //iAiwServiceHandler->Reset();
       
   332     // attach interest for PRINT from Active Toolbar
       
   333     iAiwServiceHandler->AttachL( R_CAM_MOVE_TO_STILL_IMAGE_INTEREST_AT );
       
   334 
       
   335     iAiwServiceHandler->AttachMenuL( ROID(R_CAM_STILL_POST_CAPTURE_MENU_ID), 
       
   336             R_CAM_MOVE_TO_STILL_IMAGE_INTEREST );         
       
   337 
       
   338     iAiwServiceHandler->AttachMenuL( ROID( R_CAM_STILL_POST_CAPTURE_MENU_ID),
       
   339             R_CAM_SHARE_ON_OVI_INTEREST );
       
   340 
       
   341     // SHARE_AIW
       
   342     iAiwServiceHandler->AttachMenuL( ROID( R_CAM_STILL_POST_CAPTURE_MENU_ID),
       
   343             R_CAM_AIW_VIEW_INTEREST );
       
   344 
       
   345     if ( iController.IntegerSettingValue(ECamSettingItemPhotoEditorSupport) != ECamNoEditorSupport )
       
   346         {    
       
   347         iAiwServiceHandler->AttachMenuL( ROID( R_CAM_STILL_POST_CAPTURE_MENU_ID), 
       
   348                 R_CAM_SET_AS_CALL_IMAGE_INTEREST_EDITOR );
       
   349         }
       
   350     else
       
   351         {
       
   352         iAiwServiceHandler->AttachMenuL( ROID( R_CAM_STILL_POST_CAPTURE_MENU_ID), 
       
   353                     R_CAM_SET_AS_CALL_IMAGE_INTEREST );
       
   354         }
       
   355     
       
   356     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMSTILLPOSTCAPTUREVIEW_DOACTIVATEL, "e_CCamStillPostCaptureView_DoActivateL 0" );
       
   357     }
       
   358 
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // CCamStillPostCaptureView::DisplayDeleteNoteL()
       
   362 // Display the delete confirmation note
       
   363 // -----------------------------------------------------------------------------
       
   364 //
       
   365 TBool CCamStillPostCaptureView::DisplayDeleteNoteL()
       
   366     {
       
   367     // Display the delete confirmation note
       
   368     TInt err = KErrNone;
       
   369     HBufC* confirmationText;
       
   370     confirmationText = StringLoader::LoadLC( R_CAM_STILL_POST_CAPTURE_DELETE_NOTE_TEXT );
       
   371     CAknQueryDialog* confirmationDialog = new( ELeave )CAknQueryDialog( *confirmationText );
       
   372     CleanupStack::PopAndDestroy( confirmationText );
       
   373     if ( confirmationDialog->ExecuteLD( R_CAM_STILL_POST_CAPTURE_DELETE_NOTE ) )
       
   374         {
       
   375         if ( iEmbedded )
       
   376             {
       
   377             //To prevent sofkeys blinking when capturing, we need to blank
       
   378             //the softkeys here
       
   379             BlankSoftkeysL();
       
   380             Cba()->DrawNow();
       
   381             }
       
   382         err = iController.DeleteCurrentFile();
       
   383         if ( err ) 
       
   384             {
       
   385             User::Leave( err );
       
   386             }
       
   387         return ETrue;
       
   388         }                
       
   389     else
       
   390         {
       
   391         return EFalse;
       
   392         }
       
   393     }
       
   394     
       
   395 // -----------------------------------------------------------------------------
       
   396 // CCamStillPostCaptureView::DisplayDeleteSequenceNoteL()
       
   397 // Display the delete confirmation note for a sequence of images
       
   398 // -----------------------------------------------------------------------------
       
   399 //
       
   400 TBool CCamStillPostCaptureView::DisplayDeleteSequenceNoteL()
       
   401     {
       
   402     // Display the delete sequence confirmation note
       
   403     HBufC* confirmationText;
       
   404 
       
   405     confirmationText = StringLoader::LoadLC( R_CAM_BURST_DELETE_MULTIPLE_NOTE_TEXT, iController.TimeLapseImageCount() );    
       
   406     
       
   407     // Create the dialog with the text, and show it to the user
       
   408     CAknQueryDialog* confirmationDialog = new( ELeave )CAknQueryDialog( *confirmationText );
       
   409     CleanupStack::PopAndDestroy( confirmationText );
       
   410 
       
   411     if ( confirmationDialog->ExecuteLD( R_CAM_BURST_DELETE_MULTIPLE_NOTE ) )
       
   412         {
       
   413         iController.DeleteTimeLapseFiles(); 
       
   414         return ETrue;
       
   415         }                
       
   416     else
       
   417         {
       
   418         return EFalse;
       
   419         }     
       
   420     }    
       
   421 
       
   422 // ---------------------------------------------------------------------------
       
   423 // CCamStillPostCaptureView::CCamStillPostCaptureView
       
   424 // C++ constructor
       
   425 // ---------------------------------------------------------------------------
       
   426 //
       
   427 CCamStillPostCaptureView::CCamStillPostCaptureView( CCamAppController& aController )
       
   428     : CCamPostCaptureViewBase( aController )
       
   429     {
       
   430     }
       
   431 
       
   432 // ---------------------------------------------------------------------------
       
   433 // CCamStillPostCaptureView::ConstructL
       
   434 // Symbian OS 2nd phase constructor
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 void CCamStillPostCaptureView::ConstructL()
       
   438     {
       
   439     BaseConstructL( ROID(R_CAM_STILL_POST_CAPTURE_VIEW_ID));
       
   440     CCamPostCaptureViewBase::ConstructL();
       
   441   
       
   442 	iRockerKeyPress = EFalse;
       
   443     }
       
   444 
       
   445 
       
   446 // ---------------------------------------------------------------------------
       
   447 // CCamStillPostCaptureView::DoDeactivate
       
   448 // Deactivate this view
       
   449 // ---------------------------------------------------------------------------
       
   450 //
       
   451 void CCamStillPostCaptureView::DoDeactivate()
       
   452     {
       
   453     CCamPostCaptureViewBase::DoDeactivate();
       
   454     }
       
   455 
       
   456 // ---------------------------------------------------------------------------
       
   457 // CCamStillPostCaptureView::SetTitlePaneTextL
       
   458 // Set the view's title text
       
   459 // ---------------------------------------------------------------------------
       
   460 //
       
   461 void CCamStillPostCaptureView::SetTitlePaneTextL()
       
   462     {   
       
   463     TBool titleAlwaysShowsFileName = EFalse;
       
   464   
       
   465     CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() );
       
   466     if ( appUi->CamOrientation() == ECamOrientationViewMode ||
       
   467               titleAlwaysShowsFileName )
       
   468         {
       
   469         appUi->SetTitleL( iController.CurrentImageName() );
       
   470         }
       
   471     }
       
   472 
       
   473 
       
   474 // ---------------------------------------------------------------------------
       
   475 // CCamStillPostCaptureView::ProcessCommandL
       
   476 // Handling ECamCmdToggleActiveToolbar from any of the PostCaptureView's
       
   477 // either Image/Video. 
       
   478 // ---------------------------------------------------------------------------
       
   479 //
       
   480 void CCamStillPostCaptureView::ProcessCommandL( TInt aCommand )
       
   481     {
       
   482     CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() );
       
   483     TCamOrientation orientation = appUi->CamOrientation();
       
   484     if( orientation == ECamOrientationCamcorder || 
       
   485         orientation == ECamOrientationCamcorderLeft ||
       
   486         orientation == ECamOrientationPortrait )
       
   487         {
       
   488         if ( aCommand == ECamCmdToggleActiveToolbar )
       
   489             {
       
   490             CCamPostCaptureViewBase::HandleCommandL( aCommand );
       
   491             }
       
   492          else
       
   493             {
       
   494 			CAknView::ProcessCommandL( aCommand );	            
       
   495             }
       
   496         }
       
   497     else 
       
   498         {
       
   499         if ( aCommand == EAknSoftkeyContextOptions && !iRockerKeyPress )
       
   500             {
       
   501             iRockerKeyPress = ETrue;
       
   502             MenuBar()->SetContextMenuTitleResourceId( ROID(R_CAM_STILL_POST_CAPTURE_MENUBAR_ID) );
       
   503             // Here we launch the Context Options by Hiding Help and Exit
       
   504             // Check DynInitMenuPaneL() method and search for iRockerKeyPress for more details
       
   505             MenuBar()->SetMenuType( CEikMenuBar::EMenuContext );
       
   506             MenuBar()->TryDisplayMenuBarL();
       
   507             // Here we again set back the type of menu to "Options" when pressed LSK
       
   508             MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions );
       
   509             }
       
   510         else
       
   511             {
       
   512             CAknView::ProcessCommandL( aCommand );
       
   513             }
       
   514         }
       
   515     // CALL THE BASE CLASS
       
   516     
       
   517     }
       
   518     
       
   519 // ---------------------------------------------------------------------------
       
   520 // CCamStillPostCaptureView::DynInitMenuPaneL
       
   521 // Changes MenuPane dynamically
       
   522 // ---------------------------------------------------------------------------
       
   523 //
       
   524 void CCamStillPostCaptureView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   525     {
       
   526     CCamPostCaptureViewBase::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   527   
       
   528     if ( iAiwServiceHandler && iAiwServiceHandler->IsAiwMenu( aResourceId ) )
       
   529         {
       
   530         CAiwGenericParamList& paramList = iAiwServiceHandler->InParamListL();
       
   531         TAiwVariant variant( iController.CurrentFullFileName() );
       
   532         TAiwGenericParam param( EGenericParamFile, variant );
       
   533         paramList.AppendL( param );
       
   534 
       
   535         // Set as contact call image needs image MIME type as AIW param
       
   536         TCamOrientation orientation = static_cast<CCamAppUiBase*>( AppUi() )->CamOrientation();              
       
   537 
       
   538         TAiwVariant variant2(  KCamImageMimeType );
       
   539         TAiwGenericParam param2( EGenericParamMIMEType, variant2 );
       
   540         paramList.AppendL( param2 );
       
   541 
       
   542         iAiwServiceHandler->InitializeMenuPaneL(
       
   543             *aMenuPane, 
       
   544             aResourceId, 
       
   545             ECamCmdAIWCommands, 
       
   546             paramList );
       
   547         }
       
   548 
       
   549     if ( iAiwServiceHandler )
       
   550         {
       
   551         // handle any AIW menu cascades
       
   552         if ( iAiwServiceHandler->HandleSubmenuL( *aMenuPane ) )
       
   553             {
       
   554             return;
       
   555             }
       
   556         }
       
   557 
       
   558     if ( aResourceId == ROID( R_CAM_STILL_POST_CAPTURE_MENU_ID ) ||
       
   559          aResourceId == ROID( R_CAM_STILL_POST_CAPTURE_OK_MENU_ID ) )
       
   560         {
       
   561         TInt itemPos = 0;
       
   562         if ( aMenuPane->MenuItemExists( ECamCmdSendToCallerMultimedia, itemPos ) )
       
   563             {
       
   564             aMenuPane->SetItemDimmed(
       
   565                 ECamCmdSendToCallerMultimedia, ETrue );
       
   566             }
       
   567         
       
   568 		TInt editorSupport = iController.IntegerSettingValue(ECamSettingItemPhotoEditorSupport);
       
   569         
       
   570 		if( editorSupport == ECamNoEditorSupport || 
       
   571 			editorSupport == ECamEditorSupportInOptions )
       
   572             {
       
   573 			if ( aMenuPane->MenuItemExists( ECamCmdSend, itemPos ) )
       
   574 				{
       
   575 				aMenuPane->SetItemDimmed(
       
   576 					ECamCmdSend, ETrue );
       
   577 				}
       
   578 			}
       
   579 		if( editorSupport == ECamNoEditorSupport || 
       
   580 			editorSupport == ECamEditorSupportInToolbar )
       
   581 			{
       
   582 			if ( aMenuPane->MenuItemExists( ECamCmdEditPhoto, itemPos ) )
       
   583 				{
       
   584 				aMenuPane->SetItemDimmed(
       
   585 					ECamCmdEditPhoto, ETrue );
       
   586 				}			
       
   587 			}
       
   588 			
       
   589         /*
       
   590          * MSK : ContextOptions --> We just hide Help and Exit from the Options Menu when
       
   591          *       the MSK is pressed in the postcapture still view
       
   592          *       iRockerKeyPress represents MSK key event in still postcapture view
       
   593          */
       
   594         if ( aMenuPane->MenuItemExists( EAknCmdHelp, itemPos ) &&
       
   595              aMenuPane->MenuItemExists( ECamCmdInternalExit, itemPos ) )
       
   596             {
       
   597             if ( iRockerKeyPress )
       
   598                 { // We hide Help and Exit
       
   599                 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   600                 aMenuPane->SetItemDimmed( ECamCmdInternalExit, ETrue );
       
   601                 iRockerKeyPress = EFalse;
       
   602                 }
       
   603             else
       
   604                 { // We show Help and Exit
       
   605                 aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   606                 aMenuPane->SetItemDimmed( ECamCmdInternalExit, EFalse );	
       
   607                 }
       
   608             }
       
   609         }
       
   610     }
       
   611 
       
   612 // ---------------------------------------------------------------------------
       
   613 // CCamStillPostCaptureView::HandleNotifyL
       
   614 // Handles any notification caused by asynchronous ExecuteCommandL
       
   615 // or event.
       
   616 // ---------------------------------------------------------------------------
       
   617 //
       
   618 TInt CCamStillPostCaptureView::HandleNotifyL(
       
   619     TInt /*aCmdId*/,
       
   620     TInt aEventId,
       
   621     CAiwGenericParamList& /*aEventParamList*/,
       
   622     const CAiwGenericParamList& /*aInParamList*/ )
       
   623     {
       
   624     //AIW fails to assign. eg. the contact is locked for being used now.    
       
   625     if ( aEventId == KAiwEventError && iController.IsAppUiAvailable() )
       
   626       {
       
   627       CCamAppUi* appUi =  static_cast<CCamAppUi*>( AppUi() );
       
   628       TRAP_IGNORE( appUi->HandleCameraErrorL( KErrInUse ) );
       
   629       }    
       
   630     return 0;
       
   631     }
       
   632     
       
   633 
       
   634 // ---------------------------------------------------------------------------
       
   635 // CCamStillPostCaptureView::DynInitToolbarL
       
   636 // Dynamically initialize toolbar contents
       
   637 // ---------------------------------------------------------------------------
       
   638 //
       
   639 void CCamStillPostCaptureView::DynInitToolbarL( TInt aResourceId, 
       
   640                                        CAknToolbar* aToolbar )
       
   641     {
       
   642     PRINT2( _L("Camera => CCamStillPostCaptureView::DynInitToolbarL(%d, 0x%X)" ), aResourceId, aToolbar );
       
   643     (void)aResourceId; //remove compiler warning
       
   644 
       
   645     if( aToolbar && iController.IsTouchScreenSupported() )
       
   646         {
       
   647         // HideItem will not do anything if a button for the given
       
   648         // command ID is not found.
       
   649 		if( iEmbedded )
       
   650 			{
       
   651 			aToolbar->HideItem( ECamCmdSend, ETrue, EFalse );
       
   652 			aToolbar->HideItem( ECamCmdEdit, ETrue, EFalse );
       
   653 			aToolbar->HideItem( ECamCmdPhotos, ETrue, EFalse );
       
   654 			aToolbar->HideItem( ECamCmdOneClickUpload, ETrue, EFalse );
       
   655 			aToolbar->HideItem( ECamCmdDelete, ETrue, EFalse );
       
   656 			}
       
   657 		else
       
   658 			{
       
   659 			TInt editorSupport = iController.IntegerSettingValue(ECamSettingItemPhotoEditorSupport);
       
   660             if( editorSupport == ECamEditorSupportInToolbar )
       
   661                 {
       
   662                 aToolbar->RemoveItem( ECamCmdSend );
       
   663                 CAknButton* editButton = dynamic_cast<CAknButton*>(aToolbar->ControlOrNull( ECamCmdEdit ));
       
   664                 if( editButton )
       
   665                     {
       
   666                     CAknButtonState* state = editButton->State();
       
   667                     if( state )
       
   668                         {
       
   669                         HBufC* helpText = StringLoader::LoadLC( R_QTN_LCAM_TT_IMAGE_EDITOR );
       
   670                         state->SetHelpTextL(*helpText);
       
   671                         CleanupStack::PopAndDestroy(helpText);
       
   672                         }
       
   673                     }
       
   674                 }
       
   675             else
       
   676                 {
       
   677                 aToolbar->RemoveItem( ECamCmdEdit );
       
   678                 }
       
   679             
       
   680             if(iOneClickUploadUtility->OneClickUploadSupported())
       
   681                 {
       
   682                 aToolbar->RemoveItem( ECamCmdPhotos );
       
   683                 }
       
   684             else
       
   685                 {
       
   686                 aToolbar->RemoveItem( ECamCmdOneClickUpload );
       
   687                 }
       
   688 			}
       
   689         }
       
   690     
       
   691     PRINT2( _L("Camera <= CCamStillPostCaptureView::DynInitToolbarL(%d, 0x%X)" ), aResourceId, aToolbar );
       
   692     }
       
   693 
       
   694 //  End of File