Revision: 201023
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 17:59:54 +0300
changeset 36 b12f3922a74f
parent 32 5c1e3c6aa4ef
child 37 64817133cd1d
Revision: 201023 Kit: 2010125
camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h
camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h
camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h
camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp
camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp
camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp
camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp
camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp
camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp
camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp
camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h
camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro
camerauis/cameraxui/cxui/cxui.pro
camerauis/cameraxui/cxui/icons/cxui.svg
camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h
camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h
camerauis/cameraxui/cxui/inc/cxuienums.h
camerauis/cameraxui/cxui/inc/cxuierrormanager.h
camerauis/cameraxui/cxui/inc/cxuieventlog.h
camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h
camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h
camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h
camerauis/cameraxui/cxui/inc/cxuistandby.h
camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h
camerauis/cameraxui/cxui/inc/cxuiview.h
camerauis/cameraxui/cxui/inc/cxuiviewmanager.h
camerauis/cameraxui/cxui/layouts/errornote_popup.docml
camerauis/cameraxui/cxui/layouts/image_setting.xml
camerauis/cameraxui/cxui/layouts/setting_scenemode.docml
camerauis/cameraxui/cxui/layouts/standbymode_popup.docml
camerauis/cameraxui/cxui/layouts/view_still_precapture.docml
camerauis/cameraxui/cxui/layouts/view_video_precapture.docml
camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp
camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp
camerauis/cameraxui/cxui/src/cxuierrormanager.cpp
camerauis/cameraxui/cxui/src/cxuieventlog.cpp
camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp
camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp
camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp
camerauis/cameraxui/cxui/src/cxuistandby.cpp
camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp
camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp
camerauis/cameraxui/cxui/src/cxuiview.cpp
camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp
camerauis/cameraxui/cxui/src/main.cpp
--- a/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h	Wed Jun 23 17:59:54 2010 +0300
@@ -27,6 +27,7 @@
 
 //forward declarations
 class CxeCameraDevice;
+class CxeSettings;
 
 
 
@@ -41,7 +42,7 @@
     Q_OBJECT
 public:
 
-    CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice );
+    CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice, CxeSettings &settings );
     virtual ~CxeAutoFocusControlSymbian();
 
     CxeError::Id  start(bool soundEnabled = true);
@@ -81,7 +82,8 @@
 
     // Handle ECam events
     void handleCameraEvent( int eventUid, int error );
-    void handleSceneChanged(CxeScene& scene);
+    void handleSceneChanged(CxeScene &scene);
+    void handleSettingValueChanged(const QString &settingId, QVariant newValue);
 
 private:
 
@@ -93,8 +95,11 @@
     CCamera::CCameraAdvancedSettings *mAdvancedSettings; // not owned
     CxeAutoFocusControl::Mode mAfMode;
     CCamera::CCameraAdvancedSettings::TFocusRange mAFRange;
+    CxeSettings &mSettings;
     bool mCancelled;
     bool mSoundEnabled;
+    bool mFaceTrackingOverride; //need for temporary override of the AF mode if FT is enabled by user
+    CxeAutoFocusControl::Mode mPreviousAFMode; //for restoring previous AF mode in case of FT override
     };
 
 #endif // CXEAUTOFOCUSCONTROLSYMBIAN_H
--- a/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h	Wed Jun 23 17:59:54 2010 +0300
@@ -51,8 +51,8 @@
     void updateBrightnessSetting(QVariant newValue);
     void updateExposureModeSetting(QVariant newValue);
     void updateExposureCompensationSetting(QVariant newValue);
-
     void updateFlashSetting(QVariant newValue);
+    void updateFaceTrackingSetting(QVariant newValue);
 
 private:
     CxeCameraDevice &mCameraDevice;
--- a/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h	Wed Jun 23 17:59:54 2010 +0300
@@ -95,7 +95,7 @@
     void prepareZoomForStill(int ecamStillResolutionIndex);
 
 protected: // from CxeStateMachine
-    void handleStateChanged( int newStateId, CxeError::Id error );
+    void handleStateChanged(int newStateId, CxeError::Id error);
 
 
 protected slots:
@@ -106,8 +106,11 @@
     // notification for when camera is released
     void prepareForRelease();
 
-    // ECam events
-    void handleImageData( MCameraBuffer *buffer, int error );
+    // ECAM events
+    void handleCameraEvent(int eventUid, int error);
+
+    // Image data event
+    void handleImageData(MCameraBuffer *buffer, int error);
 
     // Snapshot event
     void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot);
--- a/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -40,11 +40,14 @@
 /*
 * CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian
 */
-CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice)
+CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice,
+                                                       CxeSettings &settings)
     : CxeStateMachine("CxeAutoFocusControlSymbian"),
       mCameraDevice(cameraDevice),
       mAdvancedSettings(NULL),
-      mCancelled(false)
+      mSettings(settings),
+      mCancelled(false),
+      mFaceTrackingOverride(false)
 {
     CX_DEBUG_ENTER_FUNCTION();
 
@@ -65,6 +68,13 @@
     QObject::connect( &cameraDevice,
                       SIGNAL(prepareForRelease()),
                       this,SLOT(prepareForRelease()) );
+
+    // connect scene / setting change callbacks to settings control
+    QObject::connect(&mSettings,
+            SIGNAL(settingValueChanged(const QString&,QVariant)),
+            this,
+            SLOT(handleSettingValueChanged(const QString&,QVariant)));
+
     OstTrace0(camerax_performance, CXEAUTOFOCUSCONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
 
     initializeResources();
@@ -476,4 +486,40 @@
     return mSoundEnabled;
 }
 
+/*!
+* Handle new setting value.
+* New value is set to camera.
+* \param settingId The id of the updated setting
+* \param newValue A new value for the updated setting
+*/
+void CxeAutoFocusControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    if (settingId == CxeSettingIds::FACE_TRACKING) {
+        // Updating AF mode when face tracking is activated
+        // in scene mode which doesn't support face tracking
+        if (newValue.toInt()) {
+            //Face tracking enabled
+            if(mAfMode == CxeAutoFocusControl::Infinity ||
+               mAfMode == CxeAutoFocusControl::Hyperfocal) {
+                mPreviousAFMode = mAfMode;
+                setMode(CxeAutoFocusControl::Auto);
+                mFaceTrackingOverride = true;
+            }
+        } else {
+            //Face tracking disabled
+            if (mFaceTrackingOverride) {
+                mAfMode = mPreviousAFMode;
+                setMode(mAfMode);
+                mFaceTrackingOverride = false;
+            }
+        }
+
+    } else {
+        // do nothing
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 // end of file
--- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -119,11 +119,11 @@
         CX_DEBUG_ASSERT(mSettingsModel);
 
         mSettings = new CxeSettingsImp(*mSettingsModel);
-        
+
         //! @todo a temporary hack to change the startup sequence to avoid GOOM problems
         static_cast<CxeSettingsImp*>(mSettings)->loadSettings(mode());
-        
-        
+
+
         // Connect P&S key updates to settings signal.
         connect(settingsStore, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
                 mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)));
@@ -150,7 +150,8 @@
 
         mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
 
-        mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice);
+        mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, 
+		                            *mSettings);
 
         mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
 
@@ -205,6 +206,11 @@
             mAutoFocusControl,
             SLOT(handleCameraEvent(int,int)));
 
+    connect(mCameraDeviceControl,
+            SIGNAL(cameraEvent(int,int)),
+            mStillCaptureControl,
+            SLOT(handleCameraEvent(int,int)));
+
     // Connect signal for device ready events
     connect(mCameraDeviceControl,
             SIGNAL(deviceReady()),
--- a/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -48,7 +48,10 @@
 const char MAX_CHAR = 'Z';
 
 const TInt64 KMinRequiredSpaceImage = 2000000;
-const TInt64 KMinRequiredSpaceVideo = 4000000;
+
+// Whether there's enough space for video or not is handled lower in the SW stack
+// so this is set to 0 to fix an error
+const TInt64 KMinRequiredSpaceVideo = 0;
 
 
 
--- a/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -19,6 +19,7 @@
 #include <ecamadvsettings.h>
 #include <ecamimageprocessing.h>
 #include <ecam/ecamconstants.h>
+#include <ecamfacetrackingcustomapi.h>
 
 #include <QString>
 #include <QVariant>
@@ -59,6 +60,8 @@
 /*!
 * Handle new setting value.
 * New value is set to camera.
+* \param settingId The id of the updated setting
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
 {
@@ -79,6 +82,8 @@
         updateExposureModeSetting(newValue);
     } else if (settingId == CxeSettingIds::EV_COMPENSATION_VALUE) {
             updateExposureCompensationSetting(newValue);
+    } else if (settingId == CxeSettingIds::FACE_TRACKING) {
+            updateFaceTrackingSetting(newValue);
     } else {
         // do nothing
     }
@@ -93,7 +98,7 @@
 /*!
 * Handle new scene being set.
 * Scene settings are checked and new values are set to camera.
-* @param scene New scene containing scene specific settings.
+* \param scene New scene containing scene specific settings.
 */
 void CxeSettingsControlSymbian::handleSceneChanged(CxeScene& scene)
 {
@@ -104,12 +109,13 @@
     foreach (const QString& settingId, scene.keys()) {
         handleSettingValueChanged(settingId, scene[settingId]);
     }
+
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-
 /*!
-*
+* Update color tone setting value to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateColorToneSetting(QVariant newValue)
 {
@@ -136,7 +142,8 @@
 }
 
 /*!
-*
+* Update white balance setting value to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateWhiteBalanceSetting(QVariant newValue)
 {
@@ -155,7 +162,8 @@
 }
 
 /*!
-*
+* Update light sensitivity (ISO) setting value to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateLightSensitivitySetting(QVariant newValue)
 {
@@ -180,7 +188,8 @@
 }
 
 /*!
-*
+* Update sharpness setting value to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateSharpnessSetting(QVariant newValue)
 {
@@ -210,7 +219,8 @@
 }
 
 /*!
-*
+* Update contrast setting value to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateContrastSetting(QVariant newValue)
 {
@@ -233,7 +243,8 @@
 }
 
 /*!
-*
+* Update brightness setting value to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateBrightnessSetting(QVariant newValue)
 {
@@ -256,7 +267,8 @@
 }
 
 /*!
-*
+* Update Exposure mode to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateExposureModeSetting(QVariant newValue)
 {
@@ -275,7 +287,8 @@
 }
 
 /*!
-*
+* Update Exposure Compensation mode to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateExposureCompensationSetting(QVariant newValue)
 {
@@ -297,7 +310,8 @@
 }
 
 /*!
-*
+* Update flash mode to the camera device
+* \param newValue A new value for the updated setting
 */
 void CxeSettingsControlSymbian::updateFlashSetting(QVariant newValue)
 {
@@ -315,4 +329,18 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+* Update face tracking mode to the camera device
+* \param newValue A new value for the updated setting
+*/
+void CxeSettingsControlSymbian::updateFaceTrackingSetting(QVariant newValue)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking();
+    if(faceTracking) {
+        TRAP_IGNORE(faceTracking->SetFaceTrackingL(newValue.toInt()));
+    }
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 // end of file
--- a/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -499,6 +499,7 @@
     imgSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imgSceneAuto.insert(CxeSettingIds::BRIGHTNESS, 0);
     imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto);
+    imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_AUTO, imgSceneAuto);
 
@@ -516,6 +517,7 @@
     imgSceneSports.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imgSceneSports.insert(CxeSettingIds::BRIGHTNESS, 0);
     imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff);
+    imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, imgSceneSports);
 
@@ -533,6 +535,7 @@
     imgSceneCloseUp.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imgSceneCloseUp.insert(CxeSettingIds::BRIGHTNESS, 0);
     imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto);
+    imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_MACRO, imgSceneCloseUp);
 
@@ -549,6 +552,7 @@
     imgPortraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imgPortraitscene.insert(CxeSettingIds::BRIGHTNESS, 0);
     imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye);
+    imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
 
@@ -565,6 +569,7 @@
     imglandscapescene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imglandscapescene.insert(CxeSettingIds::BRIGHTNESS, 0);
     imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff);
+    imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, imglandscapescene);
 
@@ -582,6 +587,7 @@
     imgNightscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imgNightscene.insert(CxeSettingIds::BRIGHTNESS, 0);
     imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff);
+    imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, imgNightscene);
 
@@ -598,6 +604,7 @@
     imgNightpotraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
     imgNightpotraitscene.insert(CxeSettingIds::BRIGHTNESS, 0);
     imgNightpotraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye);
+    imgNightpotraitscene.insert(CxeSettingIds::FACE_TRACKING, 1);
 
     mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
 
--- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -382,8 +382,9 @@
     return err;
 }
 
-/**
+/*!
  * Command to start image capture now.
+ * @sa handleCameraEvent
  */
 void CxeStillCaptureControlSymbian::capture()
 {
@@ -392,10 +393,10 @@
 
     // Start the image capture as fast as possible to minimize lag.
     // Check e.g. space available *after* this.
+    // Capture sound will be played when we receive "image capture event" from ECAM.
     mCameraDevice.camera()->CaptureImage();
 
     if (imagesLeft() > 0) {
-        mCaptureSoundPlayer->play();
         setState(Capturing);
 
         //! @todo: NOTE: This call may not stay here. It can move depending on the implementation for burst capture.
@@ -472,6 +473,23 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+* Handle ECAM events.
+* Needed only for capture sound synchronization.
+* @param eventUid ECAM event id.
+* @param error Error code. KErrNone if operation has been successful.
+*/
+void CxeStillCaptureControlSymbian::handleCameraEvent(int eventUid, int error)
+{
+    if (eventUid == KUidECamEventImageCaptureEventUidValue && error == KErrNone) {
+        CX_DEBUG(("CxeStillCaptureControlSymbian::handleCameraEvent - image capture event"));
+        if (state() == CxeStillCaptureControl::Capturing) {
+            mCaptureSoundPlayer->play();
+        }
+    }
+}
+
+
 /**
  * handleImageData: Image data received from ECam
  */
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -23,13 +23,15 @@
 #include "cxetestutils.h"
 #include "cxefakecameradevicecontrol.h"
 #include "cxefakecameradevice.h"
+#include "cxefakesettings.h"
 #include "cxeautofocuscontrolsymbian.h"
 #include "unittest_cxeautofocuscontrolsymbian.h"
 
 UnitTestCxeAutoFocusControlSymbian::UnitTestCxeAutoFocusControlSymbian()
-    : mAutoFocusControl(0),
-      mCameraDeviceControl(0),
-      mCameraDevice(0)
+    : mAutoFocusControl(NULL),
+      mCameraDeviceControl(NULL),
+      mCameraDevice(NULL),
+      mFakeSettings(NULL)
 {
 }
 
@@ -43,11 +45,13 @@
 {
     qDebug() << "UnitTestCxeAutoFocusControlSymbian::init =>";
 
+    mFakeSettings = new CxeFakeSettings();
+
     mCameraDeviceControl = new CxeFakeCameraDeviceControl();
     mCameraDevice = new CxeFakeCameraDevice();
     mCameraDevice->newCamera(mCameraDeviceControl->cameraIndex(), mCameraDeviceControl);
 
-    mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice);
+    mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, *mFakeSettings);
     //mAutoFocusControl->initializeResources();
 
     connect(mCameraDeviceControl, SIGNAL(cameraEvent(int,int)),
@@ -61,15 +65,18 @@
 {
     qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup =>";
     delete mAutoFocusControl;
-    mAutoFocusControl = 0;
+    mAutoFocusControl = NULL;
 
     delete mCameraDeviceControl;
-    mCameraDeviceControl = 0;
+    mCameraDeviceControl = NULL;
 
     delete mCameraDevice;
-    mCameraDevice = 0;
+    mCameraDevice = NULL;
+
+    delete mFakeSettings;
+    mFakeSettings = NULL;
+
     qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup <=";
-
 }
 
 
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h	Wed Jun 23 17:59:54 2010 +0300
@@ -24,6 +24,7 @@
 class CxeAutoFocusControlSymbian;
 class CxeFakeCameraDeviceControl;
 class CxeFakeCameraDevice;
+class CxeFakeSettings;
 
 class UnitTestCxeAutoFocusControlSymbian : public QObject
 {
@@ -53,6 +54,7 @@
     CxeAutoFocusControlSymbian *mAutoFocusControl;
     CxeFakeCameraDeviceControl *mCameraDeviceControl;
     CxeFakeCameraDevice *mCameraDevice;
+    CxeFakeSettings *mFakeSettings;
 };
 
 #endif // UNITTEST_CXEAUTOFOCUSCONTROLSYMBIAN_H
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro	Wed Jun 23 17:59:54 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-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"
@@ -33,7 +33,9 @@
     cxecameradevice.cpp \
     cxefakecameradevice.cpp \
     cxecameradevicecontrolsymbian.cpp \
-    cxefakecameradevicecontrol.cpp
+    cxefakecameradevicecontrol.cpp \
+    cxefakesettings.cpp
+
 HEADERS *= unittest_cxeautofocuscontrolsymbian.h \
     cxeautofocuscontrol.h \
     cxeautofocuscontrolsymbian.h \
@@ -48,4 +50,6 @@
     cxecameradevicecontrol.h \
     cxecameradevicecontrolsymbian.h \
     cxefakecameradevicecontrol.h \
-    cxutils.h
+    cxutils.h \
+    cxefakesettings.h \
+    cxesettings.h
--- a/camerauis/cameraxui/cxui/cxui.pro	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.pro	Wed Jun 23 17:59:54 2010 +0300
@@ -24,7 +24,7 @@
     TARGET.UID3         = 0x101f857a
     TARGET.VID          = VID_DEFAULT
     TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
-    ICON                = ./icons/cxui.svg
+    SKINICON            = qtg_large_camera
     RSS_RULES           = "group_name=\"Qt Camera\";"
     # Fix for QMake translating INCLUDEPATH to SYSTEMINCLUDE
     # and TraceCompiler needing USERINCLUDE.
@@ -59,7 +59,8 @@
     -lefsrv \
     -lws32 \
     -lgdi \
-    -lapgrfx
+    -lapgrfx \
+    -lusbman
 
 CONFIG += hb
 CONFIG += service
@@ -96,6 +97,7 @@
     cxuiserviceprovider.h \
     cxuiscenemodeview.h \
     cxuizoomslider.h \
+    cxuieventlog.h \
     traces/OstTraceDefinitions.h
 
 SOURCES += main.cpp \
@@ -123,7 +125,8 @@
     cxuisettingxmlreader.cpp \
     cxuiserviceprovider.cpp \
     cxuiscenemodeview.cpp \
-    cxuizoomslider.cpp
+    cxuizoomslider.cpp \
+    cxuieventlog.cpp
 
 RESOURCES += cxui.qrc
 
--- a/camerauis/cameraxui/cxui/icons/cxui.svg	Fri Jun 11 13:26:48 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://web.resource.org/cc/"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   baseProfile="tiny"
-   height="16px"
-   version="1.1"
-   viewBox="0 0 16 16"
-   width="16px"
-   x="0px"
-   y="0px"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.45.1"
-   sodipodi:docname="cxui.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   sodipodi:docbase="J:\">
-  <metadata
-     id="metadata33">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <defs
-     id="defs31" />
-  <sodipodi:namedview
-     inkscape:window-height="575"
-     inkscape:window-width="753"
-     inkscape:pageshadow="2"
-     inkscape:pageopacity="0.0"
-     guidetolerance="10.0"
-     gridtolerance="10.0"
-     objecttolerance="10.0"
-     borderopacity="1.0"
-     bordercolor="#666666"
-     pagecolor="#ffffff"
-     id="base"
-     inkscape:zoom="23.5625"
-     inkscape:cx="8"
-     inkscape:cy="8"
-     inkscape:window-x="46"
-     inkscape:window-y="46"
-     inkscape:current-layer="svg2" />
-  <path
-     d="M1,3C0.447,3,0,3.447,0,4v9c0,0.553,0.447,1,1,1h14c0.553,0,1-0.447,1-1V4  c0-0.553-0.447-1-1-1H1z"
-     fill="#030303"
-     fill-opacity="0.7"
-     stroke-opacity="0.7"
-     id="path4" />
-  <linearGradient
-     gradientUnits="userSpaceOnUse"
-     id="SVGID_1_"
-     x1="7.9995"
-     x2="7.9995"
-     y1="3.2114"
-     y2="15.0201">
-    <stop
-       offset="0"
-       style="stop-color:#E6E6F5"
-       id="stop7" />
-    <stop
-       offset="1"
-       style="stop-color:#333342"
-       id="stop9" />
-  </linearGradient>
-  <rect
-     fill="url(#SVGID_1_)"
-     height="9"
-     width="14"
-     x="1"
-     y="4"
-     id="rect11" />
-  <rect
-     height="7"
-     width="3"
-     x="1"
-     y="5"
-     id="rect13" />
-  <rect
-     fill="none"
-     height="16"
-     width="16"
-     id="rect15" />
-  <path
-     d="M9,5.5c-1.656,0-3,1.342-3,3c0,1.656,1.344,3,3,3s3-1.344,3-3C12,6.842,10.656,5.5,9,5.5z"
-     fill="#FFFFFF"
-     fill-opacity="0.5"
-     stroke-opacity="0.5"
-     id="path17" />
-  <linearGradient
-     gradientUnits="userSpaceOnUse"
-     id="SVGID_2_"
-     x1="9"
-     x2="9"
-     y1="10.5"
-     y2="6.5005">
-    <stop
-       offset="0"
-       style="stop-color:#404040"
-       id="stop20" />
-    <stop
-       offset="1"
-       style="stop-color:#000000"
-       id="stop22" />
-  </linearGradient>
-  <path
-     d="M9,6.5c-1.104,0-2,0.896-2,2s0.896,2,2,2s2-0.896,2-2S10.104,6.5,9,6.5z"
-     fill="url(#SVGID_2_)"
-     id="path24" />
-  <circle
-     cx="9"
-     cy="8.5"
-     r="1.5"
-     id="circle26" />
-  <rect
-     fill="#FFFFFF"
-     height="1"
-     width="2"
-     x="12"
-     y="5"
-     id="rect28" />
-  <path
-     sodipodi:type="star"
-     style="opacity:0.94240836;fill:#d6c838;fill-opacity:0.88888891;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.2;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-     id="path2185"
-     sodipodi:sides="5"
-     sodipodi:cx="9.5490713"
-     sodipodi:cy="2.0795755"
-     sodipodi:r1="2.2878442"
-     sodipodi:r2="1.1439221"
-     sodipodi:arg1="0.7066142"
-     sodipodi:arg2="1.3349327"
-     inkscape:flatsided="false"
-     inkscape:rounded="0"
-     inkscape:randomized="0"
-     d="M 11.289124,3.5649867 L 9.8163862,3.1918257 L 8.6740673,4.1934816 L 8.5738634,2.6775113 L 7.268236,1.9006302 L 8.6790448,1.33687 L 9.0144416,-0.14492486 L 9.9865733,1.0226225 L 11.499487,0.88370401 L 10.689489,2.1690482 L 11.289124,3.5649867 z "
-     transform="matrix(1.5393553,0,0,1.408644,-1.7933311,0.4035599)" />
-  <path
-     style="opacity:0.94240836;fill:#ff2e0f;fill-opacity:0.8888889;fill-rule:nonzero;stroke:#000000;stroke-width:0.2;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-     id="path3370"
-     d="M 14.630774,11.24099 C 14.536244,11.293201 14.819308,11.135621 14.913602,11.082985 C 14.481821,11.352087 13.722787,11.77327 14.656116,11.243166 C 14.601222,11.283527 14.543867,11.319822 14.486831,11.357029 C 14.437422,11.390808 14.396114,11.433944 14.351156,11.472963 C 14.309178,11.515651 14.26657,11.557634 14.223886,11.599601 C 14.182552,11.64315 14.139433,11.684905 14.096701,11.727058 C 14.055728,11.779123 14.013745,11.830689 13.971712,11.882115 C 13.930618,11.932717 13.901793,11.991086 13.868625,12.046694 C 13.834262,12.097799 13.804,12.151471 13.771122,12.203569 C 13.74198,12.259923 13.712319,12.315887 13.682367,12.371835 C 13.645599,12.420172 13.611237,12.469783 13.575435,12.518766 C 13.576382,12.524441 13.542269,12.564221 13.539221,12.568399 L 12.964509,12.8166 C 12.977159,12.801279 12.983841,12.78099 13.00246,12.770636 C 13.03838,12.720619 13.065683,12.665813 13.108017,12.620824 C 13.138052,12.568359 13.175201,12.518226 13.201925,12.46288 C 13.230706,12.407601 13.254233,12.348305 13.297659,12.302125 C 13.329751,12.242915 13.362423,12.185108 13.397584,12.127804 C 13.439735,12.076333 13.485971,12.026575 13.519242,11.969082 C 13.560668,11.925564 13.600873,11.881029 13.646456,11.841713 C 13.687757,11.798172 13.727797,11.753552 13.773357,11.714319 C 13.816095,11.671426 13.855641,11.624515 13.905953,11.589889 C 13.963378,11.550947 14.020518,11.509498 14.076653,11.467879 C 15.811177,10.450909 13.771639,11.654918 14.33755,11.305861 C 14.598104,11.152026 14.854897,10.991197 15.121717,10.848282 L 14.630774,11.24099 z " />
-  <path
-     style="opacity:0.94240836;fill:#ff2e0f;fill-opacity:0.88888891;fill-rule:nonzero;stroke:#000000;stroke-width:0.2;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-     id="path3372"
-     d="M 12.536373,11.151805 C 12.479091,11.112926 12.425863,11.066349 12.373213,11.020818 C 12.318706,10.984622 12.274062,10.936464 12.225987,10.892819 C 12.180124,10.852651 12.118378,10.841646 12.062404,10.820224 C 11.993358,10.796414 11.920203,10.799144 11.848539,10.793666 C 11.764854,10.791607 11.681139,10.792432 11.597439,10.792411 C 11.520114,10.78747 11.445488,10.807058 11.370376,10.823301 C 11.31182,10.851463 11.25456,10.880325 11.197936,10.912724 C 12.433537,10.203519 11.242957,10.886316 11.129455,10.95397 C 10.964788,11.05212 11.461299,10.761935 11.62806,10.667387 C 11.82895,10.55349 11.227849,10.897966 11.02959,11.016383 C 10.863384,11.115655 11.365295,10.823458 11.533148,10.726996 C 11.476649,10.755902 11.431493,10.800249 11.38141,10.837915 C 11.337848,10.878924 11.295825,10.921376 11.252854,10.962975 C 11.206382,11.00289 11.170524,11.053058 11.129928,11.097647 C 11.092807,11.158857 11.067126,11.226268 11.038356,11.291673 C 11.005691,11.346797 10.978703,11.40475 10.948581,11.46091 C 10.915377,11.519644 10.903042,11.585876 10.884924,11.649985 C 10.856841,11.718877 10.856743,11.79285 10.847839,11.865235 C 10.843555,11.948771 10.844701,12.032437 10.844233,12.116043 C 10.830979,12.188576 10.870591,12.24475 10.890369,12.309567 C 10.909887,12.366867 10.953154,12.407295 10.984984,12.45545 C 11.007428,12.514726 11.06428,12.537513 11.105022,12.574156 C 11.161423,12.611161 11.22794,12.626325 11.291582,12.646683 C 11.372991,12.666699 11.454079,12.686484 11.535801,12.705221 C 11.619169,12.718924 11.703733,12.71686 11.787822,12.71948 C 11.852203,12.701 11.915762,12.676981 11.977319,12.65036 C 12.056025,12.643997 12.131451,12.624951 12.208836,12.610477 C 12.286379,12.601106 12.362213,12.581633 12.437697,12.561528 C 12.515374,12.555659 12.583081,12.517888 12.654168,12.490024 C 12.779027,12.421456 12.403038,12.624564 12.277914,12.692649 C 12.326236,12.656994 12.356079,12.603509 12.392588,12.556897 C 12.398225,12.549 12.403861,12.541103 12.409497,12.533207 L 12.98081,12.277956 C 12.976298,12.288174 12.971786,12.298391 12.967274,12.308609 C 12.93166,12.359492 12.892236,12.406932 12.858798,12.459415 C 12.632643,12.59766 12.418155,12.779405 12.16321,12.874737 C 12.089941,12.899359 12.019497,12.93215 11.940801,12.938494 C 11.865045,12.955847 11.790582,12.977118 11.713002,12.985849 C 11.636244,12.999757 11.558608,13.012149 11.483594,13.033306 C 11.417596,13.057385 11.357855,13.092193 11.284124,13.084018 C 11.197723,13.080109 11.110795,13.079304 11.025856,13.060563 C 10.942758,13.039451 10.859091,13.020237 10.776541,12.997001 C 10.71014,12.973551 10.640782,12.958337 10.581895,12.917287 C 10.535529,12.87375 10.479432,12.840023 10.449209,12.779439 C 10.412728,12.725506 10.368785,12.677429 10.34474,12.614874 C 10.318807,12.543426 10.280684,12.478215 10.290239,12.398374 C 10.290213,12.313935 10.289592,12.229478 10.291787,12.145058 C 10.297734,12.068362 10.295745,11.990298 10.319518,11.916022 C 10.337205,11.849975 10.354913,11.78339 10.378901,11.71923 C 10.406602,11.660623 10.42984,11.601228 10.468884,11.548823 C 10.500626,11.483495 10.531777,11.417505 10.558334,11.34943 C 10.595847,11.29904 10.618516,11.239494 10.675418,11.205108 C 10.716885,11.161461 10.756836,11.116372 10.803027,11.077518 C 10.850615,11.034367 10.892757,10.983201 10.951582,10.953602 C 12.76177,9.8994863 9.8120897,11.74785 11.613308,10.562924 C 11.636263,10.547824 10.141534,11.417376 11.684847,10.521976 C 11.744708,10.492838 11.800431,10.455161 11.86856,10.447873 C 11.94582,10.436899 12.021218,10.417484 12.100421,10.42687 C 12.184926,10.427049 12.269484,10.426228 12.353923,10.430254 C 12.430498,10.439828 12.509003,10.439224 12.58119,10.471408 C 12.644687,10.497556 12.71265,10.512359 12.760138,10.56646 C 12.807052,10.608172 12.851257,10.653264 12.902641,10.689812 C 12.955006,10.733819 13.005046,10.782137 13.06712,10.811974 L 12.536373,11.151805 z " />
-  <path
-     style="opacity:0.94240836;fill:#ff2e0f;fill-opacity:0.88888891;fill-rule:nonzero;stroke:#000000;stroke-width:0.2;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-     id="path3374"
-     d="M 13.693167,10.50844 C 13.72605,10.587373 13.763502,10.664162 13.801348,10.740812 C 13.83602,10.805891 13.875315,10.868176 13.9148,10.930338 C 13.948877,10.981628 13.986887,11.030648 14.024252,11.079411 C 14.051665,11.132902 14.092621,11.17577 14.126284,11.22406 C 14.160688,11.283316 14.208336,11.331887 14.253013,11.38308 C 14.286779,11.440917 14.333007,11.488714 14.374828,11.540352 C 14.420516,11.588389 14.465529,11.636852 14.511604,11.684467 C 14.558096,11.725133 14.590469,11.779082 14.627595,11.827936 C 14.681255,11.858472 14.715201,11.908795 14.757878,11.950847 C 14.805211,11.986976 14.847727,12.0286 14.891885,12.068326 C 14.933797,12.131457 14.990385,12.181018 15.042435,12.234662 C 15.07404,12.261042 15.098477,12.294022 15.126607,12.323818 L 14.593515,12.647234 C 14.567296,12.619304 14.545418,12.587291 14.514932,12.563522 C 14.460338,12.50949 14.405633,12.456387 14.358189,12.395763 C 14.312596,12.355498 14.266755,12.315483 14.221852,12.274425 C 14.178362,12.23293 14.139643,12.186338 14.090695,12.149997 C 14.053827,12.101853 14.022388,12.04905 13.976492,12.008615 C 13.930428,11.959921 13.884377,11.911282 13.839521,11.861462 C 13.797695,11.810362 13.75108,11.763396 13.717836,11.705554 C 13.673949,11.654197 13.627084,11.605194 13.590484,11.548033 C 13.55491,11.496657 13.513331,11.449678 13.483195,11.394039 C 13.446296,11.345458 13.406444,11.298257 13.37498,11.245668 C 13.335226,11.179863 13.294886,11.11435 13.261162,11.045118 C 13.22412,10.972468 13.190017,10.897789 13.149421,10.827059 L 13.693167,10.50844 z " />
-</svg>
--- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h	Wed Jun 23 17:59:54 2010 +0300
@@ -46,11 +46,12 @@
     };
 
 public:
-    CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings& settings);
+    CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings &settings);
     virtual ~CxuiApplicationFrameworkMonitor();
 
 public:
     ForegroundState foregroundState() const;
+    bool isUsbMassMemoryModeActive() const;
 
 signals:
     /*!
@@ -64,8 +65,18 @@
     */
     void batteryEmpty();
 
+    /*!
+    * USB mass memory mode was just activated or deactivated.
+    * @param active If true, mass memory mode was activated, and mass memory cannot be accessed.
+    * Otherwise mass memory mode was deactivated, and mass memory is again accessible.
+    */
+    void usbMassMemoryModeToggled(bool active);
+
+
 private:
-    CxuiApplicationFrameworkMonitorPrivate* p;
+    CxuiApplicationFrameworkMonitorPrivate *p;
+
+    friend class CxuiApplicationFrameworkMonitorPrivate;
 };
 
 #endif // CXUIAPPLICATIONFRAMEWORKMONITOR_H
--- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h	Wed Jun 23 17:59:54 2010 +0300
@@ -28,6 +28,7 @@
 class RWindowGroup;
 class QString;
 class QSymbianEvent;
+class CxuiEventLog;
 #endif // Q_OS_SYMBIAN
 
 
@@ -35,16 +36,14 @@
 {
     Q_OBJECT
 
-public:
-    CxuiApplicationFrameworkMonitorPrivate(CxuiApplication &application, CxeSettings& settings);
+private:
+    CxuiApplicationFrameworkMonitorPrivate(CxuiApplicationFrameworkMonitor *parent,
+                                           CxuiApplication &application,
+                                           CxeSettings &settings);
     virtual ~CxuiApplicationFrameworkMonitorPrivate();
 
-public:
     CxuiApplicationFrameworkMonitor::ForegroundState foregroundState() const;
-
-signals:
-    void foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState t);
-    void batteryEmpty();
+    bool isUsbMassMemoryModeActive() const;
 
 #ifdef Q_OS_SYMBIAN
 private slots:
@@ -53,25 +52,33 @@
 
 private:
     void init();
-    bool handleWindowServerEvent(const QSymbianEvent *event);
+    void handleWindowServerEvent(const QSymbianEvent *event);
+    void handleUsbPropertyEvent(unsigned long int key, QVariant value);
     void setState(CxuiApplicationFrameworkMonitor::ForegroundState state);
     CxuiApplicationFrameworkMonitor::ForegroundState getCurrentState();
     unsigned int focusedApplicationUid();
 #endif // Q_OS_SYMBIAN
 
-
 private:
+    CxuiApplicationFrameworkMonitor *q;
     CxuiApplication &mApplication;
-    CxeSettings& mSettings;
+    CxeSettings &mSettings;
 #ifdef Q_OS_SYMBIAN
     RWsSession &mWsSession;
     RWindowGroup &mWindowGroup;
     int mWindowGroupId;
     QString mWindowGroupName;
+
     int mKeyLockState;
     int mBatteryStatus;
+    int mUsbPersonality;
+
+    CxuiEventLog *mEventLog;
 #endif // Q_OS_SYMBIAN
+
     CxuiApplicationFrameworkMonitor::ForegroundState mState;
+
+    friend class CxuiApplicationFrameworkMonitor;
 };
 
 #endif // CXUIAPPLICATIONFRAMEWORKMONITORPRIVATE_H
--- a/camerauis/cameraxui/cxui/inc/cxuienums.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuienums.h	Wed Jun 23 17:59:54 2010 +0300
@@ -82,6 +82,7 @@
     static const char *STILL_PRE_CAPTURE_GOTO_VIDEO_ACTION = "cxui_action_goto_video";
     static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL = "images_remaining";
     static const char *STILL_PRE_CAPTURE_QUALITY_ICON = "quality_indicator";
+    static const char *STILL_PRE_CAPTURE_FACE_TRACKING_ICON = "face_tracking_indicator";
     static const char *STILL_PRE_CAPTURE_POST_CAPTURE_ACTION = "cxui_action_stillpostcapture";
     static const char *STILL_PRE_CAPTURE_INDICATOR_CONTAINER = "indicatorContainer";
     static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER = "images_left_container";
@@ -150,6 +151,7 @@
     static const char *SCENE_VIEW_RADIOBUTTONS  = "scene_view_radioButtonList";
     static const char *SCENE_VIEW_OK_BUTTON  = "scene_ok_button";
     static const char *SCENE_VIEW_CANCEL_BUTTON  = "scene_cancel_button";
+    static const char *SCENE_VIEW_HEADING_WIDGET = "scene_title";
 }
 
 namespace CxUiInternal
--- a/camerauis/cameraxui/cxui/inc/cxuierrormanager.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuierrormanager.h	Wed Jun 23 17:59:54 2010 +0300
@@ -20,6 +20,7 @@
 #include <QObject>
 #include "cxeerror.h"
 
+class HbAction;
 class HbDialog;
 class CxuiDocumentLoader;
 class CxuiCaptureKeyHandler;
@@ -42,10 +43,13 @@
     void aboutToRecoverError();
     void errorRecovered();
 
-private slots:
+public slots:
 
-    void analyze(CxeError::Id error);
-    void aboutToClosePopup();
+    void showPopup(CxeError::Id error);
+    void hidePopup(CxeError::Id error);
+
+private slots:
+    void popupClosed(HbAction *action);
     void closeApp();
 
 private:
@@ -59,10 +63,10 @@
         Critical // when error can be recovered, but needs actions e.g. camera in use
     };
 
-    void launchPopup(QString& errorMsgTxt);
-    void showHighSeverityNote(QString& errorMsgTxt);
-    void showLowSeverityNote(QString& errorMsgTxt);
-    QString getErrorDetails(CxeError::Id error);
+    void launchPopup(const QString &errorText, const QString &buttonText);
+    void showHighSeverityNote(const QString &errorText, const QString &buttonText);
+    void showLowSeverityNote(const QString &errorText);
+    void getErrorDetails(QString &errorText, QString &buttonText);
 
 private:
 
@@ -70,6 +74,7 @@
     CxuiCaptureKeyHandler &mKeyHandler;
     CxuiDocumentLoader *mDocumentLoader; // not own
     HbDialog* mErrorMsgPopup;
+    CxeError::Id mErrorId;
     CxuiErrorManager::ErrorSeverity mErrorSeverity;
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuieventlog.h	Wed Jun 23 17:59:54 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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:
+*
+*/
+
+#ifndef CXUIEVENTLOG_H
+#define CXUIEVENTLOG_H
+
+#include <QString>
+#include <QTime>
+#include <QLinkedList>
+
+/*!
+* Class for saving events in run-time to be printed / traced out later.
+* Useful when tracing is not possible when the events occur, but can be done later.
+*/
+class CxuiEventLog
+{
+public:
+    CxuiEventLog(const QString &name, int size = 10);
+    ~CxuiEventLog();
+
+    void append(const QString &type, const QString &value);
+    void print() const;
+
+private:
+    struct CxuiEvent
+    {
+    public:
+        CxuiEvent(const QString &type, const QString &value);
+
+        QTime mTime;
+        QString mType;
+        QString mValue;
+    };
+
+    QLinkedList<CxuiEvent> mEvents;
+    int mSize;
+    QString mName;
+};
+
+#endif // CXUIEVENTLOG_H
--- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h	Wed Jun 23 17:59:54 2010 +0300
@@ -27,6 +27,7 @@
 class HbMainWindow;
 class HbAction;
 class HbLabel;
+class ShareUi;
 
 class CxeEngine;
 class CxuiDocumentLoader;
@@ -55,7 +56,6 @@
 
 protected:
     bool eventFilter(QObject *object, QEvent *event);
-    void mousePressEvent(QGraphicsSceneMouseEvent *event);
     void showEvent(QShowEvent *event);
     void hideEvent(QHideEvent *event);
     void showToolbar();
@@ -95,6 +95,8 @@
     QGraphicsRectItem *mBackgroundItem;
     HbLabel *mImageLabel;
 
+    ShareUi *mShareUi;
+
     /**
      * Timer used to stop viewfinder after a delay if the user remains in
      * post-capture view. Viewfinder is not stopped immediately when
--- a/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h	Wed Jun 23 17:59:54 2010 +0300
@@ -113,7 +113,6 @@
     virtual void initializeSettingsGrid() = 0;
     void showEvent(QShowEvent *event);
     void hideEvent(QHideEvent *event);
-    void mousePressEvent(QGraphicsSceneMouseEvent *event);
     bool eventFilter(QObject *object, QEvent *event);
     void launchSettingsDialog(QObject *action);
     bool isPostcaptureOn() const;
@@ -147,6 +146,7 @@
     CxuiSettingDialog *mSettingsDialog;
     CxuiSettingRadioButtonList *mSettingsDialogList;
     HbLabel *mQualityIcon;
+    HbLabel *mFaceTrackingIcon;
 
 private:
     CxuiSettingDialog* createSettingsDialog();
--- a/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h	Wed Jun 23 17:59:54 2010 +0300
@@ -99,6 +99,7 @@
     HbPushButton* mScenesOkButton;
     HbPushButton* mScenesCancelButton;
     HbWidget* mScenesContainer;
+    HbLabel *mScenesHeading;
 
     QTimer mCameraReleaseTimer;
 
--- a/camerauis/cameraxui/cxui/inc/cxuistandby.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuistandby.h	Wed Jun 23 17:59:54 2010 +0300
@@ -45,6 +45,10 @@
     CxuiStandby(CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader, CxeEngine *engine);
     ~CxuiStandby();
 
+public:
+    void allowDismiss(bool allow);
+    bool isActive() const;
+
 signals:
 
     /*
@@ -58,26 +62,15 @@
     void aboutToExitStandby();
 
 public slots:
-
-    /*
-    * starts standby timer
-    */
     void startTimer();
-
-    /*
-    * stops standby timer
-    */
     void stopTimer();
-
-    /*
-    * handles focus gain event
-    */
-    bool handleMouseEvent();
+    bool handleMouseEvent(QEvent *event);
+    void enterStandby();
+    void exitStandby();
 
 private slots:
 
     void dismissStandby();
-    void toStandby();
 
 private: // helper methods
 
@@ -92,6 +85,7 @@
     HbDialog *mStandbyPopup;
     QTimer *mStandbyTimer;
     bool mStandbyDialogVisible;
+    bool mAllowDismiss;
 };
 
 #endif // CXUISTANDBY_H
--- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h	Wed Jun 23 17:59:54 2010 +0300
@@ -125,6 +125,7 @@
 protected:
     void initializeSettingsGrid();
     void closeDialogs();
+    void updateFaceTrackingIcon();
 
 protected:
     CxuiSelfTimer *mSelfTimer;
--- a/camerauis/cameraxui/cxui/inc/cxuiview.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiview.h	Wed Jun 23 17:59:54 2010 +0300
@@ -23,6 +23,7 @@
 #include <hbview.h>
 #include <hbmainwindow.h>
 #include <hbframedrawer.h>
+#include <hbinstantfeedback.h>
 
 class CxuiDocumentLoader;
 class CxuiCaptureKeyHandler;
@@ -67,6 +68,8 @@
                                        HbFrameDrawer::FrameType frameType =
                                        HbFrameDrawer::NinePieces);
 
+    void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 protected slots:
     virtual void launchNotSupportedNotification();
     virtual void launchPhotosApp();
@@ -100,6 +103,7 @@
     bool   mZoomVisible;
     QTimer mHideControlsTimeout;
 
+    HbInstantFeedback mControlsFeedback;
 };
 
 #endif // CXUIVIEW_H
--- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h	Wed Jun 23 17:59:54 2010 +0300
@@ -56,6 +56,9 @@
     */
     CxuiDocumentLoader* documentLoader();
 
+    //@todo: Temporarily needed in main().
+    bool proceedStartup();
+
 public slots:
     void changeToPostcaptureView();
     void changeToPrecaptureView();
@@ -64,8 +67,10 @@
     void showScenesView();
 
 private slots:
+    void startupCheck();
     void toForeground();
     void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
+    void showUsbErrorPopup(bool show);
     void handleBatteryEmpty();
     void aboutToLooseFocus();
     void aboutToGainFocus();
@@ -81,6 +86,7 @@
     bool eventFilter(QObject *object, QEvent *event);
 
 private:
+    void initStartupView();
     void createStillPrecaptureView();
     void createVideoPrecaptureView();
     CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera);
--- a/camerauis/cameraxui/cxui/layouts/errornote_popup.docml	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/errornote_popup.docml	Wed Jun 23 17:59:54 2010 +0300
@@ -1,11 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.0">
+<hbdocument version="1.1">
     <widget name="errornote_popup" type="HbDialog">
+        <sizepolicy horizontalPolicy="Minimum" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+        <sizehint height="360" type="MINIMUM" width="640"/>
+        <enums name="dismissPolicy" value="NoDismiss"/>
+        <bool name="backgroundFaded" value="FALSE"/>
         <widget name="errornote_content_widget" role="HbDialog:contentWidget" type="HbWidget">
             <widget name="errornote_text" type="HbLabel">
                 <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                 <real name="z" value="0.3"/>
-                <sizehint height="360" type="PREFERRED" width="640"/>
+                <sizehint height="360" type="MINIMUM" width="640"/>
                 <string locid="txt_cam_info_error" name="plainText" value="Unexpected error occurred. Power off the device and restart"/>
             </widget>
             <widget name="errornote_exit_button_widget" type="HbWidget">
@@ -24,14 +28,12 @@
             <real name="z" value="0.1"/>
             <layout type="anchor">
                 <anchoritem dst="errornote_exit_button_widget" dstEdge="BOTTOM" spacing="0" src="" srcEdge="BOTTOM"/>
-                <anchoritem dst="errornote_exit_button_widget" dstEdge="LEFT" spacing="400" src="" srcEdge="LEFT"/>
+                <anchoritem dst="errornote_exit_button_widget" dstEdge="CENTERH" spacing="0un" src="" srcEdge="CENTERH"/>
             </layout>
         </widget>
-        <size height="360" name="size" width="640"/>
-        <rect height="360" name="geometry" width="640" x="0" y="0"/>
     </widget>
     <connect receiver="errornote_popup" sender="errornote_button_exit" signal="released()" slot="close()"/>
-    <metadata activeUIState="Common ui state" display="NHD landscape" unit="un">
+    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_landscape" unit="un">
         <uistate name="Common ui state" sections="#common"/>
     </metadata>
 </hbdocument>
--- a/camerauis/cameraxui/cxui/layouts/image_setting.xml	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/image_setting.xml	Wed Jun 23 17:59:54 2010 +0300
@@ -115,6 +115,16 @@
             <item string="txt_cam_list_night"           value="image_scene_night"          icon="qtg_mono_night" />
             <item string="txt_cam_list_night_portrait"  value="image_scene_night_portrait" icon="qtg_mono_night_portrait" />
         </setting_list>
+        
+        <!-- Face tracking (setting list) -->
+        <setting_list id="face_tracking"
+                      heading="txt_cam_title_facetracking"
+                      preview="1"
+                      type="SingleLineListBox"
+                      setting_icon="">
+            <item string="txt_cam_list_facetracking_on" value="1" icon="qtg_mono_face_tracking" />
+            <item string="txt_cam_list_facetracking_off" value="0" icon="" />
+        </setting_list>
 
     </settings>
 </cxui>
\ No newline at end of file
--- a/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml	Wed Jun 23 17:59:54 2010 +0300
@@ -18,11 +18,11 @@
                 </widget>
                 <widget name="button_container" type="HbWidget">
                     <widget name="scene_ok_button" type="HbPushButton">
-                        <string name="text" value="txt_common_button_ok"/>
+                        <string locid="txt_common_button_ok" name="text" value="Ok"/>
                         <string name="state" value="normal"/>
                     </widget>
                     <widget name="scene_cancel_button" type="HbPushButton">
-                        <string name="text" value="txt_common_button_cancel"/>
+                        <string locid="txt_common_button_cancel" name="text" value="Cancel"/>
                         <string name="state" value="normal"/>
                     </widget>
                     <real name="z" value="0"/>
@@ -35,7 +35,7 @@
                 </widget>
                 <widget name="scene_title" type="HbLabel">
                     <real name="z" value="4"/>
-                    <string name="plainText" value="txt_cam_title_scene_mode"/>
+                    <string name="plainText" value="Scene settings dialog"/>
                     <fontspec name="fontSpec" role="Title" textheight="var(hb-param-text-height-primary)"/>
                 </widget>
                 <real name="z" value="2"/>
--- a/camerauis/cameraxui/cxui/layouts/standbymode_popup.docml	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/standbymode_popup.docml	Wed Jun 23 17:59:54 2010 +0300
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.0">
+<hbdocument version="1.1">
     <widget name="standbymode_popup" type="HbDialog">
+        <sizehint height="360" type="MINIMUM" width="640"/>
         <widget name="standbymode_widget" role="HbDialog:contentWidget" type="HbWidget">
             <widget name="standby_text" type="HbLabel">
                 <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
@@ -10,9 +11,8 @@
             </widget>
             <real name="z" value="0.1"/>
         </widget>
-        <sizehint height="360" type="MINIMUM" width="640"/>
     </widget>
-    <metadata activeUIState="Common ui state" display="NHD landscape" unit="un">
+    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_landscape" unit="un">
         <uistate name="Common ui state" sections="#common"/>
     </metadata>
 </hbdocument>
--- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml	Wed Jun 23 17:59:54 2010 +0300
@@ -47,18 +47,24 @@
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <icon iconName="qtg_mono_camera" name="icon"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                 </widget>
                 <widget name="quality_indicator" type="HbLabel">
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                     <bool name="visible" value="TRUE"/>
                 </widget>
                 <widget name="flash_indicator" type="HbLabel">
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
+                    <bool name="visible" value="TRUE"/>
+                </widget>
+                <widget name="face_tracking_indicator" type="HbLabel">
+                    <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+                    <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                     <bool name="visible" value="TRUE"/>
                 </widget>
                 <real name="z" value="5"/>
@@ -68,6 +74,7 @@
                     <linearitem itemname="mode_indicator"/>
                     <linearitem itemname="quality_indicator"/>
                     <linearitem itemname="flash_indicator"/>
+                    <linearitem itemname="face_tracking_indicator"/>
                 </layout>
             </widget>
             <layout type="anchor">
--- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml	Wed Jun 23 17:59:54 2010 +0300
@@ -58,25 +58,25 @@
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <icon iconName="qtg_mono_camcorder" name="icon"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                 </widget>
                 <widget name="video_quality_indicator" type="HbLabel">
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <icon iconName="qtg_mono_vga" name="icon"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                 </widget>
                 <widget name="video_audio_mute_indicator" type="HbLabel">
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <icon iconName="qtg_mono_call_mute" name="icon"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                 </widget>
                 <widget name="video_stability_indicator" type="HbLabel">
                     <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
                     <icon iconName="qtg_mono_call_mute" name="icon"/>
                     <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
-                    <sizehint height="var(hb-param-graphic-size-secondary)" type="FIXED" width="var(hb-param-graphic-size-secondary)"/>
+                    <sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
                     <bool name="visible" value="FALSE"/>
                 </widget>
                 <real name="z" value="5"/>
--- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -28,13 +28,7 @@
 CxuiApplicationFrameworkMonitor::CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings &settings)
 {
     CX_DEBUG_ENTER_FUNCTION();
-    p = new CxuiApplicationFrameworkMonitorPrivate(application, settings);
-
-    connect(p, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)),
-            this, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)));
-    connect(p, SIGNAL(batteryEmpty()), this, SIGNAL(batteryEmpty()));
-
-
+    p = new CxuiApplicationFrameworkMonitorPrivate(this, application, settings);
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -57,4 +51,13 @@
     return p->foregroundState();
 }
 
+/*!
+* Is USB connected in mass memory mode?
+* @return True if USB mass memory mode is active and connected, false otherwise.
+*/
+bool CxuiApplicationFrameworkMonitor::isUsbMassMemoryModeActive() const
+{
+    return p->isUsbMassMemoryModeActive();
+}
+
 // end of file
--- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -25,14 +25,19 @@
 #include <eikenv.h>
 #include <avkondomainpskeys.h>  // keyguard state
 #include <hwrmpowerstatesdkpskeys.h> // battery status
+#include <UsbWatcherInternalPSKeys.h> // usb status
+#include <usbman.h>
+#include <usbpersonalityids.h>
 
 #include <QMetaEnum>
 #include <QString>
 #include <QVariant>
 #include <qsymbianevent.h>
+
 #endif // Q_OS_SYMBIAN
 
 #include "cxutils.h"
+#include "cxuieventlog.h"
 #include "cxuiapplication.h"
 #include "cxesettings.h"
 #include "cxuiapplicationframeworkmonitorprivate.h"
@@ -64,6 +69,11 @@
         return convertTDesC2QString(name);
     }
 
+    inline QString bitString(int number, char fill = '0', int width = 32)
+    {
+        return QString::number(number, 2).rightJustified(width, fill);
+    }
+
     //!@todo: Avkon UIDs not needed once device dialogs fully implemented in Orbit.
 
     // AknCapServer
@@ -75,6 +85,10 @@
     static const unsigned int UID_TASKSWITCHER    = 0x2002677D;
     // Dialog server
     static const unsigned int UID_DIALOGAPPSERVER = 0x20022FC5;
+
+    // Log event types
+    static const char *EVENT_USB        = "usb";
+    static const char *EVENT_FOREGROUND = "foreground";
 }
 #endif // Q_OS_SYMBIAN
 
@@ -82,8 +96,11 @@
 /*!
 * Constructor
 */
-CxuiApplicationFrameworkMonitorPrivate::CxuiApplicationFrameworkMonitorPrivate(CxuiApplication &application, CxeSettings& settings)
-    :  mApplication(application),
+CxuiApplicationFrameworkMonitorPrivate::CxuiApplicationFrameworkMonitorPrivate(CxuiApplicationFrameworkMonitor *parent,
+                                                                               CxuiApplication &application,
+                                                                               CxeSettings& settings)
+    :  q(parent),
+       mApplication(application),
        mSettings(settings),
 #ifdef Q_OS_SYMBIAN
        mWsSession(CCoeEnv::Static()->WsSession()),
@@ -92,17 +109,18 @@
        mWindowGroupName(),
        mKeyLockState(EKeyguardNotActive),
        mBatteryStatus(EBatteryStatusUnknown),
+       mUsbPersonality(0),
+       mEventLog(NULL),
 #endif // Q_OS_SYMBIAN
        mState(CxuiApplicationFrameworkMonitor::ForegroundOwned)
 {
     CX_DEBUG_ENTER_FUNCTION();
-
 #ifdef Q_OS_SYMBIAN
     mWindowGroup.EnableFocusChangeEvents();
     mWindowGroupName = windowGroupName(mWsSession, mWindowGroupId);
+    mEventLog = new CxuiEventLog("CxuiApplicationFrameworkMonitorPrivate");
     init();
 #endif // Q_OS_SYMBIAN
-
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -111,7 +129,11 @@
 */
 CxuiApplicationFrameworkMonitorPrivate::~CxuiApplicationFrameworkMonitorPrivate()
 {
-    CX_DEBUG_IN_FUNCTION();
+    CX_DEBUG_ENTER_FUNCTION();
+#ifdef Q_OS_SYMBIAN
+    delete mEventLog;
+#endif // Q_OS_SYMBIAN
+    CX_DEBUG_EXIT_FUNCTION();
 }
 
 /*!
@@ -123,6 +145,24 @@
     return mState;
 }
 
+/*!
+* Is USB connected in mass memory mode?
+* @return True if USB mass memory mode is active and connected, false otherwise.
+*/
+bool CxuiApplicationFrameworkMonitorPrivate::isUsbMassMemoryModeActive() const
+{
+    bool active(false);
+#ifdef Q_OS_SYMBIAN
+    // Mass memory mode activity can be seen from the KUsbWatcherSelectedPersonality property.
+    // When USB is connected in Mass Memory Mode, we get KUsbPersonalityIdMS as personality id.
+    // If USB is not connected, personality id is KUsbWatcherSelectedPersonalityNone.
+    active = (mUsbPersonality == KUsbPersonalityIdMS);
+#endif // Q_OS_SYMBIAN
+    return active;
+}
+
+
+
 #ifdef Q_OS_SYMBIAN
 /*!
 * Slot to handle Symbian event.
@@ -153,7 +193,7 @@
     CX_DEBUG_ENTER_FUNCTION();
 
     if (uid == KPSUidAvkonDomain.iUid && key == KAknKeyguardStatus) {
-        CX_DEBUG(("CxuiApplicationFrameworkMonitor - keylock status changed: %d -> %d", value.toInt(), mKeyLockState));
+        CX_DEBUG(("CxuiApplicationFrameworkMonitor - keylock status changed: %d -> %d", mKeyLockState, value.toInt()));
 
         // Check if the keylock value has actually changed
         const int newKeyLockState = value.toInt();
@@ -163,7 +203,7 @@
             setState(getCurrentState());
         }
     } else if (uid == KPSUidHWRMPowerState.iUid && key == KHWRMBatteryStatus ) {
-        CX_DEBUG(("CxuiApplicationFrameworkMonitor - battery status changed: %d -> %d", value.toInt(), mBatteryStatus));
+        CX_DEBUG(("CxuiApplicationFrameworkMonitor - battery status changed: %d -> %d", mBatteryStatus, value.toInt() ));
 
         // If status changed, check if battery is going empty.
         const int newBatteryStatus = value.toInt();
@@ -172,8 +212,29 @@
 
             // Notify that battery is almost empty,
             // need to stop any recordings etc.
-            if( mBatteryStatus == EBatteryStatusEmpty ) {
-                emit batteryEmpty();
+            if(mBatteryStatus == EBatteryStatusEmpty) {
+                emit q->batteryEmpty();
+            }
+        }
+    } else if (uid == KPSUidUsbWatcher.iUid && key == KUsbWatcherSelectedPersonality) {
+        CX_DEBUG(("CxuiApplicationFrameworkMonitor - usb personality changed: %d -> %d", mUsbPersonality, value.toInt()));
+
+        const int newUsbPersonality(value.toInt());
+        if (newUsbPersonality != mUsbPersonality) {
+            // Check before saving the new state if mass memory mode was active,
+            // so we know when to emit the unactivated signal.
+            const bool wasUsbMassMemoryModeActive(isUsbMassMemoryModeActive());
+            // Store new state.
+            mUsbPersonality = newUsbPersonality;
+
+            // Save state to log.
+            if (mEventLog) {
+                mEventLog->append(EVENT_USB, QString::number(mUsbPersonality));
+            }
+
+            // Check if mass memory mode activity changed.
+            if (wasUsbMassMemoryModeActive != isUsbMassMemoryModeActive()) {
+                emit q->usbMassMemoryModeToggled(isUsbMassMemoryModeActive());
             }
         }
     }
@@ -201,6 +262,10 @@
     mSettings.get(KPSUidAvkonDomain.iUid, KAknKeyguardStatus, Cxe::PublishAndSubscribe, value);
     mKeyLockState = value.toInt();
 
+    // Get current USB personality
+    mSettings.get(KPSUidUsbWatcher.iUid, KUsbWatcherSelectedPersonality, Cxe::PublishAndSubscribe, value);
+    mUsbPersonality = value.toInt();
+
     bool ok = connect(&mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
                       this, SLOT(handlePropertyEvent(long int, unsigned long int, QVariant)));
     CX_DEBUG_ASSERT(ok);
@@ -215,7 +280,7 @@
 * Helper method to handle Symbian event that specificly is of type QSymbianEvent::WindowServerEvent.
 * @param event Symbian event to be handled. (Ownership not taken.)
 */
-bool CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event)
+void CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event)
     {
     // We receive tons of these events, so function start and end traces
     // are intentionally left out.
@@ -242,13 +307,13 @@
             const TWsVisibilityChangedEvent *visibilityEvent = wsEvent->VisibilityChanged();
             if (visibilityEvent) {
                 CX_DEBUG(("CxuiApplicationFrameworkMonitor - EFullyVisible: bits[%s]",
-                    QString::number(TWsVisibilityChangedEvent::EFullyVisible, 2).toAscii().constData() ));
+                    bitString(TWsVisibilityChangedEvent::EFullyVisible).toAscii().constData() ));
                 CX_DEBUG(("CxuiApplicationFrameworkMonitor - EPartiallyVisible: bits[%s]",
-                    QString::number(TWsVisibilityChangedEvent::EPartiallyVisible, 2).toAscii().constData() ));
+                    bitString(TWsVisibilityChangedEvent::EPartiallyVisible).toAscii().constData() ));
                 CX_DEBUG(("CxuiApplicationFrameworkMonitor - ENotVisible: bits[%s]",
-                    QString::number(TWsVisibilityChangedEvent::ENotVisible, 2).toAscii().constData() ));
+                    bitString(TWsVisibilityChangedEvent::ENotVisible).toAscii().constData() ));
                 CX_DEBUG(("CxuiApplicationFrameworkMonitor - event:       bits[%s]",
-                    QString::number(visibilityEvent->iFlags, 2).toAscii().constData() ));
+                    bitString(visibilityEvent->iFlags).toAscii().constData() ));
             }
             break;
         }
@@ -256,8 +321,6 @@
             break;
         }
     }
-
-    return false;
 }
 
 /*!
@@ -287,14 +350,17 @@
         }
 
         if (mState != original) {
-            CX_DEBUG(("CxuiApplicationFrameworkMonitor - state change [%s] -> [%s]",
-                CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator(
-                    CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(original),
-                CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator(
-                    CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState) ));
+            // Print the event log with this foreground event included.
+            if (mEventLog) {
+                mEventLog->append(
+                    EVENT_FOREGROUND,
+                    CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator(
+                        CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState));
+                mEventLog->print();
+            }
 
             // If state was changed, signal it to listeners.
-            emit foregroundStateChanged(mState);
+            emit q->foregroundStateChanged(mState);
         }
     }
 }
@@ -312,6 +378,7 @@
 
     if (mKeyLockState != EKeyguardNotActive) {
         // Keylock enabled is the same as if other application is in foreground.
+        CX_DEBUG(("CxuiApplicationFrameworkMonitor - key lock on"));
         state = CxuiApplicationFrameworkMonitor::ForegroundFullyLost;
     } else if (focusWindowGroupId == mWindowGroupId) {
         // If our window group has focus, we clearly are the foreground owning application.
@@ -374,7 +441,6 @@
 
 #ifdef CX_DEBUG
     QString name(windowGroupName(mWsSession, focusWgId));
-
     CX_DEBUG(("CxuiApplicationFrameworkMonitor - Own window group id:     0x%08x", mWindowGroupId));
     CX_DEBUG(("CxuiApplicationFrameworkMonitor - Focused window group id: 0x%08x", focusWgId));
     CX_DEBUG(("CxuiApplicationFrameworkMonitor - Own window group name:        [%s]", mWindowGroupName.toAscii().constData()));
--- a/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -16,6 +16,7 @@
 */
 
 #include <QCoreApplication>
+#include <HbAction>
 #include <HbDialog>
 #include <HbMessageBox>
 #include <HbLabel>
@@ -37,6 +38,7 @@
     mKeyHandler(keyHandler),
     mDocumentLoader(documentLoader),
     mErrorMsgPopup(NULL),
+    mErrorId(CxeError::None),
     mErrorSeverity(CxuiErrorManager::None)
 {
     CX_DEBUG_ENTER_FUNCTION();
@@ -54,23 +56,29 @@
 
 
 /*!
-* Analyze the error code and act accordingly.
-* @param error Error code.
+* Show error popup based on the error id.
+* @param error Error id.
 */
-void CxuiErrorManager::analyze(CxeError::Id error)
+void CxuiErrorManager::showPopup(CxeError::Id error)
 {
     CX_DEBUG_ENTER_FUNCTION();
-
-    mErrorMsgPopup = NULL;
     mErrorSeverity = CxuiErrorManager::None;
 
     if (error != CxeError::None) {
-        // start evaluating the error.
-        QString errorMsgTxt = getErrorDetails(error);
+        CxeError::Id oldError = mErrorId;
+        mErrorId = error;
 
-        if(mErrorSeverity != CxuiErrorManager::None) {
+        // start evaluating the error.
+        QString errorText;
+        QString buttonText;
+        getErrorDetails(errorText, buttonText);
+
+        if (mErrorSeverity != CxuiErrorManager::None) {
+            // Clear the old error if one for some reason exists.
+            hidePopup(oldError);
+
             // show the error note to the user.
-            launchPopup(errorMsgTxt);
+            launchPopup(errorText, buttonText);
         } else {
             // ignore
         }
@@ -79,13 +87,31 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+* Close the open error popup, if it is shown for the same error as requested here.
+* @param error Error id, for which we are closing the error dialog.
+*/
+void CxuiErrorManager::hidePopup(CxeError::Id error)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    if (mErrorId == error) {
+        if (mErrorMsgPopup) {
+            mErrorMsgPopup->close();
+            mErrorMsgPopup = NULL;
+        }
+    }
+    CX_DEBUG_EXIT_FUNCTION();
+}
 
 /*!
 * Slot that gets called when error note is closed.
 */
-void CxuiErrorManager::aboutToClosePopup()
+void CxuiErrorManager::popupClosed(HbAction *action)
 {
     CX_DEBUG_ENTER_FUNCTION();
+    // Dialog or action instance cannot be used anymore.
+    mErrorMsgPopup = NULL;
+
     // handle any use-cases when the error can be recovered
     emit errorRecovered();
     CX_DEBUG_EXIT_FUNCTION();
@@ -109,59 +135,66 @@
 * and set the severity level, based on given error code.
 * @param error Error code to be analyzed.
 */
-QString CxuiErrorManager::getErrorDetails(CxeError::Id error)
+void CxuiErrorManager::getErrorDetails(QString &errorText, QString &buttonText)
 {
     CX_DEBUG_ENTER_FUNCTION();
-    QString msg("No Error");
-    switch(error) {
+    switch (mErrorId) {
+        case CxeError::MemoryNotAccessible:
+            mErrorSeverity = CxuiErrorManager::Severe;
+            errorText = hbTrId("txt_cam_info_error_usb_disconnected");
+            buttonText = hbTrId("txt_cam_info_error_usb_disconnected_button");
+            break;
         case CxeError::Died:
         case CxeError::InitializationFailed:
         case CxeError::HwNotAvailable:
         case CxeError::NotReady:
             mErrorSeverity = CxuiErrorManager::Severe;
-            msg = hbTrId("txt_cam_info_error");
+            errorText = hbTrId("txt_cam_info_error");
+            buttonText = hbTrId("txt_common_button_close");
             break;
         case CxeError::InUse:
             mErrorSeverity = CxuiErrorManager::Severe;
-            msg = hbTrId("txt_cam_info_camera_already_in_use");
+            errorText = hbTrId("txt_cam_info_camera_already_in_use");
+            buttonText = hbTrId("txt_common_button_close");
             break;
         case CxeError::DiskFull:
             mErrorSeverity = CxuiErrorManager::Warning;
-            msg = hbTrId("txt_cam_info_memory_full");
+            errorText = hbTrId("txt_cam_info_memory_full");
+            break;
         default:
+            errorText = "No Error";
             break;
     }
     CX_DEBUG_EXIT_FUNCTION();
-
-    return msg;
 }
 
 /*!
 *
 */
-void CxuiErrorManager::launchPopup(QString& errorMsgTxt)
+void CxuiErrorManager::launchPopup(const QString &errorText, const QString &buttonText)
 {
     CX_DEBUG_ENTER_FUNCTION();
 
     switch (mErrorSeverity) {
-    case CxuiErrorManager::Warning:
-        showLowSeverityNote(errorMsgTxt);
+    case CxuiErrorManager::None:
         break;
-    case CxuiErrorManager::Severe:
-    case CxuiErrorManager::Critical:
-        showHighSeverityNote(errorMsgTxt);
+    case CxuiErrorManager::Warning:
+        showLowSeverityNote(errorText);
         break;
     default:
+        showHighSeverityNote(errorText, buttonText);
         break;
     }
 
+    mErrorSeverity = CxuiErrorManager::None;
+
     CX_DEBUG_EXIT_FUNCTION();
 }
 
 /*!
 * Show error note for high severity error.
 */
-void CxuiErrorManager::showHighSeverityNote(QString& errorMsgTxt)
+void CxuiErrorManager::showHighSeverityNote(const QString &errorText, const QString &buttonText)
 {
     // we always prepare the popup for the new message and hence we load the
     // popup everytime from document loader
@@ -175,6 +208,8 @@
 
     mErrorMsgPopup = qobject_cast<HbDialog*>(mDocumentLoader->findWidget(CxUiLayout::ERROR_POPUP));
     CX_ASSERT_ALWAYS(mErrorMsgPopup);
+    mErrorMsgPopup->setAttribute(Qt::WA_DeleteOnClose, true);
+    mErrorMsgPopup->setTimeout(HbDialog::NoTimeout);
 
     // HbDialog's default background item is replaced with black rectangle
     QGraphicsRectItem *backgroundItem = new QGraphicsRectItem();
@@ -184,26 +219,24 @@
     backgroundItem->setRect(origBgItem->boundingRect());
     mErrorMsgPopup->setBackgroundItem(backgroundItem);
 
-    mErrorMsgPopup->setTimeout(HbDialog::NoTimeout);
-    mErrorMsgPopup->setBackgroundFaded(false);
 
     // color of standby text is set in the code. It cannot be done in docml
     HbLabel* label = qobject_cast<HbLabel*>(mDocumentLoader->findWidget(CxUiLayout::ERROR_TEXT_WIDGET));
     label->setTextColor(Qt::white);
-    label->setPlainText(errorMsgTxt);
+    label->setPlainText(errorText);
 
     HbPushButton *exitButton = qobject_cast<HbPushButton*>(mDocumentLoader->findWidget(CxUiLayout::ERROR_BUTTON_WIDGET));
-
-    if(mErrorSeverity == CxuiErrorManager::Severe) {
+    if (!buttonText.isEmpty()) {
         // inform ui about error recovery
-        emit aboutToRecoverError();
-        QObject::connect(mErrorMsgPopup, SIGNAL(aboutToClose()), this, SLOT(closeApp()));
+        exitButton->setText(buttonText);
+        connect(exitButton, SIGNAL(released()), this, SLOT(closeApp()));
         exitButton->show();
     } else {
         // TODO handle other severity cases here.
     }
 
-    mErrorMsgPopup->show();
+    emit aboutToRecoverError();
+    mErrorMsgPopup->open(this, SLOT(popupClosed(HbAction*)));
 
     CX_DEBUG_EXIT_FUNCTION();
 }
@@ -211,9 +244,9 @@
 /*!
 * Show error note for low severity error.
 */
-void CxuiErrorManager::showLowSeverityNote(QString& errorMsgTxt)
+void CxuiErrorManager::showLowSeverityNote(const QString &errorText)
 {
     CX_DEBUG_ENTER_FUNCTION();
-    HbMessageBox::warning(errorMsgTxt);
+    HbMessageBox::warning(errorText);
     CX_DEBUG_EXIT_FUNCTION();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuieventlog.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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:
+*
+*/
+
+#include "cxutils.h"
+#include "cxuieventlog.h"
+
+/*!
+* Event log item constructor.
+* @param type Event type description
+* @param id Event id description
+*/
+CxuiEventLog::CxuiEvent::CxuiEvent(const QString &type, const QString &value)
+    : mTime(QTime::currentTime()), mType(type), mValue(value)
+{
+}
+
+
+/*!
+* Event log constructor.
+* @param name Event log name.
+* @param size Maximum number of events stored to log. After maximum size is encountered,
+* old events are discarded as new ones are added.
+*/
+CxuiEventLog::CxuiEventLog(const QString& name, int size)
+    : mSize(size),
+      mName(name)
+{
+}
+
+/*!
+* Event log destructor.
+*/
+CxuiEventLog::~CxuiEventLog()
+{
+}
+
+/*!
+* Append new event to the log.
+* @param type Event type description
+* @param id Event id description
+*/
+void CxuiEventLog::append(const QString &type, const QString &value)
+{
+    if (mSize) {
+        if (mEvents.size() >= mSize) {
+            mEvents.removeFirst();
+        }
+        mEvents.append(CxuiEvent(type, value));
+    }
+}
+
+/*!
+* Print out the event log.
+*/
+void CxuiEventLog::print() const
+{
+    if (mEvents.size()) {
+
+        CX_DEBUG(("[INFO] >>> CameraX event log[%s]", mName.toAscii().constData()));
+        foreach(CxuiEvent e, mEvents) {
+            CX_DEBUG(("[INFO] <-> event: time[%s] type[%s] value[%s]",
+                      e.mTime.toString("HH:mm:ss.zzz").toAscii().constData(),
+                      e.mType.toAscii().constData(),
+                      e.mValue.toAscii().constData()));
+        }
+        CX_DEBUG(("[INFO] <<< CameraX event log[%s]", mName.toAscii().constData()));
+    }
+}
+
+// end of file
--- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -17,7 +17,6 @@
 #include <QDebug>
 #include <QPixmap>
 #include <QTimer>
-#include <QGraphicsSceneEvent>
 #include <QFileInfo>
 #include <QApplication>
 #include <QGraphicsRectItem>
@@ -76,6 +75,7 @@
     mEmbeddedToolbar(NULL),
     mBackgroundItem(NULL),
     mImageLabel(NULL),
+    mShareUi(NULL),
     mStopViewfinderTimer(this),
     mReleaseCameraTimer(this),
     mPostcaptureTimer(this),
@@ -97,6 +97,7 @@
     CX_DEBUG_ENTER_FUNCTION();
     QCoreApplication::instance()->removeEventFilter(this);
     stopTimers();
+    delete mShareUi;
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -126,6 +127,8 @@
     mImageLabel = qobject_cast<HbLabel *>(widget);
     CX_DEBUG_ASSERT(mImageLabel);
 
+    mShareUi = new ShareUi();
+
     // get toolbar pointers from the documentloader
     widget = mDocumentLoader->findWidget(STILL_POST_CAPTURE_TOOLBAR);
     // This resize is a workaround to get toolbar shown correctly.
@@ -206,7 +209,7 @@
  */
 void CxuiPostcaptureView::playVideo()
 {
-
+    
     launchNotSupportedNotification();
     //! @todo needs an implementation
     CX_DEBUG_IN_FUNCTION();
@@ -285,16 +288,12 @@
 
     stopTimers();
     releaseCamera();
-
+    hideControls();
     QString filename = getCurrentFilename();
-
     QStringList filelist;
     filelist.append(filename);
 
-    ShareUi dialog;
-    dialog.send(filelist, true);
-
-    showControls();
+    mShareUi->send(filelist, true);
 
     CX_DEBUG_EXIT_FUNCTION();
 }
@@ -398,22 +397,6 @@
 }
 
 // ---------------------------------------------------------------------------
-// CxuiPostcaptureView::mousePressEvent
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiPostcaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
-
-    if (event->type() == QEvent::GraphicsSceneMousePress) {
-        mPostcaptureTimer.stop();
-        toggleControls();
-        event->accept();
-    }
-
-}
-
-// ---------------------------------------------------------------------------
 // CxuiPostcaptureView::showEvent
 //
 // ---------------------------------------------------------------------------
--- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -16,7 +16,6 @@
 */
 
 #include <coemain.h>
-#include <QGraphicsSceneEvent>
 #include <QProcess>
 #include <QApplication>
 #include <hbmainwindow.h>
@@ -169,9 +168,6 @@
 
     if (mMainWindow) {
         mEngine->viewfinderControl().setWindow(mMainWindow->effectiveWinId());
-        setFlag(QGraphicsItem::ItemIsFocusable);
-        setFocusPolicy(Qt::StrongFocus);
-        setFocus();
     }
 
     CX_DEBUG_EXIT_FUNCTION();
@@ -278,25 +274,9 @@
         // call load widgets to load app DocML and get the pointers to needed widgets
         loadWidgets();
     }
-
     CxuiView::toggleControls();
 }
 
-
-// ---------------------------------------------------------------------------
-// CxuiPrecaptureView::mousePressEvent
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiPrecaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
-    //! @todo temporary workaround for title bar mouse event handling bug
-    if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) {
-        toggleControls();
-        event->accept();
-    }
-}
-
 // ---------------------------------------------------------------------------
 // CxuiPrecaptureView::handleZoomLevelChange
 // Slot to handle zoom level change signal from zoom control.
@@ -483,15 +463,13 @@
 */
 void CxuiPrecaptureView::prepareToCloseDialog(HbAction *action)
 {
-    if (!action) {
-        return;
-    }
-
     // Check if the dialog was started from grid, and show the grid now if needed.
     // Autofocus key-press will clear the action to disable showing the grid.
-    QString fromGrid = action->property(PROPERTY_KEY_SETTING_GRID).toString();
-    if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) {
-        showSettingsGrid();
+    if (action) {
+        QString fromGrid = action->property(PROPERTY_KEY_SETTING_GRID).toString();
+        if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) {
+            showSettingsGrid();
+        }
     }
 
     // Clear the starter actions to be sure they are not reused.
--- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -51,7 +51,8 @@
 CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) :
     CxuiView(parent),
     mSettingsInfo(NULL),
-    mScenesBackground(NULL)
+    mScenesBackground(NULL),
+    mScenesHeading(NULL)
 {
     CX_DEBUG_IN_FUNCTION();
 }
@@ -105,6 +106,10 @@
     widget = mDocumentLoader->findWidget(SCENE_VIEW_CONTAINER);
     mScenesContainer = qobject_cast<HbWidget *> (widget);
 
+    mScenesHeading = qobject_cast<HbLabel *>(
+        mDocumentLoader->findWidget(SCENE_VIEW_HEADING_WIDGET));
+    CX_ASSERT_ALWAYS(mScenesHeading);
+
     //Now let's retreive the pointer to icon widget
     widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE);
     mScenesBackground = qobject_cast<HbLabel *> (widget);
@@ -157,6 +162,10 @@
     mSettingPairList = data.mSettingPairList;
     mScenesList->init(&data);
 
+    if (mScenesHeading) {
+        mScenesHeading->setPlainText(data.mHeading);
+    }
+
     if (mScenesBackground) {
         QString sceneId;
         mEngine->settings().get(data.mSettingId, sceneId);
@@ -311,6 +320,7 @@
     CX_DEBUG_ENTER_FUNCTION();
     mScenesList->handleClose();
     mScenesBackground->setIcon(HbIcon());
+    mScenesHeading = NULL;
     // Make sure engine prepares for new image/video if necessary
     mEngine->initMode(mEngine->mode());
     emit viewCloseEvent();
--- a/camerauis/cameraxui/cxui/src/cxuistandby.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuistandby.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -20,6 +20,7 @@
 #include <QGraphicsSceneEvent>
 #include <hblabel.h>
 #include <hbdialog.h>
+#include <hbinstantfeedback.h>
 #include <QGraphicsRectItem>
 #include <QColor>
 
@@ -35,15 +36,16 @@
 
 
 
-/*
-* CxuiStandby::CxuiStandby
-*/
+/*!
+ * Constructor
+ */
 CxuiStandby::CxuiStandby(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader, CxeEngine *engine)
 : mKeyHandler(keyHandler),
   mDocumentLoader(documentLoader),
   mEngine(engine),
   mStandbyPopup(NULL),
-  mStandbyDialogVisible(false)
+  mStandbyDialogVisible(false),
+  mAllowDismiss(true)
 {
     CX_DEBUG_ENTER_FUNCTION();
     CX_ASSERT_ALWAYS(engine);
@@ -55,7 +57,7 @@
     QCoreApplication::instance()->installEventFilter(this);
 
     CX_ASSERT_ALWAYS(mStandbyTimer);
-    connect(mStandbyTimer, SIGNAL(timeout()), this, SLOT(toStandby()));
+    connect(mStandbyTimer, SIGNAL(timeout()), this, SLOT(enterStandby()));
     mStandbyTimer->setSingleShot(true);
 
     CX_DEBUG_EXIT_FUNCTION();
@@ -63,9 +65,9 @@
 
 
 
-/*
-* CxuiStandby::~CxuiStandby()
-*/
+/*!
+ * Destructor
+ */
 CxuiStandby::~CxuiStandby()
 {
     CX_DEBUG_IN_FUNCTION();
@@ -76,9 +78,41 @@
 }
 
 
-/*
-* stops standby timer
+/*!
+* Allow dismissing standby mode with AF or capture key?
+* @param allow Is dismissing allowed.
 */
+void CxuiStandby::allowDismiss(bool allow)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    mAllowDismiss = allow;
+    if (allow) {
+        if (mStandbyDialogVisible) {
+            // Reconnect the close signals if dialog is visible
+            connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
+            connect(&mKeyHandler, SIGNAL(captureKeyPressed()),   mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
+        }
+    } else {
+        disconnect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()));
+        disconnect(&mKeyHandler, SIGNAL(captureKeyPressed()),   mStandbyPopup, SLOT(close()));
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Is standby mode active?
+* @return True, if standby mode is active, false if not.
+*/
+bool CxuiStandby::isActive() const
+{
+    return mStandbyDialogVisible;
+}
+
+/*!
+ * stops standby timer
+ */
 void CxuiStandby::stopTimer()
 {
     if(mStandbyTimer) {
@@ -86,9 +120,9 @@
     }
 }
 
-/*
-* starts standby timer
-*/
+/*!
+ * starts standby timer
+ */
 void CxuiStandby::startTimer()
 {
     if(mStandbyTimer) {
@@ -96,19 +130,37 @@
     }
 }
 
-
-/*
-* handles mouse press events
-* returns if mouse key press is consumed.
-*/
-bool CxuiStandby::handleMouseEvent()
+/*!
+ * Handles mouse press events
+ * returns if mouse key press is consumed.
+ * \param event event to be handled
+ * \return boolean to indicate whether the event was handled or not
+ */
+bool CxuiStandby::handleMouseEvent(QEvent *event)
 {
     bool keyHandled = false;
 
     // close the dialog if it's visible
     if (mStandbyDialogVisible && mStandbyPopup) {
-        CX_DEBUG(( "closing the popup mStandbyDialogVisible = : %d", mStandbyDialogVisible ));
-        mStandbyPopup->close();
+        HbInstantFeedback feedback(HbFeedback::BasicItem);
+        switch (event->type()) {
+            case QEvent::GraphicsSceneMousePress:
+                feedback.play();
+                break;
+            case QEvent::GraphicsSceneMouseRelease:
+                if (mAllowDismiss) {
+                    CX_DEBUG(( "closing the popup mStandbyDialogVisible = : %d", mStandbyDialogVisible ));
+                    // todo: sound disabling doesn't work in orbit yet so don't do feedback on release
+                    // needs to be enabled when orbit support is done
+                    //feedback.setModalities(HbFeedback::Tactile);
+                    //feedback.play();
+                    exitStandby();
+                }
+                break;
+            default:
+                break;
+        }
+        // eat all mouse events when standby is active
         keyHandled = true;
     } else if (mStandbyTimer && mStandbyTimer->isActive()) {
         // restart the timer only if it's running
@@ -119,10 +171,10 @@
 }
 
 
-/*
-* switching to standby.
-*/
-void CxuiStandby::toStandby()
+/*!
+ * switching to standby.
+ */
+void CxuiStandby::enterStandby()
 {
     CX_DEBUG_ENTER_FUNCTION();
 
@@ -165,17 +217,31 @@
 
         mStandbyPopup->show();
         // connecting half press or full press key signal to dismiss standby
-        connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()));
-        connect(&mKeyHandler, SIGNAL(captureKeyPressed()),   mStandbyPopup, SLOT(close()));
+        connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
+        connect(&mKeyHandler, SIGNAL(captureKeyPressed()),   mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Close the standby dialog.
+*/
+void CxuiStandby::exitStandby()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mAllowDismiss && mStandbyDialogVisible && mStandbyPopup) {
+        mStandbyPopup->close();
     }
 
     CX_DEBUG_EXIT_FUNCTION();
 }
 
 
-/*
-* dismisses standby
-*/
+/*!
+ * dismisses standby
+ */
 void CxuiStandby::dismissStandby()
 {
     CX_DEBUG_ENTER_FUNCTION();
@@ -194,17 +260,16 @@
 
 
 
-/*
-* checks if we can swtich to standby
-*/
+/*!
+ * checks if we can switch to standby
+ */
 bool CxuiStandby::proceedToStandy()
 {
     CX_DEBUG_ENTER_FUNCTION();
     CX_ASSERT_ALWAYS(mEngine);
 
     bool ok = false;
-    if(!mStandbyDialogVisible &&
-        mEngine->isEngineReady()) {
+    if (!mStandbyDialogVisible) {
         CX_DEBUG(("show standby dialog"));
         ok = true;
     }
@@ -216,10 +281,9 @@
 
 
 
-/*
-*  Event filter which filters application wide mouse events.
-*/
-
+/*!
+ *  Event filter which filters application wide mouse events.
+ */
 bool CxuiStandby::eventFilter(QObject *object, QEvent *event)
 {
     Q_UNUSED(object);
@@ -229,7 +293,7 @@
         case QEvent::GraphicsSceneMouseMove:
         case QEvent::GraphicsSceneMousePress:
         case QEvent::GraphicsSceneMouseRelease:
-            eventWasConsumed = handleMouseEvent();
+            eventWasConsumed = handleMouseEvent(event);
             break;
         default:
             break;
--- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -130,6 +130,10 @@
     mQualityIcon = qobject_cast<HbLabel *>(widget);
     CX_DEBUG_ASSERT(mQualityIcon);
 
+    widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON);
+    mFaceTrackingIcon = qobject_cast<HbLabel *>(widget);
+    CX_DEBUG_ASSERT(mFaceTrackingIcon);
+
     widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER);
     mIndicators = qobject_cast<HbWidget *>(widget);
     CX_DEBUG_ASSERT(mIndicators);
@@ -296,7 +300,8 @@
         action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::CONTRAST);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
-        mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification()));
+        action = mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchSetting()));
+        action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::FACE_TRACKING);
         action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
 
         connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
@@ -555,6 +560,7 @@
 
     updateImagesLeftLabel();
     updateQualityIcon();
+    updateFaceTrackingIcon();
 
     // cancel selftimer when returning to precapture
     // since selftimer needs to be turned off after capturing an image
@@ -704,6 +710,8 @@
             updateQualityIcon();
             // update images left when quality values are changed
             updateImagesLeftLabel();
+        } else if (key == CxeSettingIds::FACE_TRACKING) {
+            updateFaceTrackingIcon();
         }
 
         // update toolbar flash icon
@@ -792,4 +800,26 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/*!
+    Update the face tracking icon
+*/
+void CxuiStillPrecaptureView::updateFaceTrackingIcon()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    if (mFaceTrackingIcon && mEngine) {
+        QString key = "";
+        QString icon = "";
+        int currentValue = -1;
+
+        key = CxeSettingIds::FACE_TRACKING;
+
+        mEngine->settings().get(key, currentValue);
+        icon = getSettingItemIcon(key, currentValue);
+
+        mFaceTrackingIcon->setIcon(HbIcon(icon));
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 // end of file
--- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -575,9 +575,13 @@
         }
         mElapsedTimer.start(CXUI_ELAPSED_TIME_TIMEOUT);
         disableFeedback();
-        if (mRecordingAnimation && mRecordingIcon) {
-            mRecordingAnimation->start();
-        }
+
+        // commented out the activation of the recording animation because
+        // it is causing issues when using SW rendering
+        //if (mRecordingAnimation && mRecordingIcon) {
+        //  mRecordingAnimation->start();
+        //}
+
         break;
     case CxeVideoCaptureControl::Paused:
         mElapsedTimer.stop();
@@ -593,9 +597,12 @@
             mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
         }
 
-        if (mRecordingAnimation && mRecordingIcon) {
-            mRecordingAnimation->stop();
-        }
+        // commented out the stopping of the recording animation since the activation
+        // is commented out also couple lines earlier
+        //if (mRecordingAnimation && mRecordingIcon) {
+        //    mRecordingAnimation->stop();
+        //}
+
         enableFeedback();
 
         mElapsedTimer.stop();
--- a/camerauis/cameraxui/cxui/src/cxuiview.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -17,6 +17,7 @@
 
 #include <QGraphicsItem>
 #include <QProcess>
+#include <QGraphicsSceneEvent>
 #include <hbtoolbar.h>
 #include <hbnotificationdialog.h>
 #include <hbframeitem.h>
@@ -45,7 +46,8 @@
         mSlider(NULL),
         mToolbar(NULL),
         mIndicators(NULL),
-        mHideControlsTimeout(this)
+        mHideControlsTimeout(this),
+        mControlsFeedback(HbFeedback::BasicItem)
 {
     CX_DEBUG_IN_FUNCTION();
 }
@@ -357,4 +359,36 @@
     }
 }
 
+/*!
+ * Handle mouse press events on this view. Needed to implement toggling of
+ * controls and playing feedback.
+ * \param event event to be handled
+ */
+void CxuiView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+    //! @todo temporary workaround for title bar mouse event handling bug
+    if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) {
+        mControlsFeedback.setModalities(HbFeedback::All);
+        mControlsFeedback.play();
+        event->accept();
+    }
+}
+
+/*!
+ * Handle mouse release events on this view. Needed to implement toggling of
+ * controls and playing feedback.
+ * \param event to be handled
+ */
+void CxuiView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+    //! @todo temporary workaround for title bar mouse event handling bug
+    if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70) {
+        // todo: sound disabling doesn't work in orbit yet so don't do feedback on release
+        // needs to be enabled when orbit support is done
+        //mControlsFeedback.setModalities(HbFeedback::Tactile);
+        //mControlsFeedback.play();
+        toggleControls();
+        event->accept();
+    }
+}
 // End of file
--- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -76,8 +76,8 @@
     mApplicationMonitor = new CxuiApplicationFrameworkMonitor(mApplication, mEngine.settings());
     connect(mApplicationMonitor, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)),
             this, SLOT(handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)));
-    connect(mApplicationMonitor, SIGNAL(batteryEmpty()),
-            this, SLOT(handleBatteryEmpty()));
+    connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty()));
+    connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)), this, SLOT(showUsbErrorPopup(bool)));
 
     // Connect memory monitor start / stop to focused status
     connect(this, SIGNAL(focusGained()), &mEngine.memoryMonitor(), SLOT(startMonitoring()));
@@ -105,49 +105,24 @@
     connect(mErrorManager, SIGNAL(aboutToRecoverError()), this, SLOT(aboutToLooseFocus()));
     connect(mErrorManager, SIGNAL(errorRecovered()), this, SLOT(aboutToGainFocus()));
 
-    if (!CxuiServiceProvider::isCameraEmbedded()) {
-        // For embedded mode: don't create view yet, create
-        // when engine inits to correct mode
-        CX_DEBUG_ASSERT(mEngine.cameraDeviceControl().cameraIndex() == Cxe::PrimaryCameraIndex);
-        if (mEngine.mode() == Cxe::VideoMode) {
-            createVideoPrecaptureView();
-            mMainWindow.blockSignals(true);
-            mMainWindow.setCurrentView(mVideoPrecaptureView, false);
-            mMainWindow.blockSignals(false);
-        } else {
-            createStillPrecaptureView();
-            mMainWindow.blockSignals(true);
-            mMainWindow.setCurrentView(mStillPrecaptureView, false);
-            mMainWindow.blockSignals(false);
-        }
-        connectPreCaptureSignals();
-    }
-
     //connecting initmode signals
     connect(&mEngine.cameraDeviceControl(), SIGNAL(initModeComplete(CxeError::Id)),
             this, SLOT(createPostcaptureView()));
 
     connect(&mEngine.cameraDeviceControl(), SIGNAL(initModeComplete(CxeError::Id)),
-            mErrorManager, SLOT(analyze(CxeError::Id)));
+            mErrorManager, SLOT(showPopup(CxeError::Id)));
 
     connect(&mEngine.stillCaptureControl(), SIGNAL(imageCaptured(CxeError::Id, int)),
-            mErrorManager, SLOT(analyze(CxeError::Id)));
-
-    if (CxuiServiceProvider::isCameraEmbedded()) {
-        // connect signals to set up the view after image/video prepare
-        connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)),
-                this, SLOT(changeToPrecaptureView()));
-        connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
-                this, SLOT(changeToPrecaptureView()));
-
-        // start standby timer now because view will not be ready when viewfinder is started
-        mStandbyHandler->startTimer();
-    }
+            mErrorManager, SLOT(showPopup(CxeError::Id)));
 
     // Register stylesheet. It will be automatically destroyed on application
     // exit.
     HbStyleLoader::registerFilePath(":/camerax/cxui.css");
 
+    // Create the view we are starting in, or connect signals so it
+    // will be created once we know the mode we are starting to.
+    initStartupView();
+
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -167,6 +142,14 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+/**
+* Temporary method to check if camera startup should be proceeded after creating view mananger.
+*/
+bool CxuiViewManager::proceedStartup()
+{
+    return !mStandbyHandler->isActive();
+}
+
 
 // ---------------------------------------------------------------------------
 // CxuiViewManager::prepareWindow
@@ -178,6 +161,61 @@
     getPrecaptureView(mEngine.mode(), mEngine.cameraDeviceControl().cameraIndex())->prepareWindow();
 }
 
+/*!
+* Check if we need to take special actions in startup.
+* USB mass memory mode atleast requires us to enter error standby mode,
+* where user can only exit or fix the issue (remove cable).
+*/
+void CxuiViewManager::startupCheck()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (mApplicationMonitor && mApplicationMonitor->isUsbMassMemoryModeActive()) {
+        showUsbErrorPopup(true);
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Select and initialize the view we need to start into.
+*/
+void CxuiViewManager::initStartupView()
+{
+    CX_DEBUG_ENTER_FUNCTION();
+
+    if (!CxuiServiceProvider::isCameraEmbedded()) {
+        // For embedded mode: don't create view yet, create
+        // when engine inits to correct mode
+        CX_DEBUG_ASSERT(mEngine.cameraDeviceControl().cameraIndex() == Cxe::PrimaryCameraIndex);
+        if (mEngine.mode() == Cxe::VideoMode) {
+            createVideoPrecaptureView();
+            mMainWindow.blockSignals(true);
+            mMainWindow.setCurrentView(mVideoPrecaptureView, false);
+            mMainWindow.blockSignals(false);
+        } else {
+            createStillPrecaptureView();
+            mMainWindow.blockSignals(true);
+            mMainWindow.setCurrentView(mStillPrecaptureView, false);
+            mMainWindow.blockSignals(false);
+        }
+        connectPreCaptureSignals();
+
+        startupCheck();
+    } else {
+        // For embedded mode: don't create view yet, create when engine inits to correct mode.
+        // Connect signals to set up the view after image/video prepare
+        connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)),
+                this, SLOT(changeToPrecaptureView()));
+        connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
+                this, SLOT(changeToPrecaptureView()));
+
+        // start standby timer now because view will not be ready when viewfinder is started
+        mStandbyHandler->startTimer();
+    }
+
+    CX_DEBUG_EXIT_FUNCTION();
+}
 
 // ---------------------------------------------------------------------------
 // CxuiViewManager::createStillPrecaptureView
@@ -415,21 +453,25 @@
                 this, SLOT(changeToPrecaptureView()));
     }
 
-    HbView *view = getPrecaptureView(mEngine.mode(),
-        mEngine.cameraDeviceControl().cameraIndex());
-
-    mMainWindow.blockSignals(true);
-    mMainWindow.setCurrentView(view, false);
-    mMainWindow.blockSignals(false);
+    // If standby mode is active, don't switch to precapture view and reserve camera now.
+    if (mStandbyHandler->isActive()) {
+        CX_DEBUG(("CxuiViewManager - Change to precapture blocked as standby mode still active."));
+    } else {
+        HbView *view = getPrecaptureView(mEngine.mode(),
+            mEngine.cameraDeviceControl().cameraIndex());
 
-    if (mSceneModeView){
-        delete mSceneModeView;
-        mSceneModeView = NULL;
+        mMainWindow.blockSignals(true);
+        mMainWindow.setCurrentView(view, false);
+        mMainWindow.blockSignals(false);
+
+        if (mSceneModeView){
+            delete mSceneModeView;
+            mSceneModeView = NULL;
+        }
+        // connecting necessary pre-capture view signals
+        connectPreCaptureSignals();
+        emit startStandbyTimer();
     }
-    // connecting necessary pre-capture view signals
-    connectPreCaptureSignals();
-    emit startStandbyTimer();
-
     CX_DEBUG_EXIT_FUNCTION();
 }
 
@@ -567,7 +609,7 @@
         connect(currentView, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection);
 
         // connecting error signals from precapture view to errormanager.
-        connect(currentView, SIGNAL(reportError(CxeError::Id)),   mErrorManager, SLOT(analyze(CxeError::Id)), Qt::UniqueConnection);
+        connect(currentView, SIGNAL(reportError(CxeError::Id)),   mErrorManager, SLOT(showPopup(CxeError::Id)), Qt::UniqueConnection);
     }
 
     CX_DEBUG_EXIT_FUNCTION();
@@ -652,6 +694,33 @@
     }
 }
 
+/*!
+* Show or hide error popup based on change in USB mass memory mode activity.
+* @param show Show the popup?
+*/
+void CxuiViewManager::showUsbErrorPopup(bool show)
+{
+    CX_DEBUG_ENTER_FUNCTION();
+    if (show) {
+        mStandbyHandler->enterStandby();
+        mStandbyHandler->allowDismiss(false);
+        // Emulate "mass memory not accessible" error to Error Manager
+        // to get the same functionality as if the error came from CxEngine.
+        mErrorManager->showPopup(CxeError::MemoryNotAccessible);
+    } else {
+        mStandbyHandler->allowDismiss(true);
+        // If we are in postcapture view or scene view, we can return right away to normal mode.
+        // For precapture views we expect user action before reserving camera
+        // and starting viewfinder again.
+        QObject *currentView = mMainWindow.currentView();
+        if (currentView == mPostcaptureView || currentView == mSceneModeView) {
+            mStandbyHandler->exitStandby();
+        }
+        mErrorManager->hidePopup(CxeError::MemoryNotAccessible);
+    }
+    CX_DEBUG_EXIT_FUNCTION();
+}
+
 // ---------------------------------------------------------------------------
 // CxuiViewManager::aboutToLooseFocus()
 //
@@ -681,20 +750,27 @@
 {
     CX_DEBUG_ENTER_FUNCTION();
 
-    // Disconnect capture key event and bringing us to foreground connection (if there is one).
-    disconnect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground()));
-
-    // we are getting the focus.
-    if (mMainWindow.currentView() != mPostcaptureView) {
-        connectPreCaptureSignals();
+    // If standby mode is still active, no action is needed yet.
+    // This is the case when USB mass memory mode error is cleared.
+    if (mStandbyHandler->isActive()) {
+        CX_DEBUG(("CxuiViewManager - Focus gain event ignored as standby mode still active."));
     } else {
-        connectPostCaptureSignals();
-    }
+
+        // Disconnect capture key event and bringing us to foreground connection (if there is one).
+        disconnect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground()));
 
-    if (mKeyHandler) {
-        mKeyHandler->listenKeys(true);
+        // we are getting the focus.
+        if (mMainWindow.currentView() != mPostcaptureView) {
+            connectPreCaptureSignals();
+        } else {
+            connectPostCaptureSignals();
+        }
+
+        if (mKeyHandler) {
+            mKeyHandler->listenKeys(true);
+        }
+        emit focusGained();
     }
-    emit focusGained();
 
     CX_DEBUG_EXIT_FUNCTION();
 }
--- a/camerauis/cameraxui/cxui/src/main.cpp	Fri Jun 11 13:26:48 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/main.cpp	Wed Jun 23 17:59:54 2010 +0300
@@ -20,7 +20,7 @@
 #include <QApplication>
 #include <QGraphicsProxyWidget>
 // needed for localization
-#include <QTranslator>
+#include <HbTranslator>
 #include <QLocale>
 #include <hbmainwindow.h>
 #include <xqserviceutil.h>
@@ -40,9 +40,8 @@
 using namespace Cxe;
 
 // CONSTANTS
-const QString TRANSLATIONS_PATH = "z:/resource/qt/translations/";
-const QString TRANSLATIONS_FILE_NAME = "camera_";
-const QString COMMON_TRANSLATIONS_FILE_NAME = "common_";
+const QString TRANSLATIONS_PATH = "/resource/qt/translations/";
+const QString TRANSLATIONS_FILE = "camera";
 
 int main(int argc, char *argv[])
 {
@@ -82,24 +81,14 @@
         OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" );
     }
 
-    // Load the language specific localization files: application + common
+    // Load language specific application localization file, e.g. "camera_en.qm"
+    CX_DEBUG(("CxUI: Load translations.."));
     OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" );
-    QTranslator translator;
-    QString lang = QLocale::system().name();
-
-    CX_DEBUG(("CxUI: loading translation"));
-    bool ret = false;
-    ret = translator.load(TRANSLATIONS_PATH + TRANSLATIONS_FILE_NAME + lang);
-    CX_DEBUG(("load ok=%d", ret));
-    app.installTranslator( &translator );
-
-    QTranslator commonTranslator;
-    CX_DEBUG(("CxUI: loading common translation"));
-    ret = false;
-    ret = commonTranslator.load(TRANSLATIONS_PATH + COMMON_TRANSLATIONS_FILE_NAME + lang);
-    CX_DEBUG(("load ok=%d", ret));
-    app.installTranslator(&commonTranslator);
+    HbTranslator* trans = new HbTranslator(TRANSLATIONS_PATH, TRANSLATIONS_FILE);
+    // Load language specific common localization file
+    trans->loadCommon();
     OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" );
+    CX_DEBUG(("CxUI: ..translations loaded"));
 
     OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" );
     HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent |
@@ -124,8 +113,11 @@
     OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
     //! @todo initMode call added here as a temporary hack to change the startup sequence
 	// in order to avoid GOOM issues
-	  User::After(2000000);
-    eng->initMode(Cxe::ImageMode);
+	if (viewManager->proceedStartup()) {
+    	User::After(2000000);
+        eng->initMode(Cxe::ImageMode);
+    }
+
     int returnValue = app.exec();
 
     // delete service provider instance
@@ -133,6 +125,7 @@
 
     delete viewManager;
     delete mainWindow;
+    delete trans;
     delete eng;
 
     return returnValue;