engine/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp
changeset 36 6481344a6d67
parent 26 c499df2dbb33
child 44 aa2fa096cbfb
--- a/engine/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp	Thu May 27 12:51:42 2010 +0300
+++ b/engine/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp	Fri Jun 11 13:38:23 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)
         {
@@ -218,7 +232,7 @@
 	    
 	    if(aSpecs->IsSupported(KMPXMediaGeneralSize))
 	    	{
-	    	tnFileInfo->iFileSize = aSpecs->ValueTObjectL<TInt>(KMPXMediaGeneralSize);
+	    	tnFileInfo->iFileSize = aSpecs->ValueTObjectL<TUint>(KMPXMediaGeneralSize);
 	    	countInfo++;
 	    	}
 	    if(aSpecs->IsSupported(KGlxMediaGeneralLastModifiedDate))