photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp
branchRCL_3
changeset 30 a60acebbbd9d
parent 25 191387a8b767
child 47 f9e827349359
equal deleted inserted replaced
25:191387a8b767 30:a60acebbbd9d
   100 // ----------------------------------------------------------------------------
   100 // ----------------------------------------------------------------------------
   101 // Navigates to the given path
   101 // Navigates to the given path
   102 // ----------------------------------------------------------------------------
   102 // ----------------------------------------------------------------------------
   103 //
   103 //
   104 EXPORT_C void CGlxCollectionPluginBase::OpenL(const CMPXCollectionPath& aPath,
   104 EXPORT_C void CGlxCollectionPluginBase::OpenL(const CMPXCollectionPath& aPath,
   105                    const TArray<TMPXAttribute>& /*aAttrs*/,
   105                    const TArray<TMPXAttribute>& aAttrs,
   106                    CMPXFilter* aFilter)
   106                    CMPXFilter* aFilter)
   107     {
   107     {
   108     TRACER("void CGlxCollectionPluginBase::OpenL()");
   108     TRACER("void CGlxCollectionPluginBase::OpenL()");
   109     iPath = CMPXCollectionPath::NewL(aPath);
   109     iPath = CMPXCollectionPath::NewL(aPath);
   110     if(aFilter)
   110     // When a collection is opened for browsing, 
   111         {
   111     // there are two queries executed with similar filter. 
   112         if(aFilter->IsSupported(KGlxFilterGeneralNavigationalStateOnly))
   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)
   113             {
   121             {
   114             RArray<TMPXItemId> mpxIds;
   122             openRequest = ETrue;
   115          	CleanupClosePushL(mpxIds);
       
   116             iPath->AppendL(mpxIds.Array());
       
   117             iObs->HandleOpen(iPath, KErrNone);
       
   118             CleanupStack::PopAndDestroy(&mpxIds);
       
   119             delete iPath;
       
   120             iPath = NULL;
       
   121             return;
       
   122             }
   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;
   123         }
   137         }
   124 
   138 
   125     TGlxMediaId targetId(aPath.Id());
   139     TGlxMediaId targetId(aPath.Id());
   126     if (aPath.Levels() == KGlxCollectionRootLevel)
   140     if (aPath.Levels() == KGlxCollectionRootLevel)
   127         {
   141         {