secureswitools/swisistools/source/sisxlibrary/sislogo.cpp
changeset 0 ba25891c3a9e
child 26 04d4a7bbc3e0
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file 
       
    21  @internalComponent
       
    22  @released
       
    23 */
       
    24 
       
    25 #include "sislogo.h"
       
    26 #include "exception.h"
       
    27 
       
    28 void CSISLogo::Set (const std::wstring& aMime, const std::wstring& aTarget, const TUint32 aFileIndex, const CSISDataUnit& aDataUnit)
       
    29 
       
    30 {
       
    31 	assert (! aMime.empty ());	// if empty mime type is valid, rewrite WasteOfSpace below.
       
    32 	iLogoFile.SetFileIndex(aFileIndex);
       
    33 	iLogoFile.SetMimeType (aMime);
       
    34 	if (aTarget.empty ())
       
    35 		{
       
    36 		iLogoFile.SetOperation (CSISFileDescription::EOpRun);
       
    37 		iLogoFile.SetOptions (CSISFileDescription::EInstFileRunOptionByMimeType);
       
    38 		}
       
    39 	else
       
    40 		{
       
    41 		iLogoFile.SetOperation (CSISFileDescription::EOpRun + CSISFileDescription::EOpInstall);
       
    42 		iLogoFile.SetOptions (	CSISFileDescription::EInstFileRunOptionByMimeType +
       
    43 								CSISFileDescription::EInstFileRunOptionInstall);
       
    44 		iLogoFile.SetTarget (aTarget);
       
    45 		}
       
    46 }
       
    47 
       
    48 
       
    49 
       
    50 std::string CSISLogo::Name () const
       
    51 	{
       
    52 	return "Logo";
       
    53 	}
       
    54 
       
    55 
       
    56 bool CSISLogo::WasteOfSpace () const
       
    57 	{
       
    58 	return ! (Required () || iLogoFile.HasMimeType ());
       
    59 	}
       
    60 
       
    61 void CSISLogo::AddPackageEntry(std::wostream& aStream, bool aVerbose) const
       
    62 	{
       
    63 	if(WasteOfSpace())
       
    64 		{
       
    65 		return;
       
    66 		}
       
    67 	if (aVerbose)
       
    68 		{
       
    69 		aStream << L"; Logo" << std::endl;
       
    70 		}
       
    71 	aStream << L"=";
       
    72 	const wchar_t* dataFileNameW = iLogoFile.GetFileName();
       
    73 	aStream <<L"\"" << dataFileNameW << L"\"";
       
    74 	delete[] const_cast<wchar_t*>(dataFileNameW); 
       
    75 	aStream << L", " ;
       
    76 	aStream << L"\"";
       
    77 	iLogoFile.MimeType().AddPackageEntry(aStream, aVerbose);
       
    78 	aStream << L"\"";
       
    79 	aStream << L", " ;
       
    80 	aStream << L"\"";
       
    81 	iLogoFile.Target().AddPackageEntry(aStream, aVerbose);
       
    82 	aStream << L"\"";
       
    83 	aStream << std::endl << std::endl;
       
    84 	}
       
    85