photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp
branchRCL_3
changeset 24 ea65f74e6de4
parent 23 b023a8d2866a
--- a/photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp	Thu Jul 15 18:39:01 2010 +0300
+++ b/photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp	Thu Aug 19 09:55:03 2010 +0300
@@ -20,19 +20,16 @@
 
 #include "glxmulmodelproviderbase.h"
 
-#include <e32err.h>
 #include <alf/alfenv.h>
 #include <alf/alfevent.h>
 #include <alf/ialfwidgetfactory.h>
 #include <alf/alfwidgetenvextension.h>
-//#include <osn/ustring.h>
 #include <mul/imulwidget.h>
 #include <mul/mulevent.h>
 #include <mul/mulvisualitem.h>
+#include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
 #include <glxlog.h>  //Logging
 #include <glxtracer.h>
-#include "glxbinding.h"
-#include "glxcommandbindingutility.h"
 #include <glxnavigationalstate.h>
 #include <glxnavigationalstatedefs.h>
 
@@ -42,8 +39,9 @@
 #include <glxtexturemanager.h>
 #include <glxicons.mbg>
 #include <glxuistd.h>
-#include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
 #include "glxdrmgiftexturecreator.h"
+#include "glxbinding.h"
+#include "glxcommandbindingutility.h"
 
 using namespace Alf;
 
@@ -51,9 +49,6 @@
 static const char* const KGridWidget = "GridWidget";
 static const char* const KCoverFlowWidget = "CoverflowWidget";
 
-//@todo to be uncommented when using command binding
-//#include "glxboundcommand.h"
-
 // ----------------------------------------------------------------------------
 // BaseConstructL
 // ----------------------------------------------------------------------------
@@ -189,6 +184,7 @@
 	AlfEventStatus response = EEventNotHandled;
 	if ( aEvent.IsCustomEvent() )
 		{
+		GLX_LOG_INFO1("CGlxMulModelProviderBase::offerEvent() aEvent.CustomParameter(%d)", aEvent.CustomParameter());    
 		switch ( aEvent.CustomParameter() ) 
 			{
 			case KAlfActionIdDeviceLayoutChanged:
@@ -206,9 +202,29 @@
 				response = EEventHandled;
 				}
 				break;
-			default:
-				break;
-			}
+            case Alf::ETypeItemRemoved:
+                {
+                GLX_LOG_INFO("CGlxMulModelProviderBase::offerEvent - ETypeItemRemoved!");
+                CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
+                CleanupClosePushL(*uiUtility);
+                if (iModel->Count() == 0 && UString(KCoverFlowWidget)
+                        == UString(iWidget.widgetName())
+                        && iNavigationalState->ViewingMode()
+                                == NGlxNavigationalState::EView
+                        && uiUtility->GetForegroundStatus())
+                    {
+                    uiUtility->SetViewNavigationDirection(
+                            EGlxNavigationBackwards);
+
+                    iNavigationalState->ActivatePreviousViewL();
+                    response = EEventHandled;
+                    }
+                CleanupStack::PopAndDestroy(uiUtility);
+                }
+                break;
+            default:
+                break;
+            }
 		}
 	return response;
 	}
@@ -306,12 +322,12 @@
         TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown;
         if (aMedia.GetDrmProtected(drm))
             {
-            GLX_DEBUG1("CGlxMulModelProviderBase::SetDataT GetDrmValidity");
             aMedia.GetDrmValidity(isValid);
+            GLX_DEBUG2("CGlxMulModelProviderBase::SetDataT DrmValidity(%d)", isValid);
             }
         TInt frameCount;
         aMedia.GetFrameCount(frameCount);
-        
+        GLX_DEBUG2("CGlxMulModelProviderBase::SetDataT framecount=%d", frameCount);
         //Create the DRM gif texture intance only if the DRM gif image is
         //valid and focused
         if (frameCount > 1 && drm && isValid == EGlxDrmRightsValid)
@@ -444,6 +460,7 @@
     {
     TRACER("CGlxMulModelProviderBase::RemoveItems");
     // RemoveItems does not throw according to model documentation
+    GLX_LOG_INFO2("CGlxMulModelProviderBase::RemoveItems() aIndex(%d), aCount(%d)", aIndex, aCount);    
     iModel->Remove( aIndex, aCount );
     }