camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 22 f54ad444594d
parent 21 289bbfdb6627
--- a/camerauis/cameraapp/generic/src/CamAppui.cpp	Thu Jul 15 18:18:07 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamAppui.cpp	Thu Aug 19 09:36:57 2010 +0300
@@ -63,6 +63,7 @@
 
 #include <AknCommonDialogsDynMem.h>
 #include <CAknMemorySelectionDialogMultiDrive.h>
+#include <aknmessagequerydialog.h>
 
 #include "CameraappPrivateCRKeys.h"
 #include "CamAppUi.h"
@@ -146,7 +147,45 @@
                                    | ECamCameraEventClassVfControl
                                    | ECamCameraEventClassSsControl
                                    | ECamCameraEventClassSettings );
-
+/**
+ * class CCamFtuDisplay
+ * This class is used to give a notification to Camera First Time User regarding the 
+ * geotagging of captured images or videos.
+ */
+
+class CCamFtuDisplay : public CAsyncOneShot 
+    {
+public:
+    /**
+     * CCamFtuDisplay
+     * Default Constructor
+     */
+    CCamFtuDisplay( CCamAppUi * aCamAppUi )
+    : CAsyncOneShot( CActive::EPriorityLow), iCamAppUi(aCamAppUi)
+            {
+            }
+    enum TEnableCamFtu
+        {
+        ECamFtuEnable = 0,
+        ECamFtuDisable
+        };
+    
+protected:
+    /**
+     * RunL
+     * Callback method
+     */
+    void RunL()
+        {
+        iCamAppUi->CamFtuDisplayL();
+        }
+private:
+    /**
+     * iCamAppUi
+     * An instance of the CCamAppUi
+     */
+    CCamAppUi* iCamAppUi;
+    };
 
 
 // ===========================================================================
@@ -252,6 +291,12 @@
     delete iCollectionManager;
     iCollectionManager = NULL;
 
+    if( iCamFtuDisplay )
+        {
+        delete iCamFtuDisplay;
+        iCamFtuDisplay = NULL;
+        }
+
     PRINT( _L("Camera <= ~CCamAppUi" ))
     }
 
@@ -662,7 +707,20 @@
 
   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
-  }
+   
+  //  To get FTU flag value
+
+    TInt ftuValue=0;
+    TInt retErr=0;
+    retErr=iRepository->Get( KCamCrFtuMessageFlag, ftuValue );
+   
+    if( !IsEmbedded() && ftuValue == CCamFtuDisplay::ECamFtuEnable 
+	        && retErr==KErrNone )
+        {
+        iCamFtuDisplay = new (ELeave)CCamFtuDisplay(this);
+        iCamFtuDisplay->Call();
+        }
+    }
     
 
 
@@ -694,9 +752,73 @@
   PRINT1( _L("Camera <= CCamAppUi::IsInternalView, return %d"), internal );
   return internal;
   }
-
-
- 
+// -----------------------------------------------------------------------------
+// CCamAppUi:: HyperlinkCallback
+// Call back method for the hyper link text 
+// -----------------------------------------------------------------------------
+//
+TInt CCamAppUi:: HyperlinkCallback(TAny* aAny)
+    {
+    (static_cast<CCamAppUi*>(aAny))->OpenSettingView();
+    return EFalse;
+    }
+// -----------------------------------------------------------------------------
+// CCamAppUi::OpenSettingView
+// Non static public method , to launch the settings view
+// -----------------------------------------------------------------------------
+//
+void CCamAppUi::OpenSettingView()
+    {
+    TRAP_IGNORE( HandleCommandL( ECamCmdSettings ) );
+    }
+// -----------------------------------------------------------------------------
+// CCamAppUi::CamFtuDisplayL()
+// TO Display FTU message for first time camera launched
+// -----------------------------------------------------------------------------
+//
+void CCamAppUi::CamFtuDisplayL()
+    {    
+
+	iController.SetIntegerSettingValueL( ECamSettingItemRecLocation, ECamLocationOn );
+
+    CAknMessageQueryDialog* dlg =
+    new (ELeave) CAknMessageQueryDialog();
+    dlg->PrepareLC( R_FTU_MESSAGE_DIALOG );
+    HBufC* msg = iEikonEnv->AllocReadResourceLC( R_FTU_MESSAGE_DIALOG_TEXT );
+    HBufC* hyperLinkMsg = iEikonEnv->AllocReadResourceLC(
+            R_FTU_MESSAGE_HYPERLINK_TEXT );
+   
+    TInt len = msg->Length() 
+            + hyperLinkMsg->Length() 
+            + KOpeningLinkTag().Length() 
+            + KClosingLinkTag().Length();
+    
+    HBufC* displayMsg = HBufC::NewLC( len );
+    _LIT(KMsgFormat, "%S%S%S%S");
+    displayMsg->Des().Format(KMsgFormat, 
+            msg, 
+            &KOpeningLinkTag(),
+            hyperLinkMsg,
+            &KClosingLinkTag());
+
+    dlg->SetMessageTextL( *displayMsg );
+    CleanupStack::PopAndDestroy(3); //msg, hyperLinkMsg, displayMsg
+    
+    TCallBack callback( HyperlinkCallback, this );
+
+    dlg->SetLink( callback );
+
+    dlg->RunLD();
+
+    iRepository->Set( KCamCrFtuMessageFlag, CCamFtuDisplay::ECamFtuDisable );
+
+	//Read the location record value in case its changed by hyperlink
+
+	TInt value = 0;
+	iRepository->Get( KCamCrPhotoStoreLocation, value );
+	iController.SetIntegerSettingValueL( ECamSettingItemRecLocation, value );
+	
+    } 
 // -----------------------------------------------------------------------------
 // CCamAppUi::IsConstructionComplete
 // Returns whether or not all construction has completed
@@ -895,7 +1017,14 @@
         // In capture setup mode, toolbar and indicators are not visible
         // They will be updated when returning to precap, similarily to
         // when setting the self timer mode above
-        if( iPreCaptureMode != ECamPreCapCaptureSetup )
+        // during changing from still pre-capture view to video pre-capture view, no need 
+        // to show toolbar of still image. It will display toolbar of video when entering video pre-capture  
+
+        if( ( iPreCaptureMode != ECamPreCapCaptureSetup && 
+              iPreCaptureMode != ECamPreCapSceneSetting ) &&                           
+            !( IsViewFinderInTransit() && 
+                iMode == ECamControllerImage &&
+                iTargetMode == ECamControllerVideo ) )    
             {
             // Re-show the active palette
             iActivePaletteHandler->UpdateActivePaletteL();
@@ -922,6 +1051,14 @@
             }        
         
         UpdateCba();
+        CCamViewBase* precapView = static_cast<CCamViewBase*>( iView );              
+        if( precapView && 
+            IsViewFinderInTransit() && 
+            iMode == ECamControllerImage &&
+            iTargetMode == ECamControllerVideo )
+          {
+          precapView->ViewCba()->DrawNow();       
+          }
         }    
     }
 
@@ -1474,7 +1611,10 @@
         SetActivePaletteVisibility( EFalse );           
            
         // Update CBA
-        UpdateCba();
+        if ( iSelfTimer && iSelfTimer->IsActive() )
+            {
+            UpdateCba();
+            }
         }
       }
       break;
@@ -2007,6 +2147,10 @@
                 }
             }
         }
+     else
+        {
+        SetToolbarVisibility();
+        }
       iFirstVFStart = EFalse;
       
       PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL updating CBA") );
@@ -3943,7 +4087,7 @@
       {
       iController.ReleaseArray( ETrue );    
       }
-    if ( iPreCaptureMode != ECamPreCapTimeLapseSlider )
+    if ( iPreCaptureMode != ECamPreCapTimeLapseSlider && !IsEmbedded() )
       {
       iPreCaptureMode = ECamPreCapViewfinder;
       }