installationservices/swi/source/swis/server/planner.cpp
branchRCL_3
changeset 34 741e5bba2bd1
parent 19 7ca52d38f8c3
child 65 7333d7932ef7
equal deleted inserted replaced
28:98a43fae6e2b 34:741e5bba2bd1
   229 	
   229 	
   230 	// PlannedPackages is used to avoid duplicate node in the uninstallation
   230 	// PlannedPackages is used to avoid duplicate node in the uninstallation
   231 	// tree.
   231 	// tree.
   232 	RPointerArray<CSisRegistryPackage> plannedPackages;
   232 	RPointerArray<CSisRegistryPackage> plannedPackages;
   233 	CleanupResetAndDestroy<RPointerArray<CSisRegistryPackage> >::PushL(plannedPackages);
   233 	CleanupResetAndDestroy<RPointerArray<CSisRegistryPackage> >::PushL(plannedPackages);
       
   234 
       
   235 	// Add the root node in the planned packages, so that it is not added again (as a node in the tree)
       
   236 	// in case of a cyclic dependency.	
       
   237 	CSisRegistryPackage* rootPackage = CSisRegistryPackage::NewL(currentNode->PackageL());
       
   238 	plannedPackages.AppendL(rootPackage);
   234 	
   239 	
   235 	while(ETrue)
   240 	while(ETrue)
   236 		{
   241 		{
   237 		// plannedPackages is used to avoid creation of duplicate nodes in the tree
   242 		// plannedPackages is used to avoid creation of duplicate nodes in the tree
   238 		CreateChildNodesL(*currentNode, plannedPackages);
   243 		CreateChildNodesL(*currentNode, plannedPackages);
   348  */
   353  */
   349 void CPlanner::CreateNewNodesL(RPointerArray<CSisRegistryPackage>& aProcessPackages, CUninstallationNode& aParentNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages)
   354 void CPlanner::CreateNewNodesL(RPointerArray<CSisRegistryPackage>& aProcessPackages, CUninstallationNode& aParentNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages)
   350 	{
   355 	{
   351 	// We are removing items from array (aProcessPackages)and thus require index 
   356 	// We are removing items from array (aProcessPackages)and thus require index 
   352 	// adjustment. But if loop run in reverse order there is no need to adjust the index
   357 	// adjustment. But if loop run in reverse order there is no need to adjust the index
       
   358 	CleanupResetAndDestroyPushL(aPlannedPackages);
   353 	for (TInt i = aProcessPackages.Count() - 1; i >= 0; --i)
   359 	for (TInt i = aProcessPackages.Count() - 1; i >= 0; --i)
   354 		{
   360 		{
   355 		// Ignore already added package
   361 		// Ignore already added package
   356 		if (IsInPlannedPackages(aPlannedPackages, *aProcessPackages[i]))
   362 		if (IsInPlannedPackages(aPlannedPackages, *aProcessPackages[i]))
   357 			{
   363 			{
   390 		aPlannedPackages.AppendL(aProcessPackages[i]);
   396 		aPlannedPackages.AppendL(aProcessPackages[i]);
   391 		// Ownership is transfered from aProcessPackages to aPlannedPackages
   397 		// Ownership is transfered from aProcessPackages to aPlannedPackages
   392 		aProcessPackages.Remove(i);
   398 		aProcessPackages.Remove(i);
   393 		CleanupStack::PopAndDestroy(&registryEntry);
   399 		CleanupStack::PopAndDestroy(&registryEntry);
   394 		}
   400 		}
       
   401 	CleanupStack::Pop(&aPlannedPackages);
   395 	}
   402 	}
   396 
   403 
   397 /**
   404 /**
   398  * This functions determines whether it is now okay to confirm the removal of the package(Node in the uninstallation tree).  
   405  * This functions determines whether it is now okay to confirm the removal of the package(Node in the uninstallation tree).  
   399  * 
   406  * 
   512 		    {
   519 		    {
   513             DEBUG_PRINTF3(_L("CPlanner::CreatePlannedApplicationL failed to publish Uid %x with error."),aRootNode.PackageL().Uid(), err);
   520             DEBUG_PRINTF3(_L("CPlanner::CreatePlannedApplicationL failed to publish Uid %x with error."),aRootNode.PackageL().Uid(), err);
   514             User::Leave(err);
   521             User::Leave(err);
   515 		    }
   522 		    }
   516 		}
   523 		}
       
   524 
   517 	CleanupStack::Pop(rootApplication);
   525 	CleanupStack::Pop(rootApplication);
   518 	
   526 	
   519 	return rootApplication;
   527 	return rootApplication;
   520 	}
   528 	}
   521 
   529 
   526  * @param aNode The CApplication object to populate.
   534  * @param aNode The CApplication object to populate.
   527  * @param aRegistryEntry The relevant SIS Registry entry for the package.
   535  * @param aRegistryEntry The relevant SIS Registry entry for the package.
   528  */
   536  */
   529 void CPlanner::ConfirmForUninstallL(CUninstallationNode& aNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages)
   537 void CPlanner::ConfirmForUninstallL(CUninstallationNode& aNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages)
   530 	{
   538 	{
       
   539 	CleanupResetAndDestroyPushL(aPlannedPackages);
   531 	aNode.SetIsPlanned(ETrue);
   540 	aNode.SetIsPlanned(ETrue);
   532 
   541 
   533 	// aNode owns package therefore to transfer the ownership
   542 	// aNode owns package therefore to transfer the ownership
   534 	// a copy of CSisRegistryPackage is made.
   543 	// a copy of CSisRegistryPackage is made.
   535 	CSisRegistryPackage* package = CSisRegistryPackage::NewLC(aNode.PackageL());
   544 	CSisRegistryPackage* package = CSisRegistryPackage::NewLC(aNode.PackageL());
   536 	aPlannedPackages.AppendL(package);
   545 	aPlannedPackages.AppendL(package);
   537 	CleanupStack::Pop(package);
   546 	CleanupStack::Pop(2, &aPlannedPackages);
   538 	}
   547 	}
   539 
   548 
   540 /**
   549 /**
   541  * This function is called after the node/package is marked for uninstallation.
   550  * This function is called after the node/package is marked for uninstallation.
   542  * So it will fully populate the details of CApplication object.
   551  * So it will fully populate the details of CApplication object.