photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 64 34937ec34dac
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    18 
    18 
    19 
    19 
    20 
    20 
    21 #include "glxmulmodelproviderbase.h"
    21 #include "glxmulmodelproviderbase.h"
    22 
    22 
       
    23 #include <e32err.h>
    23 #include <alf/alfenv.h>
    24 #include <alf/alfenv.h>
    24 #include <alf/alfevent.h>
    25 #include <alf/alfevent.h>
    25 #include <alf/ialfwidgetfactory.h>
    26 #include <alf/ialfwidgetfactory.h>
    26 #include <alf/alfwidgetenvextension.h>
    27 #include <alf/alfwidgetenvextension.h>
       
    28 //#include <osn/ustring.h>
    27 #include <mul/imulwidget.h>
    29 #include <mul/imulwidget.h>
    28 #include <mul/mulevent.h>
    30 #include <mul/mulevent.h>
    29 #include <mul/mulvisualitem.h>
    31 #include <mul/mulvisualitem.h>
    30 #include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
       
    31 #include <glxlog.h>  //Logging
    32 #include <glxlog.h>  //Logging
    32 #include <glxtracer.h>
    33 #include <glxtracer.h>
       
    34 #include "glxbinding.h"
       
    35 #include "glxcommandbindingutility.h"
    33 #include <glxnavigationalstate.h>
    36 #include <glxnavigationalstate.h>
    34 #include <glxnavigationalstatedefs.h>
    37 #include <glxnavigationalstatedefs.h>
    35 
    38 
    36 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
    39 #include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
    37 #include <glxuiutilities.rsg>
    40 #include <glxuiutilities.rsg>
    38 #include <glxgeneraluiutilities.h>
    41 #include <glxgeneraluiutilities.h>
    39 #include <glxtexturemanager.h>
    42 #include <glxtexturemanager.h>
    40 #include <glxicons.mbg>
    43 #include <glxicons.mbg>
    41 #include <glxuistd.h>
    44 #include <glxuistd.h>
       
    45 #include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
    42 #include "glxdrmgiftexturecreator.h"
    46 #include "glxdrmgiftexturecreator.h"
    43 #include "glxbinding.h"
       
    44 #include "glxcommandbindingutility.h"
       
    45 
    47 
    46 using namespace Alf;
    48 using namespace Alf;
    47 
    49 
    48 static const char* const KListWidget = "ListWidget";
    50 static const char* const KListWidget = "ListWidget";
    49 static const char* const KGridWidget = "GridWidget";
    51 static const char* const KGridWidget = "GridWidget";
    50 static const char* const KCoverFlowWidget = "CoverflowWidget";
    52 static const char* const KCoverFlowWidget = "CoverflowWidget";
       
    53 
       
    54 //@todo to be uncommented when using command binding
       
    55 //#include "glxboundcommand.h"
    51 
    56 
    52 // ----------------------------------------------------------------------------
    57 // ----------------------------------------------------------------------------
    53 // BaseConstructL
    58 // BaseConstructL
    54 // ----------------------------------------------------------------------------
    59 // ----------------------------------------------------------------------------
    55 //
    60 //
   182 	{
   187 	{
   183 	TRACER("CGlxMulModelProviderBase::offerEvent");
   188 	TRACER("CGlxMulModelProviderBase::offerEvent");
   184 	AlfEventStatus response = EEventNotHandled;
   189 	AlfEventStatus response = EEventNotHandled;
   185 	if ( aEvent.IsCustomEvent() )
   190 	if ( aEvent.IsCustomEvent() )
   186 		{
   191 		{
   187 		GLX_LOG_INFO1("CGlxMulModelProviderBase::offerEvent() aEvent.CustomParameter(%d)", aEvent.CustomParameter());    
       
   188 		switch ( aEvent.CustomParameter() ) 
   192 		switch ( aEvent.CustomParameter() ) 
   189 			{
   193 			{
   190 			case KAlfActionIdDeviceLayoutChanged:
   194 			case KAlfActionIdDeviceLayoutChanged:
   191 				{
   195 				{
   192 				HandleOrientationChanged();
   196 				HandleOrientationChanged();
   200 					HandleFocusChanged( FocusIndex(), iPreviousFocusIndex );
   204 					HandleFocusChanged( FocusIndex(), iPreviousFocusIndex );
   201 					}
   205 					}
   202 				response = EEventHandled;
   206 				response = EEventHandled;
   203 				}
   207 				}
   204 				break;
   208 				break;
   205             case Alf::ETypeItemRemoved:
   209 			default:
   206                 {
   210 				break;
   207                 GLX_LOG_INFO("CGlxMulModelProviderBase::offerEvent - ETypeItemRemoved!");
   211 			}
   208                 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
       
   209                 CleanupClosePushL(*uiUtility);
       
   210                 if (iModel->Count() == 0 && UString(KCoverFlowWidget)
       
   211                         == UString(iWidget.widgetName())
       
   212                         && iNavigationalState->ViewingMode()
       
   213                                 == NGlxNavigationalState::EView
       
   214                         && uiUtility->GetForegroundStatus())
       
   215                     {
       
   216                     uiUtility->SetViewNavigationDirection(
       
   217                             EGlxNavigationBackwards);
       
   218 
       
   219                     iNavigationalState->ActivatePreviousViewL();
       
   220                     response = EEventHandled;
       
   221                     }
       
   222                 CleanupStack::PopAndDestroy(uiUtility);
       
   223                 }
       
   224                 break;
       
   225             default:
       
   226                 break;
       
   227             }
       
   228 		}
   212 		}
   229 	return response;
   213 	return response;
   230 	}
   214 	}
   231 
   215 
   232 // ----------------------------------------------------------------------------
   216 // ----------------------------------------------------------------------------
   458 //    
   442 //    
   459 void CGlxMulModelProviderBase::RemoveItems( TInt aIndex, TInt aCount )
   443 void CGlxMulModelProviderBase::RemoveItems( TInt aIndex, TInt aCount )
   460     {
   444     {
   461     TRACER("CGlxMulModelProviderBase::RemoveItems");
   445     TRACER("CGlxMulModelProviderBase::RemoveItems");
   462     // RemoveItems does not throw according to model documentation
   446     // RemoveItems does not throw according to model documentation
   463     GLX_LOG_INFO2("CGlxMulModelProviderBase::RemoveItems() aIndex(%d), aCount(%d)", aIndex, aCount);    
       
   464     iModel->Remove( aIndex, aCount );
   447     iModel->Remove( aIndex, aCount );
   465     }    
   448     }    
   466 
   449 
   467 // ----------------------------------------------------------------------------
   450 // ----------------------------------------------------------------------------
   468 // SetFocusIndex
   451 // SetFocusIndex