Revision: 201021 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:21:41 +0300
branchRCL_3
changeset 31 8f559c47d7fd
parent 27 53c8aa5d97a3
child 35 e32fcfe0045f
Revision: 201021 Kit: 2010123
camerauis/cameraapp/build/cameraapp.mmp
camerauis/cameraapp/conf/cameraapp.confml
camerauis/cameraapp/conf/cameraapp_101FFA86.crml
camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamPhotoSettingsList.cpp
camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamVideoSettingsList.cpp
camerauis/cameraapp/generic/common/inc/CamSettingsInternal.hrh
camerauis/cameraapp/generic/common/inc/CameraappPrivateCRKeys.h
camerauis/cameraapp/generic/common/inc/mcamsettingsmodel.h
camerauis/cameraapp/generic/common/src/CamStaticSettingsModel.cpp
camerauis/cameraapp/generic/data/nhdcamsettings.rss
camerauis/cameraapp/generic/data/vgacamsettings.rss
camerauis/cameraapp/generic/inc/CamAppController.h
camerauis/cameraapp/generic/inc/CamAppUi.h
camerauis/cameraapp/generic/inc/CamPostCaptureContainer.h
camerauis/cameraapp/generic/inc/CamPreCaptureContainerBase.h
camerauis/cameraapp/generic/inc/CamSettingsModel.h
camerauis/cameraapp/generic/inc/CamStillPreCaptureView.h
camerauis/cameraapp/generic/inc/CamVideoPostCaptureView.h
camerauis/cameraapp/generic/inc/CamVideoPreCaptureView.h
camerauis/cameraapp/generic/inc/camcapturebuttoncontainer.h
camerauis/cameraapp/generic/inc/cameracontroller/camcameraevents.h
camerauis/cameraapp/generic/inc/cameracontroller/camimagedecoder.h
camerauis/cameraapp/generic/inc/camtvaccessorymonitor.h
camerauis/cameraapp/generic/src/CamAppController.cpp
camerauis/cameraapp/generic/src/CamAppui.cpp
camerauis/cameraapp/generic/src/CamBurstThumbnailContainer.cpp
camerauis/cameraapp/generic/src/CamCaptureSetupContainer.cpp
camerauis/cameraapp/generic/src/CamCaptureSetupMenu.cpp
camerauis/cameraapp/generic/src/CamFileCheckAo.cpp
camerauis/cameraapp/generic/src/CamInfoListBoxContainer.cpp
camerauis/cameraapp/generic/src/CamPostCaptureContainer.cpp
camerauis/cameraapp/generic/src/CamPreCaptureContainerBase.cpp
camerauis/cameraapp/generic/src/CamPreCaptureViewBase.cpp
camerauis/cameraapp/generic/src/CamSceneSettingContainer.cpp
camerauis/cameraapp/generic/src/CamShootingModeContainer.cpp
camerauis/cameraapp/generic/src/CamStandbyContainer.cpp
camerauis/cameraapp/generic/src/CamStillPreCaptureContainer.cpp
camerauis/cameraapp/generic/src/CamStillPreCaptureView.cpp
camerauis/cameraapp/generic/src/CamUserSceneSetupContainer.cpp
camerauis/cameraapp/generic/src/CamVideoPostCaptureView.cpp
camerauis/cameraapp/generic/src/CamVideoPreCaptureContainer.cpp
camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp
camerauis/cameraapp/generic/src/CamZoomModel.cpp
camerauis/cameraapp/generic/src/camcapturebuttoncontainer.cpp
camerauis/cameraapp/generic/src/cameracontroller/camcameracontroller.cpp
camerauis/cameraapp/generic/src/cameracontroller/camimagedecoder.cpp
camerauis/cameraapp/generic/src/camoneclickuploadutility.cpp
camerauis/cameraapp/generic/src/camstartuplogo.cpp
camerauis/cameraapp/generic/src/camtvaccessorymonitor.cpp
--- a/camerauis/cameraapp/build/cameraapp.mmp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/build/cameraapp.mmp	Wed Jun 09 09:21:41 2010 +0300
@@ -193,6 +193,8 @@
 SOURCE          camsnapshotrotator.cpp
 SOURCE          camstartuplogo.cpp
 SOURCE          camstartuplogocontroller.cpp
+SOURCE          camcapturebuttoncontainer.cpp
+SOURCE          camtvaccessorymonitor.cpp
 
 // Camera controller sources
 SOURCEPATH      ../generic/src/cameracontroller
@@ -324,6 +326,8 @@
 LIBRARY SensrvClient.lib
 LIBRARY sensrvutil.lib
 
+LIBRARY svgengine.lib // For reading share SVGs
+
 #ifdef CAMERAAPP_LOGGING
 LIBRARY flogger.lib
 #endif
@@ -352,6 +356,8 @@
 LIBRARY glxmetadatadialog.lib
 
 LIBRARY thumbnailmanager.lib
+LIBRARY accclient.lib
+LIBRARY accpolicy.lib
 
 
 // ---------------------------------------------------------------------------
Binary file camerauis/cameraapp/conf/cameraapp.confml has changed
Binary file camerauis/cameraapp/conf/cameraapp_101FFA86.crml has changed
--- a/camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamPhotoSettingsList.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamPhotoSettingsList.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -241,8 +241,51 @@
 		        {
                 iDrive = static_cast<TDriveNumber>(0); //Doesn't matter
 		        }
-		    TInt includedMedias = AknCommonDialogsDynMem::EMemoryTypeMMCExternal |
-                                 AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;   
+		    TInt includedMedias(0);
+		    CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> 
+		                                ( AppUi->View( KGSCamcorderGSPluginUid ) );
+		    TInt driveCount(0);
+		    if( !parent->IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage) )
+		        {
+                includedMedias |= AknCommonDialogsDynMem::EMemoryTypePhone;
+                driveCount++;
+		        }
+		    
+		    TInt drive(0);
+		    TUint driveStatus(0);    
+		    TInt err(0);
+		    err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive );
+		    if( err == KErrNone )
+		        {
+		        err = DriveInfo::GetDriveStatus( CCoeEnv::Static()->FsSession(), 
+		                                         drive, 
+		                                         driveStatus );
+		        if( err == KErrNone )
+		            {
+                    if( ( driveStatus & DriveInfo::EDrivePresent) ==  DriveInfo::EDrivePresent )
+                        {
+                        includedMedias |= AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;
+                        driveCount++;
+                        }
+		            }
+                }
+		    
+		    err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
+            if( err == KErrNone )
+                {
+                err = DriveInfo::GetDriveStatus( CCoeEnv::Static()->FsSession(), 
+                                                 drive,
+                                                 driveStatus );
+                if( err == KErrNone )
+                    {
+                    if( ( driveStatus & DriveInfo::EDrivePresent) ==  DriveInfo::EDrivePresent )
+                        {
+                        includedMedias |= AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice;
+                        driveCount++;
+                        }
+                    }
+                }
+		    
 		    settingItem = new ( ELeave ) 
 		                  CAknMemorySelectionSettingItemMultiDrive(
 		                                                      aIdentifier,
@@ -250,7 +293,11 @@
                                                               );
 		    static_cast<CAknMemorySelectionSettingItemMultiDrive*>(settingItem)
 		                        ->SetIncludedMediasL(includedMedias);
-            }
+		    if( driveCount <= 1 )
+		        {
+                settingItem->SetHidden( ETrue );
+                }
+		    }
             break;
  
         case ECamSettingItemPhotoNameBaseType:
--- a/camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamVideoSettingsList.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamVideoSettingsList.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -240,15 +240,61 @@
                 {
                 iDrive = static_cast<TDriveNumber>(0); //Doesn't matter
                 }
-            TInt includedMedias = AknCommonDialogsDynMem::EMemoryTypeMMCExternal |
-                                 AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;   
+            TInt includedMedias(0);
+            CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> 
+                                        ( AppUi->View( KGSCamcorderGSPluginUid ) );
+            TInt driveCount(0);
+            if( !parent->IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage) )
+                {
+                includedMedias |= AknCommonDialogsDynMem::EMemoryTypePhone;
+                driveCount++;
+                }
+            
+            TInt drive(0);
+            TUint driveStatus(0);    
+            TInt err(0);
+            err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive );
+            if( err == KErrNone )
+                {
+                err = DriveInfo::GetDriveStatus( CCoeEnv::Static()->FsSession(), 
+                                                 drive, 
+                                                 driveStatus );
+                if( err == KErrNone )
+                    {
+                    if( ( driveStatus & DriveInfo::EDrivePresent) ==  DriveInfo::EDrivePresent )
+                        {
+                        includedMedias |= AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;
+                        driveCount++;
+                        }
+                    }
+                }
+            
+            err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
+            if( err == KErrNone )
+                {
+                err = DriveInfo::GetDriveStatus( CCoeEnv::Static()->FsSession(), 
+                                                 drive, 
+                                                 driveStatus );
+                if( err == KErrNone )
+                    {
+                    if( ( driveStatus & DriveInfo::EDrivePresent) ==  DriveInfo::EDrivePresent )
+                        {
+                        includedMedias |= AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice;
+                        driveCount++;
+                        }
+                    }
+                }
             settingItem = new ( ELeave ) 
                           CAknMemorySelectionSettingItemMultiDrive(
                                                               aIdentifier,
                                                               iDrive
                                                               );
             static_cast<CAknMemorySelectionSettingItemMultiDrive*>(settingItem)
-                                            ->SetIncludedMediasL(includedMedias);
+                                ->SetIncludedMediasL(includedMedias);
+            if( driveCount <= 1 )
+                {
+                settingItem->SetHidden( ETrue );
+                }
             break;
             }
         case ECamSettingItemVideoNameBaseType:
--- a/camerauis/cameraapp/generic/common/inc/CamSettingsInternal.hrh	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/common/inc/CamSettingsInternal.hrh	Wed Jun 09 09:21:41 2010 +0300
@@ -87,6 +87,7 @@
   ECamSettingItemPhotoEditorSupport,    // Support for photo editor
   ECamSettingItemVideoEditorSupport,    // Support for video editor
   ECamSettingItemRemovePhoneMemoryUsage, // Remove phone memory usage
+  ECamSettingItemStopRecordingInHdmiMode, // Stop video recording when HDMI cable is inserted
   ECamSettingItemStaticCommonRangeMax,    // Range marker for static common settings
   // -----------------------------------------------------
 
@@ -598,6 +599,7 @@
   (const TUint16* const)_S16("ItemPhotoEditorSupport"),
   (const TUint16* const)_S16("ItemVideoEditorSupport"),
   (const TUint16* const)_S16("ItemRemovePhoneMemoryUsage"),
+  (const TUint16* const)_S16("ItemStopRecordingInHdmiMode"),
   (const TUint16* const)_S16("ItemStaticCommonRangeMax"),
   // -----------------------------------------------------
   (const TUint16* const)_S16("ItemUserSceneRangeMin"),
--- a/camerauis/cameraapp/generic/common/inc/CameraappPrivateCRKeys.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/common/inc/CameraappPrivateCRKeys.h	Wed Jun 09 09:21:41 2010 +0300
@@ -95,6 +95,9 @@
 //Remove phone memory usage
 const TUint32 KCamCrRemovePhoneMemoryUsage = 0x5C;
 
+// Stops Video recording when HDMI cable is inserted
+const TUint32 KCamCrStopRecordingInHdmiMode = 0x5D;
+
 // =========================================================
 // Cameraapp variant settings file
 const TUid KCRUidCameraappVariant = {0x10208A43};
--- a/camerauis/cameraapp/generic/common/inc/mcamsettingsmodel.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/common/inc/mcamsettingsmodel.h	Wed Jun 09 09:21:41 2010 +0300
@@ -312,6 +312,19 @@
     virtual void SetPreviousSceneMode( TCamSceneId aPreviousSceneMode ) = 0;
     
     /**
+    * Sets user scene setting to default
+    */
+    virtual void SetUserSceneDefault() = 0;
+    
+    /**
+    * Handles a change in the value for the photo scene setting.
+    * That is, it updates the rest of the photo dynamic setings.
+    * @param the new scene value.
+    * @since 2.8
+    */
+    virtual void PhotoSceneHasChangedL( TInt aSettingValue ) = 0;
+    
+    /**
     * Store UserScene settings
     * @since 5.1
     */
--- a/camerauis/cameraapp/generic/common/src/CamStaticSettingsModel.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/common/src/CamStaticSettingsModel.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -99,34 +99,41 @@
 CCamStaticSettingsModel::IntegerSettingValue( TInt aSettingItem ) const
     {
     TInt value = KErrNotFound;
+    const RPointerArray<TIntSetting> *iStaticIntSettings=NULL;
     // If setting item is in the static photo settings return it's value.
     if( ECamSettingItemStaticPhotoRangeMax > aSettingItem
         && ECamSettingItemStaticPhotoRangeMin < aSettingItem )
       {
-      TInt settingIndex = SearchInSettingsListFor(
-                                                  iStaticPhotoIntSettings,
-                                                  aSettingItem );
-      value = iStaticPhotoIntSettings[settingIndex]->iValueId;
+        iStaticIntSettings=&iStaticPhotoIntSettings;
       }
     // Otherwise, if setting item is in the static video settings return it's value.
     else if( ECamSettingItemStaticVideoRangeMax > aSettingItem 
           && ECamSettingItemStaticVideoRangeMin < aSettingItem )
       {
-      TInt settingIndex = SearchInSettingsListFor( iStaticVideoIntSettings, aSettingItem );
-      value = iStaticVideoIntSettings[settingIndex]->iValueId;
+        iStaticIntSettings=&iStaticVideoIntSettings;
       }
     // Look in static common settings.
     else if( ECamSettingItemStaticCommonRangeMax > aSettingItem
           && ECamSettingItemStaticCommonRangeMin < aSettingItem )
       {
-      TInt settingIndex = SearchInSettingsListFor( iStaticCommonIntSettings, aSettingItem );
-      value = iStaticCommonIntSettings[settingIndex]->iValueId;
+        iStaticIntSettings=&iStaticCommonIntSettings;
       }
     else
       {
       PRINT( _L("Camera <> Not found, PANIC !! ECamPanicUnknownSettingItem" ))
       CamPanic( ECamPanicUnknownSettingItem );
       }
+
+    if( iStaticIntSettings )
+        {
+        TInt settingIndex = SearchInSettingsListFor(
+                                                    *iStaticIntSettings,
+                                                    aSettingItem );
+        if( settingIndex < iStaticIntSettings->Count() && settingIndex >= 0 )
+            {
+            value = (*iStaticIntSettings)[settingIndex]->iValueId;
+            }
+        }
     return value;
     }
 
@@ -732,6 +739,7 @@
       case ECamSettingItemPhotoEditorSupport: crKey = KCamCrPhotoEditorSupport; break;
       case ECamSettingItemVideoEditorSupport: crKey = KCamCrVideoEditorSupport; break;
       case ECamSettingItemRemovePhoneMemoryUsage: crKey = KCamCrRemovePhoneMemoryUsage; break;
+	  case ECamSettingItemStopRecordingInHdmiMode: crKey = KCamCrStopRecordingInHdmiMode; break;
       
       default:                                CamPanic( ECamPanicUnknownSettingItem );
                                               break;
--- a/camerauis/cameraapp/generic/data/nhdcamsettings.rss	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/data/nhdcamsettings.rss	Wed Jun 09 09:21:41 2010 +0300
@@ -386,6 +386,35 @@
 	{
 	buf = qtn_lcam_tt_video_editor;
 	}
+
+//-----------------------------------------------------------------------------
+//
+//    r_qtn_lcam_hdmi_cable_detected
+//    This popup note is displayed when HDMI cable is plugged to the device
+//    while video recording is ongoing. Video recording is not allowed
+//    with HDMI connection.
+//    popup_note_window
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_lcam_hdmi_cable_detected
+	{
+	buf = qtn_lcam_hdmi_cable_detected;
+	}
+
+//-----------------------------------------------------------------------------
+//
+//    r_qtn_lcam_hdmi_remove_cable
+//    This popup note is displayed when user tries to start 
+//    video recording while HDMI cable is plugged. 
+//    Video recording is not allowed with HDMI connection.
+//    popup_note_window
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_lcam_hdmi_remove_cable
+	{
+	buf = qtn_lcam_hdmi_remove_cable;
+	}
+
 	
 /**************************************
 *         Other structures            *
@@ -1519,7 +1548,7 @@
                                 {
                                 AVKON_BUTTON_STATE
                                     {
-                                    txt = qtn_lcam_tb_show_viewfinder_grid;
+                                    txt = qtn_lcam_tb_grid;
                                     }
                                 };
                             };
@@ -3284,6 +3313,18 @@
 
 //----------------------------------------------------
 //   
+//    r_qtn_lcam_tb_grid
+//    Text for the 'grid' button in toolbar extension
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_qtn_lcam_tb_grid 
+    {
+    buf = qtn_lcam_tb_grid;
+    }
+
+//----------------------------------------------------
+//   
 //    r_qtn_lcam_tt_videoflash
 //    Tooltip for the video button in fixed toolbar
 //
--- a/camerauis/cameraapp/generic/data/vgacamsettings.rss	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/data/vgacamsettings.rss	Wed Jun 09 09:21:41 2010 +0300
@@ -387,6 +387,35 @@
 	{
 	buf = qtn_lcam_tt_video_editor;
 	}
+
+//-----------------------------------------------------------------------------
+//
+//    r_qtn_lcam_hdmi_cable_detected
+//    This popup note is displayed when HDMI cable is plugged to the device
+//    while video recording is ongoing. Video recording is not allowed
+//    with HDMI connection.
+//    popup_note_window
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_lcam_hdmi_cable_detected
+	{
+	buf = qtn_lcam_hdmi_cable_detected;
+	}
+
+//-----------------------------------------------------------------------------
+//
+//    r_qtn_lcam_hdmi_remove_cable
+//    This popup note is displayed when user tries to start 
+//    video recording while HDMI cable is plugged. 
+//    Video recording is not allowed with HDMI connection.
+//    popup_note_window
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_lcam_hdmi_remove_cable
+	{
+	buf = qtn_lcam_hdmi_remove_cable;
+	}
+
 	
 /**************************************
 *         Other structures            *
@@ -1457,7 +1486,7 @@
                                 {
                                 AVKON_BUTTON_STATE
                                     {
-                                    txt = qtn_lcam_tb_show_viewfinder_grid;
+                                    txt = qtn_lcam_tb_grid;
                                     }
                                 };
                             };
@@ -3182,6 +3211,18 @@
 
 //----------------------------------------------------
 //   
+//    r_qtn_lcam_tb_grid
+//    Text for the 'grid' button in toolbar extension
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_qtn_lcam_tb_grid 
+    {
+    buf = qtn_lcam_tb_grid;
+    }
+
+//----------------------------------------------------
+//   
 //    r_qtn_lcam_tt_videoflash
 //    Tooltip for the video button in fixed toolbar
 //
--- a/camerauis/cameraapp/generic/inc/CamAppController.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamAppController.h	Wed Jun 09 09:21:41 2010 +0300
@@ -58,7 +58,7 @@
 #include "camcameracontroller.h"
 #include "CamDriveChangeNotifier.h"
 #include "CamSyncRotatorAo.h"
-
+#include "camtvaccessorymonitor.h"
 
 // ===========================================================================
 // CONSTANTS
@@ -87,6 +87,12 @@
   EBusyLast // Marker
   };
 
+enum TCamHdmiEvent
+    {
+    ECamHdmiNoEvent,
+    ECamHdmiCableConnectedBeforeRecording,
+    ECamHdmiCableConnectedDuringRecording
+    };
 
 // ===========================================================================
 // FORWARD DECLARATIONS
@@ -165,7 +171,8 @@
                           public MCamBurstModeObserver,
                           public MCFListener
                           ,public MCamDriveChangeNotifierObserver
-                          ,public MBitmapRotationObserver 
+                          ,public MBitmapRotationObserver,
+                          public MCamTvAccessoryObserver
                           
     {
     public:  // Constructors and destructor
@@ -468,7 +475,31 @@
     * @param aErr KErrNone if successful
     */
     void RotationCompleteL( TInt aErr );
+    
+    /**
+    * From MCamTvaccessoryObserver
+    * Handles TV Out/HDMI Cable connect Events
+    */
+    void HandleTvAccessoryConnectedL();
+    
+    /**
+    * From MCamTvaccessoryObserver
+    * Handles TV Out/HDMI Cable disconnect Events
+    */
+    void HandleTvAccessoryDisconnectedL();
+    
+    
+    /**
+     * Returns Etrue if HDMI Cable is connected
+     */
+    TBool IsHdmiCableConnected();
+    
 
+    /**
+    * Called when exiting in secondary camera mode
+    */
+    void HandleSecondaryCameraExitL();
+	
 private:
     void ReadVariantFlagsL();
 
@@ -1531,6 +1562,7 @@
     void ChangeOperation( TCamCaptureOperation aNewOperation, 
                           TInt          aError = KErrNone );
 
+  public:
     /**
     * Notify controller observers of an event.
     * @since 2.8
@@ -1539,6 +1571,7 @@
     */
     void NotifyControllerObservers( TCamControllerEvent aEvent,
                                     TInt                aError = KErrNone ) const;
+  private:
 
     /**
     * Starts the viewfinder if the engine has been prepared for the 
@@ -2222,6 +2255,33 @@
          * is rotated and ready for drawing
          */
         void SnapshotRotationComplete();
+        
+        /**
+         * Method to retrieve Remaining Recording time from CCaeEngine
+         */
+        TTimeIntervalMicroSeconds RemainingVideoRecordingTime();
+        
+        
+        /**
+         * Handles hdmi connect event during recording after video stop
+         */
+        void HandlePostHdmiConnectDuringRecordingEventL();
+        
+		/**
+		* Sets a Pending Hdmi Event
+		*/
+        void SetPendingHdmiEvent( TCamHdmiEvent aPendingHdmiEvent );
+        
+		/**
+		* Handles the current pending Hdmi EVent
+		*/
+        void HandlePendingHdmiEvent();
+		
+    /**
+	* Returns ETrue when scene mode is forced to 
+    * "Automatic" by secondary camera
+	*/
+    TBool SceneModeForcedBySecondaryCamera();
 
   private:
 
@@ -2504,6 +2564,8 @@
     CCamPropertyWatcher* iSlideStateWatcher;
     // Property watcher to report changes in the keylock state
     CCamPropertyWatcher* iKeyLockStatusWatcher;
+    // Property watcher to report changes in the profile state
+    CCamPropertyWatcher* iProfileStatusWatcher;
     // Set to ETrue if shutter sound always played
     // otherwise playing shutter sound depends on
     // current profile
@@ -2608,8 +2670,17 @@
     TCamImageOrientation  iCaptureOrientation;
     
     TBool iIssueModeChangeSequenceSucceeded;
+    
+    CCamTvAccessoryMonitor* iTvAccessoryMonitor;
+    
+    TBool iHdmiCableConnectedDuringRecording;
+    
     TBool iSnapshotRedrawNeeded;
     
+    TCamHdmiEvent iPendingHdmiEvent;
+	
+    TBool iSceneModeForcedBySecondaryCamera;
+	
     };
 
 #endif      // CAMAPPCONTROLLER_H
--- a/camerauis/cameraapp/generic/inc/CamAppUi.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamAppUi.h	Wed Jun 09 09:21:41 2010 +0300
@@ -900,6 +900,11 @@
         * otherwise EFalse.
         */
         TBool IsToolBarExtensionVisible() const;
+        
+        /*
+         * Handles Hdmi events
+         */
+        void HandleHdmiEventL( TCamHdmiEvent aEvent );
  
     public: // Functions from base classes
         /**
--- a/camerauis/cameraapp/generic/inc/CamPostCaptureContainer.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamPostCaptureContainer.h	Wed Jun 09 09:21:41 2010 +0300
@@ -43,7 +43,7 @@
     
     enum TCamPostCaptureSubControls
         {
-        ECamPostCaptureSubControlNaviPane,
+        ECamPostCaptureSubControlNaviPane = 1,
         ECamPostCaptureActivePalette
         };
     
--- a/camerauis/cameraapp/generic/inc/CamPreCaptureContainerBase.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamPreCaptureContainerBase.h	Wed Jun 09 09:21:41 2010 +0300
@@ -46,6 +46,7 @@
 class CCamTimeLapseSlider;
 class MCamVfGridDrawer;
 class CCamStartupLogo;
+class CCamCaptureButtonContainer;
 
 
 // ===========================================================================
@@ -74,7 +75,8 @@
     enum TCamPreCaptureSubControls
       {             
       // ECamTimeLapseControl         
-      ECamActivePalette
+      ECamActivePalette = 1,
+      ECamCaptureButton
       };
 
     enum TFocusState
@@ -165,7 +167,14 @@
     * @param aRect area where to draw
     */
     virtual void Draw( const TRect& aRect ) const;
-
+    
+    /**
+     * From CCoeControl.
+     * @since 5.2
+     * @param aDrawNow Flag to indicate if the container should be drawn
+     */
+    virtual void FocusChanged( TDrawNow aDrawNow );
+    
   // -------------------------------------------------------------------------
   // From MCamControllerObserver
   public:
@@ -272,28 +281,33 @@
     void BlinkResolutionIndicatorOnChange( TBool aBlink=ETrue );
     
     /**
-     * From CCoeControl.
-	 * @since 5.1
-	 * @param aDrawNow Flag to indicate if the container should be drawn
+     * Updates the visibility of the capture button 
+     * @since 5.2
      */
-    void FocusChanged( TDrawNow aDrawNow );
-
+    void UpdateCaptureButton();
+    
+    /**
+     * Perform the UI adjustments just before start of capture  
+     * @since 5.2
+     */
+    void PrepareForCapture();
+    
   protected: 
 
-        /**
-        * Callback for zoom timer when zoom pane needs to be hidden.
-        * @since 2.8
+    /**
+    * Callback for zoom timer when zoom pane needs to be hidden.
+    * @since 2.8
     * @param aObject - Pointer to instance of CCamPreCaptureContainerBase
-        * @return KErrNone
-        */
+    * @return KErrNone
+    */
     static TInt ZoomTimerCallback( TAny* aObject );
     
-        /**
-        * Callback for reticule timer, 
-        * @since 3.0
+    /**
+    * Callback for reticule timer, 
+    * @since 3.0
     * @param aObject - Pointer to instance of CCamPreCaptureContainerBase
-        * @return KErrNone
-        */
+    * @return KErrNone
+    */
     static TInt ReticuleTimerCallback( TAny* aObject );
 
         /**
@@ -397,13 +411,6 @@
     */    
     void SizeChanged();
     
-    /**
-     * Checks whether the custom capture button should be shown 
-     * @since 5.1
-     * @return ETrue if capture button should be active, EFalse otherwise
-     */
-    TBool CaptureButtonActive() const;
-    
   private:
     /**
     * Draws the reticule over the viewfinder
@@ -601,23 +608,16 @@
 
     /**
      * Callback used by timer to blink resolution indicator
-     * @since 5.1
+     * @since 5.2
      * @param aSelf Pointer to self (container)
      */
     static TInt IndicatorVisible( TAny *aSelf );
     
     /**
      * Draw resolution indicator (for blinking).
-     * @since 5.1
+     * @since 5.2
      */
     void DrawResolutionIndicator();
-    
-    /**
-     * Draws Capture/Record button
-     * @since 5.1
-     * @param aGc The context to draw with
-     */
-    void DrawCaptureButton( CBitmapContext& aGc ) const;
 
   // =========================================================================
   // Data
@@ -668,11 +668,7 @@
     TRect iReticuleRect;
 
     // Icons and rect for capturing image
-    CFbsBitmap *iCaptureIcon;
-    CFbsBitmap *iCaptureMask;
-    TRect iCaptureRect;
-    TBool iCaptureButtonShown;
-    TBool iCaptureIconPressed;
+    CCamCaptureButtonContainer* iCaptureButtonContainer;
 
     /**
      * Autofocus indication icons array.  
--- a/camerauis/cameraapp/generic/inc/CamSettingsModel.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamSettingsModel.h	Wed Jun 09 09:21:41 2010 +0300
@@ -368,7 +368,7 @@
   public:
 
     /*
-    * Sets user scene setting to default if user has once selected
+    * Sets user scene setting to default
     */
 	void SetUserSceneDefault(); 
     
--- a/camerauis/cameraapp/generic/inc/CamStillPreCaptureView.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamStillPreCaptureView.h	Wed Jun 09 09:21:41 2010 +0300
@@ -252,7 +252,7 @@
         /*
          * Update Face Tracking specific icons if supported. 
         */
-        void UpdateFaceTracKingIconsL();
+        void UpdateFaceTrackingIconsL();
 
     private:    // Functions from base classes
 
--- a/camerauis/cameraapp/generic/inc/CamVideoPostCaptureView.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamVideoPostCaptureView.h	Wed Jun 09 09:21:41 2010 +0300
@@ -24,7 +24,7 @@
 // FORWARD DECLARATIONS
 class CCamAppController;
 class CCamContainerBase;
-
+class CCamTimer;
 
 // CLASS DECLARATION
 
@@ -111,6 +111,16 @@
             TInt aEventId,
             CAiwGenericParamList& aEventParamList,
             const CAiwGenericParamList& aInParamList );
+
+		/*
+		* Hdmi Timer callback
+		*/        
+        static TInt HdmiTimerCallback( TAny* aSelf );
+
+		/*
+		* Hdmi Timer callback handler
+		*/        
+        void DoHdmiTimerCallbackL();
     
     private:    // New functions
 
@@ -161,6 +171,8 @@
     private:    // Data
     
     	TBool iRockerKeyPress;
+    	
+    	CCamTimer* iHdmiTimer;
     };
 
 #endif      // CAMVIDEOPOSTCAPTUREVIEW_H   
--- a/camerauis/cameraapp/generic/inc/CamVideoPreCaptureView.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/CamVideoPreCaptureView.h	Wed Jun 09 09:21:41 2010 +0300
@@ -26,6 +26,7 @@
 class CAknButton;
 class MAknsSkinInstance;
 class TAknsItemID;
+class CCamTimer;
 
 // CLASS DECLARATION
 
@@ -125,7 +126,19 @@
         * Update the softkeys for the current situation.
         * @since 2.8
         */
-        void UpdateCbaL();  
+        void UpdateCbaL();
+		
+		/*
+		* Hdmi Timer callback
+		*/        
+        static TInt HdmiTimerCallback( TAny* aSelf );
+
+		/*
+		* Hdmi Timer callback handler
+		*/        
+        void DoHdmiTimerCallbackL();
+    
+  
 
     protected:  // Functions from base classes
   
@@ -259,6 +272,7 @@
         // Have mute/unmute option in embedded video menu
         TInt iAudioEnabled;
         
+    	CCamTimer* iHdmiTimer;
     };
 
 #endif      // CAMVIDEOPRECAPTUREVIEW_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraapp/generic/inc/camcapturebuttoncontainer.h	Wed Jun 09 09:21:41 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container for custom camera capture button (touch) 
+*
+*/
+
+#ifndef CAMCAPTUREBUTTONCONTAINER_H_
+#define CAMCAPTUREBUTTONCONTAINER_H_
+
+
+#include "CamPreCaptureContainerBase.h"
+#include "CamSettingsInternal.hrh"
+
+
+// ===========================================================================
+// FORWARD DECLARATIONS
+
+class MTouchFeedback;
+
+
+// ===========================================================================
+// CLASS DECLARATION
+
+class CCamCaptureButtonContainer : public CCoeControl
+    {
+private:
+    CCamCaptureButtonContainer();
+    
+protected: 
+
+    /**
+    * C++ constructor
+    * @since 5.2
+    * @param aController reference to CCamAppController instance
+    * @param aView reference to the view containing this container
+    * @param aContainer reference to the parent container
+    * @param aCameraMode mode of the camera (image/video) 
+    */
+    CCamCaptureButtonContainer( CCamAppController& aController,
+                                CAknView& aView,
+                                CCamPreCaptureContainerBase& aContainer,
+                                TCamCameraMode aCameraMode );
+    
+    /**
+    * Perform the second phase construction of a CCamCaptureButtonContainer object.
+    * @since 5.2
+    * @param aRect rectangular region bounding this container
+    */
+    void ConstructL( const TRect& aRect );
+
+public:
+    /**
+    * Destructor.
+    */
+    virtual ~CCamCaptureButtonContainer();
+    
+    /**
+    * Two-phased factory constructor
+    * @since 5.2
+    * @param aController reference to CCamAppController instance
+    * @param aView reference to the view containing this container
+    * @param aContainer Parent container
+    * @return pointer to the created CCamCaptureButtonContainer object already pushed on the Cleanupstack
+    */
+    static CCamCaptureButtonContainer* NewLC( CCamAppController& aController,
+                                              CAknView& aView,            
+                                              CCamPreCaptureContainerBase& aContainer,
+                                              const TRect& aRect,
+                                              TCamCameraMode aCameraMode );
+    
+    /**
+    * Two-phased factory constructor.
+    * @since 5.2
+    * @param aController reference to CCamAppController instance
+    * @param aView reference to the view containing this container
+    * @param aContainer Parent container
+    * @return pointer to the created CCamCaptureButtonContainer object
+    */
+    static CCamCaptureButtonContainer* NewL( CCamAppController& aController, 
+                                             CAknView& aView,
+                                             CCamPreCaptureContainerBase& aContainer,
+                                             const TRect& aRect,
+                                             TCamCameraMode aCameraMode );
+    
+public:
+    /**
+    * Performs the actual draw on the container 
+    * @since 5.2
+    * @param aRect area where to draw
+    */
+    virtual void Draw( const TRect& aRect ) const;
+    
+    /**
+     * From CCoeControl
+     * Handle pointer events. 
+     * @since S60 5.2
+     * @param aPointerEvent information about the pointerevent
+     */
+    virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+    /**
+     * Used to control visibilty of capture button
+     * @since S60 5.2
+     * @param aShown button is shown if ETrue, else not shown 
+     */
+    void SetCaptureButtonShown( TBool aShown );
+
+private:
+    /**
+     * Draws the capture button
+     * @since S60 5.2
+     * @param aGc graphics context to draw to 
+     */
+    void DrawCaptureButton( CBitmapContext& aGc ) const;
+    
+private:
+
+    CCamAppController& iController; 
+    CAknView& iView;
+    CCamPreCaptureContainerBase& iParentContainer;
+
+    TCamCameraMode iCameraMode;
+    MTouchFeedback* iFeedback;
+
+    // Icons and rect for capturing image
+    CFbsBitmap *iCaptureIcon;
+    CFbsBitmap *iCaptureMask;
+    TRect iCaptureRect;
+    TBool iCaptureButtonShown;
+    TBool iCaptureButtonPressed;
+    };
+
+#endif /* CAMCAPTUREBUTTONCONTAINER_H_ */
--- a/camerauis/cameraapp/generic/inc/cameracontroller/camcameraevents.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/cameracontroller/camcameraevents.h	Wed Jun 09 09:21:41 2010 +0300
@@ -110,6 +110,8 @@
   ECamCameraEventFlashReady,
   ECamCameraEventFlashNotReady,
 
+  //Image capture event
+  ECamCameraEventImageCaptureEvent,
   // -------------------------------------------------------  
   // Not an event id, but a marker.
   ECamCameraEventCount 
@@ -197,7 +199,8 @@
   (const TUint16*)_S16("ECamCameraEventSetAfRange"),
   
   (const TUint16*)_S16("ECamCameraEventFlashReady"),
-  (const TUint16*)_S16("ECamCameraEventFlashNotReady")
+  (const TUint16*)_S16("ECamCameraEventFlashNotReady"),
+  (const TUint16*)_S16("ECamCameraEventImageCaptureEvent")
   };
 
 __ASSERT_COMPILE( (sizeof(KCamCameraEventNames) / sizeof(TUint16*)) == ECamCameraEventCount );
--- a/camerauis/cameraapp/generic/inc/cameracontroller/camimagedecoder.h	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/inc/cameracontroller/camimagedecoder.h	Wed Jun 09 09:21:41 2010 +0300
@@ -30,7 +30,7 @@
 class CImageDecoder;
 class MCameraBuffer;
 class CCamBufferShare;
-
+class CSvgEngineInterfaceImpl;
 
 // ===========================================================================
 // Classes
@@ -101,7 +101,7 @@
 
     void StartConversionL( CCamBufferShare* aBuffer );
     
-    void StartIconConversionL( TDesC* aFilePath );
+    void StartIconConversionL( TDesC* aFilePath, TSize& aSize );
 
   private:
 
@@ -154,7 +154,7 @@
 
     RFs                       iFs;
     MCamImageDecoderObserver& iObserver;
-    
+    CSvgEngineInterfaceImpl* iSvgEngine;
 
     CCamBufferShare* iSharedImageData;
     HBufC8*          iThumbnailData;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraapp/generic/inc/camtvaccessorymonitor.h	Wed Jun 09 09:21:41 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class to handle TV accessory events
+*/
+
+#ifndef CAMTVACCESSORYMONITOR_H
+#define CAMTVACCESSORYMONITOR_H
+
+
+#include <AknWsEventObserver.h>     // for MAknWsEventObserver
+#include <AccessoryServer.h>        // for RAccessoryServer
+#include <AccessoryMode.h>          // for RAccessoryMode
+#include <AccessoryConnection.h>    // for RAccessoryConnection
+#include <AccPolGenericIDArray.h>
+
+
+class MCamTvAccessoryObserver
+    {
+public:
+    virtual void HandleTvAccessoryConnectedL() = 0;
+    virtual void HandleTvAccessoryDisconnectedL() = 0;
+    };
+
+class CCamTvAccessoryMonitor : public CActive
+    {
+public:
+    // Cancel and destroy
+    ~CCamTvAccessoryMonitor();
+
+    // Two-phased constructor.
+    static CCamTvAccessoryMonitor* NewL( MCamTvAccessoryObserver* aObserver );
+
+public:
+
+    // Starts to listen to tv accessory events
+    void StartListeningL();
+    
+    // Returns ETrue if TVOut cable is connected
+    TBool IsTvOutCableConnected();
+    
+    // Returns ETrue if HDMI cable is connected
+    TBool IsHdmiCableConnected();
+    
+private:
+    // C++ constructor
+    CCamTvAccessoryMonitor( MCamTvAccessoryObserver* aObserver );
+
+    // Second-phase constructor
+    void ConstructL();
+
+private:
+    // From CActive
+    // Handle completion
+    void RunL();
+
+    // How to cancel me
+    void DoCancel();
+
+    // Override to handle leaves from RunL(). Default implementation causes
+    // the active scheduler to panic.
+    TInt RunError(TInt aError);
+
+
+private:
+
+    MCamTvAccessoryObserver* iObserver;
+ 
+    TBool iTvOutConnectionState;
+    TBool iHDMIConnectionState;
+
+    
+    RAccessoryServer iTvAccServer;
+    RAccessoryMode iTvAccMode;
+    RAccessoryConnection iTvAccCon;
+    TAccPolGenericIDArray iCurrentAccArray;
+    TAccPolAccessoryMode iPolAccMode;
+    TAccMode iPreviousMode;
+    };
+
+#endif // CAMTVACCESSORYMONITOR_H
--- a/camerauis/cameraapp/generic/src/CamAppController.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamAppController.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -80,6 +80,8 @@
 #include "CamCallStateAo.h"    
 #include "CamPropertyWatcher.h"
 #include <avkondomainpskeys.h>
+#include <ProfileEngineInternalPSKeys.h>
+#include <ProfileEnginePrivatePSKeys.h>
 
 #ifndef __WINSCW__
   #include "rlocationtrail.h"
@@ -108,6 +110,8 @@
 #include "CamGSInterface.h"
 #include "CameraUiConfigManager.h"
 #include "camsnapshotrotator.h"
+#include "CamVideoPreCaptureView.h"
+
 #include <bitmaptransforms.h> 
 
 #ifdef _DEBUG
@@ -495,6 +499,12 @@
     delete iKeyLockStatusWatcher;
     }
   
+  if ( iProfileStatusWatcher )
+      {
+      iProfileStatusWatcher->Cancel();
+      delete iProfileStatusWatcher;
+      }
+  
   if ( iConfigManager  && iConfigManager->IsPublishZoomStateSupported() )
       {
       TRAP_IGNORE ( PublishZoomStateL( EFalse ) );
@@ -598,6 +608,13 @@
       }
 
   delete iSnapShotRotator;
+  
+  if( iTvAccessoryMonitor )
+      {
+      delete iTvAccessoryMonitor;
+      iTvAccessoryMonitor = NULL;
+      }
+  
   PRINT( _L("Camera <= ~CCamAppController") );
   }
 
@@ -1077,6 +1094,12 @@
       {      
       iInfo.iOperation = aNewOperation;
       NotifyControllerObservers( ECamEventOperationStateChanged, aError );
+      if( aNewOperation == ECamStandby )
+          {
+          ClearSequenceBusyFlag( &iBusyFlags );
+          TCamControllerInfo& info = const_cast<TCamControllerInfo&>( iCameraController->ControllerInfo() );
+          ClearFlags( info.iBusy , ECamBusySequence );
+          }
       }
 
   PRINT( _L("Camera <= CCamAppController::SetOperation") );
@@ -1223,7 +1246,7 @@
             iInfo.iOperation == ECamResuming     ||
             iInfo.iOperation == ECamCompleting )
             {    
-            iVideoTimeRemaining = iCameraController->RemainingVideoRecordingTime();  
+            iVideoTimeRemaining = RemainingVideoRecordingTime();  
             }
         else 
             {
@@ -1236,6 +1259,7 @@
             }
         }
    if ( ECamControllerVideo == CurrentMode() &&
+            iInfo.iOperation == ECamNoOperation && 
    	    ECamMediaStorageCard == IntegerSettingValue( ECamSettingItemVideoMediaStorage ) &&
    	    appUi->IsMemoryFullOrUnavailable( ECamMediaStorageCard ) )
         {
@@ -1722,22 +1746,6 @@
        }
 
     PRINT1( _L("Camera <> Tried to start capture, status:%d"), capture ); 
-    if ( capture )
-      {
-      if( ECamActiveCameraPrimary == iInfo.iActiveCamera
-          && iConfigManager && iConfigManager->IsCaptureToneDelaySupported() )
-        {
-        // first cancel to make sure
-        iCaptureToneDelayTimer->Cancel();
-        // delay playing of capture tone
-        iCaptureToneDelayTimer->StartTimer();
-        }
-      else
-        {
-        // Play capture sound
-        PlaySound( CaptureToneId(), EFalse );
-        }
-      }
     }
   // -------------------------------------------------------
   // Not ready for a capture
@@ -1864,58 +1872,65 @@
   {
   PRINT( _L("Camera => CCamAppController::StartVideoRecordingL") );    
   __ASSERT_DEBUG( iCameraController, CamPanic( ECamPanicInvalidState ) );
-  if( ECamControllerVideo == iInfo.iMode )
-    {
-    if( !iVideoRequested
-     &&  ECamNoOperation == iInfo.iOperation )
-      {
-      iVideoRequested = ETrue;     
+  if ( ECamControllerVideo == iInfo.iMode )
+      {
+      CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );  
+      if ( IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
+               IsHdmiCableConnected() )
+          {
+          appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+          return;
+          }
+      if ( !iVideoRequested
+              &&  ECamNoOperation == iInfo.iOperation )
+          {
+          iVideoRequested = ETrue;     
       if( !iSilentProfile || iShutterSndAlwaysOn  )
-        	{
-        	// Load (and play) the start video sound	
-        	PlaySound( ECamVideoStartSoundId , ETrue );  
-        	}   
-  
-      // initialise the array accessing values
-      iArrayUsageCount   = KVideoArrayUsers;
-      iCurrentImageIndex = 0;
-  
-      if( ECamMediaStorageCard == 
-              IntegerSettingValue( ECamSettingItemVideoMediaStorage ) )
-        {
-        TRAPD( err, ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
-        if ( err )
           {
-          PRINT( _L("Camera <> invalid MMC") );        
-          NotifyControllerObservers( ECamEventInvalidMemoryCard );
-  
-          // If we have got here, we can't access MMC. Switch to phone memory
-          TRAP_IGNORE( ForceUsePhoneMemoryL() ); //with multiple drive support, 
-                                                 //this actually uses the internal mass memory
-          // Ignore for now, let fail when recording.
-          TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone, ETrue ) );
+          // Load (and play) the start video sound	
+          PlaySound( ECamVideoStartSoundId , ETrue );  
+          }   
+  
+          // initialise the array accessing values
+          iArrayUsageCount   = KVideoArrayUsers;
+          iCurrentImageIndex = 0;
+  
+          if ( ECamMediaStorageCard == 
+                   IntegerSettingValue( ECamSettingItemVideoMediaStorage ) )
+              {
+              TRAPD( err, ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
+              if ( err )
+                  {
+                  PRINT( _L("Camera <> invalid MMC") );        
+                  NotifyControllerObservers( ECamEventInvalidMemoryCard );
+  
+                  // If we have got here, we can't access MMC. Switch to phone memory
+                  TRAP_IGNORE( ForceUsePhoneMemoryL() ); //with multiple drive support, 
+                                                         //this actually uses the internal mass memory
+                  // Ignore for now, let fail when recording.
+                  TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone, ETrue ) );
+                  }
+              }
+          else
+              {
+              // Ignore for now, let fail when recording.
+              TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
+              }
+
+          if( iSilentProfile && !iShutterSndAlwaysOn )
+              {
+              PlaySoundComplete();
+              }
+          // Remember where are we recording
+          iInitialVideoStorageLocation = static_cast<TCamMediaStorage>( 
+               IntegerSettingValue( ECamSettingItemVideoMediaStorage ) );
           }
-        }
       else
-        {
-        // Ignore for now, let fail when recording.
-        TRAP_IGNORE( ReserveFileNamesL( iInfo.iMode, ECamImageCaptureNone ) );
-        }
-
-        if( iSilentProfile && !iShutterSndAlwaysOn )
-        	{
-        	PlaySoundComplete();
-        	}
-      // Remember where are we recording
-      iInitialVideoStorageLocation = static_cast<TCamMediaStorage>( 
-                    IntegerSettingValue( ECamSettingItemVideoMediaStorage ) );
-      }
-    else
-      {
-      // Video already requested or other operation busy.
-      // Request ignored.
-      }
-    }
+          {
+          // Video already requested or other operation busy.
+          // Request ignored.
+          }
+      }
   // Note: The code to actually START video recording has been moved
   // to the PlaySoundComplete function so as to only start when
   // sound playback has completed.
@@ -2231,7 +2246,8 @@
    && ECamCompleting  != CurrentOperation() )
     {  
     // If we are currently focused, cancel autofocus
-    if ( IsViewFinding() && CurrentOperation() != ECamCapturing ) // Cannot do AF operations if VF not on. AF is anyway cancelled on VF start event.
+    if ( IsViewFinding() && CurrentOperation() != ECamCapturing &&  // Cannot do AF operations if VF not on. AF is anyway cancelled on VF start event.
+        iCurrentAFRequest != ECamRequestCancelAutofocus ) // Don't cancel twice
       {
       if( ECamFocusing == CurrentOperation() )
         {
@@ -2494,6 +2510,9 @@
     PRINT ( _L("Camera <> Photo quality index:                  ") );
     PRINT1( _L("Camera <> Before loading 2nd cam settings: %d   "), IntegerSettingValue( ECamSettingItemPhotoQuality ) );
 #endif
+    
+    // Scene mode is forced to Automatic while secondary camera is in use.
+    iSceneModeForcedBySecondaryCamera = ETrue;
 
     LoadSecondaryCameraSettingsL();
   
@@ -2523,6 +2542,9 @@
         {
         PRINT( _L("Camera <> switch to 1st cam") )
         targetCamera = ECamActiveCameraPrimary;
+        
+        // Primary camera will use its previously selected scene mode after camera switch.
+        iSceneModeForcedBySecondaryCamera = EFalse;
         }
     else
         {
@@ -3408,6 +3430,22 @@
         CCamSettingConversion::Map2CameraControllerSettingId( aSettingItem ) );
       iCameraController->DirectSettingsChangeL( cameraId );
       NotifyControllerObservers( ECamEventFaceTrackingStateChanged );
+      
+      // If Face tracking was turned off by user (not forced off by a scene mode)
+      // update iPreviousFaceTrack to the current state as we are not going to
+      // reset to the previous state automatically at any point.
+      TCamSceneId scene = static_cast< TCamSceneId > 
+          ( IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) );
+      
+      if ( scene != ECamSceneMacro &&
+           scene != ECamSceneScenery &&
+           scene != ECamSceneSports && 
+           !iSceneModeForcedBySecondaryCamera )
+          {
+          PRINT1( _L("Camera MK: Changing face tracking state -> update iPreviousFaceTrack to %d"), aSettingValue );
+          iSettingsModel->SetPreviousFaceTrack( static_cast<TCamSettingsOnOff>( aSettingValue ) );
+          }
+      
       break;
       }  
     case ECamSettingItemDynamicVideoFlash:  
@@ -4496,7 +4534,7 @@
           iInfo.iOperation == ECamResuming     ||
           iInfo.iOperation == ECamCompleting )
         {          
-        iVideoTimeRemaining = iCameraController->RemainingVideoRecordingTime();  
+        iVideoTimeRemaining = RemainingVideoRecordingTime();  
         }
       else 
         {
@@ -4724,6 +4762,7 @@
   , iRamDiskCriticalLevel( KErrNotFound )
   , iImageOrientation( ECamOrientation0 )
   , iLastImageOrientation( ECamOrientation0 )
+  , iPendingHdmiEvent( ECamHdmiNoEvent )
   {
   }
 
@@ -4825,6 +4864,14 @@
       // request notifications about key lock status
       iKeyLockStatusWatcher->Subscribe();     
       }
+  
+  iProfileStatusWatcher = CCamPropertyWatcher::NewL( *this,
+                                                     KPSUidProfileEngine,
+                                                     KProEngActiveProfileChanged );
+  // request notifications about profile status
+  iProfileStatusWatcher->Subscribe();    
+  IsProfileSilent();
+  
   // read central repository value indicating whether camera shutter sound
   // should be played always or depending on the current profile setting
   CRepository* cr = CRepository::NewLC( KCRUidCamcorderFeatures );
@@ -4887,7 +4934,10 @@
 
   User::LeaveIfError( iFs.Connect() ); 
   iDriveChangeNotifier = CCamDriveChangeNotifier::NewL( iFs, *this ); 
-
+  
+  iTvAccessoryMonitor = CCamTvAccessoryMonitor::NewL( this );
+  iTvAccessoryMonitor->StartListeningL();
+  
   PRINT( _L("Camera <= CCamAppController::ConstructL"));
   }
 
@@ -7908,7 +7958,12 @@
                   }
               }
           }
-
+      
+      if ( aCategory == KPSUidProfileEngine && aKey == KProEngActiveProfileChanged )
+          {
+          PRINT( _L("Camera <> aCategory == KCRUidProfileEngine && aKey == KProEngActiveWarningTones") );
+          IsProfileSilent();
+          }
 
 #endif // !( defined(__WINS__) || defined(__WINSCW__        
 
@@ -8340,11 +8395,21 @@
 //  
 TBool CCamAppController::IsProfileSilent()
     {
-    TRAPD( ignore, iSilentProfile = IsProfileSilentL() );
-    if ( ignore )
-        {
-        }
-    return iSilentProfile;
+    if ( !iShutterSndAlwaysOn )
+        {
+        TRAPD( ignore, iSilentProfile = IsProfileSilentL() );
+        if ( ignore )
+            {
+            // If reading the warning tone (= camera tones) value fails
+            // we set tones off by default
+            iSilentProfile = ETrue;
+            }
+        return iSilentProfile;
+        }
+    else
+        {
+        return EFalse;
+        }
     }
 
 
@@ -8356,21 +8421,21 @@
 //  
 TBool CCamAppController::IsProfileSilentL()
     {
-    // get current keypad volume as indication of whether
+    // If camera tones have been set off from settings, return true here 
+    if ( iSettingsModel->IntegerSettingValue( ECamSettingItemPhotoCaptureTone )
+                == ECamSettToneOff )
+        {
+        return ETrue;
+        }
+    
+    // Get current keypad volume as an indication of whether
     // or not we have a silent profile
     CRepository* cr = CRepository::NewLC( KCRUidProfileEngine );
     TInt value;
     User::LeaveIfError( cr->Get( KProEngActiveWarningTones, value ) );
+    PRINT1(_L("Camera <> CCamAppController::IsProfileSilentL() value = %d"), value)
     CleanupStack::PopAndDestroy( cr );
     
-    //In case the phone variant allows turning camera tones off,
-    // first check if that is the case here.
-    if ( iSettingsModel->IntegerSettingValue( ECamSettingItemPhotoCaptureTone )
-            == ECamSettToneOff )
-        {
-        return ETrue;
-        }
-
     return ( value == 0 );
     }
 
@@ -9159,7 +9224,13 @@
             return;
             }
       break;
-      }  
+      }
+    //Image capture event  
+    case ECamCameraEventImageCaptureEvent:
+      {
+      PlaySound( CaptureToneId(), EFalse );
+      }
+      break;  
     default:
       break;
     }
@@ -10771,12 +10842,13 @@
                       }
                   }
               }
-          else if ( aType == EDriveUSBMassStorageModeOn )
+          else if ( aType == EDriveUSBMassStorageModeOn &&
+                  appUi->IsRecoverableStatus() )
               {
               SwitchToStandbyL(ECamErrMassStorageMode);
-
               }
-          else if ( aType == EDriveUSBMassStorageModeOff )
+          else if ( aType == EDriveUSBMassStorageModeOff &&
+                  !appUi->IsRecoverableStatus() )
               {
               SwitchToStandbyL( KErrNone );
               }
@@ -11363,6 +11435,151 @@
     PRINT( _L( "Camera <= CCamAppController::SnapshotRotationComplete" ) );    
     }
 
- 
+// ---------------------------------------------------------------------------
+// CCamAppController::HandleTvAccessoryConnectedL
+// 
+// ---------------------------------------------------------------------------
+//
+void CCamAppController::HandleTvAccessoryConnectedL()
+    {
+    PRINT(_L("Camera => CCamAppController::HandleTvAccessoryConnectedL "));
+    if( IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) 
+            && IsHdmiCableConnected() )
+        {
+        if( ECamCapturing == iInfo.iOperation || 
+            ECamPaused == iInfo.iOperation )
+            {
+            CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
+            iHdmiCableConnectedDuringRecording = ETrue;
+            TVwsViewId activeView;
+            if ( appUi->GetActiveViewId( activeView ) == KErrNone )
+              {
+              if( ECamViewIdVideoPreCapture == activeView.iViewUid.iUid  )
+                  {
+                  CCamVideoPreCaptureView* view = static_cast<CCamVideoPreCaptureView*>( appUi->View( activeView.iViewUid ) );
+                  view->HandleCommandL( ECamCmdStop );
+                  }
+              }
+            }
+        }
+    PRINT(_L("Camera <= CCamAppController::HandleTvAccessoryConnectedL "));
+    }
+
+// ---------------------------------------------------------------------------
+// CCamAppController::HandleTvAccessoryConnectedL
+// 
+// ---------------------------------------------------------------------------
+//
+void CCamAppController::HandleTvAccessoryDisconnectedL()
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CCamAppController::IsHdmiCableConnected
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CCamAppController::IsHdmiCableConnected()
+    {
+    return iTvAccessoryMonitor->IsHdmiCableConnected();
+    }
 //  End of File  
 
+
+// ---------------------------------------------------------------------------
+// CCamAppController::RemainingVideoRecordingTime
+// 
+// ---------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCamAppController::RemainingVideoRecordingTime()
+    {
+    return iCameraController->RemainingVideoRecordingTime();
+    }
+
+// ---------------------------------------------------------------------------
+// CCamAppController::HandlePostHdmiConnectDuringRecordingEventL
+// 
+// ---------------------------------------------------------------------------
+//
+void CCamAppController::HandlePostHdmiConnectDuringRecordingEventL()
+    {
+    if( iHdmiCableConnectedDuringRecording == TBool(ETrue) )
+        {
+        iHdmiCableConnectedDuringRecording = EFalse;
+        CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
+        appUi->HandleHdmiEventL( ECamHdmiCableConnectedDuringRecording );
+        }  
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCamAppController::SetPendingHdmiEvent
+// 
+// ---------------------------------------------------------------------------
+//
+void CCamAppController::SetPendingHdmiEvent( TCamHdmiEvent aPendingHdmiEvent )
+    {
+    iPendingHdmiEvent = aPendingHdmiEvent;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCamAppController::HandlePendingHdmiEvent
+// 
+// ---------------------------------------------------------------------------
+//
+void CCamAppController::HandlePendingHdmiEvent()
+    {
+    if( iPendingHdmiEvent != ECamHdmiNoEvent )
+        {
+        CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
+        appUi->HandleHdmiEventL( iPendingHdmiEvent );
+        iPendingHdmiEvent = ECamHdmiNoEvent;
+        }
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CCamAppController::HandleSecondaryCameraExit
+// 
+// Place here any extra things that need to be done when
+// exiting camera app. in secondary camera mode
+// ---------------------------------------------------------------------------
+//
+void CCamAppController::HandleSecondaryCameraExitL()
+    {
+    PRINT( _L( "Camera => CCamAppController::HandleSecondaryCameraExit" ) );          
+    
+    // Scene mode and face tracking issues --->
+    CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );  
+    // Do a switch to primary camera.
+    appUi->HandleCommandL( ECamCmdSwitchCamera );
+    // Set correct settings for primary camera.
+    SetDynamicSettingsToDefaults();
+    // Check if "User" scene mode should be on.
+    iSettingsModel->SetUserSceneDefault();
+    // PhotoSceneHasChangedL() needs to be called to 
+    // get also face tracking to the correct state.
+    iSettingsModel->PhotoSceneHasChangedL( IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) );
+    // StoreFaceTrackingValue() does nothing in 2ndary camera mode.
+    // (Because scene mode is forced to Auto while in 2ndary camera.)
+    // -> Always save face tracking state when exiting from 2ndary cam.
+    SetIntegerSettingValueL( ECamSettingItemFaceTracking, iSettingsModel->GetPreviousFaceTrack() );   
+    // <--- Scene mode and face tracking issues
+    
+    PRINT( _L( "Camera <= CCamAppController::HandleSecondaryCameraExit" ) );    
+    }    
+
+// ---------------------------------------------------------------------------
+// CCamAppController::SceneModeForcedBySecondaryCamera
+// 
+// ---------------------------------------------------------------------------
+//    
+TBool CCamAppController::SceneModeForcedBySecondaryCamera()
+    {
+    return iSceneModeForcedBySecondaryCamera;
+    }
+	
+//  End of File  
+
--- a/camerauis/cameraapp/generic/src/CamAppui.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamAppui.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -1731,6 +1731,11 @@
      case ECamCmdSwitchCamera:
          {
          PRINT( _L("Camera => CCamAppUi::HandleCommandL ECamCmdSwitchCamera" ))
+         
+         // By now it safe to assume that we are no longer returning from a pretended exit.
+         PRINT( _L("Camera <> Set iReturningFromPretendExit = EFalse") )
+         iReturningFromPretendExit = EFalse;
+         
          //If modechange sequence going on ignore switching...
          if( iController.CaptureModeTransitionInProgress() ||
              iController.CaptureState() != ECamCaptureOff || 
@@ -3394,6 +3399,7 @@
           //so we need to display toolbar when keylock is set to off and camera gain focus again.
           if ( ECamViewStatePreCapture == iViewState &&
                ECamPreCapViewfinder == iPreCaptureMode && 
+               ( !( iSelfTimer && iSelfTimer->IsActive() ) ) &&
                iController.CurrentOperation() != ECamCapturing )  
             {
             SetToolbarVisibility(); 
@@ -3791,7 +3797,7 @@
   //In those cases view switching is not needed unless current mode also changes.
   if( (iViewState==iTargetViewState) && ( iViewState==ECamViewStatePostCapture) && (iMode==iTargetMode) )
       {
-      PRINT(_L("Camera <> CCamAppUi::TrySwitchViewL, CALLED WITHOUT PURPOSE"));      
+      PRINT(_L("Camera <= CCamAppUi::TrySwitchViewL, CALLED WITHOUT PURPOSE"));      
       return;
       }  
   
@@ -3830,7 +3836,7 @@
   // If keylock is enabled, view switching is allowed in order to avoid 
   // flickering
   
-  if ( AppInBackground( ETrue ) && ECamViewStateStandby != iTargetViewState )  
+  if ( iPretendExit || ( AppInBackground( ETrue ) && ECamViewStateStandby != iTargetViewState ) )  
     {          
     PRINT( _L("Camera <> app in background set pending view switch") )
     if ( aDeactivateFirst )
@@ -4487,7 +4493,7 @@
 			if(currentLocation != ECamMediaStorageCard && 
 				!IsMemoryFullOrUnavailable(ECamMediaStorageCard))
 				{
-				supportedMemTypes |= AknCommonDialogsDynMem::EMemoryTypeMMCExternal;
+				supportedMemTypes |= AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice;
 				}
 			if(currentLocation != ECamMediaStorageMassStorage && 
 				!IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage))
@@ -5012,6 +5018,14 @@
             PRINT( _L("Camera <= CCamAppUi::StartCaptureL, video no memory") );
             return EKeyWasNotConsumed;
             }
+        else if( iController.IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
+                iController.IsHdmiCableConnected() )
+            {
+            iController.SetPendingHdmiEvent( ECamHdmiCableConnectedBeforeRecording );
+            PRINT( _L("Camera <= CCamAppUi::StartCaptureL, HDMI Cable connected") );
+            return EKeyWasNotConsumed;
+            }
+        
         PERF_EVENT_END_L1( EPerfEventKeyToCapture );
         PERF_EVENT_START_L1( EPerfEventStartVideoRecording );    
         static_cast<CCamViewBase*>( iView )->UnsetCourtesySoftKeysL();
@@ -5193,7 +5207,19 @@
     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CLOSEAPPL, "e_CCamAppUi_CloseAppL 1" );
     
     PRINT( _L("Camera => CCamAppUi::CloseAppL") )
-
+    
+    // Special considerations needed for secondary camera
+    // regarding scene mode and face tracking state
+    if ( IsSecondCameraEnabled() && !IsEmbedded() )
+        {
+        // This includes storing the face tracking value
+        iController.HandleSecondaryCameraExitL();
+        }
+    else
+        {
+        iController.StoreFaceTrackingValue(); // store the current FT setting
+        }
+    
     // cancel the self timer if active - can be active
     // if closing the slide while counting down
     if ( iInSelfTimerMode != ECamSelfTimerDisabled )
@@ -5398,6 +5424,9 @@
                     {
                     SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__CAPTURE_SECONDARY );      
                     }
+                // Special considerations needed for secondary camera
+                // regarding scene mode and face tracking state
+                iController.HandleSecondaryCameraExitL();
                 }
               }
             }
@@ -8480,9 +8509,21 @@
 	else if(iMode == ECamControllerVideo)
 		{
 		TTimeIntervalMicroSeconds timeLeft = 0;
-		TRAPD(err,timeLeft =
-					iController.
-					CalculateVideoTimeRemainingL(aStorageLocation););
+		
+		TInt err(KErrNone);
+		if( iController.CurrentOperation() == ECamNoOperation )
+		    {
+            TRAP(err,timeLeft =
+                    iController.
+                    CalculateVideoTimeRemainingL(aStorageLocation) );
+            }
+		else
+		    {
+            TRAP(err,timeLeft =
+                    iController.
+                    RemainingVideoRecordingTime() );
+            }
+		
 		if(err)
 		    timeLeft = 0;
 		return (timeLeft < KMemoryFullVideoRemaining);
@@ -8836,6 +8877,36 @@
     PRINT(_L("Camera <= CCamAppUi::HandleServerAppExit."));
     }
 
-
+// -----------------------------------------------------------------------------
+// CCamAppUi::HandleHdmiEventL 
+// -----------------------------------------------------------------------------
+//
+void CCamAppUi::HandleHdmiEventL( TCamHdmiEvent aEvent )
+    {
+    HBufC* noteString = NULL;
+    CAknWarningNote* note = NULL;
+    switch( aEvent )
+        {
+        case ECamHdmiCableConnectedBeforeRecording:
+            {
+            noteString = StringLoader::LoadLC( R_QTN_LCAM_HDMI_REMOVE_CABLE );
+            note = new (ELeave) CAknWarningNote();
+            note->ExecuteLD( *noteString );
+            CleanupStack::PopAndDestroy( noteString );
+            }
+            break;
+        case ECamHdmiCableConnectedDuringRecording:
+            {
+            noteString = StringLoader::LoadLC( R_QTN_LCAM_HDMI_CABLE_DETECTED );
+            note = new (ELeave) CAknWarningNote();
+            note->ExecuteLD( *noteString );
+            CleanupStack::PopAndDestroy( noteString );
+            }
+            break;
+        default:
+            break;
+        }
+    
+    }
 
 //  End of File
--- a/camerauis/cameraapp/generic/src/CamBurstThumbnailContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamBurstThumbnailContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -170,7 +170,7 @@
 //
 TInt CCamBurstThumbnailContainer::CountComponentControls() const
     {    
-    return 1;   // Return the number of controls inside this container
+    return CCamContainerBase::CountComponentControls() + 1;   // Return the number of controls inside this container
     }
 
 // ---------------------------------------------------------
@@ -180,18 +180,22 @@
 //
 CCoeControl* CCamBurstThumbnailContainer::ComponentControl( TInt aIndex ) const
     {
+    CCoeControl* control = NULL;
+    control = CCamContainerBase::ComponentControl( aIndex );
+    if( control != NULL )
+        return control;
     switch ( aIndex )
         {
-        case 0:
+        case 1:
             {
-            return iGridControl;
-            }            
+            control = iGridControl;
+            }
+            break;
         default: 
             break;                   
         }
     
-    // Should never get here
-    return NULL;
+    return control;
     }
 
 
--- a/camerauis/cameraapp/generic/src/CamCaptureSetupContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamCaptureSetupContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -277,16 +277,21 @@
 //
 TInt CCamCaptureSetupContainer::CountComponentControls() const
     {
-    return 1; // Return the number of controls inside this container
+    return CCamContainerBase::CountComponentControls() + 1; // Return the number of controls inside this container
     }
 
 // ---------------------------------------------------------
 // CCamCaptureSetupContainer::ComponentControl
 // ---------------------------------------------------------
 //
-CCoeControl* CCamCaptureSetupContainer::ComponentControl(TInt /*aIndex*/) const
+CCoeControl* CCamCaptureSetupContainer::ComponentControl( TInt aIndex ) const
     {
-    return iCaptureSetupControl;
+    CCoeControl* control = CCamContainerBase::ComponentControl( aIndex );
+    if( control == NULL)
+        {
+        control = iCaptureSetupControl;
+        }
+    return control;
     }
 
 // ---------------------------------------------------------
@@ -395,11 +400,11 @@
     
     // If the Ok button or shutter key is pressed, select the current item
     if ( ( aKeyEvent.iCode == EKeyOK && aKeyEvent.iRepeats == 0 && aType == EEventKey ) ||
-         ( aType == EEventKeyDown && 
+         ( aType == EEventKey && 
          ( IsCaptureKeyL( aKeyEvent, aType ) || IsShutterKeyL( aKeyEvent, aType ) ) ) )  
         {
         TKeyResponse response = iCaptureSetupControl->OfferKeyEventL( aKeyEvent, aType );
-        if ( aType == EEventKeyDown && response == EKeyWasNotConsumed &&
+        if ( aType == EEventKey && response == EKeyWasNotConsumed &&
             ( ECamSettingItemDynamicPhotoFlash == iControlHandler.SettingType() ||
             ECamSettingItemDynamicSelfTimer == iControlHandler.SettingType() ) )
             {
--- a/camerauis/cameraapp/generic/src/CamCaptureSetupMenu.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamCaptureSetupMenu.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -173,17 +173,22 @@
 TInt CCamCaptureSetupMenu::CountComponentControls() const
     {
 	// this control contains a listbox
-    return 1; 
+    return CCamContainerBase::CountComponentControls() + 1; 
     }
 
 // ---------------------------------------------------------
 // CCamCaptureSetupMenu::ComponentControl(TInt aIndex) const
 // ---------------------------------------------------------
 //
-CCoeControl* CCamCaptureSetupMenu::ComponentControl(TInt /*aIndex*/) const
+CCoeControl* CCamCaptureSetupMenu::ComponentControl(TInt aIndex) const
     {
-	return iCaptureSetupListBox;
-    }
+    CCoeControl* control = CCamContainerBase::ComponentControl( aIndex );
+    if( control == NULL)
+        {
+        control = iCaptureSetupListBox;
+        }
+    return control;
+	}
 
 // ---------------------------------------------------------
 // CCamCaptureSetupMenu::Draw(const TRect& aRect) const
--- a/camerauis/cameraapp/generic/src/CamFileCheckAo.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamFileCheckAo.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -99,6 +99,12 @@
             PRINT1( _L("Camera <> CCamFileCheckAo::RunL: File %s didn't exist"),iArray->FileName( iFileIndex ).Ptr() )
             iArray->SetDeleted( iFileIndex, ETrue );             
             iFileCount--;
+            
+            // Avoid instant view switch from postcapture
+            // to precapture when the file was deleted
+            // in Photos or File Manager while camera
+            // postcapture view was in background.
+            User::After( 150000 ); 
             }  	
         }
     else
--- a/camerauis/cameraapp/generic/src/CamInfoListBoxContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamInfoListBoxContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -312,7 +312,7 @@
 //
 TInt CCamInfoListBoxContainer::CountComponentControls() const
     {
-    return 1;
+    return CCamContainerBase::CountComponentControls() + 1;
     }
 
 // ---------------------------------------------------------
@@ -320,9 +320,14 @@
 // Returns the requested component control
 // ---------------------------------------------------------
 //
-CCoeControl* CCamInfoListBoxContainer::ComponentControl( TInt /*aIndex*/ ) const
+CCoeControl* CCamInfoListBoxContainer::ComponentControl( TInt aIndex ) const
     {
-    return iListBox;
+    CCoeControl* control = CCamContainerBase::ComponentControl( aIndex );
+    if( control == NULL)
+        {
+        control = iListBox;
+        }
+    return control;
     }
 
 // ---------------------------------------------------------
@@ -411,7 +416,7 @@
     
     // If the Ok button or shutter key is pressed, select the current item
     if ( ( aKeyEvent.iCode == EKeyOK && aKeyEvent.iRepeats == 0 && aType == EEventKey ) ||
-         ( aType == EEventKeyDown && 
+         ( aType == EEventKey && 
          ( IsCaptureKeyL( aKeyEvent, aType ) || IsShutterKeyL( aKeyEvent, aType ) ) ) )
         {
         TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType );
--- a/camerauis/cameraapp/generic/src/CamPostCaptureContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamPostCaptureContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -201,7 +201,7 @@
 //
 TInt CCamPostCaptureContainer::CountComponentControls() const
     {
-	TInt count = 0;
+	TInt count = CCamContainerBase::CountComponentControls();
     if( ( iPaneInUse == ECamPaneCounter ) || ( iPaneInUse == ECamPaneProgress ) )
 	    {
 	    count++;
@@ -225,7 +225,9 @@
 //
 CCoeControl* CCamPostCaptureContainer::ComponentControl( TInt aIndex ) const
     {
-	CCoeControl* con = NULL;
+	CCoeControl* con = CCamContainerBase::ComponentControl( aIndex );
+	if( con )
+	    return con;
    	switch( aIndex )
     	{
 	    case ECamPostCaptureSubControlNaviPane:
--- a/camerauis/cameraapp/generic/src/CamPreCaptureContainerBase.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamPreCaptureContainerBase.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -66,6 +66,7 @@
 #include "camstartuplogo.h"
 #include "camvfgridinterface.h"
 #include "camlinevfgriddrawer.h"
+#include "camcapturebuttoncontainer.h"
 
 // CONSTANTS
 const TInt KZoomPanelTimeout = 4000000;     // 4s 
@@ -76,13 +77,9 @@
 const TInt KNumberOfBlinks = 3;
 const TInt KNumberOfBlinksVideo = 8;
 
-const TRect KIconRect(0, 0, 40, 40);
-const TInt32 KCaptureButtonWidth( 50 );
-const TInt32 KCaptureButtonYDelta( 35 );
-const TInt32 KCaptureIconDelta( 7 );
-const TUint32 KToolbarExtensionBgColor = 0x00000000;
-const TInt KToolBarExtensionBgAlpha = 0x7F;
-
+const TSize  KCaptureButtonSize( 50, 50 );
+const TSize  KAdditionalArea( 25, 11 );
+const TInt32 KCaptureButtonYDelta( 10 );
 
 // Snapshot data is needed in timelapse mode
 const TUint KCameraEventInterest = ( ECamCameraEventClassVfControl      
@@ -102,7 +99,12 @@
 CCamPreCaptureContainerBase::~CCamPreCaptureContainerBase()
   {
   PRINT( _L("Camera => ~CCamPreCaptureContainerBase" ))
-  
+
+  if( iCaptureButtonContainer )
+      {
+      delete iCaptureButtonContainer;
+      }
+
   iController.ViewfinderWindowDeleted( &Window() );
   
   iController.RemoveSettingsObserver  ( this );
@@ -311,14 +313,28 @@
     TRAP_IGNORE(iStartupLogo = CCamStartupLogo::NewL(*appUi->StartupLogoController(), aRect));
     }
 
-  // Capture icon rectangle
-  TRect containerRect = Rect();
-  TPoint center( containerRect.Center() );
+  // Capture button container  
+  if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() &&
+       iController.IsTouchScreenSupported() )
+      {
+      TRect rect = Rect();
+      TPoint center( rect.Center() );
+      TRect captureRect;
+      captureRect.SetRect( center.iX   - KCaptureButtonSize.iWidth/2,
+                           rect.iBr.iY - KCaptureButtonSize.iHeight - KCaptureButtonYDelta, 
+                           center.iX   + KCaptureButtonSize.iWidth/2,
+                           rect.iBr.iY - KCaptureButtonYDelta  );
+      captureRect.Grow( KAdditionalArea );
 
-  iCaptureRect.SetRect( center.iX - KCaptureButtonWidth/2, 
-                        containerRect.iBr.iY - KCaptureButtonWidth - KCaptureButtonYDelta, 
-                        center.iX + KCaptureButtonWidth/2, 
-                        containerRect.iBr.iY - KCaptureButtonYDelta  );
+      TCamCameraMode mode = ECamControllerImage;
+      if ( iView.Id() == TUid::Uid( ECamViewIdVideoPreCapture ) )
+          {
+          mode = ECamControllerVideo;
+          }
+      iCaptureButtonContainer = CCamCaptureButtonContainer::NewL( iController, iView, 
+                                                                  *this, captureRect, 
+                                                                  mode );
+      }
 
   PRINT( _L("Camera <= CCamPreCaptureContainerBase::BaseConstructL ") );
   }
@@ -562,20 +578,7 @@
     // Stop any zooming activity if capture key detected
     if ( captureKey )
         {
-        CCamZoomPane* zoom_pane = appUi->ZoomPane();
-
-        if ( zoom_pane )
-            {
-            PRINT( _L("Camera <> CCamPreCaptureContainerBase::OfferKeyEventL calling StopZoom()") );
-            zoom_pane->StopZoom();
-            }
-        
-        // Stop blinking icon when capture is initiated
-        if ( iIndBlinkTimer && iIndBlinkTimer->IsActive() )
-            {
-            iIndBlinkTimer->Cancel();
-            iDrawIndicator = ETrue;
-            }
+        PrepareForCapture();
         }
     TBool viewFinderRunning = iReceivedVfFrame;
     if ( iController.UiConfigManagerPtr() &&
@@ -671,6 +674,7 @@
             PRINT( _L("Camera <= CCamPreCaptureContainerBase::OfferKeyEventL .. capture key up handled") )
             return EKeyWasConsumed;
             }
+        iController.HandlePendingHdmiEvent();
         }
     else 
         {
@@ -742,6 +746,8 @@
     // ---------------------------------------------------
     case ECamEventOperationStateChanged:
       {
+	  UpdateCaptureButton();
+
       if( iController.IsAppUiAvailable() && iController.UiConfigManagerPtr()
           && iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
         {
@@ -752,12 +758,13 @@
             HandleOperationStateChangeEventL();
             }
         }
-      iCaptureButtonShown = CaptureButtonActive();
       break;
       }
     // ---------------------------------------------------
     case ECamEventEngineStateChanged:
         {
+        UpdateCaptureButton();
+        
         PRINT1( _L("Camera <> Start mode indi blinking, op:%d"), iController.CurrentOperation() );
 
         if ( !iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() 
@@ -1120,12 +1127,6 @@
        }
    DrawScreenFurniture( gc );
    DrawNaviControls( gc );
-   
-   // Draw capture button
-   if( iCaptureButtonShown )
-       {
-       DrawCaptureButton( gc );   
-       }
 
    PRINT( _L( "Camera <= CCamPreCaptureContainerBase::Draw" ) );        
    }
@@ -1710,14 +1711,19 @@
 //
 TInt CCamPreCaptureContainerBase::CountComponentControls() const
   {
-  TInt count = 0;
+  TInt count = CCamContainerBase::CountComponentControls();
     if(iActivePalette && iActivePalette->CoeControl()->IsVisible())
         {
         count++; //Active Palette
-        }   
+        }
     
-  return count;
-  }
+    if( iCaptureButtonContainer ) // Capture button container
+        {
+        count++;
+        }
+    PRINT1( _L("Camera <> CCamPreCaptureContainerBase::CountComponentControls %d"), count );
+    return count;
+    }
 
 // ----------------------------------------------------
 // CCamPreCaptureContainerBase::ComponentControl
@@ -1726,10 +1732,13 @@
 //
 CCoeControl* CCamPreCaptureContainerBase::ComponentControl( TInt aIndex ) const
   {
-  CCoeControl* con = NULL;
+  PRINT1( _L("Camera <> CCamPreCaptureContainerBase::ComponentControl index:%d"), aIndex );
+  CCoeControl* con = CCamContainerBase::ComponentControl( aIndex );
+  if( con )
+      return con;
+
   switch ( aIndex )
       {
-     
      /*
       case ECamTimeLapseControl:
             {
@@ -1752,9 +1761,26 @@
           if(iActivePalette && iActivePalette->CoeControl()->IsVisible())         
               {
               con = iActivePalette->CoeControl();
-              }             
+              }
+          else if( iCaptureButtonContainer )
+              {
+              PRINT( _L("Camera <> capture button container A") );
+              con = iCaptureButtonContainer;
+              }
+          else
+              {
+              
+              }
           break;
-          }        
+          }     
+      case ECamCaptureButton:
+          {
+          if( iCaptureButtonContainer )
+              {
+              PRINT( _L("Camera <> capture button container A") );
+              con = iCaptureButtonContainer;
+              }
+          }
         default:
             break;
       }         
@@ -2453,99 +2479,31 @@
         aPointerEvent.iType,
         aPointerEvent.iPosition.iX,
         aPointerEvent.iPosition.iY );
-   CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
-   
-   // Capture button
-   TRect captureRect( iCaptureRect );
-   captureRect.Grow( 30, 30 );
-   
-   if ( iCaptureButtonShown && captureRect.Contains( aPointerEvent.iPosition ) )
+    CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
+    if ( !appUi->IsSecondCameraEnabled() )
        {
-       if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
-           {
-           MTouchFeedback* feedback = MTouchFeedback::Instance(); 
-           if ( !iCaptureIconPressed && feedback )
-               {
-               feedback->InstantFeedback( ETouchFeedbackBasicButton );        
-               }
-           iCaptureIconPressed = ETrue;           
-           DrawNow( captureRect );
-           }
-       else if ( aPointerEvent.iType == TPointerEvent::EButton1Up
-                 && iCaptureIconPressed )
+       // don't let zoom pane be used when capturing image
+       if ( iController.CurrentMode() != ECamControllerImage ||
+            ( iController.CurrentOperation() != ECamCapturing &&
+              iController.CurrentOperation() != ECamCompleting &&
+              iController.CurrentOperation() != ECamFocusing ) )
            {
-           iCaptureIconPressed = EFalse;
-
-           // Give feedback on button release
-           MTouchFeedback* feedback = MTouchFeedback::Instance(); 
-           if ( feedback )
-               {
-               feedback->InstantFeedback( ETouchFeedbackBasicButton );        
-               }
-
-           // About to start capture ... hide stop zoom etc.
-           if ( iZoomPane )
-               {
-               PRINT( _L("Camera <> CCamPreCaptureContainerBase::HandlePointerEventL - StopZoom()") );
-               iZoomPane->StopZoom();
-               iZoomPane->MakeVisible( EFalse, ETrue );
-               }
-           // Stop blinking icon when capture is initiated
-           if ( iIndBlinkTimer && iIndBlinkTimer->IsActive() )
-               {
-               iIndBlinkTimer->Cancel();
-               iDrawIndicator = ETrue;
-               }
+           if ( iZoomPane )  
+                {
+                if ( iZoomPane->HandlePointerEventL( aPointerEvent ) )
+                    {
+                    ShowZoomPaneWithTimer(); 
+                    return;
+                    }
+                }
+           }
 
-           if ( iController.CurrentMode() == ECamControllerVideo ) 
-               {
-               iView.HandleCommandL( ECamCmdRecord );
-               }
-           else
-               {
-               iView.HandleCommandL( ECamCmdCaptureImage );
-               }
-           }
-       else
-           {
-		   // Avoid compiler warning
-           }
-       }
-   else 
-       {
-       PRINT( _L("Camera <> CCamPreCaptureContainerBase::HandlePointerEventL - outside button region") );
-       // Drags can potentially start from inside button area
-       if ( iCaptureIconPressed && aPointerEvent.iType != TPointerEvent::EDrag )
-           {
-           iCaptureIconPressed = EFalse;
-           DrawNow( captureRect );
-           }
-          
-       if ( !appUi->IsSecondCameraEnabled() )
-           {
-           // don't let zoom pane be used when capturing image
-           if ( iController.CurrentMode() != ECamControllerImage ||
-                ( iController.CurrentOperation() != ECamCapturing &&
-                  iController.CurrentOperation() != ECamCompleting &&
-                  iController.CurrentOperation() != ECamFocusing ) )
-               {
-               if ( iZoomPane )  
-                    {
-                    if ( iZoomPane->HandlePointerEventL( aPointerEvent ) )
-                        {
-                        ShowZoomPaneWithTimer(); 
-                        return;
-                        }
-                    }
-               }
-    
-            if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
-                  !appUi->DrawPreCaptureCourtesyUI() )
-                {
-                appUi->HandleCommandL( ECamCmdRaiseCourtesyUI );
-                }
-           CCamContainerBase::HandlePointerEventL( aPointerEvent );
-           }
+        if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
+              !appUi->DrawPreCaptureCourtesyUI() )
+            {
+            appUi->HandleCommandL( ECamCmdRaiseCourtesyUI );
+            }
+       CCamContainerBase::HandlePointerEventL( aPointerEvent );
        }
 
     PRINT( _L("Camera <= CCamPreCaptureContainerBase::HandlePointerEventL") );
@@ -2904,64 +2862,64 @@
     }
 
 // -------------------------------------------------------------
-// CCamPreCaptureContainerBase::DrawCaptureButton
-// -------------------------------------------------------------
-//
-void CCamPreCaptureContainerBase::DrawCaptureButton( CBitmapContext& aGc ) const
-    {
-    TRect containerRect = Rect();
-    TPoint iconTl( containerRect.Center().iX - KCaptureButtonWidth/2 + KCaptureIconDelta, 
-                   containerRect.iBr.iY - KCaptureButtonYDelta - KCaptureButtonWidth + KCaptureIconDelta );
-
-    aGc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
-    aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
-    aGc.SetPenStyle( CGraphicsContext::ENullPen );
-   
-    if ( iCaptureIconPressed )
-        {
-        aGc.SetBrushColor( KRgbBlack );
-        }
-    else
-        {
-        aGc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) );
-        }
-    aGc.DrawEllipse( iCaptureRect );    
-
-    aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
-    aGc.SetPenStyle( CGraphicsContext::ESolidPen );
-    aGc.BitBltMasked( iconTl, iCaptureIcon, KIconRect, iCaptureMask, EFalse );
-    }
-
-// -------------------------------------------------------------
 // CCamPreCaptureContainerBase::FocusChanged
 // -------------------------------------------------------------
 //
 void CCamPreCaptureContainerBase::FocusChanged( TDrawNow aDrawNow )
     {
-    PRINT2( _L("Camera <> CCamPreCaptureContainerBase::FocusChanged, draw:%d, focused:%d"), aDrawNow, 
-                IsFocused() );
-    iCaptureButtonShown = CaptureButtonActive();
-    if ( aDrawNow )
-        {
-        DrawNow();
-        }
+    PRINT3( _L("Camera <> CCamPreCaptureContainerBase::FocusChanged, draw:%d, focused:%d, button focused:%d"), 
+                aDrawNow, IsFocused(), 
+                iCaptureButtonContainer ? iCaptureButtonContainer->IsFocused() : 0 );
+    UpdateCaptureButton();
+    CCoeControl::FocusChanged( aDrawNow );
     }
 
 // -------------------------------------------------------------
-// CCamPreCaptureContainerBase::CaptureButtonActive
+// CCamPreCaptureContainerBase::UpdateCaptureButton
 // -------------------------------------------------------------
 //
-TBool CCamPreCaptureContainerBase::CaptureButtonActive() const
+void CCamPreCaptureContainerBase::UpdateCaptureButton()
     {
+    PRINT(_L("Camera => CCamPreCaptureContainerBase::UpdateCaptureButton"));
+    
     TBool buttonActive = EFalse;
-    if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() 
-            && iController.IsTouchScreenSupported() )
+    if ( iCaptureButtonContainer )
         {
-        buttonActive = IsFocused() && iController.CurrentOperation() == ECamNoOperation;
-        PRINT1( _L("Camera <> capture button active:%d"), buttonActive );
+        TCamCameraMode mode = iController.CurrentMode();
+        
+        buttonActive = ( IsFocused() || iCaptureButtonContainer->IsFocused() ) 
+                       && ECamNoOperation == iController.CurrentOperation()
+                       && ( ECamControllerImage == mode || ECamControllerVideo == mode );
+
+        PRINT1( _L("Camera <> capture button shown:%d"), buttonActive );
+        iCaptureButtonContainer->SetCaptureButtonShown( buttonActive );
         }
-    return buttonActive;
+    PRINT(_L("Camera <= CCamPreCaptureContainerBase::UpdateCaptureButton"));
     }
 
-// End of File  
+// -------------------------------------------------------------
+// CCamPreCaptureContainerBase::PrepareForCapture
+// -------------------------------------------------------------
+//
+void CCamPreCaptureContainerBase::PrepareForCapture()
+    {
+    if ( iZoomPane )
+        {
+        PRINT( _L("Camera <> CCamPreCaptureContainerBase::PrepareForCapture - StopZoom()") );
+        iZoomPane->StopZoom();
+        }
+    
+    // Stop blinking icon when capture is initiated
+    if ( iIndBlinkTimer && iIndBlinkTimer->IsActive() )
+        {
+        iIndBlinkTimer->Cancel();
+        iDrawIndicator = ETrue;
+        }
+    
+    if ( iCaptureButtonContainer )
+        {
+        iCaptureButtonContainer->SetCaptureButtonShown( EFalse );
+        }
+    }
+// End of File
 
--- a/camerauis/cameraapp/generic/src/CamPreCaptureViewBase.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamPreCaptureViewBase.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -209,7 +209,10 @@
             break;
        case ECamCmdPopUpMenuZoom: 
             {
-            iContainer->ShowZoomPaneWithTimer();
+            if ( iContainer )
+                {
+                iContainer->ShowZoomPaneWithTimer();
+                }
             }     
             break;
         case ECamCmdCaptureSetupFlashStill:
@@ -247,6 +250,13 @@
                 }
             }     
             break;
+        case ECamCmdSettings:
+            // Hide the capture button
+            if ( iContainer )
+                {
+                iContainer->SetFocus( EFalse );
+                }
+            // fall-through
         default:
             {                                       
             CCamCaptureSetupViewBase::HandleCommandL( aCommand );                            
@@ -661,8 +671,12 @@
         {
         StatusPane()->MakeVisible( EFalse );
         }
+    
     if ( iController.IsTouchScreenSupported() )
         {
+        // Make sure that icons are upto date
+        UpdateToolbarIconsL();
+    
         CAknToolbar* fixedToolbar = Toolbar();
         if ( fixedToolbar )
             {
@@ -790,6 +804,10 @@
 void CCamPreCaptureViewBase::DoDeactivate()
     {                              
     PRINT( _L( "Camera => CCamPreCaptureViewBase::DoDeactivate" ) );
+    
+    delete iGestureFw;
+    iGestureFw = NULL;
+
     CCamCaptureSetupViewBase::DoDeactivate();
                                
     iController.RemoveControllerObserver( this );
@@ -1864,18 +1882,21 @@
         CCamZoomPane *zoomPane = appUi->ZoomPane();
         
         CCamPreCaptureContainerBase* container = static_cast<CCamPreCaptureContainerBase*>( iContainer );
-        container->ShowZoomPaneWithTimer();
-
-        // Zoom to min (if not already at min) zoom level, otherwise zoom in to max level
-        if ( !zoomPane->IsZoomAtMinimum() )
+        if ( container && zoomPane )
             {
-            PRINT( _L("Camera <> Zooming out to min level") );
-            zoomPane->ZoomToMinimum();
-            }
-        else
-            {
-            PRINT( _L("Camera <> Zooming to max level") );
-            zoomPane->ZoomToMaximum();
+            container->ShowZoomPaneWithTimer();
+
+            // Zoom to min (if not already at min) zoom level, otherwise zoom in to max level
+            if ( !zoomPane->IsZoomAtMinimum() )
+                {
+                PRINT( _L("Camera <> Zooming out to min level") );
+                zoomPane->ZoomToMinimum();
+                }
+            else
+                {
+                PRINT( _L("Camera <> Zooming to max level") );
+                zoomPane->ZoomToMaximum();
+                }
             }
         }
     else
--- a/camerauis/cameraapp/generic/src/CamSceneSettingContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamSceneSettingContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -703,10 +703,10 @@
 //
 TInt CCamSceneSettingContainer::CountComponentControls() const
   {
-  TInt count = 0; // Return the number of controls inside this container    
+  TInt count = CCamContainerBase::CountComponentControls(); // Return the number of controls inside this container    
   if ( iScrollFrame )
     {
-    count = iScrollFrame->CountComponentControls();
+    count += iScrollFrame->CountComponentControls();
     }
   return count;
   }
@@ -718,14 +718,17 @@
 //
 CCoeControl* CCamSceneSettingContainer::ComponentControl( TInt aIndex ) const
   {
-  if ( iScrollFrame )
-    {
-    return iScrollFrame->ComponentControl( aIndex );
-    }
+  CCoeControl* control = NULL;
+  if( aIndex == 0 )
+      control = CCamContainerBase::ComponentControl( aIndex );
   else
-    {
-    return NULL;
-    }    
+      {
+      if ( iScrollFrame )
+          {
+          return iScrollFrame->ComponentControl( aIndex - 1 );
+          }
+      }
+  return control;
   }
 
 // ---------------------------------------------------------
--- a/camerauis/cameraapp/generic/src/CamShootingModeContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamShootingModeContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -498,7 +498,7 @@
 //
 TInt CCamShootingModeContainer::CountComponentControls() const
     {
-    return 1;
+    return CCamContainerBase::CountComponentControls() + 1;
     }
 
 // ---------------------------------------------------------
@@ -506,9 +506,14 @@
 // Returns the requested component control
 // ---------------------------------------------------------
 //
-CCoeControl* CCamShootingModeContainer::ComponentControl( TInt /*aIndex*/ ) const
+CCoeControl* CCamShootingModeContainer::ComponentControl( TInt aIndex ) const
     {
-    return iListBox;
+    CCoeControl* control = CCamContainerBase::ComponentControl( aIndex );
+    if( control == NULL )
+        {
+        control = iListBox;
+        }
+    return control;
     }
 
 // ---------------------------------------------------------
@@ -587,7 +592,7 @@
     if ( iController.UiConfigManagerPtr()
          && iController.UiConfigManagerPtr()->IsAutoFocusSupported() )
         {
-        if( aType == EEventKeyDown && IsShutterKeyL( aKeyEvent, aType ) )
+        if( aType == EEventKey && IsShutterKeyL( aKeyEvent, aType ) )
             {
             TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType );
             if( UserSceneHighlighted() )
@@ -601,7 +606,7 @@
             return response;
             }
         }
-    else if( aType == EEventKeyDown && IsCaptureKeyL( aKeyEvent, aType ) )
+    else if( aType == EEventKey && IsCaptureKeyL( aKeyEvent, aType ) )
         {
         TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType );
         if( UserSceneHighlighted() )
--- a/camerauis/cameraapp/generic/src/CamStandbyContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamStandbyContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -128,8 +128,7 @@
 //
 TInt CCamStandbyContainer::CountComponentControls() const
     {
-    TInt count = 1;
-    return count; // Return the number of controls inside this container
+    return CCamContainerBase::CountComponentControls() + 1;
     }
 
 // ---------------------------------------------------------
@@ -139,17 +138,20 @@
 //
 CCoeControl* CCamStandbyContainer::ComponentControl( TInt aIndex ) const
     {
+    CCoeControl* control = CCamContainerBase::ComponentControl( aIndex );
+    if( control )
+        return control;
     switch ( aIndex )
         {
-        case 0:
+        case 1:
             {
-            return iText;
+            control = iText;
             }
+            break;
         default:
-            {
-            return NULL;
-            }
+            break;
         }
+    return control;
     }
 
 // ---------------------------------------------------------
--- a/camerauis/cameraapp/generic/src/CamStillPreCaptureContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamStillPreCaptureContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -51,9 +51,6 @@
 const TRgb KGridColor     = KRgbGray;
 const CGraphicsContext::TPenStyle KGridStyle = CGraphicsContext::ESolidPen;
 
-_LIT(KCamBitmapFile, "z:\\resource\\apps\\cameraapp.mif");
-const TSize KIconSize(35, 35);
-
 // ================= MEMBER FUNCTIONS =======================
 
 // ---------------------------------------------------------------------------
@@ -101,13 +98,6 @@
       delete iFlashBitmap;
       delete iFlashBitmapMask;
       }
-  
-  if ( iCaptureIcon )
-      {
-      delete iCaptureIcon;
-      delete iCaptureMask;
-      }
-  
   PRINT( _L("Camera <= ~CCamStillPreCaptureContainer" ))
   }
 
@@ -160,16 +150,6 @@
           ->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
       OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMSTILLPRECAPTURECONTAINER_CONSTRUCTL, "e_CAM_APP_AP_SETUP 0" );
       }
-  
-  // Load capture icon
-  AknIconUtils::CreateIconL(
-           iCaptureIcon,
-           iCaptureMask,
-           KCamBitmapFile(),
-           EMbmCameraappQgn_indi_cam4_capture,
-           EMbmCameraappQgn_indi_cam4_capture_mask );
-  AknIconUtils::SetSize( iCaptureIcon, KIconSize, EAspectRatioPreserved );
-  AknIconUtils::SetSize( iCaptureMask, KIconSize, EAspectRatioPreserved );
 
   PRINT( _L("Camera <= CCamStillPreCaptureContainer::ConstructL" ))
   }
@@ -663,6 +643,20 @@
       return EKeyWasNotConsumed;
       }
     }
+  if ( iController.UiConfigManagerPtr() 
+         && !iController.UiConfigManagerPtr()->IsAutoFocusSupported()
+         && iController.IsTouchScreenSupported() )
+         {
+         CAknToolbar* fixedToolbar = appui->CurrentFixedToolbar();
+         if ( fixedToolbar )
+            {
+             CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension();
+            if ( extension )
+                {
+                 extension->SetShown( EFalse ); 
+                }
+             }
+         }
 
   // Go straight to capture
   keyResponse = appui->StartCaptureL( aKeyEvent );
--- a/camerauis/cameraapp/generic/src/CamStillPreCaptureView.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamStillPreCaptureView.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -1182,8 +1182,6 @@
           CAknToolbar* toolbar = Toolbar();
           toolbar->SetToolbarVisibility(EFalse);
           }
-
-      UpdateToolbarIconsL();
       }
   else
       {
@@ -1351,6 +1349,7 @@
 //
 void CCamStillPreCaptureView::UpdateToolbarIconsL()
     {
+    PRINT( _L("Camera => CCamStillPreCaptureView::UpdateToolbarIconsL") );
 	OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMSTILLPRECAPTUREVIEW_UPDATETOOLBARICONSL, "e_CCamStillPreCaptureView_UpdateToolbarIconsL 1" );
     // fixed toolbar is used only with touch devices
     if(!iController.IsTouchScreenSupported())
@@ -1366,9 +1365,10 @@
 	UpdateSelfTimerIconsL();
 	UpdateVFGridIconsL();
 	UpdateBurstModeIconsL();
-	UpdateFaceTracKingIconsL(); 
+	UpdateFaceTrackingIconsL(); 
 	RedrawToolBar();
     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMSTILLPRECAPTUREVIEW_UPDATETOOLBARICONSL, "e_CCamStillPreCaptureView_UpdateToolbarIconsL 0" );
+    PRINT( _L("Camera <= CCamStillPreCaptureView::UpdateToolbarIconsL") );
     }
 
 // ---------------------------------------------------------------------------
@@ -2148,7 +2148,7 @@
                     EMbmCameraappQgn_indi_cam4_viewfinder_off_mask,
                     skinInstance,
                     KAknsIIDQgnIndiCam4ViewfinderOff );
-                HBufC* buttonText = StringLoader::LoadLC( R_QTN_LCAM_TB_HIDE_VIEWFINDER_GRID );
+                HBufC* buttonText = StringLoader::LoadLC( R_QTN_LCAM_TB_GRID );
                 state->SetTextL( *buttonText );
                 CleanupStack::PopAndDestroy( buttonText );
                 }
@@ -2161,7 +2161,7 @@
                     EMbmCameraappQgn_indi_cam4_viewfinder_on_mask,
                     skinInstance,
                     KAknsIIDQgnIndiCam4ViewfinderOn );
-                HBufC* buttonText = StringLoader::LoadLC( R_QTN_LCAM_TB_SHOW_VIEWFINDER_GRID );
+                HBufC* buttonText = StringLoader::LoadLC( R_QTN_LCAM_TB_GRID );
                 state->SetTextL( *buttonText );
                 CleanupStack::PopAndDestroy( buttonText );
                 }
@@ -2232,48 +2232,47 @@
 // CCamStillPreCaptureView::UpdateFaceTrackingIconsL 
 // ---------------------------------------------------------------------------
 //
-void CCamStillPreCaptureView::UpdateFaceTracKingIconsL()
+void CCamStillPreCaptureView::UpdateFaceTrackingIconsL()
     {
     CAknButton* button = ToolbarButtonById(  ECamCmdToggleFacetracking  );
       
     if ( button )
-              {
-              CAknButtonState* state = button->State();
-              if ( state )
-                  {
-                  TInt face = iController.IntegerSettingValue(  ECamSettingItemFaceTracking );
+        {
+        CAknButtonState* state = button->State();
+        if ( state )
+            {
+            TInt face = iController.IntegerSettingValue( 
+                ECamSettingItemFaceTracking );
                  
-                MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
-                TFileName iconFileName;
-                CamUtility::ResourceFileName( iconFileName );  
-                  if ( face == ECamSettOff )
-                      {
-                      PRINT( _L( "Camera => UpdateFaceTrackingIconL on" ) ); 
-                      SetIconL (
-                                button,
-                                iconFileName,
-                                EMbmCameraappQgn_indi_cam4_tb_facedet_off,
-                                EMbmCameraappQgn_indi_cam4_tb_facedet_off_mask,
-                                skinInstance,
-                                KAknsIIDQgnIndiCam4TbFacedetOff );
-                      
-                      }
-                  else
-                      {
-                      PRINT( _L( "Camera => UpdateFaceTrackingIconL off" ) ); 
-                      SetIconL (
-                                 button,
-                                 iconFileName,
-                                 EMbmCameraappQgn_indi_cam4_tb_facedet,
-                                 EMbmCameraappQgn_indi_cam4_tb_facedet_mask,
-                                 skinInstance,
-                                 KAknsIIDQgnIndiCam4TbFacedet );
-                      }
-                  }
-              }
-    
-          
-      
-     }
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+            TFileName iconFileName;
+            CamUtility::ResourceFileName( iconFileName );  
+            if ( face == ECamSettOff )
+                {
+                PRINT( _L( "Camera => UpdateFaceTrackingIconL off" ) ); 
+                SetIconL (
+                    button,
+                    iconFileName,
+                    EMbmCameraappQgn_indi_cam4_tb_facedet_off,
+                    EMbmCameraappQgn_indi_cam4_tb_facedet_off_mask,
+                    skinInstance,
+                    KAknsIIDQgnIndiCam4TbFacedetOff );
+                }
+            else
+                {
+                PRINT( _L( "Camera => UpdateFaceTrackingIconL on" ) ); 
+                SetIconL (
+                          button,
+                          iconFileName,
+                          EMbmCameraappQgn_indi_cam4_tb_facedet,
+                          EMbmCameraappQgn_indi_cam4_tb_facedet_mask,
+                          skinInstance,
+                          KAknsIIDQgnIndiCam4TbFacedet );
+                }
+            }
+        }
+    // Update the status indicator too.
+    iController.NotifyControllerObservers( ECamEventFaceTrackingStateChanged );
+    }
 
 //  End of File  
--- a/camerauis/cameraapp/generic/src/CamUserSceneSetupContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamUserSceneSetupContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -415,7 +415,7 @@
 //
 TInt CCamUserSceneSetupContainer::CountComponentControls() const
     {
-	return 1;
+	return CCamContainerBase::CountComponentControls() + 1;
 	}
 
 // ---------------------------------------------------------
@@ -425,15 +425,21 @@
 CCoeControl* CCamUserSceneSetupContainer::ComponentControl
 ( TInt aIndex ) const
     {
+    CCoeControl* control = CCamContainerBase::ComponentControl( aIndex );
+    if( control )
+        return control;
     switch( aIndex )
         {
-        case 0:
-            return iUserSceneSetupList;
+        case 1:
+            {
+            control = iUserSceneSetupList;
+            }
+            break;
         default:
-            return NULL;            
+            break;            
         }
         
-    // Should never get here
+    return control;
     }
 
 // ---------------------------------------------------------------------------
@@ -445,7 +451,7 @@
     const TKeyEvent& aKeyEvent,
     TEventCode aType )
     {
-    if ( aType == EEventKeyDown &&
+    if ( aType == EEventKey &&
            ( aKeyEvent.iScanCode == EStdKeyEnter || 
                aKeyEvent.iScanCode == EStdKeyNkpEnter ) )
         {
--- a/camerauis/cameraapp/generic/src/CamVideoPostCaptureView.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamVideoPostCaptureView.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -45,10 +45,11 @@
 #include "camactivepalettehandler.h"
 #include "camoneclickuploadutility.h"
 #include "CameraUiConfigManager.h"
-
+#include "CamTimer.h"
 
 
 //CONSTANTS
+const TInt KHdmiTimeout = 1000000; //1 sec
 
 // ========================= MEMBER FUNCTIONS ================================
 
@@ -75,7 +76,12 @@
 // ---------------------------------------------------------------------------
 //
 CCamVideoPostCaptureView::~CCamVideoPostCaptureView()
-    {     
+    {
+    if( iHdmiTimer )
+        {
+        delete iHdmiTimer;
+        iHdmiTimer = NULL;
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -318,6 +324,9 @@
         iAiwServiceHandler->AttachMenuL( ROID( R_CAM_VIDEO_POST_CAPTURE_MENU_ID ), 
                 R_CAM_SET_AS_RING_TONE_INTEREST );
         }
+    if( iHdmiTimer->IsActive() )
+        iHdmiTimer->Cancel();
+    iHdmiTimer->StartTimer();
     }
 
 // ---------------------------------------------------------------------------
@@ -340,7 +349,7 @@
     PRINT( _L("Camera => CCamVideoPostCaptureView::ConstructL"))
     BaseConstructL( ROID(R_CAM_VIDEO_POST_CAPTURE_VIEW_ID));
     CCamPostCaptureViewBase::ConstructL();
-
+    iHdmiTimer = CCamTimer::NewL( KHdmiTimeout, TCallBack(HdmiTimerCallback, this));
     PRINT( _L("Camera <= CCamVideoPostCaptureView::ConstructL"))
     }
 
@@ -619,6 +628,31 @@
 
     PRINT2( _L("Camera <= CCamVideoPostCaptureView::DynInitToolbarL(%d, 0x%X)" ), aResourceId, aToolbar );
     }
+	
+// ---------------------------------------------------------------------------
+// CCamVideoPostCaptureView::HdmiTimerCallback
+// ---------------------------------------------------------------------------
+//
+TInt CCamVideoPostCaptureView::HdmiTimerCallback( TAny* aSelf )
+    {
+    CCamVideoPostCaptureView* self = static_cast<CCamVideoPostCaptureView*>(aSelf);
+    TInt err(0);
+    if( self )
+        {
+        TRAP(err, self->DoHdmiTimerCallbackL() );
+        }
+    PRINT1( _L("Camera <> CCamVideoPostCaptureView::HdmiTimerCallback err=%d"), err);
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCamVideoPostCaptureView::DoHdmlTimerCallbackL
+// ---------------------------------------------------------------------------
+//
+void CCamVideoPostCaptureView::DoHdmiTimerCallbackL()
+    {
+    iController.HandlePostHdmiConnectDuringRecordingEventL();
+    }
 
     
 //  End of File  
--- a/camerauis/cameraapp/generic/src/CamVideoPreCaptureContainer.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamVideoPreCaptureContainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -48,10 +48,6 @@
 #endif
 
 
-// CONSTANTS
-_LIT(KCamBitmapFile, "z:\\resource\\apps\\cameraapp.mif");
-const TSize KIconSize(35, 35);
-
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -84,12 +80,6 @@
       iFeedback->RemoveFeedbackForControl( this );
       }
   delete iFileTypeIndicator;
-  
-  if ( iCaptureIcon )
-      {
-      delete iCaptureIcon;
-      delete iCaptureMask;
-      }
   PRINT( _L("Camera <= ~CCamVideoPreCaptureContainer") );
   }
 
@@ -101,11 +91,8 @@
 void CCamVideoPreCaptureContainer::ConstructL( const TRect& aRect )
     {
     PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL"))
-	PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL C"))
 	TCamVideoResolution res = iController.GetCurrentVideoResolution();
-	PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL D"))
 	iVFRes = iController.VideoViewFinderResourceId( res );
-	PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL E"))
 
     BaseConstructL( aRect );
     iShowReticule = EFalse;
@@ -161,16 +148,6 @@
         if ( !iFeedback )
             iFeedback = MTouchFeedback::CreateInstanceL();
         }
-    
-    // Load record icon
-    AknIconUtils::CreateIconL(
-             iCaptureIcon,
-             iCaptureMask,
-             KCamBitmapFile(),
-             EMbmCameraappQgn_indi_cam4_video,
-             EMbmCameraappQgn_indi_cam4_video_mask );
-    AknIconUtils::SetSize( iCaptureIcon, KIconSize, EAspectRatioPreserved );
-    AknIconUtils::SetSize( iCaptureMask, KIconSize, EAspectRatioPreserved );
     }
 
 // ---------------------------------------------------------------------------
@@ -438,6 +415,20 @@
     {
     CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
     
+       if ( iController.UiConfigManagerPtr() 
+                && !iController.UiConfigManagerPtr()->IsAutoFocusSupported()
+                && iController.IsTouchScreenSupported() )
+                {
+                CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar();
+                if ( fixedToolbar )
+                   {
+                    CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension();
+                   if ( extension )
+                       {
+                        extension->SetShown( EFalse ); 
+                       }
+                    }
+                }
     // neither recording nor paused
     // so attempt to start recording
     PRINT( _L("Camera <> starting capture") );
@@ -446,10 +437,6 @@
     // Hide the toolbar if we are capturing
     if( EKeyWasConsumed == keyResponse )
         {
-        // Hide capture button if we are capturing
-        iCaptureButtonShown = CaptureButtonActive();    
-        DrawNow( iCaptureRect );
-
         // Repeated key events (MSK) are ignored.
         iController.SetDemandKeyRelease( ETrue );  
         
--- a/camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -57,8 +57,9 @@
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "CamVideoPreCaptureViewTraces.h"
 #endif
+#include "CamTimer.h"
 
-
+const TInt KHdmiTimeout = 1000000; // 1 sec
 
 
 // ========================= MEMBER FUNCTIONS ================================
@@ -84,6 +85,11 @@
 //
 CCamVideoPreCaptureView::~CCamVideoPreCaptureView()
     {
+    if( iHdmiTimer )
+        {
+        delete iHdmiTimer;
+        iHdmiTimer = NULL;
+        }
     }
     
 // ---------------------------------------------------------------------------
@@ -148,7 +154,12 @@
              // if the Camera in the Portrait mode
              // MSK event is handled like a capture key
             {
-            if ( iController.IsViewFinding() && appUi->CheckMemoryL() )
+            if( iController.IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
+                    iController.IsHdmiCableConnected() )
+                {
+                appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+                }
+            else if ( iController.IsViewFinding() && appUi->CheckMemoryL() )
                 {
                 iController.StartVideoRecordingL();
                 // fixed toolbar is used only with touch devices
@@ -168,7 +179,11 @@
         {
         	TInt callType( EPSCTsyCallTypeUninitialized );
             RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
-            if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
+            if( iController.IsHdmiCableConnected() )
+                {
+                appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+                }
+            else if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
             {
             SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
             appUi->SetLensCoverExit( EFalse );
@@ -575,7 +590,10 @@
           {
           // Vf was stopped when stopping video recording, need to restart here
           // if postcapture is off.
-          StartViewFinder();  
+          StartViewFinder();
+          if( iHdmiTimer->IsActive() )
+              iHdmiTimer->Cancel();
+          iHdmiTimer->StartTimer();
           } 
       break;
       }
@@ -619,17 +637,17 @@
 //
 void CCamVideoPreCaptureView::ConstructL()
     {
-    BaseConstructL( ROID(R_CAM_VIDEO_PRE_CAPTURE_VIEW_ID));
+    BaseConstructL( ROID(R_CAM_VIDEO_PRE_CAPTURE_VIEW_ID) );
     if(iController.UiConfigManagerPtr()->IsXenonFlashSupported())
         {
         CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR);
-        UpdateToolbarIconsL();
         }
     else
         {
         CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR_VIDEOLIGHT);
         }
     CCamPreCaptureViewBase::ConstructL();
+    iHdmiTimer = CCamTimer::NewL( KHdmiTimeout, TCallBack(HdmiTimerCallback, this));
     }
 
 // ---------------------------------------------------------------------------
@@ -1314,7 +1332,12 @@
     		// in CCamVideoPreCaptureContainer
         	TInt callType( EPSCTsyCallTypeUninitialized );
             RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
-            if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
+            if( iController.IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
+                    iController.IsHdmiCableConnected() )
+                {
+                appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+                }
+            else if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
             {
                 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
                 iController.StartVideoRecordingL();
@@ -1643,5 +1666,30 @@
          }
      }
 
+ // ---------------------------------------------------------------------------
+ // CCamVideoPostCaptureView::HdmiTimerCallback
+ // ---------------------------------------------------------------------------
+ //
+ TInt CCamVideoPreCaptureView::HdmiTimerCallback( TAny* aSelf )
+     {
+     CCamVideoPreCaptureView* self = static_cast<CCamVideoPreCaptureView*>(aSelf);
+     TInt err(0);
+     if( self )
+         {
+         TRAP(err, self->DoHdmiTimerCallbackL() );
+         }
+     PRINT1( _L("Camera <> CCamVideoPreCaptureView::HdmiTimerCallback err=%d"), err);
+     return err;
+     }
+
+ // ---------------------------------------------------------------------------
+ // CCamVideoPostCaptureView::DoHdmlTimerCallbackL
+ // ---------------------------------------------------------------------------
+ //
+ void CCamVideoPreCaptureView::DoHdmiTimerCallbackL()
+     {
+     iController.HandlePostHdmiConnectDuringRecordingEventL();
+     }
+
 
 //  End of File  
--- a/camerauis/cameraapp/generic/src/CamZoomModel.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamZoomModel.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -1356,7 +1356,7 @@
         }
     else
         {
-        PRINT( _L( "Camera <= CCamZoomModel::AllowDigZoom ETrue" ) );
+        PRINT( _L( "Camera <= CCamZoomModel::AllowDigZoom False" ) );
         return EFalse;   
         }      
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraapp/generic/src/camcapturebuttoncontainer.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -0,0 +1,296 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container for custom camera capture button 
+*
+*/
+
+#include <AknIconUtils.h>
+#include <touchfeedback.h>
+
+#include "camcapturebuttoncontainer.h"
+#include "CamPreCaptureViewBase.h"
+#include "camlogging.h"
+#include "cameraapp.mbg"
+#include "CamAppUi.h"
+
+// CONSTANTS
+_LIT(KCamBitmapFile, "z:\\resource\\apps\\cameraapp.mif");
+const TSize KIconSize( 35, 35 );
+const TSize KAdditionalArea( 25, 11 );
+const TInt32 KCaptureIconDelta( 7 );
+const TUint32 KToolbarExtensionBgColor = 0x00000000;
+const TInt KToolBarExtensionBgAlpha = 0x7F;
+const TInt KCaptureButtonOrdinalPriority( 1 );
+
+
+// -----------------------------------------------------------------------------
+// CCamCaptureButtonContainer::CCamCaptureButtonContainer
+// -----------------------------------------------------------------------------
+//
+CCamCaptureButtonContainer::CCamCaptureButtonContainer( CCamAppController& aController,
+                                                        CAknView& aView,
+                                                        CCamPreCaptureContainerBase& aContainer,
+                                                        TCamCameraMode aCameraMode ) 
+    : iController( aController ), 
+      iView( aView ),
+      iParentContainer( aContainer ),
+      iCameraMode( aCameraMode )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCaptureButtonContainer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCamCaptureButtonContainer::ConstructL( const TRect& aRect )
+    {
+    PRINT( _L("Camera => CCamCaptureButtonContainer::ConstructL") );
+    CreateWindowL();
+    SetRect( aRect );
+    Window().SetBackgroundColor( KRgbTransparent );
+
+    // Keep hidden until explicitly made visible
+    MakeVisible( EFalse );
+    CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
+
+    // Load capture icon
+    TInt bitmapId = EMbmCameraappQgn_indi_cam4_capture;
+    TInt maskId   = EMbmCameraappQgn_indi_cam4_capture_mask;
+    if ( iCameraMode == ECamControllerVideo )
+        {
+        bitmapId = EMbmCameraappQgn_indi_cam4_video;
+        maskId   = EMbmCameraappQgn_indi_cam4_video_mask;
+        }
+    AknIconUtils::CreateIconL(
+             iCaptureIcon,
+             iCaptureMask,
+             KCamBitmapFile(),
+             bitmapId,
+             maskId );
+    AknIconUtils::SetSize( iCaptureIcon, KIconSize, EAspectRatioPreserved );
+    
+    iCaptureRect = aRect;
+    iFeedback = MTouchFeedback::Instance();
+    PRINT( _L("Camera <= CCamCaptureButtonContainer::ConstructL") );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCaptureButtonContainer::~CCamCaptureButtonContainer
+// -----------------------------------------------------------------------------
+//
+CCamCaptureButtonContainer::~CCamCaptureButtonContainer()
+    {
+    delete iCaptureIcon;
+    delete iCaptureMask;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCaptureButtonContainer::NewLC
+// -----------------------------------------------------------------------------
+//
+CCamCaptureButtonContainer* CCamCaptureButtonContainer::NewLC( CCamAppController& aController,
+                                                               CAknView& aView,
+                                                               CCamPreCaptureContainerBase& aContainer,
+                                                               const TRect& aRect,
+                                                               TCamCameraMode aCameraMode )
+    {
+    CCamCaptureButtonContainer* self = new (ELeave) CCamCaptureButtonContainer( aController, 
+                                                                                aView,
+                                                                                aContainer,
+                                                                                aCameraMode );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCaptureButtonContainer::NewL
+// -----------------------------------------------------------------------------
+//
+CCamCaptureButtonContainer* CCamCaptureButtonContainer::NewL( CCamAppController& aController,
+                                                              CAknView& aView,
+                                                              CCamPreCaptureContainerBase& aContainer,
+                                                              const TRect& aRect, 
+                                                              TCamCameraMode aCameraMode )
+    {
+    CCamCaptureButtonContainer* self = CCamCaptureButtonContainer::NewLC( aController, 
+                                                                          aView,
+                                                                          aContainer,
+                                                                          aRect,
+                                                                          aCameraMode );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -------------------------------------------------------------
+// CCamCaptureButtonContainer::HandlePointerEventL
+// -------------------------------------------------------------
+//
+void CCamCaptureButtonContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
+    {
+    PRINT3( _L("Camera => CCamCaptureButtonContainer::HandlePointerEventL type:%d position:%d,%d"), 
+                     aPointerEvent.iType, aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY );    
+
+    if( iCaptureButtonShown )
+        {
+        PRINT( _L("Camera <> Capture button shown") );
+        // Button down -> pressed (highlighted)
+        if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+            {
+            SetPointerCapture( ETrue );
+            ClaimPointerGrab( ETrue );
+            iCaptureButtonPressed = ETrue;
+            if ( !iFeedback )
+                {
+                iFeedback = MTouchFeedback::Instance();
+                }
+            // Feedback on button press
+            if ( iFeedback )
+                {
+                iFeedback->InstantFeedback( ETouchFeedbackBasicButton );        
+                }
+            DrawNow();
+            }
+        // Button up after button down (within button area) -> start capture
+        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up
+                  && iCaptureButtonPressed && Rect().Contains(aPointerEvent.iPosition) )
+            {
+            PRINT( _L("Camera <> starting capture") );
+            ClaimPointerGrab( EFalse );
+            SetPointerCapture( EFalse );
+            iCaptureButtonPressed = EFalse;
+
+            // Give feedback on button release
+            if ( iFeedback )
+                {
+                iFeedback->InstantFeedback( ETouchFeedbackBasicButton );        
+                }
+
+            iParentContainer.PrepareForCapture();
+            if ( iCameraMode == ECamControllerVideo ) 
+                {
+                iView.HandleCommandL( ECamCmdRecord );
+                }
+            else
+                {
+                iView.HandleCommandL( ECamCmdCaptureImage );
+                }
+            }
+        // Drags can potentially start from inside button area
+        else if ( iCaptureButtonPressed && aPointerEvent.iType != TPointerEvent::EDrag )
+            {
+            PRINT( _L("Camera <> outside button region - button to not-pressed state") );
+            ClaimPointerGrab( EFalse );
+            SetPointerCapture( EFalse );
+            iCaptureButtonPressed = EFalse;
+            DrawNow();
+            }
+        else
+            {
+            PRINT( _L("Camera <> unhandled case") );
+            // Avoid compiler warning
+            }
+        }
+
+    PRINT( _L("Camera <= CCamCaptureButtonContainer::HandlePointerEventL") );
+    }
+
+// -------------------------------------------------------------
+// CCamCaptureButtonContainer::SetCaptureButtonShown
+// -------------------------------------------------------------
+//
+void CCamCaptureButtonContainer::SetCaptureButtonShown( TBool aShown )
+    {
+    PRINT1( _L("Camera => CCamCaptureButtonContainer::SetCaptureButtonShown shown:%d"), aShown );
+    iCaptureButtonShown = aShown;
+
+    if ( !aShown )
+        {
+        MakeVisible( EFalse );
+        }
+    else if ( !IsVisible() )
+        {
+        // Ensure button is in non-pressed state when making visible 
+        iCaptureButtonPressed = EFalse;
+
+        PRINT( _L("Camera <> Making the capture button visible") );
+        DrawableWindow()->SetOrdinalPosition( 0, KCaptureButtonOrdinalPriority );
+        MakeVisible( ETrue );
+        DrawDeferred();
+        }
+    else
+        {
+        PRINT( _L("Camera <> Already visible!") );
+        }
+
+    PRINT( _L("Camera <= CCamCaptureButtonContainer::SetCaptureButtonShown") );
+    }
+
+// -----------------------------------------------------------------------------
+// CCamCaptureButtonContainer::Draw
+// -----------------------------------------------------------------------------
+//
+void CCamCaptureButtonContainer::Draw( const TRect& aRect ) const
+    {
+    PRINT( _L("Camera => CCamCaptureButtonContainer::Draw") );
+
+    CWindowGc& gc = SystemGc();
+    if ( iCaptureButtonShown )
+        {
+        DrawCaptureButton( gc );
+        }
+    else
+        {
+        PRINT( _L("Camera <> button hidden") );
+        }
+
+    PRINT( _L("Camera <= CCamCaptureButtonContainer::Draw") );
+    }
+
+// -------------------------------------------------------------
+// CCamCaptureButtonContainer::DrawCaptureButton
+// -------------------------------------------------------------
+//
+void CCamCaptureButtonContainer::DrawCaptureButton( CBitmapContext& aGc ) const
+    {
+    PRINT( _L("Camera => CCamCaptureButtonContainer::DrawCaptureButton") );
+
+    TRect boundingRect( iCaptureRect );
+    boundingRect.Move( -iCaptureRect.iTl.iX, -iCaptureRect.iTl.iY );
+    boundingRect.Shrink( KAdditionalArea );
+    
+    TPoint iconTl( boundingRect.iTl.iX + KCaptureIconDelta, 
+                   boundingRect.iTl.iY + KCaptureIconDelta );
+
+    aGc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
+    aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    aGc.SetPenStyle( CGraphicsContext::ENullPen );
+    if ( iCaptureButtonPressed )
+        {
+        aGc.SetBrushColor( KRgbBlack );
+        }
+    else
+        {
+        aGc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) );
+        }
+    aGc.DrawEllipse( boundingRect );
+
+    TRect iconRect( KIconSize );
+    aGc.SetPenStyle( CGraphicsContext::ESolidPen );
+    aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    aGc.BitBltMasked( iconTl, iCaptureIcon, iconRect, iCaptureMask, EFalse );
+
+    PRINT( _L("Camera <= CCamCaptureButtonContainer::DrawCaptureButton") );
+    }
+
--- a/camerauis/cameraapp/generic/src/cameracontroller/camcameracontroller.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/cameracontroller/camcameracontroller.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -649,6 +649,10 @@
         HandleFlashStatusEvent( aEvent.iErrorCode, ECamCameraEventFlashNotReady );
         break;
       // -------------------------------
+      // Capture event
+      case KUidECamEventImageCaptureEventUidValue:
+          NotifyObservers(aEvent.iErrorCode,  ECamCameraEventImageCaptureEvent, EventClass( ECamCameraEventImageCaptureEvent ));
+      break;
       default:
         break;
       // -------------------------------
@@ -4140,6 +4144,8 @@
 CCamCameraController::HandleReserveGainEvent( TInt aStatus )
   {
   PRINT1( _L("Camera => CCamCameraController::HandleReserveGainEvent, status:%d"), aStatus );
+  iAfInProgress = EFalse;  // Stop waiting autofocus events, if reserving camera.
+
   CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
   if( appUi->StandbyStatus() && !appUi->IsRecoverableStatus() )
       {
@@ -5705,6 +5711,7 @@
     case ECamCameraEventImageStop:
     case ECamCameraEventImageRelease:
     case ECamCameraEventImageData:
+    case ECamCameraEventImageCaptureEvent:
       return ECamCameraEventClassImage;
     // -------------------------------------------------------
     case ECamCameraEventVideoInit:
--- a/camerauis/cameraapp/generic/src/cameracontroller/camimagedecoder.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/cameracontroller/camimagedecoder.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -22,6 +22,7 @@
 
 #include <eikenv.h>
 #include <SvgCodecImageConstants.hrh>
+#include <SVGEngineInterfaceImpl.h>
 
 #include "camlogging.h"
 #include "camfilesaveutility.h"
@@ -88,7 +89,8 @@
      delete iDecodedMask;
      iDecodedMask = NULL;
      }
- 
+
+  delete iSvgEngine;
   iFs.Close();
   PRINT( _L("Camera <= ~CCamImageDecoder") );
   }
@@ -154,47 +156,57 @@
   PRINT( _L("Camera <= CCamImageDecoder::StartConversionL") );
   }
 
-
-void CCamImageDecoder::StartIconConversionL( TDesC* aFilePath )
-  {
-  PRINT( _L("Camera => CCamImageDecoder::StartConversionL 2") );
-
-  // Data for CImageDecoder must be available throughout the conversion.
-  // Need to stop any outstanding operation before deleting the descriptor.
-  Cancel();
-
-  PRINT( _L("Camera <> CCamImageDecoder: Creating decoder..") );
+// ---------------------------------------------------------------------------
+// CCamImageDecoder::StartIconConversionL
+// ---------------------------------------------------------------------------
+//
+void CCamImageDecoder::StartIconConversionL( TDesC* aFilePath, TSize& aSize )
+    {
+    PRINT3( _L("Camera => CCamImageDecoder::StartIconConversionL, file:[%S], size:(%d,%d)"),
+              &(*aFilePath), aSize.iWidth, aSize.iHeight );
 
-  delete iDecoder;
-  iDecoder = NULL;
-  
-  CImageDecoder::TOptions options = (CImageDecoder::TOptions) (CImageDecoder::EOptionNoDither );
-  iDecoder = CImageDecoder::FileNewL( iFs, *aFilePath , options, KImageTypeSVGUid );
+    // Delete any previous bitmaps, if any
+    delete iDecodedBitmap,
+    iDecodedBitmap = NULL;
+    delete iDecodedMask;
+    iDecodedMask = NULL;
+    
+    // Create bitmap for use while decoding 
+    CFbsBitmap* frameBuffer = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL( frameBuffer );
 
-  if( iDecoder->FrameCount() > 0 )
-    {
-    const TFrameInfo& info( iDecoder->FrameInfo() );
+    TFontSpec spec;
+    if ( !iSvgEngine )
+        {
+        iSvgEngine = CSvgEngineInterfaceImpl::NewL( frameBuffer, NULL, spec );
+        }
+    
+    TInt domHandle = KErrNotFound;
+    MSvgError* serr = iSvgEngine->PrepareDom( *aFilePath, domHandle );
+    PRINT3( _L("Camera <> prepare svg dom reader, warning:%d, err code:%d, description:[%S]"), 
+                serr->IsWarning(), serr->ErrorCode(), &(serr->Description()) );
+    if ( serr->HasError() && !serr->IsWarning() )
+        {
+        PRINT1( _L("Camera <> leaving with error:%d"), serr->SystemErrorCode() );
+        User::Leave( serr->SystemErrorCode() );
+        }
 
-#ifdef _DEBUG   
-    TSize size = info.iOverallSizeInPixels;
-    PRINT2( _L("Camera <> CCamImageDecoder: Bmp size(%d,%d)"), size.iWidth, size.iHeight );
-    PRINT1( _L("Camera <> CCamImageDecoder: Bmp dispmode(%d)"), info.iFrameDisplayMode );
-#endif
-
+    // create image bitmap
     PRINT( _L("Camera <> CCamImageDecoder: Create bitmap for snapshot..") );
     if( !iDecodedBitmap ) iDecodedBitmap = new (ELeave) CFbsBitmap;
     else                  iDecodedBitmap->Reset();
-    
+
     if( !iDecodedMask ) iDecodedMask = new (ELeave) CFbsBitmap;
     else                iDecodedMask->Reset();
 
     TRAPD ( createError, 
-            {
-            iDecodedBitmap->Create( info.iOverallSizeInPixels, info.iFrameDisplayMode );
-            iDecodedMask->Create( info.iOverallSizeInPixels, EGray256 );
-            } );
-    if( KErrNone != createError )
+        {
+        iDecodedBitmap->Create( aSize, EColor64K );
+        iDecodedMask->Create( aSize, EGray256 );
+        } );
+    if( createError )
       {
+      PRINT1( _L("Camera <> Error while creating bitmaps:%d"), createError );
       delete iDecodedBitmap;
       iDecodedBitmap = NULL;
       delete iDecodedMask;
@@ -202,19 +214,29 @@
       User::Leave( createError );
       }
 
-    PRINT( _L("Camera <> CCamImageDecoder: start conversion..") );
-    iRetryCounter = 0;
-    iDecoder->Convert( &iStatus, *iDecodedBitmap, *iDecodedMask, 0 );
-    SetActive();
-    }
-  else
-    {
-    PRINT( _L("Camera <> CCamImageDecoder: No frame provided, leave..") );
-    User::Leave( KErrNotFound );    
+    // create soft mask
+    iSvgEngine->SetViewportHeight((CSvgDocumentImpl *)domHandle, aSize.iHeight);
+    iSvgEngine->SetViewportWidth((CSvgDocumentImpl *)domHandle, aSize.iWidth);
+
+    // render svg image
+    serr = iSvgEngine->RenderDom( domHandle, iDecodedBitmap, iDecodedMask );
+    PRINT3( _L("Camera <> render svg, warning:%d, err code:%d, description:[%S]"), 
+                serr->IsWarning(), serr->ErrorCode(), &(serr->Description()) );
+    if ( serr->HasError() && !serr->IsWarning() )
+        {
+        PRINT1( _L("Camera <> leaving with error:%d"), serr->SystemErrorCode() );
+        User::Leave( serr->SystemErrorCode() );
+        }
+
+    CleanupStack::PopAndDestroy( frameBuffer );
+    if ( !IsActive() )
+        {
+        SetActive();
+        }
+
+    PRINT( _L("Camera <= CCamImageDecoder::StartIconConversionL") );
     }
 
-  PRINT( _L("Camera <= CCamImageDecoder::StartConversionL 2") );
-  }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
@@ -318,6 +340,12 @@
       {
       // CImageDecoder has finished using the data,
       // so we are able to free it.
+      if ( iSvgEngine )
+          {
+          iSvgEngine->Destroy();
+          delete iSvgEngine;
+          iSvgEngine = NULL;
+          }
       SetImageData( NULL );
       iObserver.ImageDecodedL( iStatus.Int(), iDecodedBitmap, iDecodedMask );
       break;
--- a/camerauis/cameraapp/generic/src/camoneclickuploadutility.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/camoneclickuploadutility.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -25,7 +25,6 @@
 #include <vgacamsettings.rsg>
 #include <centralrepository.h>
 
-
 #include "camoneclickuploadutility.h"
 #include "camlogging.h"
 #include "CamPanic.h"
@@ -362,7 +361,7 @@
         PRINT( _L("Camera <> Decoding icon") );
         iToolbar = aToolbar;
         TRAPD( err, DecodeIconL( &currIcon ) );
-        if (err)
+        if ( err )
             {
             PRINT1( _L("Camera <> CamOneClickUploadUtility - Icon decoding failed: %d"), err );
             }
@@ -377,12 +376,19 @@
             if ( button )
                 {
                 CAknButtonState* state = button->State();
-
-                CGulIcon *icon = CGulIcon::NewL( iIconImage, iIconMask );
+                CGulIcon *icon;
+                if ( iIconMask )
+                    {
+                    PRINT( _L("Camera <> Mask available") );
+                    icon =  CGulIcon::NewL( iIconImage, iIconMask );
+                    }
+                else
+                    {
+                    icon =  CGulIcon::NewL( iIconImage );
+                    }                
                 state->SetIcon( icon );
                 icon->SetBitmapsOwnedExternally( ETrue );
 
-                button->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame );
                 aToolbar->DrawNow();
                 }
             }
@@ -402,7 +408,30 @@
         {
         iDecoder = CCamImageDecoder::NewL( *this );
         }
-    iDecoder->StartIconConversionL( aPath );
+    
+    TSize size( 44, 44 );
+    CAknButton* button = dynamic_cast<CAknButton*>(
+        iToolbar->ControlOrNull( ECamCmdDelete ) );
+    if ( button )
+        {
+        CAknButtonState* state = button->State();
+        if ( state )
+            {
+            const CGulIcon* icon = state->Icon();
+            if ( icon )
+                {
+                CFbsBitmap* bitmap = icon->Bitmap(); 
+                if ( bitmap )
+                    {
+                    if ( bitmap->SizeInPixels().iHeight > 0 )
+                        {
+                        size = bitmap->SizeInPixels();
+                        }
+                    }
+                }
+            }
+        }
+    iDecoder->StartIconConversionL( aPath, size );
 
     // Mark the given file as the icon in use when decoding has started
     iIconFileName.Copy( *aPath );
@@ -436,33 +465,27 @@
     
         if ( iToolbar )
             {
-            PRINT( _L("Displaying icon") );
+            PRINT( _L("Camera <> Ready to add icon to toolbar") );
             
             CAknButton* uploadButton =
                         static_cast<CAknButton*> (iToolbar->ControlOrNull(ECamCmdOneClickUpload));
             
-            CAknButtonState* currentState(NULL);
             if ( uploadButton )
                 {
-                currentState = uploadButton->State();
-                }
-            CGulIcon *icon(NULL);
-            if ( iIconMask )
-                {
-                icon =  CGulIcon::NewL( iIconImage, iIconMask );
-                }
-            else
-                {
-                icon =  CGulIcon::NewL( iIconImage ); //Prevent freed pointer warning
-                }
-            icon->SetBitmapsOwnedExternally( ETrue );
-            if ( currentState )
-                {
-                currentState->SetIcon( icon );
-                }
-            if ( uploadButton )
-                {
-                uploadButton->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame );
+                PRINT( _L("Camera <> Creating new icon") );
+                CGulIcon *icon(NULL);
+                if ( iIconMask )
+                    {
+                    PRINT( _L("Camera <> Mask available") );
+                    icon =  CGulIcon::NewL( iIconImage, iIconMask );
+                    }
+                else
+                    {
+                    icon =  CGulIcon::NewL( iIconImage );
+                    }
+
+                icon->SetBitmapsOwnedExternally( ETrue );
+                uploadButton->State()->SetIcon( icon );
                 }
             iToolbar->DrawNow();
             }
--- a/camerauis/cameraapp/generic/src/camstartuplogo.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/camstartuplogo.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -24,6 +24,7 @@
 #include "camstartuplogo.h"
 
 _LIT(KCamBitmapFile, "z:\\resource\\apps\\cameraapp.mif");
+const TInt KStartupLogoOrdinalPriority( 2 );
 
 // ---------------------------------------------------------------------------
 // Two-phased constructor
@@ -158,7 +159,7 @@
     RDrawableWindow* window = DrawableWindow();
     if (window)
         {
-        window->SetOrdinalPosition(0);
+        window->SetOrdinalPosition(0, KStartupLogoOrdinalPriority);
         }
 
     PRINT(_L("Camera <= CCamStartupLogo::ShowL"))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraapp/generic/src/camtvaccessorymonitor.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility class to handle TV accessory events*
+*/
+
+#include <eikenv.h>
+#include <AccPolGenericIdDefinitions.h>
+#include <AccPolSubblockNameArray.h>
+
+#include "camtvaccessorymonitor.h"
+#include "camlogging.h"
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::CCamTvAccessoryMonitor
+// -----------------------------------------------------------------------------
+//
+CCamTvAccessoryMonitor::CCamTvAccessoryMonitor( MCamTvAccessoryObserver* aObserver ) :
+    CActive(EPriorityHigh),
+    iObserver( aObserver )
+    {
+    PRINT(_L("Camera <> CCamTvAccessoryMonitor::CCamTvAccessoryMonitor"));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::NewL
+// -----------------------------------------------------------------------------
+//
+CCamTvAccessoryMonitor* CCamTvAccessoryMonitor::NewL( MCamTvAccessoryObserver* aObserver )
+    {
+    PRINT(_L("Camera => CCamTvAccessoryMonitor::NewL"));
+    CCamTvAccessoryMonitor* self = new (ELeave) CCamTvAccessoryMonitor( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    PRINT(_L("Camera <= CCamTvAccessoryMonitor::NewL"));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CCamTvAccessoryMonitor::ConstructL()
+    {
+    PRINT(_L("Camera => CCamTvAccessoryMonitor::ConstructL"));
+    CActiveScheduler::Add(this); // Add to scheduler
+    User::LeaveIfError(iTvAccServer.Connect());
+    iTvAccMode.CreateSubSession(iTvAccServer);
+    TInt err = iTvAccMode.GetAccessoryMode( iPolAccMode );
+   
+    if ( err != KErrNone )
+       {
+       iPolAccMode.iAccessoryMode = EAccModeHandPortable;
+       iPreviousMode = EAccModeHandPortable;
+       }
+    else
+       {
+       iPreviousMode = iPolAccMode.iAccessoryMode;
+       }          
+    PRINT(_L("Camera <= CCamTvAccessoryMonitor::ConstructL"));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::~CCamTvAccessoryMonitor
+// -----------------------------------------------------------------------------
+//
+CCamTvAccessoryMonitor::~CCamTvAccessoryMonitor()
+    {
+    PRINT(_L("Camera => CCamTvAccessoryMonitor::~CCamTvAccessoryMonitor"));
+    Cancel(); // Cancel any request, if outstanding
+    iTvAccMode.CloseSubSession();
+    iTvAccServer.Disconnect();
+    PRINT(_L("Camera <= CCamTvAccessoryMonitor::~CCamTvAccessoryMonitor"));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CCamTvAccessoryMonitor::DoCancel()
+    {
+    PRINT(_L("Camera => CCamTvAccessoryMonitor::DoCancel"));
+    iTvAccMode.CancelNotifyAccessoryModeChanged();
+    PRINT(_L("Camera <= CCamTvAccessoryMonitor::DoCancel"));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::StartListeningL
+// -----------------------------------------------------------------------------
+//
+void CCamTvAccessoryMonitor::StartListeningL()
+    {
+    PRINT(_L("Camera => CCamTvAccessoryMonitor::StartListeningL"));
+    if (!IsActive()) // required for testing
+        {
+        iTvAccMode.NotifyAccessoryModeChanged( iStatus, iPolAccMode );
+        SetActive(); 
+        }
+    PRINT(_L("Camera <= CCamTvAccessoryMonitor::StartListeningL"));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::RunL
+// -----------------------------------------------------------------------------
+//
+void CCamTvAccessoryMonitor::RunL()
+    {
+    PRINT(_L("Camera => CCamTvAccessoryMonitor::RunL"));
+    iPreviousMode = iPolAccMode.iAccessoryMode;
+    if ( iPolAccMode.iAccessoryMode == EAccModeHandPortable )
+        {
+        iObserver->HandleTvAccessoryDisconnectedL();
+        }
+    else if( IsHdmiCableConnected() 
+                || IsTvOutCableConnected() )
+        {
+        iObserver->HandleTvAccessoryConnectedL();
+        }
+    StartListeningL();
+    PRINT(_L("Camera <= CCamTvAccessoryMonitor::RunL"));
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CCamTvAccessoryMonitor::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::IsHdmiCableConnected
+// -----------------------------------------------------------------------------
+//
+TBool CCamTvAccessoryMonitor::IsHdmiCableConnected()
+    {
+    TBool ret = ( iPolAccMode.iAccessoryMode == EAccModeHDMI );
+    PRINT1(_L("Camera <> CCamTvAccessoryMonitor::IsHdmiCableConnected=%d"),ret);
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CCamTvAccessoryMonitor::IsTvOutCableConnected
+// -----------------------------------------------------------------------------
+//
+TBool CCamTvAccessoryMonitor::IsTvOutCableConnected()
+    {
+    TBool ret = ( iPolAccMode.iAccessoryMode == EAccModeTVOut );
+    PRINT1(_L("Camera <> CCamTvAccessoryMonitor::IsTvOutCableConnected=%d"),ret);
+    return ret;
+    }
+