Fixing bug 173267. Add method to get profile field values information from the registry. r=ccarlen, sr=sspitzer

This commit is contained in:
racham%netscape.com 2003-01-10 00:39:52 +00:00
Родитель 809bd65f34
Коммит f4a16c41df
2 изменённых файлов: 52 добавлений и 0 удалений

Просмотреть файл

@ -40,6 +40,7 @@
interface nsICmdLineService;
interface nsIFile;
interface nsILocalFile;
interface nsISupportsArray;
%{C++
#define NS_ERROR_PROFILE_REQUIRES_INTERACTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_PROFILE, 1)
@ -120,6 +121,11 @@ interface nsIProfileInternal : nsIProfile {
readonly attribute wstring firstProfile;
[noscript] void updateRegistry(in nsIFile regName);
[noscript] void getRegStrings(in wstring profileName,
out wstring regString,
out wstring regName,
out wstring regEmail,
out wstring regOption);
[noscript] void setRegStrings(in wstring profileName,
in wstring regString,
in wstring regName,

Просмотреть файл

@ -2416,6 +2416,9 @@ nsProfile::SetRegStrings(const PRUnichar* profileName,
rv = gProfileDataAccess->GetValue(profileName, &aProfile);
if (NS_FAILED(rv)) return rv;
if (aProfile == nsnull)
return NS_ERROR_FAILURE;
aProfile->NCHavePregInfo = regString;
@ -2449,3 +2452,46 @@ NS_IMETHODIMP nsProfile::VetoChange()
mProfileChangeVetoed = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsProfile::GetRegStrings(const PRUnichar *aProfileName,
PRUnichar **aRegString,
PRUnichar **aRegName,
PRUnichar **aRegEmail,
PRUnichar **aRegOption)
{
NS_ENSURE_ARG_POINTER(aProfileName);
NS_ENSURE_ARG_POINTER(aRegString);
NS_ENSURE_ARG_POINTER(aRegName);
NS_ENSURE_ARG_POINTER(aRegEmail);
NS_ENSURE_ARG_POINTER(aRegOption);
ProfileStruct* profileVal;
nsresult rv = gProfileDataAccess->GetValue(aProfileName, &profileVal);
if (NS_FAILED(rv))
return rv;
if (profileVal == nsnull)
return NS_ERROR_FAILURE;
*aRegString = ToNewUnicode(profileVal->NCHavePregInfo);
if (!*aRegString)
return NS_ERROR_OUT_OF_MEMORY;
*aRegName = ToNewUnicode(profileVal->NCProfileName);
if (!*aRegName)
return NS_ERROR_OUT_OF_MEMORY;
*aRegEmail = ToNewUnicode(profileVal->NCEmailAddress);
if (!*aRegEmail)
return NS_ERROR_OUT_OF_MEMORY;
*aRegOption = ToNewUnicode(profileVal->NCDeniedService);
if (!*aRegOption)
return NS_ERROR_OUT_OF_MEMORY;
delete profileVal;
return NS_OK;
}