ncdengine/provider/server/src/ncdsearchoperationimpl.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
--- a/ncdengine/provider/server/src/ncdsearchoperationimpl.cpp	Tue Aug 31 15:21:33 2010 +0300
+++ b/ncdengine/provider/server/src/ncdsearchoperationimpl.cpp	Wed Sep 01 12:22:02 2010 +0100
@@ -724,48 +724,53 @@
         delete metaIdentifier;
         metaIdentifier = NULL;
         }
-
-    // set iParentIdentifier as parent if not set otherwise, this would be the case of a
-    // normal top-level node from a content source
-    if ( ! parentIdentifier ) 
+    if( addMetaData )
         {
-        parentIdentifier = CNcdNodeIdentifier::NewLC( *iParentIdentifier );
-        }
-    
-    // Get the node reference from the data handler.
-    // The node has the given parent and its metadata
-    // will be internalized with the given data.
-    CNcdNode& node =
-    iNodeManager->DataHandlerL( *parentIdentifier, *aData, iClientUid );
-    
-    CleanupStack::PopAndDestroy( parentIdentifier );
+        // set iParentIdentifier as parent if not set otherwise, this would be the case of a
+        // normal top-level node from a content source
+        if ( ! parentIdentifier ) 
+            {
+            parentIdentifier = CNcdNodeIdentifier::NewLC( *iParentIdentifier );
+            }
+        
+        // Get the node reference from the data handler.
+        // The node has the given parent and its metadata
+        // will be internalized with the given data.
+        CNcdNode& node =
+            iNodeManager->DataHandlerL( *parentIdentifier, *aData, iClientUid );
+            
+        CleanupStack::PopAndDestroy( parentIdentifier );
 
-    // Notice that the loaded nodes should contain the actual node identifier
-    // instead of metadata identifier, because the identifiers are returned to
-    // the proxy side after operation completes.
-    CNcdNodeIdentifier* loadedNodeId = 
-        CNcdNodeIdentifier::NewLC( node.Identifier() );
-    iLoadedNodes.AppendL( loadedNodeId );
-    CleanupStack::Pop( loadedNodeId );        
+        // Notice that the loaded nodes should contain the actual node identifier
+        // instead of metadata identifier, because the identifiers are returned to
+        // the proxy side after operation completes.
+        CNcdNodeIdentifier* loadedNodeId = 
+            CNcdNodeIdentifier::NewLC( node.Identifier() );
+        iLoadedNodes.AppendL( loadedNodeId );
+        CleanupStack::Pop( loadedNodeId );        
 
-    // If the data contains icon id and datablock id, they are stored until
-    // the datablock arrives later.
-    const MNcdPreminetProtocolIcon* icon = aData->Icon();
-    if ( icon != NULL ) 
-        {
-        const TDesC& iconId = icon->Id();
-        const TDesC& dataBlockId = icon->DataBlock();
-        if ( iconId != KNullDesC && dataBlockId != KNullDesC ) 
+        // If the data contains icon id and datablock id, they are stored until
+        // the datablock arrives later.
+        const MNcdPreminetProtocolIcon* icon = aData->Icon();
+        if ( icon != NULL ) 
             {
-            // The node metadata was created by using the DataHandlerL
-            // and inserted for the node.
-            // So, the metadata can be asked from the node now.
-            MapIconIdForDataBlockL(iconId, dataBlockId, 
-                                   node.NodeMetaDataL().Identifier() );
-            node.NodeMetaDataL().IconL().SetIconDataReady( EFalse );
+            const TDesC& iconId = icon->Id();
+            const TDesC& dataBlockId = icon->DataBlock();
+            if ( iconId != KNullDesC && dataBlockId != KNullDesC ) 
+                {
+                // The node metadata was created by using the DataHandlerL
+                // and inserted for the node.
+                // So, the metadata can be asked from the node now.
+                MapIconIdForDataBlockL(iconId, dataBlockId, 
+                                       node.NodeMetaDataL().Identifier() );
+                node.NodeMetaDataL().IconL().SetIconDataReady( EFalse );
+                }
             }
         }
-    
+    else if ( parentIdentifier )
+        {
+        CleanupStack::PopAndDestroy( parentIdentifier );
+        }
     DLTRACEOUT((""));
     }