photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp
branchRCL_3
changeset 60 5b3385a43d68
equal deleted inserted replaced
59:8e5f6eea9c9f 60:5b3385a43d68
       
     1 /*
       
     2 * Copyright (c) 2008-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:    This class browses file system
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "glxcollectionpluginbase.h"
       
    24 
       
    25 #include <f32file.h>
       
    26 #include <glxfilterfactory.h>
       
    27 #include <glxlog.h>
       
    28 #include <glxmediageneraldefs.h>
       
    29 #include <glxthumbnailattributeinfo.h>
       
    30 #include <mpxcollectionmessagedefs.h>
       
    31 #include <mpxcollectionpath.h>
       
    32 #include <mpxcollectionpluginobserver.h>
       
    33 #include <mpxmedia.h>
       
    34 #include <mpxmediadrmdefs.h>
       
    35 #include <mpxmediageneraldefs.h>
       
    36 #include <mpxmessagegeneraldefs.h>
       
    37 #include <glxtracer.h>
       
    38 
       
    39 #include "glxcommandrequest.h"
       
    40 #include "glxgetrequest.h"
       
    41 #include "glxidlistrequest.h"
       
    42 #include "glxrequest.h"
       
    43 #include "glxstringcache.h"
       
    44 #include "glxthumbnailrequest.h"
       
    45 #include "mglxdatasource.h"
       
    46 
       
    47 
       
    48 // CONSTANTS
       
    49 const TGlxThumbnailRequest::TPriorityMode KGlxDefaultThumbnailPriority = TGlxThumbnailRequest::EPrioritizeQuality;
       
    50 
       
    51 // ============================ LOCAL FUNCTIONS ==============================
       
    52     
       
    53 // ============================ MEMBER FUNCTIONS ==============================
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // Constructor
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C CGlxCollectionPluginBase::CGlxCollectionPluginBase()
       
    60     {
       
    61     TRACER("CGlxCollectionPluginBase::CGlxCollectionPluginBase()");
       
    62     }
       
    63 // ----------------------------------------------------------------------------
       
    64 // Destructor
       
    65 // ----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C CGlxCollectionPluginBase::~CGlxCollectionPluginBase()
       
    68     {
       
    69     TRACER("CGlxCollectionPluginBase::~CGlxCollectionPluginBase()");
       
    70     if (iDataSource)
       
    71 	    {
       
    72     	iDataSource->Close(*this);
       
    73 	    }
       
    74 	delete iPath;
       
    75 	delete iStringCache;
       
    76     } 
       
    77 
       
    78 
       
    79 // ----------------------------------------------------------------------------
       
    80 // Executes a command on the selected collection
       
    81 // ----------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C void CGlxCollectionPluginBase::CommandL(TMPXCollectionCommand /*aCmd*/, TInt /*aArg*/)
       
    84     {
       
    85     TRACER("void CGlxCollectionPluginBase::CommandL(TMPXCollectionCommand /*aCmd*/, TInt /*aArg*/)");
       
    86     User::Leave(KErrNotSupported);
       
    87     }
       
    88 
       
    89 // ----------------------------------------------------------------------------
       
    90 // Executes a command on the selected collection
       
    91 // ----------------------------------------------------------------------------
       
    92 //
       
    93 EXPORT_C void CGlxCollectionPluginBase::CommandL(CMPXCommand& aCmd)
       
    94     {
       
    95     TRACER("void CGlxCollectionPluginBase::CommandL(CMPXCommand& aCmd)");
       
    96     CGlxCommandRequest* request = CGlxCommandRequest::NewL(aCmd, Uid(), *this);
       
    97     iDataSource->DataSourceRequestL(request, *this);
       
    98     }
       
    99 
       
   100 // ----------------------------------------------------------------------------
       
   101 // Navigates to the given path
       
   102 // ----------------------------------------------------------------------------
       
   103 //
       
   104 EXPORT_C void CGlxCollectionPluginBase::OpenL(const CMPXCollectionPath& aPath,
       
   105                    const TArray<TMPXAttribute>& aAttrs,
       
   106                    CMPXFilter* aFilter)
       
   107     {
       
   108     TRACER("void CGlxCollectionPluginBase::OpenL()");
       
   109     iPath = CMPXCollectionPath::NewL(aPath);
       
   110     // When a collection is opened for browsing, 
       
   111     // there are two queries executed with similar filter. 
       
   112     // First query to open the collection from list / cloud view.
       
   113     // Second one from grid view construction. To improve the grid opening
       
   114     // performance, the first query will be completed with empty Id list.
       
   115     TBool openRequest = EFalse;
       
   116     for (TInt index = 0; index < aAttrs.Count(); index++)
       
   117         {
       
   118         const TMPXAttribute attr = aAttrs[index];
       
   119 
       
   120         if (attr == KGlxFilterGeneralNavigationalStateOnly)
       
   121             {
       
   122             openRequest = ETrue;
       
   123             }
       
   124         }
       
   125 
       
   126     if ((aFilter && aFilter->IsSupported(
       
   127             KGlxFilterGeneralNavigationalStateOnly)) || openRequest)
       
   128         {
       
   129         RArray<TMPXItemId> mpxIds;
       
   130         CleanupClosePushL(mpxIds);
       
   131         iPath->AppendL(mpxIds.Array());
       
   132         iObs->HandleOpen(iPath, KErrNone);
       
   133         CleanupStack::PopAndDestroy(&mpxIds);
       
   134         delete iPath;
       
   135         iPath = NULL;
       
   136         return;
       
   137         }
       
   138 
       
   139     TGlxMediaId targetId(aPath.Id());
       
   140     if (aPath.Levels() == KGlxCollectionRootLevel)
       
   141         {
       
   142         targetId = TGlxMediaId(KGlxCollectionRootId);
       
   143         }
       
   144     TInt level = aPath.Levels() + 1; // filter applies to new level we are retrieving
       
   145     CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL(DefaultFilter(level), aFilter, EFalse);
       
   146     CleanupStack::PushL(filter);
       
   147     CGlxIdListRequest* request = CGlxIdListRequest::NewL(targetId, Uid(), filter, *iPath);
       
   148     CleanupStack::PopAndDestroy(filter);
       
   149     iDataSource->DataSourceRequestL(request, *this);
       
   150     }
       
   151 
       
   152 // ----------------------------------------------------------------------------
       
   153 // Extended properties of the current file (async)
       
   154 // ----------------------------------------------------------------------------
       
   155 //
       
   156 EXPORT_C void CGlxCollectionPluginBase::MediaL(const CMPXCollectionPath& aPath, 
       
   157                         const TArray< TMPXAttribute >& aAttrs,
       
   158                         const TArray<TCapability>& aCaps,
       
   159                         CMPXAttributeSpecs* aSpecs)
       
   160     {
       
   161     TRACER("void CGlxCollectionPluginBase::MediaL()");
       
   162 	__ASSERT_DEBUG(aPath.Count(), Panic(EGlxPanicMediaRequestedWithEmptyPath));
       
   163 	
       
   164 	TInt bitmapId = 0;
       
   165     
       
   166     TInt count = aAttrs.Count();
       
   167     for( TInt i = 0; i < count; ++i )
       
   168         {
       
   169         if( KGlxMediaIdThumbnail == aAttrs[i].ContentId() )
       
   170             {
       
   171             bitmapId = aAttrs[i].AttributeId();
       
   172             }
       
   173         }
       
   174         
       
   175     CGlxRequest* request = NULL;
       
   176     if(aSpecs && bitmapId)
       
   177     	{
       
   178 	    TBool clientHasDRM = EFalse;
       
   179 	    for ( TInt i = 0; i < aCaps.Count(); ++i)
       
   180 	    	{
       
   181 	    	if(aCaps[i] == ECapabilityDRM)
       
   182 	    		{
       
   183 	    		clientHasDRM = ETrue;
       
   184 	    		break;
       
   185 	    		}
       
   186 	    	}
       
   187 	    TSize size(0,0);
       
   188 	    TGlxThumbnailRequest::TPriorityMode priority = KGlxDefaultThumbnailPriority;
       
   189 	    TGlxThumbnailFilter filter = EGlxThumbnailFilterNone;
       
   190 	    TInt bitmapHandle = 0;
       
   191 	    TRect cropRect;
       
   192 		const TMPXAttributeData sizeAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailSize };
       
   193 		const TMPXAttributeData priorityAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailQualityOverSpeed };
       
   194 		const TMPXAttributeData bitmapAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailBitmapHandle };
       
   195 		const TMPXAttributeData cropAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailCroppingRect };
       
   196 		const TMPXAttributeData filterAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailFiltering };
       
   197 
       
   198 	    if(aSpecs->IsSupported(sizeAttrib))
       
   199 	    	{
       
   200 	    	size = aSpecs->ValueTObjectL<TSize>(sizeAttrib);
       
   201 	    	}
       
   202 	    if(aSpecs->IsSupported(priorityAttrib))
       
   203 	    	{
       
   204 	    	priority = aSpecs->ValueTObjectL<TBool>(priorityAttrib) ? TGlxThumbnailRequest::EPrioritizeQuality : TGlxThumbnailRequest::EPrioritizeSpeed;
       
   205 	    	}
       
   206 	    if(aSpecs->IsSupported(bitmapAttrib))
       
   207 	    	{
       
   208 	    	bitmapHandle = aSpecs->ValueTObjectL<TInt>(bitmapAttrib);
       
   209 	    	}
       
   210 	    if(aSpecs->IsSupported(cropAttrib))
       
   211 	    	{
       
   212 	    	cropRect = aSpecs->ValueTObjectL<TRect>(cropAttrib);
       
   213 	    	}
       
   214 	    if(aSpecs->IsSupported(filterAttrib))
       
   215 	    	{
       
   216 	    	filter = aSpecs->ValueTObjectL<TGlxThumbnailFilter>(filterAttrib);
       
   217 	    	}
       
   218 	    
       
   219 	    	
       
   220 	    TGlxThumbnailRequest tnRequest(TGlxMediaId(aPath.Id()), size, priority, bitmapHandle, clientHasDRM, cropRect, filter);
       
   221         CMPXFilter* defFilter = TGlxFilterFactory::CreateCombinedFilterL(DefaultFilter(aPath.Levels()), NULL, EFalse);
       
   222         CleanupStack::PushL(defFilter);
       
   223 	    request = CGlxThumbnailRequest::NewL(tnRequest, Uid(), bitmapId, defFilter);
       
   224         CleanupStack::PopAndDestroy(defFilter);
       
   225         
       
   226         CleanupStack::PushL(request);
       
   227         
       
   228  	    CGlxtnFileInfo* tnFileInfo = new (ELeave) CGlxtnFileInfo;
       
   229 	    CleanupStack::PushL(tnFileInfo);
       
   230 	    
       
   231         TInt countInfo(0);
       
   232 	    
       
   233 	    if(aSpecs->IsSupported(KMPXMediaGeneralSize))
       
   234 	    	{
       
   235 	    	tnFileInfo->iFileSize = aSpecs->ValueTObjectL<TUint>(KMPXMediaGeneralSize);
       
   236 	    	countInfo++;
       
   237 	    	}
       
   238 	    if(aSpecs->IsSupported(KGlxMediaGeneralLastModifiedDate))
       
   239 	    	{
       
   240 	    	tnFileInfo->iFileTime = aSpecs->ValueTObjectL<TInt64>(KGlxMediaGeneralLastModifiedDate);
       
   241 	    	countInfo++;
       
   242 	    	}
       
   243 	    if(aSpecs->IsSupported(KMPXMediaDrmProtected))
       
   244 	    	{
       
   245 	    	tnFileInfo->iIsProtected = aSpecs->ValueTObjectL<TBool>(KMPXMediaDrmProtected);
       
   246 	    	countInfo++;
       
   247 	    	}
       
   248 	    if(aSpecs->IsSupported(KMPXMediaGeneralUri))
       
   249 	    	{
       
   250 	    	tnFileInfo->SetFilePathL(aSpecs->ValueText(KMPXMediaGeneralUri));
       
   251 	    	countInfo++;
       
   252 	    	}
       
   253 	    if(aSpecs->IsSupported(KMPXMediaGeneralCategory))
       
   254 	    	{
       
   255 	    	TMPXGeneralCategory category = aSpecs->ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
       
   256 	    	if( EMPXVideo == category )
       
   257 	    	    {
       
   258     	    	tnFileInfo->iIsVideo = ETrue;
       
   259     	    	countInfo++;
       
   260 	    	    }
       
   261 	    	else if( EMPXImage == category )
       
   262 	    	    {
       
   263     	    	tnFileInfo->iIsVideo = EFalse;
       
   264     	    	countInfo++;
       
   265 	    	    }
       
   266 	    	}
       
   267 	    	
       
   268 	    const TInt KGlxRequiredCountInfo = 5;
       
   269         CGlxThumbnailRequest* requestTn = static_cast<CGlxThumbnailRequest*>(request);
       
   270         if( KGlxRequiredCountInfo == countInfo )
       
   271             {
       
   272             requestTn->SetThumbnailInfo(tnFileInfo);
       
   273             CleanupStack::Pop(tnFileInfo);
       
   274             }
       
   275         else
       
   276             {
       
   277             CleanupStack::PopAndDestroy(tnFileInfo);
       
   278             }
       
   279         
       
   280         CleanupStack::Pop(request);
       
   281     	}
       
   282 	else
       
   283 		{
       
   284 		request = GetRequestFactoryL(aPath, aAttrs);
       
   285 		}
       
   286     iDataSource->DataSourceRequestL(request, *this);
       
   287 		
       
   288     }
       
   289         
       
   290 // ----------------------------------------------------------------------------
       
   291 // Cancel outstanding request
       
   292 // ----------------------------------------------------------------------------
       
   293 //
       
   294 EXPORT_C void CGlxCollectionPluginBase::CancelRequest()
       
   295     {
       
   296     TRACER("void CGlxCollectionPluginBase::CancelRequest()");
       
   297     iDataSource->CancelRequest(*this);
       
   298     }
       
   299 
       
   300 // ----------------------------------------------------------------------------
       
   301 // Adds an item to the collection
       
   302 // ----------------------------------------------------------------------------
       
   303 //
       
   304 EXPORT_C void CGlxCollectionPluginBase::AddL(const CMPXMedia& /*aNewMedia*/)
       
   305     {
       
   306     TRACER("void CGlxCollectionPluginBase::AddL()");
       
   307     User::Leave(KErrNotSupported);
       
   308     }
       
   309 
       
   310 // ----------------------------------------------------------------------------
       
   311 // Remove an item or items under a group from the collection
       
   312 // ----------------------------------------------------------------------------
       
   313 //
       
   314 EXPORT_C void CGlxCollectionPluginBase::RemoveL(const CMPXCollectionPath& /*aPath*/)
       
   315     {
       
   316     TRACER("void CGlxCollectionPluginBase::RemoveL()");
       
   317     User::Leave(KErrNotSupported);
       
   318     }
       
   319 
       
   320 // ----------------------------------------------------------------------------
       
   321 // Remove an item or items under a group from the collection
       
   322 // ----------------------------------------------------------------------------
       
   323 //
       
   324 EXPORT_C void CGlxCollectionPluginBase::RemoveL(const CMPXMedia& /*aMedia*/)
       
   325     {
       
   326     TRACER("void CGlxCollectionPluginBase::RemoveL()");
       
   327     User::Leave(KErrNotSupported);
       
   328     }
       
   329 
       
   330 // ----------------------------------------------------------------------------
       
   331 // Sets/updates the media for the item
       
   332 // ----------------------------------------------------------------------------
       
   333 //
       
   334 EXPORT_C void CGlxCollectionPluginBase::SetL(const CMPXMedia& /*aMedia*/)
       
   335     {
       
   336     TRACER("void CGlxCollectionPluginBase::SetL(const CMPXMedia& /*aMedia*/)");
       
   337     User::Leave(KErrNotSupported);
       
   338     }
       
   339 
       
   340 // ----------------------------------------------------------------------------
       
   341 // FindAllL
       
   342 // ----------------------------------------------------------------------------
       
   343 //
       
   344 EXPORT_C void CGlxCollectionPluginBase::FindAllL(const CMPXMedia& /*aCriteria*/, const TArray<TMPXAttribute>& /*aAttrs*/)
       
   345     {
       
   346     TRACER("void CGlxCollectionPluginBase::FindAllL()");
       
   347     User::Leave(KErrNotSupported);
       
   348     }
       
   349 
       
   350 // ----------------------------------------------------------------------------
       
   351 // FindAllL
       
   352 // ----------------------------------------------------------------------------
       
   353 //
       
   354 EXPORT_C CMPXMedia* CGlxCollectionPluginBase::FindAllSyncL(const CMPXMedia& /*aCriteria*/,
       
   355                                     const TArray<TMPXAttribute>& /*aAttrs*/)
       
   356 	{
       
   357     TRACER("CMPXMedia* CGlxCollectionPluginBase::FindAllSyncL()");
       
   358     User::Leave(KErrNotSupported);
       
   359     return NULL;
       
   360 	}
       
   361 
       
   362     
       
   363 // ----------------------------------------------------------------------------
       
   364 // GetCapabilities
       
   365 // ----------------------------------------------------------------------------
       
   366 //
       
   367 EXPORT_C TCollectionCapability CGlxCollectionPluginBase::GetCapabilities()
       
   368 	{
       
   369     TRACER("TCollectionCapability CGlxCollectionPluginBase::GetCapabilities()");
       
   370 	return 0;
       
   371 	}
       
   372 
       
   373 EXPORT_C void CGlxCollectionPluginBase::HandleResponse(CMPXMedia* aResponse, CGlxRequest* aRequest, const TInt& aError)
       
   374 	{
       
   375     TRACER("void CGlxCollectionPluginBase::HandleResponse()");
       
   376     GLX_DEBUG2("CGlxCollectionPluginBase::HandleResponse()() aError=%d", aError);
       
   377     if (dynamic_cast<CGlxIdListRequest*>(aRequest))
       
   378 	// iRequest is a CGlxIdListRequest
       
   379 	    {
       
   380       iObs->HandleOpen(iPath, aError);
       
   381       delete iPath;
       
   382       iPath = NULL;
       
   383 	    }
       
   384 	else if (dynamic_cast<CGlxThumbnailRequest*>(aRequest))
       
   385 	// iRequest is a CGlxThumbnailRequest
       
   386         {
       
   387         //when IAD update / sisx installation of S60 TNM is done and
       
   388         //photos asks for the thumbnail, the thumbnail manager returns an 
       
   389         //error KErrServerTerminated(-15)/KErrDied(-13) for which the MPX recreates
       
   390         //the collection plugins and reconnects to the MPX server and goes into
       
   391         //a invalid state. After this, the error is not propogated to the Medialist
       
   392         //and no further requests are processed and it keeps returning KErrNotReady(-18)
       
   393         //So, as a HACK we are changing the error code to KErrCompletion(-17), 
       
   394         //for which the MPX collection does not take any action and propogates the error
       
   395         //to the medialist. This error(KErrCompletion) is treated as a temporary error
       
   396         //and the thumbnail request is made again from the medialist for which the
       
   397         //S60 TNM returns the thumbnail properly.
       
   398         iObs->HandleMedia(aResponse, ((aError == KErrServerTerminated
       
   399                 || aError == KErrDied) ? KErrCompletion : aError));
       
   400         }
       
   401 	else if (dynamic_cast<CGlxGetRequest*>(aRequest))
       
   402 	// iRequest is a CGlxGetRequest
       
   403         {
       
   404 		TInt error = aError;
       
   405         CGlxGetRequest* getRequest = static_cast<CGlxGetRequest*>(aRequest);
       
   406 		TBool b = getRequest->CpiAttributesSet();
       
   407         if(b  && ( KErrNone == error ))
       
   408         	{
       
   409         	TRAP(error, HandleCpiAttributeResponseL(aResponse, getRequest->CpiAttributes(), getRequest->MediaIds().Array()));
       
   410         	}
       
   411 		iObs->HandleMedia(aResponse, error); 
       
   412 	    }
       
   413 	else if (dynamic_cast<CGlxCommandRequest*>(aRequest))
       
   414 	// iRequest is a CGlxCommandRequest
       
   415         {
       
   416 		iObs->HandleCommandComplete(aResponse, aError); 
       
   417 	    }
       
   418 	else
       
   419 		{
       
   420 		// Other request types not handled
       
   421 		Panic(EGlxPanicLogicError); 
       
   422 		}
       
   423 	}
       
   424 
       
   425 CGlxRequest* CGlxCollectionPluginBase::GetRequestFactoryL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs)
       
   426 	{
       
   427     TRACER("CGlxRequest* CGlxCollectionPluginBase::GetRequestFactoryL()");
       
   428 	TBool doNotNeedDataSource = EFalse;
       
   429 	RArray<TGlxMediaId> mediaIdArray;
       
   430 	
       
   431 	CleanupClosePushL(mediaIdArray);
       
   432 	
       
   433 	if( aPath.Levels() == KGlxCollectionRootLevel)
       
   434 		{
       
   435 		__ASSERT_DEBUG(Uid().iUid == (TUint32)aPath.Id(), Panic(EGlxPanicIllegalArgument));
       
   436 		mediaIdArray.AppendL(TGlxMediaId(KGlxCollectionRootId));
       
   437 		doNotNeedDataSource = ETrue;
       
   438 		}
       
   439 	else
       
   440 		{
       
   441 		// Add the media Ids to the iMediaIdArray
       
   442 		TArray<TInt> selection = aPath.Selection();
       
   443 		TInt selectedCount = selection.Count();
       
   444 		if (selectedCount)
       
   445 		// Items are selected; We require the attributes for the selected items.
       
   446 			{
       
   447 			for (TInt i = 0; i < selectedCount; i++)
       
   448 				{
       
   449 				const TMPXItemId& itemId = aPath.IdOfIndex(selection[i]);
       
   450 				mediaIdArray.AppendL(TGlxMediaId(itemId));
       
   451 				}
       
   452 			}
       
   453 		else // No items are selected; We will use the current item
       
   454 			{
       
   455 			mediaIdArray.AppendL(TGlxMediaId(aPath.Id()));
       
   456 			}
       
   457 		
       
   458 		}
       
   459 	
       
   460 	// Add the attributes to the attributeArray
       
   461 	RArray<TMPXAttribute> attributeArray;
       
   462 	CleanupClosePushL(attributeArray);
       
   463 	RArray<TMPXAttribute> cpiAttributeArray;
       
   464 	CleanupClosePushL(cpiAttributeArray);
       
   465 	
       
   466 	for (TInt i = 0; i < aAttrs.Count(); i++)
       
   467 		{
       
   468         if( KGlxMediaIdCollectionPluginSpecific == aAttrs[i].ContentId())
       
   469         	{
       
   470 			cpiAttributeArray.AppendL(aAttrs[i]);
       
   471 			CpiAttributeAdditionalAttributesL(aAttrs[i], attributeArray);  
       
   472 			doNotNeedDataSource = EFalse;   	
       
   473         	}
       
   474         else 
       
   475         	{
       
   476         	if ( aAttrs[i] == KMPXMediaGeneralCount )
       
   477         	    {
       
   478         	    doNotNeedDataSource = EFalse;
       
   479         	    }
       
   480 			attributeArray.AppendL(aAttrs[i]);	       	
       
   481         	}
       
   482 		}
       
   483 	
       
   484     CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL(DefaultFilter(aPath.Levels()), NULL, EFalse);
       
   485     CleanupStack::PushL(filter);
       
   486 	CGlxRequest* request = CGlxGetRequest::NewL(mediaIdArray, attributeArray, cpiAttributeArray, Uid(), filter, doNotNeedDataSource); // Array contents ownership transferred
       
   487     CleanupStack::PopAndDestroy(filter);
       
   488 	CleanupStack::Pop(&cpiAttributeArray);
       
   489 	CleanupStack::Pop(&attributeArray);
       
   490 	CleanupStack::Pop(&mediaIdArray);
       
   491 	return request;
       
   492 	}	
       
   493 
       
   494 
       
   495  EXPORT_C void CGlxCollectionPluginBase::HandleMessage(CMPXMessage& aMessage)
       
   496 	{
       
   497     TRACER("void CGlxCollectionPluginBase::HandleMessage(CMPXMessage& aMessage)");
       
   498 	aMessage.SetTObjectValueL<TUid>(KMPXMessageCollectionId, Uid());
       
   499 	iObs->HandleMessage(&aMessage, KErrNone);
       
   500 	}
       
   501 
       
   502 EXPORT_C TBool CGlxCollectionPluginBase::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/)
       
   503 	{
       
   504     TRACER("TBool CGlxCollectionPluginBase::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/)");
       
   505 	// Default implementation ignores all update messages
       
   506 	return ETrue;
       
   507 	}
       
   508 
       
   509 EXPORT_C void CGlxCollectionPluginBase::CpiAttributeAdditionalAttributesL(const TMPXAttribute& /*aCpiAttribute*/, RArray<TMPXAttribute>& /*aAttributeArray*/)
       
   510 	{
       
   511     TRACER("void CGlxCollectionPluginBase::CpiAttributeAdditionalAttributesL()");
       
   512 	// Default implementation does not require additional attributes	
       
   513 	}
       
   514 
       
   515 EXPORT_C void CGlxCollectionPluginBase::HandleCpiAttributeResponseL(CMPXMedia* /*aResponse*/, TArray<TMPXAttribute> /*aCpiAttributes*/, TArray<TGlxMediaId> /* aMediaIds */)
       
   516 	{
       
   517     TRACER("void CGlxCollectionPluginBase::HandleCpiAttributeResponseL()");
       
   518 	// Base class does not support CPI specific attributes, deriving class must override.
       
   519 	User::Leave(KErrNotSupported);
       
   520 	}
       
   521 
       
   522 EXPORT_C HBufC* CGlxCollectionPluginBase::LoadLocalizedStringLC(const TDesC& aResourceFile, const TInt aResourceId)
       
   523     {
       
   524 	TRACER("void CGlxCollectionPluginBase::LoadLocalizedStringLC()");
       
   525 	
       
   526 	if (!iStringCache)
       
   527         {
       
   528         iStringCache = CGlxStringCache::NewL();
       
   529         }        
       
   530 	return (iStringCache->LoadLocalizedStringLC(aResourceFile,aResourceId));
       
   531     }
       
   532     
       
   533 
       
   534 EXPORT_C TGlxFilterProperties CGlxCollectionPluginBase::DefaultFilter(TInt /*aLevel*/)
       
   535     {
       
   536     TRACER("TGlxFilterProperties CGlxCollectionPluginBase::DefaultFilter(TInt /*aLevel*/)");
       
   537     TGlxFilterProperties filterProperties;
       
   538     filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate;
       
   539     filterProperties.iSortDirection = EGlxFilterSortDirectionDescending;
       
   540     
       
   541     return filterProperties;
       
   542     }
       
   543     
       
   544 
       
   545 
       
   546 // End of file