ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp
changeset 23 74c9f037fd5d
child 24 99ad1390cd33
equal deleted inserted replaced
5:f7f0874bfe7d 23:74c9f037fd5d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 /*glxmlwrapper_p.cpp*/
       
    19 //external includes
       
    20 #include <hbicon.h>
       
    21 #include <glxtracer.h>
       
    22 #include <mglxmedialist.h>
       
    23 #include <glxlog.h>
       
    24 #include <glxthumbnailcontext.h>
       
    25 #include <glxattributecontext.h>
       
    26 #include <glxuistd.h>
       
    27 #include <glxcollectionpluginall.hrh>
       
    28 #include <glxcollectionpluginalbums.hrh>
       
    29 #include <glxcollectiongeneraldefs.h>
       
    30 #include <glxthumbnailattributeinfo.h>
       
    31 #include <glxfilterfactory.h>
       
    32 #include <glxmedia.h>
       
    33 #include <glxerrormanager.h>
       
    34 #include <glxattributecontext.h>
       
    35 #include <glxuistd.h>
       
    36 #include <glxlistdefs.h>
       
    37 #include <hal.h>
       
    38 #include <hal_data.h>
       
    39 #include <glxmediaid.h>
       
    40 #include <caf/caferr.h>
       
    41 //internal includes 
       
    42 #include "glxmlwrapper_p.h"
       
    43 #include "glxmlgenericobserver.h"
       
    44 #include "glxattributeretriever.h"
       
    45 
       
    46 //#define GLXPERFORMANCE_LOG  
       
    47 #include <glxperformancemacro.h>
       
    48 
       
    49 //constant declaration
       
    50 const TInt KItemsPerPage(18);
       
    51 const TInt KTBAttributeAvailable(1);
       
    52 const TInt KTBAttributeUnavailable(0);
       
    53 const TInt KTBAttributeCorrupt(-1);
       
    54 const TInt KListDataWindowSize(10);
       
    55 const TInt KGridTNWIdth (128);
       
    56 const TInt KGridTNHeight (128);
       
    57 const TInt KFullScreenTNLSWidth (640);
       
    58 const TInt KFullScreenTNLSHeight (360);
       
    59 const TInt KFullScreenTNPTWidth (360);
       
    60 const TInt KFullScreenTNPTHeight (640);
       
    61 
       
    62 // ======== MEMBER FUNCTIONS ========
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Two-phased constructor.
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 GlxMLWrapperPrivate* GlxMLWrapperPrivate::Instance(GlxMLWrapper* aMLWrapper,
       
    69     int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType)
       
    70     {
       
    71     TRACER("GlxMLWrapperPrivate::NewLC()");
       
    72 
       
    73     GlxMLWrapperPrivate* self = new GlxMLWrapperPrivate(aMLWrapper);
       
    74    if(self){
       
    75 	   TRAPD(err,self->ConstructL(aCollectionId, aHierarchyId, aFilterType));
       
    76 	   if(err != KErrNone){
       
    77 		   delete self;
       
    78 		   self = NULL;
       
    79 		   }
       
    80 	   }
       
    81    
       
    82     return self;
       
    83     }
       
    84 // ---------------------------------------------------------------------------
       
    85 // C++ default constructor can NOT contain any code, that
       
    86 // might leave.
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 GlxMLWrapperPrivate::GlxMLWrapperPrivate(GlxMLWrapper* aMLWrapper): iMLWrapper(aMLWrapper),
       
    90 								iGridContextActivated(EFalse), iLsFsContextActivated(EFalse),
       
    91 								iPtFsContextActivated(EFalse), iPtListContextActivated(EFalse),
       
    92 								iSelectionListContextActivated(EFalse)
       
    93     {
       
    94     TRACER("GlxMLWrapperPrivate::GlxMLWrapperPrivate");
       
    95 	iGridThumbnailContext = NULL;
       
    96 	iPtFsThumbnailContext = NULL;
       
    97 	iLsFsThumbnailContext = NULL;
       
    98 	iTitleAttributeContext = NULL;
       
    99 	iSubtitleAttributeContext = NULL;
       
   100     iListThumbnailContext = NULL;
       
   101     iFocusGridThumbnailContext = NULL;
       
   102     iFocusFsThumbnailContext = NULL;
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // Symbian 2nd phase constructor can leave.
       
   107 // ---------------------------------------------------------------------------
       
   108 //  
       
   109 void GlxMLWrapperPrivate::ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType)
       
   110     {
       
   111     TRACER("GlxMLWrapperPrivate::ConstructL");
       
   112 	if(aCollectionId != KGlxAlbumsMediaId)
       
   113 		{
       
   114 		CreateMediaListL(aCollectionId, aHierarchyId,aFilterType);
       
   115 		}
       
   116 	else
       
   117 		{
       
   118 		//for creating Medial List for Albums Media path Items
       
   119 		CreateMediaListAlbumItemL(aCollectionId, aHierarchyId,aFilterType);
       
   120 		}
       
   121 	iMLGenericObserver = CGlxMLGenericObserver::NewL(*iMediaList,this);
       
   122 	iFsFromFocusOutwardIterator.SetRangeOffsets(2,2);
       
   123 	iFsFromFocusOutwardIteratorForFocus.SetRangeOffsets(0,0);
       
   124 	iBlockyIteratorForFocus.SetRangeOffsets(0,0);
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // Destructor
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 GlxMLWrapperPrivate::~GlxMLWrapperPrivate()
       
   132     {
       
   133     TRACER("GlxMLWrapperPrivate::~GlxMLWrapperPrivate");
       
   134 	RemoveGridContext();
       
   135 	RemovePtFsContext();
       
   136 	RemoveLsFsContext();
       
   137 	RemoveListContext();
       
   138 	delete iMLGenericObserver;
       
   139 	iMLGenericObserver = NULL;
       
   140 	if (iMediaList)
       
   141         {
       
   142          iMediaList->Close();
       
   143         }
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // SetContextMode
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 void GlxMLWrapperPrivate::SetContextMode(GlxContextMode aContextMode)
       
   151     {
       
   152 	TInt err = KErrNone;
       
   153 	if(aContextMode <= GlxContextPtFs) 
       
   154 		{  
       
   155 		TRAP(err, SetThumbnailContextL(aContextMode) ); //todo add a trap here
       
   156 		}
       
   157 	else 
       
   158 		{
       
   159 		TRAP(err, SetListContextL(aContextMode) );
       
   160 		}
       
   161 	GLX_LOG_INFO1("GlxMLWrapperPrivate::SetContextMode error %d", err);
       
   162 	iContextMode = aContextMode;
       
   163 	}
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // SetListContextL
       
   167 // ---------------------------------------------------------------------------
       
   168 //
       
   169 void GlxMLWrapperPrivate::SetListContextL(GlxContextMode aContextMode)
       
   170 {
       
   171 	if(GlxContextLsList == aContextMode || GlxContextPtList == aContextMode)
       
   172 		{
       
   173 		if(!iPtListContextActivated)
       
   174 			{
       
   175 			if(NULL == iTitleAttributeContext)
       
   176 				{
       
   177 				iTitleAttributeContext = CGlxDefaultAttributeContext::NewL();
       
   178 			    iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, 
       
   179 						KListDataWindowSize );
       
   180 			    iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle );
       
   181 				iMediaList->AddContextL( iTitleAttributeContext, KMaxTInt );
       
   182 				}
       
   183 			if(NULL == iSubtitleAttributeContext)
       
   184 				{
       
   185 			    iSubtitleAttributeContext = CGlxDefaultAttributeContext::NewL();
       
   186 				iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, 
       
   187 						 KListDataWindowSize );
       
   188 				iSubtitleAttributeContext->AddAttributeL( 
       
   189 								 KGlxMediaCollectionPluginSpecificSubTitle );
       
   190 				iMediaList->AddContextL( iSubtitleAttributeContext, KMaxTInt );
       
   191 
       
   192 				}
       
   193             if(NULL == iListThumbnailContext)
       
   194 	            {
       
   195 	        	iListThumbnailContext = CGlxThumbnailContext::NewL( &iThumbnailIterator ); // set the thumbnail context
       
   196 	        	iThumbnailIterator.SetRange( 10 ); 
       
   197 	        	iListThumbnailContext->SetDefaultSpec( KGridTNWIdth,KGridTNHeight );
       
   198 	        	iMediaList->AddContextL(iListThumbnailContext ,KGlxFetchContextPriorityNormal );
       
   199 	            }
       
   200 			iPtListContextActivated = ETrue;
       
   201 			}
       
   202 		}
       
   203         else if(GlxContextSelectionList == aContextMode )
       
   204         {
       
   205             if(NULL == iTitleAttributeContext)
       
   206             {
       
   207                 iTitleAttributeContext = CGlxDefaultAttributeContext::NewL();
       
   208                 iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, KListDataWindowSize );
       
   209                 iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle );
       
   210                 iMediaList->AddContextL( iTitleAttributeContext, KMaxTInt );
       
   211             }
       
   212         iSelectionListContextActivated = ETrue;
       
   213         }
       
   214 }
       
   215 
       
   216 
       
   217 // ---------------------------------------------------------------------------
       
   218 // CreateThumbnailContext
       
   219 // ---------------------------------------------------------------------------
       
   220 //
       
   221 void GlxMLWrapperPrivate::SetThumbnailContextL(GlxContextMode aContextMode)
       
   222 {
       
   223 	TRACER("GlxMLWrapperPrivate::SetThumbnailContext()");
       
   224 	if(aContextMode == GlxContextGrid) {
       
   225 		if(!iGridContextActivated) {
       
   226 			CreateGridContextL();
       
   227 		}
       
   228 
       
   229 		if(iPtFsContextActivated)
       
   230 			{
       
   231 			RemovePtFsContext();
       
   232 			}
       
   233 
       
   234 		if(iLsFsContextActivated)
       
   235 			{
       
   236 			RemoveLsFsContext();
       
   237 			}
       
   238 		}
       
   239 	if(aContextMode == GlxContextLsFs && !iLsFsContextActivated)
       
   240 		{
       
   241 		if(!iGridContextActivated)
       
   242 			{
       
   243 			CreateGridContextL();
       
   244 			}
       
   245 		if(iPtFsContextActivated)
       
   246 			{
       
   247 			RemovePtFsContext();
       
   248 			}
       
   249 		CreateLsFsContextL();
       
   250 		}
       
   251 	if(aContextMode == GlxContextPtFs && !iPtFsContextActivated)
       
   252 		{
       
   253 		if(!iGridContextActivated)
       
   254 			{
       
   255 			CreateGridContextL();
       
   256 			}
       
   257 		if(iLsFsContextActivated)
       
   258 			{
       
   259 			RemoveLsFsContext();
       
   260 			}
       
   261 		CreatePtFsContextL();
       
   262 		}
       
   263 }
       
   264 
       
   265 // ---------------------------------------------------------------------------
       
   266 // CreateGridContextL
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 void GlxMLWrapperPrivate::CreateGridContextL()
       
   270     {
       
   271 	TRACER("GlxMLWrapperPrivate::CreateGridContextL()");
       
   272 	if(iGridThumbnailContext && !iGridContextActivated)
       
   273 		{
       
   274 		delete iGridThumbnailContext;
       
   275 		iGridThumbnailContext = NULL;
       
   276 		}
       
   277 	if(!iGridContextActivated)
       
   278 		{
       
   279 		iGridThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context
       
   280 	    iGridThumbnailContext->SetDefaultSpec( KGridTNWIdth, KGridTNHeight );  //todo get these image sizes from  the layout.
       
   281         // show static items if required
       
   282         iMediaList->SetStaticItemsEnabled(EFalse);
       
   283 	    iMediaList->AddContextL(iGridThumbnailContext, KGlxFetchContextPriorityNormal );
       
   284 		iGridContextActivated = ETrue;
       
   285 		}
       
   286     
       
   287 	}
       
   288 
       
   289 // ---------------------------------------------------------------------------
       
   290 // CreateLsFsContextL
       
   291 // ---------------------------------------------------------------------------
       
   292 //
       
   293 void GlxMLWrapperPrivate::CreateLsFsContextL()
       
   294     {
       
   295 	TRACER("GlxMLWrapperPrivate::CreateGridContextL()");
       
   296 	if(iLsFsThumbnailContext && !iLsFsContextActivated)
       
   297 		{
       
   298 		delete iLsFsThumbnailContext;
       
   299 		iLsFsThumbnailContext = NULL;
       
   300 		}
       
   301 	if(!iLsFsContextActivated)
       
   302 		{
       
   303 		iLsFsThumbnailContext = CGlxThumbnailContext::NewL( &iFsFromFocusOutwardIterator ); // set the thumbnail context
       
   304 	    iLsFsThumbnailContext->SetDefaultSpec( KFullScreenTNLSWidth, KFullScreenTNLSHeight );  //todo get these image sizes from  the layout.
       
   305 	    
       
   306         if(!iFocusFsThumbnailContext)
       
   307             {
       
   308             iFocusFsThumbnailContext = CGlxThumbnailContext::NewL( &iFsFromFocusOutwardIteratorForFocus ); // set Focus FS thumbthe thumbnail context
       
   309             iFocusFsThumbnailContext->SetDefaultSpec( KFullScreenTNLSWidth, KFullScreenTNLSHeight );  //todo get these image sizes from  the layout.
       
   310             }
       
   311         if(!iFocusGridThumbnailContext)
       
   312             {
       
   313             iFocusGridThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIteratorForFocus ); // set the thumbnail context for Focus Grid
       
   314             iFocusGridThumbnailContext->SetDefaultSpec( KGridTNWIdth, KGridTNHeight );  //todo get these image sizes from  the layout.
       
   315             }
       
   316 	    
       
   317         // show static items if required
       
   318         iMediaList->SetStaticItemsEnabled(EFalse);
       
   319         iMediaList->AddContextL(iFocusFsThumbnailContext, 7 );      // Temp will change this number  
       
   320         iMediaList->AddContextL(iFocusGridThumbnailContext, 8 );    // Temp will change this number  
       
   321 	    iMediaList->AddContextL(iLsFsThumbnailContext, KGlxFetchContextPriorityGridViewFullscreenVisibleThumbnail );
       
   322 		iLsFsContextActivated = ETrue;
       
   323 		}
       
   324     
       
   325 	}
       
   326 
       
   327 // ---------------------------------------------------------------------------
       
   328 // CreatePtFsContextL
       
   329 // ---------------------------------------------------------------------------
       
   330 //
       
   331 void GlxMLWrapperPrivate::CreatePtFsContextL()
       
   332     {
       
   333 	TRACER("GlxMLWrapperPrivate::CreateGridContextL()");
       
   334 	if(iPtFsThumbnailContext && !iPtFsContextActivated)
       
   335 		{
       
   336 		delete iPtFsThumbnailContext;
       
   337 		iPtFsThumbnailContext = NULL;
       
   338 		}
       
   339 	if(!iPtFsContextActivated)
       
   340 		{
       
   341 		iPtFsThumbnailContext = CGlxThumbnailContext::NewL( &iFsFromFocusOutwardIterator ); // set the thumbnail context
       
   342 	    iPtFsThumbnailContext->SetDefaultSpec( KFullScreenTNPTWidth, KFullScreenTNPTHeight );  //todo get these image sizes from  the layout.
       
   343 	    
       
   344 	    if(!iFocusFsThumbnailContext)
       
   345 	        {
       
   346 	        iFocusFsThumbnailContext = CGlxThumbnailContext::NewL( &iFsFromFocusOutwardIteratorForFocus ); // set Focus FS thumbthe thumbnail context
       
   347 	        iFocusFsThumbnailContext->SetDefaultSpec( KFullScreenTNLSWidth, KFullScreenTNLSHeight );  //todo get these image sizes from  the layout.
       
   348 	        }
       
   349 	    if(!iFocusGridThumbnailContext)
       
   350 	        {
       
   351 	        iFocusGridThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIteratorForFocus ); // set the thumbnail context for Focus Grid
       
   352 	        iFocusGridThumbnailContext->SetDefaultSpec( KGridTNWIdth, KGridTNHeight );  //todo get these image sizes from  the layout.
       
   353 	        }
       
   354 	    
       
   355 		// show static items if required
       
   356         iMediaList->SetStaticItemsEnabled(EFalse);
       
   357         iMediaList->AddContextL(iFocusFsThumbnailContext, 7 );      // Temp will change this number  
       
   358         iMediaList->AddContextL(iFocusGridThumbnailContext, 8 );    // Temp will change this number  
       
   359 	    iMediaList->AddContextL(iPtFsThumbnailContext, KGlxFetchContextPriorityGridViewFullscreenVisibleThumbnail );
       
   360 	    iPtFsContextActivated = ETrue;
       
   361 		}
       
   362 	    
       
   363 	}
       
   364 
       
   365 // ---------------------------------------------------------------------------
       
   366 // RemoveGridContext
       
   367 // ---------------------------------------------------------------------------
       
   368 //
       
   369 void GlxMLWrapperPrivate::RemoveGridContext()
       
   370     {
       
   371 	if(iGridThumbnailContext && iGridContextActivated)
       
   372 		{
       
   373 		iMediaList->RemoveContext(iGridThumbnailContext);
       
   374 		delete iGridThumbnailContext;
       
   375 		iGridThumbnailContext = NULL;
       
   376 		iGridContextActivated = EFalse;
       
   377 		}
       
   378 	}
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // RemoveLsFsContext
       
   382 // ---------------------------------------------------------------------------
       
   383 //
       
   384 void GlxMLWrapperPrivate::RemoveLsFsContext()
       
   385     {
       
   386 	if(iLsFsThumbnailContext && iLsFsContextActivated)
       
   387 		{
       
   388 		iMediaList->RemoveContext(iLsFsThumbnailContext);
       
   389 		delete iLsFsThumbnailContext;
       
   390 		iLsFsThumbnailContext = NULL;
       
   391 		
       
   392 		if(iFocusFsThumbnailContext)
       
   393 		    {
       
   394             iMediaList->RemoveContext(iFocusFsThumbnailContext);
       
   395             delete iFocusFsThumbnailContext;
       
   396             iFocusFsThumbnailContext = NULL;
       
   397 		    }
       
   398 	    
       
   399 		if(iFocusGridThumbnailContext)
       
   400 		    {
       
   401             iMediaList->RemoveContext(iFocusGridThumbnailContext);
       
   402             delete iFocusGridThumbnailContext;
       
   403             iFocusGridThumbnailContext = NULL;
       
   404 		    }
       
   405 	    
       
   406 		iLsFsContextActivated = EFalse;
       
   407 		}
       
   408 	}
       
   409 
       
   410 // ---------------------------------------------------------------------------
       
   411 // RemovePtFsContext
       
   412 // ---------------------------------------------------------------------------
       
   413 //
       
   414 void GlxMLWrapperPrivate::RemovePtFsContext()
       
   415     {
       
   416 	if(iPtFsThumbnailContext && iPtFsContextActivated)
       
   417 		{
       
   418 		iMediaList->RemoveContext(iPtFsThumbnailContext);
       
   419 		delete iPtFsThumbnailContext;
       
   420 		iPtFsThumbnailContext = NULL;
       
   421 		
       
   422         if(iFocusFsThumbnailContext)
       
   423             {
       
   424             iMediaList->RemoveContext(iFocusFsThumbnailContext);
       
   425             delete iFocusFsThumbnailContext;
       
   426             iFocusFsThumbnailContext = NULL;
       
   427             }
       
   428         
       
   429         if(iFocusGridThumbnailContext)
       
   430             {
       
   431             iMediaList->RemoveContext(iFocusGridThumbnailContext);
       
   432             delete iFocusGridThumbnailContext;
       
   433             iFocusGridThumbnailContext = NULL;
       
   434             }
       
   435 	        
       
   436 		iPtFsContextActivated = EFalse;
       
   437 		}
       
   438 	}
       
   439 
       
   440 
       
   441 // ---------------------------------------------------------------------------
       
   442 // RemoveListContext
       
   443 // ---------------------------------------------------------------------------
       
   444 //
       
   445 void GlxMLWrapperPrivate::RemoveListContext()
       
   446 	{
       
   447 	if(iPtListContextActivated || iSelectionListContextActivated)
       
   448 	    {
       
   449 		if(iTitleAttributeContext)
       
   450 			{
       
   451 			iMediaList->RemoveContext(iTitleAttributeContext);
       
   452 			delete iTitleAttributeContext;
       
   453 			iTitleAttributeContext = NULL;
       
   454 			}
       
   455 		if(iSubtitleAttributeContext)
       
   456 			{
       
   457 			iMediaList->RemoveContext(iSubtitleAttributeContext);
       
   458 			delete iSubtitleAttributeContext;
       
   459 			iSubtitleAttributeContext = NULL;
       
   460 			}
       
   461 		if(iListThumbnailContext)
       
   462 			{
       
   463 			iMediaList->RemoveContext(iListThumbnailContext);
       
   464 			delete iListThumbnailContext;
       
   465 			iListThumbnailContext = NULL;
       
   466 			}
       
   467 		iPtListContextActivated = EFalse;
       
   468 	    iSelectionListContextActivated = EFalse;
       
   469 		}
       
   470 	}
       
   471 // ---------------------------------------------------------------------------
       
   472 // GetItemCount
       
   473 // ---------------------------------------------------------------------------
       
   474 //
       
   475 int GlxMLWrapperPrivate::GetItemCount()
       
   476     {
       
   477 	return iMediaList->Count();
       
   478     }
       
   479 
       
   480 // ---------------------------------------------------------------------------
       
   481 // CreateMediaListAlbumItemL()
       
   482 // Creates the media list for the album Item 
       
   483 // ---------------------------------------------------------------------------
       
   484 void GlxMLWrapperPrivate::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType)
       
   485 	{
       
   486 	TRACER("GlxMLWrapperPrivate::CreateMediaListAlbumItemL");
       
   487 	Q_UNUSED(aCollectionId);
       
   488 	Q_UNUSED(aHierarchyId);
       
   489 	//retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList
       
   490 	CreateMediaListL(KGlxCollectionPluginAlbumsImplementationUid,0,EGlxFilterAlbum);
       
   491 	//retrieve the path of the focussed item of the MediaList
       
   492 	CMPXCollectionPath* path = iMediaList->PathLC(NGlxListDefs:: EPathFocusOrSelection);
       
   493 	//close the existing instance of Media List
       
   494 	iMediaList->Close();
       
   495 	iMediaList = NULL;
       
   496 	//create new media list with the derived path
       
   497 	CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
       
   498 	CleanupStack::PushL(filter);
       
   499 	iMediaList = MGlxMediaList::InstanceL( *path, 
       
   500 	                  TGlxHierarchyId(0), filter );  //todo take actual hierarchy
       
   501 	CleanupStack::PopAndDestroy( filter );
       
   502 	
       
   503 	GLX_LOG_INFO1("GlxMLWrapperPrivate::CreateMediaListAlbumItemL  - Path level = %d",
       
   504 	                                                     path->Levels());
       
   505 	CleanupStack::PopAndDestroy(path);
       
   506 	}
       
   507 // ---------------------------------------------------------------------------
       
   508 // CreateMediaListL()
       
   509 // Creates a collection path
       
   510 // Create a filter as requested filtertype
       
   511 // Creates the medialist
       
   512 // ---------------------------------------------------------------------------
       
   513 void GlxMLWrapperPrivate::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) 
       
   514 	{
       
   515 	TRACER("GlxMLWrapperPrivate::CreateMediaListL");
       
   516   	Q_UNUSED(aHierarchyId);	
       
   517 	// Create path to the list of images and videos
       
   518 	CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   519 	CleanupStack::PushL( path );
       
   520 	//path->AppendL(KGlxCollectionPluginAllImplementationUid);	// All item collection plugin  //todo take actual collection path
       
   521 	path->AppendL(aCollectionId);
       
   522 	// Create filter to filter out either images or videos
       
   523 	GLX_LOG_INFO1("GlxMLWrapperPrivate::MediaListL  - Filter Type = %d",aFilterType);
       
   524 	CMPXFilter* filter = NULL;
       
   525 	if( EGlxFilterExcludeCamera == aFilterType)
       
   526 		{
       
   527 		filter = TGlxFilterFactory::CreateCameraAlbumExclusionFilterL();
       
   528 		CleanupStack::PushL(filter);
       
   529 		}
       
   530 	else
       
   531 		{
       
   532 		filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
       
   533 		CleanupStack::PushL(filter);
       
   534 		}
       
   535 	// Create the media list
       
   536 	iMediaList =  MGlxMediaList::InstanceL( *path, 
       
   537 	                  TGlxHierarchyId(aHierarchyId), filter );  //todo take actual hierarchy 
       
   538 	CleanupStack::PopAndDestroy( filter );
       
   539 	
       
   540 	GLX_LOG_INFO1("GlxMLWrapperPrivate::MediaListL  - Path level = %d",
       
   541 	                                                     path->Levels());
       
   542 	
       
   543 	CleanupStack::PopAndDestroy(path);
       
   544 	}
       
   545 
       
   546 // ---------------------------------------------------------------------------
       
   547 //  retrieveItemIcon
       
   548 // ---------------------------------------------------------------------------
       
   549 //
       
   550 HbIcon* GlxMLWrapperPrivate::RetrieveItemIcon(int aItemIndex, GlxTBContextType aTBContextType)
       
   551 	{
       
   552 	TInt itemHeight = 0;
       
   553 	TInt itemWidth = 0;
       
   554 	switch (aTBContextType)
       
   555 		{
       
   556 		case GlxTBContextGrid: 
       
   557 			{
       
   558 			itemHeight = KGridTNHeight;
       
   559 			itemWidth = KGridTNWIdth;
       
   560 			}
       
   561 			break;
       
   562 		case GlxTBContextPtFs: 
       
   563 			{
       
   564 			itemHeight = KFullScreenTNPTHeight;
       
   565 			itemWidth = KFullScreenTNPTWidth;
       
   566 			}
       
   567 			break;
       
   568 		case GlxTBContextLsFs: 
       
   569 			{
       
   570 			itemHeight = KFullScreenTNLSHeight;
       
   571 			itemWidth = KFullScreenTNLSWidth;
       
   572 			}
       
   573 			break;
       
   574 		}
       
   575 	const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   576     TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, 
       
   577             GlxFullThumbnailAttributeId( ETrue,itemWidth,itemHeight ) ); //todo map icon size with actual mode        
       
   578     const CGlxThumbnailAttribute* value = item.ThumbnailAttribute(
       
   579             thumbnailAttribute );
       
   580     TInt tnError = GlxErrorManager::HasAttributeErrorL(
       
   581                       item.Properties(), KGlxMediaIdThumbnail );
       
   582 	TSize iconSize(itemWidth, itemHeight);
       
   583 
       
   584     if (value)
       
   585         {
       
   586 		if(value->iBitmap != NULL)
       
   587 			{
       
   588 			GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d",aItemIndex);
       
   589 			return (convertFBSBitmapToHbIcon(value->iBitmap));
       
   590 			}
       
   591 		}
       
   592    /*else if (item.GetIconInfo(icon))   //todo will be required if we are planning to have static item else remove
       
   593                 {  
       
   594                 GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL GetIconInfo-Index is %d",aItemIndex);
       
   595                 }*/
       
   596 	else if( tnError == KErrCANoRights)	
       
   597 		{
       
   598 		//handle DRM case
       
   599 		}
       
   600 	else if( tnError )
       
   601 		{
       
   602 		return (new HbIcon(":/data/corrupt.svg"));
       
   603 		}
       
   604 	 GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d and have returned empty icon",aItemIndex);
       
   605 	 return NULL;
       
   606 	}
       
   607 // ---------------------------------------------------------------------------
       
   608 //  RetrieveListTitle
       
   609 // ---------------------------------------------------------------------------
       
   610 //
       
   611 QString GlxMLWrapperPrivate::RetrieveListTitle(int aItemIndex)
       
   612 {
       
   613 	const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   614 	const TDesC &title = item.Title();
       
   615     QString albumTitle =  QString::fromUtf16(title.Ptr(), title.Length());
       
   616 	return albumTitle;
       
   617  }
       
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 //  RetrieveListSubTitle
       
   621 // ---------------------------------------------------------------------------
       
   622 //
       
   623 QString GlxMLWrapperPrivate::RetrieveListSubTitle(int aItemIndex)
       
   624 {
       
   625 	const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   626 	const TDesC &subTitle = item.SubTitle();
       
   627     QString albumSubTitle =  QString::fromUtf16(subTitle.Ptr(), subTitle.Length());
       
   628 	return albumSubTitle;
       
   629 }
       
   630 
       
   631 // ---------------------------------------------------------------------------
       
   632 //  RetrieveItemUri
       
   633 // ---------------------------------------------------------------------------
       
   634 //
       
   635 QString GlxMLWrapperPrivate::RetrieveItemUri(int aItemIndex)
       
   636 {
       
   637 	const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   638 	const TDesC &uri = item.Uri();
       
   639     QString itemUri =  QString::fromUtf16(uri.Ptr(), uri.Length());
       
   640 	return itemUri;
       
   641  }
       
   642 
       
   643 // ---------------------------------------------------------------------------
       
   644 //  RetrieveItemFrameCount
       
   645 // ---------------------------------------------------------------------------
       
   646 //
       
   647 int GlxMLWrapperPrivate::RetrieveItemFrameCount(int aItemIndex)
       
   648     {
       
   649     const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   650     TInt frameCount(0);
       
   651     TBool frameCountStatus = item.GetFrameCount(frameCount);
       
   652     return frameCount;
       
   653     }
       
   654 
       
   655 // ---------------------------------------------------------------------------
       
   656 //  RetrieveItemDimension
       
   657 // ---------------------------------------------------------------------------
       
   658 //
       
   659 QSize GlxMLWrapperPrivate::RetrieveItemDimension(int aItemIndex)
       
   660 {
       
   661 	const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   662 	TSize size(0,0);
       
   663 	TBool result = item.GetDimensions(size);
       
   664     QSize itemSize(size.iWidth,size.iHeight);
       
   665 	return itemSize;
       
   666  }
       
   667 
       
   668 // ---------------------------------------------------------------------------
       
   669 //  RetrieveItemDate
       
   670 // ---------------------------------------------------------------------------
       
   671 //
       
   672 QDate GlxMLWrapperPrivate::RetrieveItemDate(int index)
       
   673     {
       
   674    	GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveItemDate %d",index);
       
   675     const TGlxMedia& item = iMediaList->Item( index );
       
   676     TTime dateValue;
       
   677     QDate date = QDate();
       
   678     TBool returnValue =item.GetDate(dateValue);
       
   679     if(returnValue)
       
   680         {
       
   681         GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveItemDate %d",returnValue);
       
   682         TDateTime dateTime = dateValue.DateTime();
       
   683         date = QDate(dateTime.Year(),TInt(dateTime.Month()+1),(dateTime.Day()+1));
       
   684         }
       
   685      return date;
       
   686      
       
   687     }
       
   688 
       
   689 // ---------------------------------------------------------------------------
       
   690 // HandleItemAddedL
       
   691 // ---------------------------------------------------------------------------
       
   692 //
       
   693  void GlxMLWrapperPrivate::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* /*aList*/ )
       
   694      {
       
   695 	 iMLWrapper->itemsAdded(aStartIndex,aEndIndex);
       
   696      }
       
   697 // ---------------------------------------------------------------------------
       
   698 // GetItemCount
       
   699 // ---------------------------------------------------------------------------
       
   700 //
       
   701 void GlxMLWrapperPrivate::HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList )
       
   702     {
       
   703 	Q_UNUSED(aList);
       
   704 	iMLWrapper->itemsRemoved(aStartIndex,aEndIndex);
       
   705 	}
       
   706 // ---------------------------------------------------------------------------
       
   707 // HandleAttributesAvailableL
       
   708 // check for Grid PtFS and LsFs thumbnails. If any of them is available notify
       
   709 // iMLWrapper
       
   710 // ---------------------------------------------------------------------------
       
   711 //
       
   712 void GlxMLWrapperPrivate::HandleAttributesAvailableL( TInt aItemIndex, 
       
   713 		const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
       
   714 	{
       
   715 	GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL %d",aItemIndex);
       
   716 	Q_UNUSED(aList);
       
   717     // char temp[100];
       
   718 	// sprintf(temp, "execution time of update %d", aItemIndex);
       
   719 	// PERFORMANCE_ADV( d1, temp) {
       
   720 	if ( iGridContextActivated || iLsFsContextActivated || iPtFsContextActivated )
       
   721 	    CheckGridTBAttribute(aItemIndex, aAttributes);
       
   722 	if ( iPtFsContextActivated )
       
   723 	    CheckPtFsTBAttribute(aItemIndex, aAttributes);
       
   724 	if ( iLsFsContextActivated )
       
   725 	    CheckLsFsTBAttribute(aItemIndex, aAttributes);
       
   726 	if (iPtListContextActivated || iSelectionListContextActivated)
       
   727 	    CheckListAttributes(aItemIndex, aAttributes);
       
   728 	// }
       
   729 	}
       
   730 // ---------------------------------------------------------------------------
       
   731 // CheckGridTBAttribute
       
   732 // ---------------------------------------------------------------------------
       
   733 //
       
   734 void GlxMLWrapperPrivate::CheckGridTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
       
   735 	{
       
   736 	TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, 
       
   737             GlxFullThumbnailAttributeId( ETrue, KGridTNWIdth, KGridTNHeight ) ); //todo map icon size with actual mode
       
   738 	TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute);
       
   739 	if(searchStatus == KTBAttributeAvailable)
       
   740 		{
       
   741 		GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckGridTBAttribute %d",aItemIndex);
       
   742 		iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextGrid);
       
   743 		}
       
   744 	else if(searchStatus == KTBAttributeCorrupt)
       
   745 		{
       
   746 		iMLWrapper->handleIconCorrupt(aItemIndex);
       
   747 		}
       
   748 	}
       
   749 
       
   750 // ---------------------------------------------------------------------------
       
   751 // CheckPtFsTBAttribute
       
   752 // ---------------------------------------------------------------------------
       
   753 //
       
   754 void GlxMLWrapperPrivate::CheckPtFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
       
   755 	{
       
   756 	TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, 
       
   757             GlxFullThumbnailAttributeId( ETrue, KFullScreenTNPTWidth, KFullScreenTNPTHeight ) ); //todo map icon size with actual mode
       
   758 	TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute);
       
   759 	if(searchStatus == KTBAttributeAvailable)
       
   760 		{
       
   761 		iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextPtFs);
       
   762 		}
       
   763 	else if(searchStatus == KTBAttributeCorrupt)
       
   764 		{
       
   765 		iMLWrapper->handleIconCorrupt(aItemIndex);
       
   766 		}
       
   767 	}
       
   768 
       
   769 // ---------------------------------------------------------------------------
       
   770 // CheckLsFsTBAttribute
       
   771 // ---------------------------------------------------------------------------
       
   772 //
       
   773 void GlxMLWrapperPrivate::CheckLsFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
       
   774 	{
       
   775 	TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, 
       
   776             GlxFullThumbnailAttributeId( ETrue, KFullScreenTNLSWidth, KFullScreenTNLSHeight ) ); //todo map icon size with actual mode
       
   777 	TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute);
       
   778 	if(searchStatus == KTBAttributeAvailable)
       
   779 		{
       
   780 		iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextLsFs);
       
   781 		}
       
   782 	else if(searchStatus == KTBAttributeCorrupt)
       
   783 		{
       
   784 		iMLWrapper->handleIconCorrupt(aItemIndex);
       
   785 		}
       
   786 	}
       
   787 // ---------------------------------------------------------------------------
       
   788 // CheckLsFsTBAttribute
       
   789 // ---------------------------------------------------------------------------
       
   790 //
       
   791 void GlxMLWrapperPrivate::CheckListAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
       
   792 	{
       
   793 	GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes %d",aItemIndex);
       
   794 	TBool attribPresent = EFalse;
       
   795 	TMPXAttribute titleAttrib(KMPXMediaGeneralTitle);
       
   796 	TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle);
       
   797     TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match );
       
   798 	    
       
   799    	const TGlxMedia& item = iMediaList->Item(aItemIndex);
       
   800 
       
   801     if (KErrNotFound != aAttributes.Find(titleAttrib, match))
       
   802     	{
       
   803 		attribPresent = ETrue;
       
   804 		GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes title present %d",aItemIndex);
       
   805     	}
       
   806 
       
   807     if (KErrNotFound != aAttributes.Find(subTitleAttrib, match))
       
   808     	{
       
   809 		attribPresent = ETrue;
       
   810 		GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes subtitle present %d",aItemIndex);
       
   811     	}
       
   812    	TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, 
       
   813             GlxFullThumbnailAttributeId( ETrue, KGridTNWIdth, KGridTNHeight ) ); //todo map icon size with actual mode
       
   814 	TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute);
       
   815     if(searchStatus == KTBAttributeAvailable)
       
   816     	{
       
   817 		attribPresent = ETrue;
       
   818 		GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes Thumbnail present %d",aItemIndex);
       
   819     	}
       
   820 	if(attribPresent)
       
   821 		{
       
   822 		iMLWrapper->handleListItemAvailable(aItemIndex);
       
   823 		}
       
   824 	}
       
   825 // ---------------------------------------------------------------------------
       
   826 // CheckTBAttributesPresenceandSanity
       
   827 // check if the requested attributes are present and their sanity
       
   828 // ---------------------------------------------------------------------------
       
   829 //
       
   830 TInt GlxMLWrapperPrivate::CheckTBAttributesPresenceandSanity( TInt aItemIndex, 
       
   831 		const RArray<TMPXAttribute>& aAttributes, TMPXAttribute aThumbnailAttribute )
       
   832 		{
       
   833 		GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckTBAttributesPresenceandSanity %d",aItemIndex);
       
   834 		TInt searchStatus = KTBAttributeUnavailable;	
       
   835 		const TGlxMedia& item = iMediaList->Item( aItemIndex );
       
   836 		TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match );
       
   837 		if (KErrNotFound != aAttributes.Find( aThumbnailAttribute, match ))
       
   838 			{
       
   839 			const CGlxThumbnailAttribute* value = item.ThumbnailAttribute(
       
   840 				aThumbnailAttribute );
       
   841 			TInt tnError = GlxErrorManager::HasAttributeErrorL(
       
   842 						item.Properties(), KGlxMediaIdThumbnail );
       
   843 			if(value)
       
   844 				{
       
   845 				searchStatus = KTBAttributeAvailable;
       
   846 				}
       
   847 			else if ( KErrNone != tnError && KErrNotSupported != tnError )
       
   848 				{
       
   849 				 searchStatus = KTBAttributeCorrupt;
       
   850 				}
       
   851 			}
       
   852 		else
       
   853 			{
       
   854 			searchStatus = KTBAttributeUnavailable;
       
   855 			}
       
   856 		return searchStatus;	
       
   857 
       
   858 	 }    
       
   859 // ---------------------------------------------------------------------------
       
   860 // GetItemCount
       
   861 // ---------------------------------------------------------------------------
       
   862 //
       
   863 void GlxMLWrapperPrivate::HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, 
       
   864     TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList )
       
   865 {
       
   866 Q_UNUSED(aType);
       
   867 Q_UNUSED(aNewIndex);
       
   868 Q_UNUSED(aOldIndex);
       
   869 Q_UNUSED(aList);
       
   870 }
       
   871 // ---------------------------------------------------------------------------
       
   872 // GetItemCount
       
   873 // ---------------------------------------------------------------------------
       
   874 //
       
   875 void GlxMLWrapperPrivate::HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList )
       
   876 {
       
   877 	Q_UNUSED(aIndex);
       
   878 	Q_UNUSED(aSelected);
       
   879 	Q_UNUSED(aList);
       
   880 }
       
   881 // ---------------------------------------------------------------------------
       
   882 // GetItemCount
       
   883 // ---------------------------------------------------------------------------
       
   884 //
       
   885 void GlxMLWrapperPrivate::HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList )
       
   886 {
       
   887 Q_UNUSED(aMessage);
       
   888 Q_UNUSED(aList);
       
   889 }
       
   890 // ---------------------------------------------------------------------------
       
   891 // GetItemCount
       
   892 // ---------------------------------------------------------------------------
       
   893 //
       
   894 void GlxMLWrapperPrivate::HandleError( TInt aError )
       
   895 	{
       
   896     GLX_LOG_INFO1("GlxMLWrapperPrivate::HandleError Error %d", aError);	
       
   897 	
       
   898     for ( TInt i = 0; i < iMediaList->Count(); i++ )
       
   899         {
       
   900         const TGlxMedia& item = iMediaList->Item( i );
       
   901         TInt thumbnailError = GlxErrorManager::HasAttributeErrorL(
       
   902                 item.Properties(), KGlxMediaIdThumbnail );
       
   903         GLX_LOG_INFO1("GlxMLWrapperPrivate::HandleError thumbnailError %d", thumbnailError);
       
   904 		if (thumbnailError)
       
   905 		    {
       
   906             GLX_LOG_INFO1("GlxMLWrapperPrivate::HandleError Index %d", i);
       
   907 			iMLWrapper->handleIconCorrupt(i);
       
   908             }
       
   909         }
       
   910 	
       
   911 	
       
   912 	}
       
   913 // ---------------------------------------------------------------------------
       
   914 // GetItemCount
       
   915 // ---------------------------------------------------------------------------
       
   916 //
       
   917 /*void GlxMLWrapperPrivate::HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, 
       
   918     MGlxMediaList* aList )
       
   919 	{}*/ //todo add handle command complete
       
   920 // ---------------------------------------------------------------------------
       
   921 // GetItemCount
       
   922 // ---------------------------------------------------------------------------
       
   923 //
       
   924 void GlxMLWrapperPrivate::HandleMediaL( TInt aListIndex, MGlxMediaList* aList )
       
   925 {
       
   926 	Q_UNUSED(aListIndex);
       
   927 	Q_UNUSED(aList);
       
   928 }
       
   929 // ---------------------------------------------------------------------------
       
   930 // GetItemCount
       
   931 // ---------------------------------------------------------------------------
       
   932 //
       
   933 void GlxMLWrapperPrivate::HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList )
       
   934 {
       
   935 	Q_UNUSED(aItemIndexes);
       
   936 	Q_UNUSED(aList);
       
   937 }
       
   938 
       
   939 // ---------------------------------------------------------------------------
       
   940 // GetItemCount
       
   941 // ---------------------------------------------------------------------------
       
   942 //
       
   943  HbIcon * GlxMLWrapperPrivate::convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap)
       
   944 {
       
   945 	GLX_LOG_INFO1("### GlxMLWrapperPrivate::convertFBSBitmapToHbIcon %d", 0);
       
   946 	aBitmap->LockHeap();
       
   947 	TUint32 *tempData = aBitmap->DataAddress();
       
   948 	uchar *data = (uchar *)(tempData);	
       
   949 	int bytesPerLine = aBitmap->ScanLineLength(aBitmap->SizeInPixels().iWidth , aBitmap->DisplayMode());
       
   950 	//QImage share the memory occupied by data
       
   951 	QImage image(data, aBitmap->SizeInPixels().iWidth, aBitmap->SizeInPixels().iHeight, bytesPerLine, QImage::Format_RGB16);
       
   952 	aBitmap->UnlockHeap();
       
   953 	HbIcon* targetIcon = new HbIcon(QIcon(QPixmap::fromImage(image)));
       
   954 	return targetIcon;
       
   955 }
       
   956 
       
   957  // ---------------------------------------------------------------------------
       
   958  // GetFocusIndex
       
   959  // ---------------------------------------------------------------------------
       
   960  //
       
   961  int GlxMLWrapperPrivate::GetFocusIndex() const
       
   962      {
       
   963      return (iMediaList->FocusIndex());
       
   964      }
       
   965  // ---------------------------------------------------------------------------
       
   966  // GetFocusIndex
       
   967  // ---------------------------------------------------------------------------
       
   968  //
       
   969  void GlxMLWrapperPrivate::SetFocusIndex(int aItemIndex)
       
   970      {
       
   971      iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aItemIndex);
       
   972      }
       
   973 
       
   974  // ---------------------------------------------------------------------------
       
   975  // SetFocusIndex
       
   976  // ---------------------------------------------------------------------------
       
   977  //
       
   978  void GlxMLWrapperPrivate::SetSelectedIndex(int aItemIndex)
       
   979      {
       
   980      iMediaList->SetSelectedL(aItemIndex,ETrue);
       
   981      }
       
   982 
       
   983  // ---------------------------------------------------------------------------
       
   984  // GetVisibleWindowIndex
       
   985  // ---------------------------------------------------------------------------
       
   986  //
       
   987  int GlxMLWrapperPrivate::GetVisibleWindowIndex()
       
   988      {
       
   989      return (iMediaList->VisibleWindowIndex());
       
   990      }
       
   991  // ---------------------------------------------------------------------------
       
   992  // SetVisibleWindowIndex
       
   993  // ---------------------------------------------------------------------------
       
   994  //
       
   995  void GlxMLWrapperPrivate::SetVisibleWindowIndex(int aItemIndex)
       
   996      {
       
   997      iMediaList->SetVisibleWindowIndexL(aItemIndex);
       
   998      }