photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp
branchRCL_3
changeset 30 a60acebbbd9d
parent 25 191387a8b767
child 47 f9e827349359
--- a/photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp	Tue Apr 27 16:37:53 2010 +0300
+++ b/photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp	Tue May 11 16:13:40 2010 +0300
@@ -102,26 +102,40 @@
 // ----------------------------------------------------------------------------
 //
 EXPORT_C void CGlxCollectionPluginBase::OpenL(const CMPXCollectionPath& aPath,
-                   const TArray<TMPXAttribute>& /*aAttrs*/,
+                   const TArray<TMPXAttribute>& aAttrs,
                    CMPXFilter* aFilter)
     {
     TRACER("void CGlxCollectionPluginBase::OpenL()");
     iPath = CMPXCollectionPath::NewL(aPath);
-    if(aFilter)
+    // When a collection is opened for browsing, 
+    // there are two queries executed with similar filter. 
+    // First query to open the collection from list / cloud view.
+    // Second one from grid view construction. To improve the grid opening
+    // performance, the first query will be completed with empty Id list.
+    TBool openRequest = EFalse;
+    for (TInt index = 0; index < aAttrs.Count(); index++)
         {
-        if(aFilter->IsSupported(KGlxFilterGeneralNavigationalStateOnly))
+        const TMPXAttribute attr = aAttrs[index];
+
+        if (attr == KGlxFilterGeneralNavigationalStateOnly)
             {
-            RArray<TMPXItemId> mpxIds;
-         	CleanupClosePushL(mpxIds);
-            iPath->AppendL(mpxIds.Array());
-            iObs->HandleOpen(iPath, KErrNone);
-            CleanupStack::PopAndDestroy(&mpxIds);
-            delete iPath;
-            iPath = NULL;
-            return;
+            openRequest = ETrue;
             }
         }
 
+    if ((aFilter && aFilter->IsSupported(
+            KGlxFilterGeneralNavigationalStateOnly)) || openRequest)
+        {
+        RArray<TMPXItemId> mpxIds;
+        CleanupClosePushL(mpxIds);
+        iPath->AppendL(mpxIds.Array());
+        iObs->HandleOpen(iPath, KErrNone);
+        CleanupStack::PopAndDestroy(&mpxIds);
+        delete iPath;
+        iPath = NULL;
+        return;
+        }
+
     TGlxMediaId targetId(aPath.Id());
     if (aPath.Levels() == KGlxCollectionRootLevel)
         {