photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
branchRCL_3
changeset 64 34937ec34dac
parent 60 5b3385a43d68
child 68 5b238bc8ffb6
--- a/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp	Wed Sep 01 12:33:26 2010 +0100
+++ b/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp	Tue Sep 14 21:19:17 2010 +0300
@@ -46,6 +46,7 @@
 #include <mpxcollectionpath.h>
 
 #include <gesturehelper.h>
+#include <coeutils.h>
 
 using namespace GestureHelper;
 
@@ -229,6 +230,12 @@
         delete iMMCNotifier;
         iMMCNotifier = NULL;
         }
+    
+    if (iUri)
+        {
+        delete iUri;
+        }
+    
     if(iMediaListMulModelProvider)
         {
         delete iMediaListMulModelProvider;
@@ -425,6 +432,7 @@
     CAknViewAppUi* appui = AppUi();
     if ( appui )
         {
+        SetTitlePaneTextL(KNullDesC);
         appui->StatusPane()->MakeVisible(EFalse);
         appui->Cba()->MakeVisible(EFalse);
         }
@@ -949,6 +957,11 @@
     if(iZoomControl && iZoomControl->Activated())
         {
         iZoomControl->HandleZoomForegroundEvent(aForeground);
+        if (aForeground && iUri && !ConeUtils::FileExists(iUri->Des()))
+            {
+            GLX_LOG_INFO("File does not exist, Exit zoom view!");
+            HandleItemRemovedL();
+            }
         }
 
     if (!aForeground)
@@ -1163,36 +1176,7 @@
             case ETypeItemRemoved:
                 {
                 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeItemRemoved");
-                TInt focusIndex = iMediaList->FocusIndex();
-                TInt mlCount = iMediaList->Count();
-                GLX_LOG_INFO2("CGlxFullScreenViewImp::OfferEventL focusIndex=%d, iOldFocusIndex=%d",
-                        focusIndex, iOldFocusIndex);
-                if (mlCount && (iOldFocusIndex == focusIndex
-                        || iOldFocusIndex == mlCount) && iZoomControl
-                        && iZoomControl->Activated())
-                    {
-                    GLX_LOG_INFO("Fcused item is removed, Exit zoom view!");
-                    DeactivateZoomControlL();
-                    }
-                SetItemToHDMIL();
-                if (focusIndex != KErrNotFound && EUiOn == GetUiState())
-                    {
-                    // show/hide the slider
-                    if (iSliderWidget)
-                        {
-                        iSliderWidget->ShowWidget(CheckIfSliderToBeShownL());
-                        }
-                    }
-                /** if this is the last image deleted when Photo is in foreground, go back to the previous view*/
-                if (mlCount == 0 && IsForeground()
-                        && iNaviState->ViewingMode()
-                                == NGlxNavigationalState::EView)
-                    {
-                    iUiUtility->SetViewNavigationDirection(
-                            EGlxNavigationBackwards);
-                    iNaviState->ActivatePreviousViewL();
-                    }
-                TRAP_IGNORE(ShowDrmExpiryNoteL());
+                HandleItemRemovedL();
                 return EEventConsumed;
                 }
             case ETypeHighlight:
@@ -1317,6 +1301,9 @@
 		case EAknSoftkeyBack:
             {
             HideUi(ETrue);
+            // Enable status pane  and  Set null text 
+			StatusPane()->MakeVisible(ETrue);
+			SetTitlePaneTextL(KNullDesC);
             break;
             }                        
         } 
@@ -1854,7 +1841,11 @@
         //(e.g. video, corrupted item, item with invalid DRM)
         iHdmiController->ItemNotSupported();
         }
+    
     iOldFocusIndex = iMediaList->FocusIndex();
+    delete iUri;
+    iUri = NULL;   
+    iUri = item.Uri().AllocL();
     }
 
 // ---------------------------------------------------------------------------
@@ -2091,3 +2082,60 @@
             }
         }
     }
+
+// ---------------------------------------------------------------------------
+// Sets the title pane text
+// ---------------------------------------------------------------------------
+void CGlxFullScreenViewImp::SetTitlePaneTextL(const TDesC& aTitleText)
+	{
+    TRACER("CGlxFullScreenViewImp::SetTitlePaneTextL()");
+    CAknViewAppUi* appui = AppUi();
+    if (appui)
+        {
+        CAknTitlePane* titlePane =
+                (CAknTitlePane*) appui->StatusPane()->ControlL(TUid::Uid(
+                        EEikStatusPaneUidTitle));
+        titlePane->SetTextL(aTitleText);
+        titlePane->DrawNow();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// HandleItemRemovedL
+// ---------------------------------------------------------------------------
+void CGlxFullScreenViewImp::HandleItemRemovedL()
+    {
+    TRACER("CGlxFullScreenViewImp::HandleItemRemovedL()");
+    TInt focusIndex = iMediaList->FocusIndex();
+    TInt mlCount = iMediaList->Count();
+    GLX_LOG_INFO2("CGlxFullScreenViewImp::HandleItemRemovedL focusIndex=%d, iOldFocusIndex=%d",
+            focusIndex, iOldFocusIndex);
+    // When photos is in background, the Following scenario could happen,
+    // 1) First item is deleted => iOldFocusIndex == focusIndex (or)
+    // 2) Last item is deleted => iOldFocusIndex == mlCount (or)
+    // 3) New item is added and focused item is deleted => iOldFocusIndex != focusIndex
+    if (mlCount && (iOldFocusIndex == focusIndex || iOldFocusIndex == mlCount
+            || iOldFocusIndex != focusIndex) && iZoomControl
+            && iZoomControl->Activated())
+        {
+        GLX_LOG_INFO("Focused item is removed, Exit zoom view!");
+        DeactivateZoomControlL();
+        }
+    SetItemToHDMIL();
+    if (focusIndex != KErrNotFound && EUiOn == GetUiState())
+        {
+        // show/hide the slider
+        if (iSliderWidget)
+            {
+            iSliderWidget->ShowWidget(CheckIfSliderToBeShownL());
+            }
+        }
+    /** if this is the last image deleted when Photo is in foreground, go back to the previous view*/
+    if (mlCount == 0 && IsForeground() && iNaviState->ViewingMode()
+            == NGlxNavigationalState::EView)
+        {
+        iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards);
+        iNaviState->ActivatePreviousViewL();
+        }
+    TRAP_IGNORE(ShowDrmExpiryNoteL());
+    }