secureswitools/swisistools/source/interpretsislib/installer.cpp
branchRCL_3
changeset 17 741e5bba2bd1
parent 12 7ca52d38f8c3
child 24 5cc91383ab1e
--- a/secureswitools/swisistools/source/interpretsislib/installer.cpp	Tue Apr 27 16:46:15 2010 +0300
+++ b/secureswitools/swisistools/source/interpretsislib/installer.cpp	Tue May 11 16:20:28 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -252,6 +252,56 @@
 	}
 }
 
+void Installer::ProcessConditionalBlockWarnings(const CSISInstallBlock& aInstallBlock, 
+											  ExpressionEvaluator& aEvaluator,
+											  const SisFile& aFile
+											  ) 
+	{
+	const CSISArray<CSISIf, CSISFieldRoot::ESISIf>& ifs = aInstallBlock.Ifs();
+	for (int i = 0; i < ifs.size(); ++i)
+		{
+		const CSISIf& ifBlock = ifs[i];
+
+		if (ifBlock.WasteOfSpace())
+			{
+			return;
+			}
+
+		// Main expression
+		if ( aEvaluator.Evaluate(ifBlock.Expression(),false).BoolValue() )
+			{
+			ProcessInstallBlockWarnings(ifBlock.InstallBlock(), aFile);
+			ProcessConditionalBlockWarnings(ifBlock.InstallBlock(), aEvaluator, aFile);
+			continue;
+			}
+		
+		int elseCount = ifBlock.ElseIfCount();
+		for (int i = 0; i < elseCount; ++i)
+			{
+			const CSISElseIf& elseIfBlock = ifBlock.ElseIf(i) ;
+			if ( aEvaluator.Evaluate(elseIfBlock.Expression(),false).BoolValue())
+				{
+				ProcessInstallBlockWarnings(elseIfBlock.InstallBlock(), aFile);
+				ProcessConditionalBlockWarnings(elseIfBlock.InstallBlock(), aEvaluator, aFile);
+				break;	// Stop processing else if blocks
+				}
+			}
+		} 
+	}
+
+void Installer::ProcessInstallBlockWarnings(const CSISInstallBlock& aInstallBlock, const SisFile& aFile)
+	{
+	aFile.ProcessEmbeddedFileWarning(aInstallBlock);
+	
+	std::string error;
+	bool result = aFile.ProcessInstallOptionsWarning(aInstallBlock,error);	
+	if(result == false)
+		{
+		std::string x;
+		throw InvalidSis(Ucs2ToUtf8(aFile.GetPackageName(),x),
+			error, SIS_NOT_SUPPORTED);
+		}
+	}
 
 TInt Installer::Install(const InstallSISFile& aInstallSISFile)
 {
@@ -270,6 +320,9 @@
 	// check file is acceptable
 	file.CheckValid();
 
+	const CSISController& ctrl = file.GetController();	
+	ProcessConditionalBlockWarnings(ctrl.InstallBlock(), *iExpressionEvaluator, file);
+	
 	if (!DependenciesOk(file))
 	{
 		return MISSING_DEPENDENCY;