installationservices/swcomponentregistry/source/client/screntries.cpp
changeset 42 d17dc5398051
parent 24 84a16765cd86
equal deleted inserted replaced
37:6e7b00453237 42:d17dc5398051
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-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".
    28 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    28 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    29 #include "screntries.h"
    29 #include "screntries.h"
    30 #include "usiflog.h"
    30 #include "usiflog.h"
    31 #include <scs/streamingarray.h>
    31 #include <scs/streamingarray.h>
    32 #include <scs/cleanuputils.h>
    32 #include <scs/cleanuputils.h>
       
    33 #include <usif/scr/screntries_platform.h>
    33 
    34 
    34 using namespace Usif;
    35 using namespace Usif;
    35 
    36 
    36 		
    37 		
    37 ///////////////////////
    38 ///////////////////////
   839 EXPORT_C const TDesC& CLocalizableComponentInfo::VendorL() const
   840 EXPORT_C const TDesC& CLocalizableComponentInfo::VendorL() const
   840 	{
   841 	{
   841 	return *iVendor;
   842 	return *iVendor;
   842 	}
   843 	}
   843 			
   844 			
       
   845 /////////////////////////////
       
   846 // TCustomAccessInfo
       
   847 /////////////////////////////
       
   848 
       
   849 EXPORT_C TCustomAccessInfo::TCustomAccessInfo(TSecureId aSecureId, TAccessMode aAccessMode)
       
   850     {
       
   851     iSecureId = aSecureId;
       
   852     iAccessMode = aAccessMode;
       
   853     }
       
   854 
       
   855 EXPORT_C TSecureId TCustomAccessInfo::SecureId() const
       
   856     {
       
   857     return iSecureId;
       
   858     }
       
   859 
       
   860 EXPORT_C TAccessMode TCustomAccessInfo::AccessMode() const
       
   861     {
       
   862     return iAccessMode;
       
   863     }
       
   864 
       
   865 /////////////////////////////
       
   866 // CSoftwareTypeRegInfo
       
   867 /////////////////////////////
       
   868 
       
   869 EXPORT_C CSoftwareTypeRegInfo* CSoftwareTypeRegInfo::NewL(const TDesC& aUniqueSoftwareTypeName)
       
   870 	{
       
   871 	CSoftwareTypeRegInfo* self = new (ELeave) CSoftwareTypeRegInfo();
       
   872 	CleanupStack::PushL(self);
       
   873 	self->iUniqueSoftwareTypeName = HBufC::NewL(aUniqueSoftwareTypeName.Length());
       
   874 	self->iUniqueSoftwareTypeName->Des().Copy(aUniqueSoftwareTypeName);
       
   875 	CleanupStack::Pop(self);
       
   876 	return self;
       
   877 	}
       
   878 
       
   879 EXPORT_C CSoftwareTypeRegInfo* CSoftwareTypeRegInfo::NewL(RReadStream& aStream)
       
   880 	{
       
   881 	CSoftwareTypeRegInfo* self = new (ELeave) CSoftwareTypeRegInfo();
       
   882 	CleanupStack::PushL(self);
       
   883 	self->InternalizeL(aStream);
       
   884 	CleanupStack::Pop(self);
       
   885 	return self;
       
   886 	}
       
   887 
       
   888 CSoftwareTypeRegInfo::CSoftwareTypeRegInfo()
       
   889 	{
       
   890 	}
       
   891 
       
   892 EXPORT_C CSoftwareTypeRegInfo::~CSoftwareTypeRegInfo()
       
   893 	{
       
   894 	delete iUniqueSoftwareTypeName;
       
   895 	iCustomAccessList.Close();
       
   896 	iMimeTypes.Close();
       
   897 	iLocalizedSoftwareTypeNames.Close();
       
   898 	delete iLauncherExecutable;
       
   899 	}
       
   900 
       
   901 EXPORT_C void CSoftwareTypeRegInfo::ExternalizeL(RWriteStream& aStream) const
       
   902 	{
       
   903 	aStream << *iUniqueSoftwareTypeName;
       
   904 	aStream << iSifPluginUid.iUid;
       
   905 	
       
   906 	//Sids
       
   907 	const TInt numSids = iCustomAccessList.Count();
       
   908 	aStream.WriteInt32L(numSids);
       
   909 	for (TInt i=0; i< numSids; ++i)
       
   910 	    {
       
   911 	    TUid sid = iCustomAccessList[i].SecureId();
       
   912 	    aStream << sid.iUid;
       
   913 	    aStream.WriteInt32L(iCustomAccessList[i].AccessMode());
       
   914 	    }
       
   915 	
       
   916 	// MIME types
       
   917 	const TInt numMimeTypes = iMimeTypes.Count();
       
   918 	aStream.WriteInt32L(numMimeTypes);
       
   919 	for (TInt i=0; i<numMimeTypes; ++i)
       
   920 		{
       
   921 		aStream << *iMimeTypes[i];
       
   922 		}
       
   923 	 
       
   924 	// Localized names
       
   925 	const TInt numLocalizedNames = iLocalizedSoftwareTypeNames.Count();
       
   926 	aStream.WriteInt32L(numLocalizedNames);
       
   927 	for (TInt i=0; i<numLocalizedNames; ++i)
       
   928 		{
       
   929 		aStream << *iLocalizedSoftwareTypeNames[i];
       
   930 		}
       
   931 
       
   932 	// Launcher executable
       
   933 	aStream << *iLauncherExecutable;
       
   934 	}
       
   935 
       
   936 void CSoftwareTypeRegInfo::InternalizeL(RReadStream& aStream)
       
   937 	{
       
   938 	ASSERT(iUniqueSoftwareTypeName == NULL);
       
   939 	
       
   940 	iUniqueSoftwareTypeName = HBufC::NewL(aStream, EUniqueSwTypeNameMaxLength);
       
   941 	
       
   942 	iSifPluginUid = TUid::Uid(aStream.ReadInt32L());
       
   943 	
       
   944 	// Sids
       
   945 	const TInt numSids = aStream.ReadInt32L();
       
   946 	for (TInt i=0; i<numSids; ++i)
       
   947 	    {
       
   948 	    TSecureId secId(TUid::Uid(aStream.ReadInt32L()));
       
   949 	    TCustomAccessInfo customAccessInfo(secId, static_cast<TAccessMode>(aStream.ReadInt32L()));
       
   950 	    iCustomAccessList.AppendL(customAccessInfo);
       
   951 	    }
       
   952 	        
       
   953 	// MIME types
       
   954 	const TInt numMimeTypes = aStream.ReadInt32L();
       
   955 	for (TInt i=0; i<numMimeTypes; ++i)
       
   956 		{
       
   957 		HBufC* mimeType = HBufC::NewLC(aStream, EUniqueSwTypeNameMaxLength);
       
   958 		iMimeTypes.AppendL(mimeType);
       
   959 		CleanupStack::Pop(mimeType);
       
   960 		}
       
   961 	
       
   962 	// Localized names
       
   963 	const TInt numLocalizedNames = aStream.ReadInt32L();
       
   964 	for (TInt i=0; i<numLocalizedNames; ++i)
       
   965 		{
       
   966 		CLocalizedSoftwareTypeName* name = CLocalizedSoftwareTypeName::NewL(aStream);
       
   967 		CleanupStack::PushL(name);
       
   968 		iLocalizedSoftwareTypeNames.AppendL(name);
       
   969 		CleanupStack::Pop(name);
       
   970 		}
       
   971 
       
   972 	iLauncherExecutable = HBufC::NewL(aStream, ELauncherExecutableMaxLength);
       
   973 	}
       
   974 
       
   975 EXPORT_C void CSoftwareTypeRegInfo::SetMimeTypeL(const TDesC& aMimeType)
       
   976 	{
       
   977 	HBufC* mimeType = HBufC::NewLC(aMimeType.Length());
       
   978 	mimeType->Des().Copy(aMimeType);
       
   979 	iMimeTypes.AppendL(mimeType);
       
   980 	CleanupStack::Pop(mimeType);
       
   981 	}
       
   982 
       
   983 EXPORT_C void CSoftwareTypeRegInfo::SetLocalizedSoftwareTypeNameL(TLanguage aLanguage, const TDesC& aName)
       
   984 	{
       
   985 	CLocalizedSoftwareTypeName* name = CLocalizedSoftwareTypeName::NewLC(aName, aLanguage);
       
   986 	iLocalizedSoftwareTypeNames.AppendL(name);
       
   987 	CleanupStack::Pop(name);
       
   988 	}
       
   989 
       
   990 EXPORT_C void CSoftwareTypeRegInfo::SetLauncherExecutableL(const TDesC& aLauncherExecutable)
       
   991     {
       
   992     HBufC* launcherExecutable = HBufC::NewLC(aLauncherExecutable.Length());
       
   993     launcherExecutable->Des().Copy(aLauncherExecutable);
       
   994     iLauncherExecutable = launcherExecutable;
       
   995     CleanupStack::Pop(launcherExecutable);
       
   996     }
   844 
   997 
   845 /////////////////////////////
   998 /////////////////////////////
   846 // CComponentFilter
   999 // CComponentFilter
   847 /////////////////////////////
  1000 /////////////////////////////
   848 
  1001 
   856 	delete iName;
  1009 	delete iName;
   857 	delete iVendor;
  1010 	delete iVendor;
   858 	delete iSwType;
  1011 	delete iSwType;
   859 	delete iFile;
  1012 	delete iFile;
   860 	iPropertyList.ResetAndDestroy();
  1013 	iPropertyList.ResetAndDestroy();
       
  1014 	iPropertyOperatorList.Reset();
   861 	}
  1015 	}
   862 
  1016 
   863 EXPORT_C CComponentFilter* CComponentFilter::NewL()
  1017 EXPORT_C CComponentFilter* CComponentFilter::NewL()
   864 	{
  1018 	{
   865 	CComponentFilter *self = CComponentFilter::NewLC();
  1019 	CComponentFilter *self = CComponentFilter::NewLC();
   952 	{
  1106 	{
   953 	iInstalledDrives.Copy(aDrives);
  1107 	iInstalledDrives.Copy(aDrives);
   954 	iSetFlag |= EInstalledDrive;
  1108 	iSetFlag |= EInstalledDrive;
   955 	}
  1109 	}
   956 					
  1110 					
   957 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, const TDesC& aValue, TLanguage aLocale)
  1111 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, const TDesC& aValue, TLanguage aLocale,
       
  1112         TDbOperator aNameOperator, TDbOperator aValueOperator)
   958 	{
  1113 	{
   959 	CPropertyEntry *prop = CLocalizablePropertyEntry::NewLC(aName, aValue, aLocale);
  1114 	CPropertyEntry *prop = CLocalizablePropertyEntry::NewLC(aName, aValue, aLocale);
   960 	iPropertyList.AppendL(prop);
  1115 	iPropertyList.AppendL(prop);
   961 	CleanupStack::Pop(prop);
  1116 	CleanupStack::Pop(prop);
       
  1117 	iPropertyOperatorList.AppendL(TPropertyOperator(aNameOperator, aValueOperator));
   962 	iSetFlag |= EProperty;
  1118 	iSetFlag |= EProperty;
   963 	}
  1119 	}
   964 
  1120 
   965 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, TInt64 aValue)
  1121 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, TInt64 aValue, TDbOperator aNameOperator, 
       
  1122         TDbOperator aValueOperator)
   966 	{
  1123 	{
   967 	CPropertyEntry *prop = CIntPropertyEntry::NewLC(aName, aValue);
  1124 	CPropertyEntry *prop = CIntPropertyEntry::NewLC(aName, aValue);
   968 	iPropertyList.AppendL(prop);
  1125 	iPropertyList.AppendL(prop);
   969 	CleanupStack::Pop(prop);
  1126 	CleanupStack::Pop(prop);
       
  1127 	iPropertyOperatorList.AppendL(TPropertyOperator(aNameOperator, aValueOperator));
   970 	iSetFlag |= EProperty;
  1128 	iSetFlag |= EProperty;
   971 	}
  1129 	}
   972 
  1130 
   973 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, const TDesC8& aValue)
  1131 EXPORT_C void CComponentFilter::AddPropertyL(const TDesC& aName, const TDesC8& aValue, TDbOperator aNameOperator, 
       
  1132         TDbOperator aValueOperator)
   974 	{
  1133 	{
   975 	CPropertyEntry *prop = CBinaryPropertyEntry::NewLC(aName, aValue);
  1134 	CPropertyEntry *prop = CBinaryPropertyEntry::NewLC(aName, aValue);
   976 	iPropertyList.AppendL(prop);
  1135 	iPropertyList.AppendL(prop);
   977 	CleanupStack::Pop(prop);
  1136 	CleanupStack::Pop(prop);
       
  1137 	iPropertyOperatorList.AppendL(TPropertyOperator(aNameOperator, aValueOperator));
   978 	iSetFlag |= EProperty;	
  1138 	iSetFlag |= EProperty;	
   979 	}
  1139 	}
   980 
  1140 
   981 EXPORT_C void CComponentFilter::SetFileL(const TDesC& aFile)
  1141 EXPORT_C void CComponentFilter::SetFileL(const TDesC& aFile)
   982 	{
  1142 	{
   993 	aStream << *iSwType;
  1153 	aStream << *iSwType;
   994 	aStream << TCardinality(iScomoState);
  1154 	aStream << TCardinality(iScomoState);
   995 	aStream << iInstalledDrives;
  1155 	aStream << iInstalledDrives;
   996 	aStream << TCardinality(iRemovable);
  1156 	aStream << TCardinality(iRemovable);
   997 	ExternalizePointersArrayL(iPropertyList, aStream);
  1157 	ExternalizePointersArrayL(iPropertyList, aStream);
       
  1158 	ExternalizeFixedLengthArrayL(iPropertyOperatorList, aStream);
   998 	aStream << *iFile;
  1159 	aStream << *iFile;
   999 	aStream << TCardinality(iDrmProtected);
  1160 	aStream << TCardinality(iDrmProtected);
  1000 	aStream << TCardinality(iHidden);
  1161 	aStream << TCardinality(iHidden);
  1001 	aStream << TCardinality(iKnownRevoked);
  1162 	aStream << TCardinality(iKnownRevoked);
  1002 	aStream << TCardinality(iOriginVerified);
  1163 	aStream << TCardinality(iOriginVerified);
  1017 	aStream >> iInstalledDrives;
  1178 	aStream >> iInstalledDrives;
  1018 	aStream >> c;
  1179 	aStream >> c;
  1019 	iRemovable = c;
  1180 	iRemovable = c;
  1020 	iPropertyList.Reset();
  1181 	iPropertyList.Reset();
  1021 	InternalizePointersArrayL(iPropertyList, aStream);
  1182 	InternalizePointersArrayL(iPropertyList, aStream);
       
  1183 	iPropertyOperatorList.Reset();
       
  1184 	InternalizeFixedLengthArrayL(iPropertyOperatorList, aStream);
  1022 	DeleteObjectZ(iFile);
  1185 	DeleteObjectZ(iFile);
  1023 	iFile = HBufC::NewL(aStream, KMaxTInt); // No restriction on length
  1186 	iFile = HBufC::NewL(aStream, KMaxTInt); // No restriction on length
  1024 	// Read if it is DRM protected
  1187 	// Read if it is DRM protected
  1025 	aStream >> c;
  1188 	aStream >> c;
  1026 	iDrmProtected = c;
  1189 	iDrmProtected = c;
  1215 
  1378 
  1216 EXPORT_C TComponentId CScrLogEntry::ComponentId() const
  1379 EXPORT_C TComponentId CScrLogEntry::ComponentId() const
  1217 	{
  1380 	{
  1218 	return iComponentId;
  1381 	return iComponentId;
  1219 	}
  1382 	}
       
  1383 
       
  1384 EXPORT_C CComponentFilter::TPropertyOperator::TPropertyOperator(TDbOperator aNameOperator, TDbOperator aValueOperator):
       
  1385         iNameOperator(aNameOperator),
       
  1386         iValueOperator(aValueOperator)
       
  1387     {
       
  1388     }
       
  1389 
       
  1390 void CComponentFilter::TPropertyOperator::ExternalizeL(RWriteStream& aStream) const
       
  1391     {
       
  1392     aStream.WriteInt32L(iNameOperator);
       
  1393     aStream.WriteInt32L(iValueOperator);
       
  1394     }
       
  1395 
       
  1396 EXPORT_C void CComponentFilter::TPropertyOperator::InternalizeL(RReadStream& aStream)
       
  1397     {
       
  1398     iNameOperator = static_cast<TDbOperator>(aStream.ReadInt32L());
       
  1399     iValueOperator = static_cast<TDbOperator>(aStream.ReadInt32L());
       
  1400     }
       
  1401 
       
  1402 EXPORT_C CComponentFilter::TDbOperator CComponentFilter::TPropertyOperator::NameOperator() const
       
  1403     {
       
  1404     return iNameOperator;
       
  1405     }
       
  1406 
       
  1407 EXPORT_C CComponentFilter::TDbOperator CComponentFilter::TPropertyOperator::ValueOperator() const
       
  1408     {
       
  1409     return iValueOperator;
       
  1410     }