secureswitools/swisistools/source/interpretsislib/sisfile.cpp
branchRCL_3
changeset 17 741e5bba2bd1
parent 12 7ca52d38f8c3
child 24 5cc91383ab1e
equal deleted inserted replaced
15:98a43fae6e2b 17:741e5bba2bd1
     1 /*
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   167 	
   167 	
   168 	return (embeddedCtls.size() != 0);	
   168 	return (embeddedCtls.size() != 0);	
   169 }
   169 }
   170 
   170 
   171 void SisFile::CheckValid() const
   171 void SisFile::CheckValid() const
   172 	{
   172 {
   173 	std::string error;
   173 	std::string error;
   174 
   174 
   175 	CSISInfo::TSISInstallationType installType = iContents.Controller().SISInfo().InstallationType();
   175 	CSISInfo::TSISInstallationType installType = iContents.Controller().SISInfo().InstallationType();
   176 	// Allow SA, SP, PU and PA(stub) installations only
   176 	// Allow SA, SP, PU and PA(stub) installations only
   177 	bool success = 	(installType == CSISInfo::EInstInstallation) 	|| 
   177 	bool success = 	(installType == CSISInfo::EInstInstallation) 	|| 
   196 	if (!success)
   196 	if (!success)
   197 		error += "SIS File contains user options";
   197 		error += "SIS File contains user options";
   198 	failed = failed || !success;
   198 	failed = failed || !success;
   199 
   199 
   200 	const CSISInstallBlock& blk = iContents.Controller().InstallBlock();
   200 	const CSISInstallBlock& blk = iContents.Controller().InstallBlock();
   201 
   201 	success = ProcessInstallOptionsWarning( blk, error);
   202 	int fileCount = blk.FileCount();
   202 
       
   203 	failed = failed || !success;
       
   204 
       
   205 	if (failed)
       
   206 		{
       
   207 		std::string x;
       
   208 		throw InvalidSis(Ucs2ToUtf8(this->GetPackageName(),x),
       
   209 			error, SIS_NOT_SUPPORTED);
       
   210 		}
       
   211 	}
       
   212 
       
   213 bool SisFile::ProcessInstallOptionsWarning(const CSISInstallBlock& aInstallBlock, std::string& aError)
       
   214 	{
       
   215 	bool success = true;
       
   216 
       
   217 	int fileCount = aInstallBlock.FileCount();
   203 	for(int i = 0; i < fileCount; ++i)
   218 	for(int i = 0; i < fileCount; ++i)
   204 		{
   219 		{
   205 		const CSISFileDescription& fD = blk.FileDescription(i);
   220 		const CSISFileDescription& fD = aInstallBlock.FileDescription(i);
   206         const CSISFileDescription::TSISFileOperation operation = fD.Operation();
   221         const CSISFileDescription::TSISFileOperation operation = fD.Operation();
   207 		std::wstring target(fD.Target().GetString());
   222 		std::wstring target(fD.Target().GetString());
   208         //
   223         //
   209         switch( operation )
   224         switch( operation )
   210             {
   225             {
   255             break;
   270             break;
   256             }
   271             }
   257 		//
   272 		//
   258         if (!success)
   273         if (!success)
   259     		{
   274     		{
   260 			error += "SIS File contains install options : "+operation;
   275 			aError += "SIS File contains install options : "+operation;
   261 			break;
   276 			break;
   262 	    	}
   277 	    	}
   263 		}
   278 		}
   264 	failed = failed || !success;
   279 	}
   265 
   280 
   266 	if (failed)
       
   267 		{
       
   268 		std::string x;
       
   269 		throw InvalidSis(Ucs2ToUtf8(this->GetPackageName(),x),
       
   270 			error, SIS_NOT_SUPPORTED);
       
   271 		}
       
   272 	}
       
   273 
   281 
   274 std::wstring SisFile::GetVendorName() const
   282 std::wstring SisFile::GetVendorName() const
   275 	{
   283 	{
   276 	return iContents.Controller().SISInfo().UniqueVendorName();
   284 	return iContents.Controller().SISInfo().UniqueVendorName();
   277 	}
   285 	}
   456 			pkgs.push_back(uid);
   464 			pkgs.push_back(uid);
   457 		 }
   465 		 }
   458 	return pkgs;
   466 	return pkgs;
   459 }
   467 }
   460 
   468 
       
   469 void SisFile::ProcessEmbeddedFileWarning(const CSISInstallBlock& aInstallBlock) const
       
   470 	{
       
   471 	TControllerMap embeddedCtls;
       
   472 	aInstallBlock.GetEmbeddedControllers(embeddedCtls, false);
       
   473 	for (TControllerMapConstIter iter = embeddedCtls.begin(); iter != embeddedCtls.end(); ++iter)
       
   474 		{
       
   475 		const CSISController* ctrl = iter->second;
       
   476 		const CSISInfo& info = ctrl->SISInfo();			
       
   477 		LWARN(L" Embedded Package not installed: UID " << std::hex << info.UID1() );
       
   478 		}
       
   479 	}
       
   480 
   461 bool SisFile::IsSupportedLanguage(TUint32 aLanguage) const
   481 bool SisFile::IsSupportedLanguage(TUint32 aLanguage) const
   462 {
   482 {
   463 	bool result = false;
   483 	bool result = false;
   464 	int langCount = iContents.Controller().LanguageCount();
   484 	int langCount = iContents.Controller().LanguageCount();
   465 	for (int i = 0; i < langCount; ++i)
   485 	for (int i = 0; i < langCount; ++i)