зеркало из https://github.com/mozilla/pjs.git
fix bug 13952 -- make it localizable, r=ftang
This commit is contained in:
Родитель
191e90b327
Коммит
3cd58d632d
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "nsIPref.h"
|
||||
#include "prefapi.h"
|
||||
#include "nsTextFormater.h"
|
||||
|
||||
extern "C" {
|
||||
#include "prmon.h"
|
||||
|
@ -172,7 +173,7 @@ Local_SACat(char **destination, const char *source)
|
|||
}
|
||||
|
||||
PRBool
|
||||
cookie_CheckConfirmYN(char * szMessage, char * szCheckMessage, PRBool* checkValue) {
|
||||
cookie_CheckConfirmYN(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue) {
|
||||
#ifdef REAL_DIALOG
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
nsresult res;
|
||||
|
@ -229,7 +230,7 @@ cookie_CheckConfirmYN(char * szMessage, char * szCheckMessage, PRBool* checkValu
|
|||
#endif
|
||||
}
|
||||
|
||||
PRIVATE char*
|
||||
PRIVATE PRUnichar*
|
||||
cookie_Localize(char* genericString) {
|
||||
nsresult ret;
|
||||
nsAutoString v("");
|
||||
|
@ -241,7 +242,7 @@ cookie_Localize(char* genericString) {
|
|||
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get net service\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsIURI *url = nsnull;
|
||||
|
||||
|
@ -250,7 +251,7 @@ cookie_Localize(char* genericString) {
|
|||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create URI\n");
|
||||
nsServiceManager::ReleaseService(kIOServiceCID, pNetService);
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
ret = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
|
||||
|
@ -258,7 +259,7 @@ cookie_Localize(char* genericString) {
|
|||
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create URL\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
/* create a bundle for the localization */
|
||||
|
@ -267,7 +268,7 @@ cookie_Localize(char* genericString) {
|
|||
kIStringBundleServiceIID, (nsISupports**) &pStringService);
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get string service\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsILocale* locale = nsnull;
|
||||
nsIStringBundle* bundle = nsnull;
|
||||
|
@ -277,14 +278,14 @@ cookie_Localize(char* genericString) {
|
|||
printf("cannot get url spec\n");
|
||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
nsCRT::free(spec);
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
ret = pStringService->CreateBundle(spec, locale, &bundle);
|
||||
nsCRT::free(spec);
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create instance\n");
|
||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
|
||||
|
@ -297,9 +298,9 @@ cookie_Localize(char* genericString) {
|
|||
NS_RELEASE(bundle);
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get string from name\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
PRIVATE nsresult cookie_ProfileDirectory(nsFileSpec& dirSpec) {
|
||||
|
@ -1357,9 +1358,9 @@ cookie_SetCookieString(char * curURL, char * setCookieHeader, time_t timeToExpir
|
|||
/* the user wants to know about cookies so let them know about every one that
|
||||
* is set and give them the choice to accept it or not
|
||||
*/
|
||||
char * new_string=0;
|
||||
PRUnichar * new_string=0;
|
||||
int count;
|
||||
char * remember_string = cookie_Localize("RememberThisDecision");
|
||||
PRUnichar * remember_string = cookie_Localize("RememberThisDecision");
|
||||
|
||||
/* find out how many cookies this host has already set */
|
||||
count = cookie_Count(host_from_header);
|
||||
|
@ -1367,21 +1368,21 @@ cookie_SetCookieString(char * curURL, char * setCookieHeader, time_t timeToExpir
|
|||
prev_cookie = cookie_CheckForPrevCookie
|
||||
(path_from_header, host_from_header, name_from_header);
|
||||
cookie_UnlockCookieList();
|
||||
char * message;
|
||||
PRUnichar * message;
|
||||
if (prev_cookie) {
|
||||
message = cookie_Localize("PermissionToModifyCookie");
|
||||
new_string = PR_smprintf(message, host_from_header ? host_from_header : "");
|
||||
new_string = nsTextFormater::smprintf(message, host_from_header ? host_from_header : "");
|
||||
} else if (count>1) {
|
||||
message = cookie_Localize("PermissionToSetAnotherCookie");
|
||||
new_string = PR_smprintf(message, host_from_header ? host_from_header : "", count);
|
||||
new_string = nsTextFormater::smprintf(message, host_from_header ? host_from_header : "", count);
|
||||
} else if (count==1){
|
||||
message = cookie_Localize("PermissionToSetSecondCookie");
|
||||
new_string = PR_smprintf(message, host_from_header ? host_from_header : "");
|
||||
new_string = nsTextFormater::smprintf(message, host_from_header ? host_from_header : "");
|
||||
} else {
|
||||
message = cookie_Localize("PermissionToSetACookie");
|
||||
new_string = PR_smprintf(message, host_from_header ? host_from_header : "");
|
||||
new_string = nsTextFormater::smprintf(message, host_from_header ? host_from_header : "");
|
||||
}
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
|
||||
/*
|
||||
* Who knows what thread we are on. Only the mozilla thread
|
||||
|
@ -1393,7 +1394,7 @@ cookie_SetCookieString(char * curURL, char * setCookieHeader, time_t timeToExpir
|
|||
PRBool userHasAccepted =
|
||||
cookie_CheckConfirmYN(new_string, remember_string, &cookie_rememberChecked);
|
||||
PR_FREEIF(new_string);
|
||||
PR_FREEIF(remember_string);
|
||||
Recycle(remember_string);
|
||||
if (cookie_rememberChecked) {
|
||||
cookie_PermissionStruct * cookie_permission2;
|
||||
cookie_permission2 = PR_NEW(cookie_PermissionStruct);
|
||||
|
@ -2228,7 +2229,7 @@ COOKIE_CookieViewerReturn(nsAutoString results) {
|
|||
|
||||
PUBLIC void
|
||||
COOKIE_GetCookieListForViewer(nsString& aCookieList) {
|
||||
char *buffer = (char*)PR_Malloc(BUFLEN2);
|
||||
PRUnichar *buffer = (PRUnichar*)PR_Malloc(BUFLEN2);
|
||||
int g = 0, cookieNum;
|
||||
cookie_CookieStruct * cookie;
|
||||
|
||||
|
@ -2248,14 +2249,14 @@ COOKIE_GetCookieListForViewer(nsString& aCookieList) {
|
|||
char *fixed_value = cookie_FixQuoted(cookie->cookie);
|
||||
char *fixed_domain_or_host = cookie_FixQuoted(cookie->host);
|
||||
char *fixed_path = cookie_FixQuoted(cookie->path);
|
||||
char * Domain = cookie_Localize("Domain");
|
||||
char * Host = cookie_Localize("Host");
|
||||
char * Yes = cookie_Localize("Yes");
|
||||
char * No = cookie_Localize("No");
|
||||
char * AtEnd = cookie_Localize("AtEndOfSession");
|
||||
PRUnichar * Domain = cookie_Localize("Domain");
|
||||
PRUnichar * Host = cookie_Localize("Host");
|
||||
PRUnichar * Yes = cookie_Localize("Yes");
|
||||
PRUnichar * No = cookie_Localize("No");
|
||||
PRUnichar * AtEnd = cookie_Localize("AtEndOfSession");
|
||||
|
||||
g += PR_snprintf(buffer+g, BUFLEN2-g,
|
||||
"%c%d%c%s%c%s%c%s%c%s%c%s%c%s%c%s",
|
||||
g += nsTextFormater::snprintf(buffer+g, BUFLEN2-g,
|
||||
nsString("%c%d%c%s%c%s%c%S%c%s%c%s%c%S%c%S").GetUnicode(),
|
||||
BREAK, cookieNum,
|
||||
BREAK, fixed_name,
|
||||
BREAK, fixed_value,
|
||||
|
@ -2263,18 +2264,18 @@ COOKIE_GetCookieListForViewer(nsString& aCookieList) {
|
|||
BREAK, fixed_domain_or_host,
|
||||
BREAK, fixed_path,
|
||||
BREAK, cookie->xxx ? Yes : No,
|
||||
BREAK, cookie->expires ? ctime(&(cookie->expires)) : AtEnd
|
||||
BREAK, cookie->expires ? (nsString(ctime(&(cookie->expires))).GetUnicode()) : AtEnd
|
||||
);
|
||||
cookieNum++;
|
||||
PR_FREEIF(fixed_name);
|
||||
PR_FREEIF(fixed_value);
|
||||
PR_FREEIF(fixed_domain_or_host);
|
||||
PR_FREEIF(fixed_path);
|
||||
PR_FREEIF(Domain);
|
||||
PR_FREEIF(Host);
|
||||
PR_FREEIF(Yes);
|
||||
PR_FREEIF(No);
|
||||
PR_FREEIF(AtEnd);
|
||||
Recycle(Domain);
|
||||
Recycle(Host);
|
||||
Recycle(Yes);
|
||||
Recycle(No);
|
||||
Recycle(AtEnd);
|
||||
}
|
||||
aCookieList = buffer;
|
||||
PR_FREEIF(buffer);
|
||||
|
|
|
@ -99,17 +99,17 @@ extern nsresult Wallet_ProfileDirectory(nsFileSpec& dirSpec);
|
|||
* Dialogs *
|
||||
***********/
|
||||
|
||||
extern PRBool Wallet_ConfirmYN(char * szMessage);
|
||||
extern PRBool Wallet_ConfirmYN(PRUnichar * szMessage);
|
||||
|
||||
PRIVATE PRBool
|
||||
si_ConfirmYN(char * szMessage) {
|
||||
si_ConfirmYN(PRUnichar * szMessage) {
|
||||
return Wallet_ConfirmYN(szMessage);
|
||||
}
|
||||
|
||||
extern PRInt32 Wallet_3ButtonConfirm(char * szMessage);
|
||||
extern PRInt32 Wallet_3ButtonConfirm(PRUnichar * szMessage);
|
||||
|
||||
PRIVATE PRInt32
|
||||
si_3ButtonConfirm(char * szMessage) {
|
||||
si_3ButtonConfirm(PRUnichar * szMessage) {
|
||||
return Wallet_3ButtonConfirm(szMessage);
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ si_Prompt(char *szMessage, char* szDefaultUsername) {
|
|||
}
|
||||
|
||||
PRIVATE PRBool
|
||||
si_SelectDialog(const char* szMessage, char** pList, PRInt32* pCount) {
|
||||
si_SelectDialog(const PRUnichar* szMessage, char** pList, PRInt32* pCount) {
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
|
@ -294,9 +294,11 @@ si_SelectDialog(const char* szMessage, char** pList, PRInt32* pCount) {
|
|||
extern void Wallet_RestartKey();
|
||||
extern char Wallet_GetKey();
|
||||
extern PRBool Wallet_KeySet();
|
||||
extern void Wallet_KeyResetTime();
|
||||
extern PRBool Wallet_KeyTimedOut();
|
||||
extern PRBool Wallet_SetKey(PRBool newkey);
|
||||
extern PRInt32 Wallet_KeySize();
|
||||
extern char * Wallet_Localize(char * genericString);
|
||||
extern PRUnichar * Wallet_Localize(char * genericString);
|
||||
extern PRBool Wallet_CancelKey();
|
||||
|
||||
char* signonFileName = nsnull;
|
||||
|
@ -321,6 +323,16 @@ si_SetKey() {
|
|||
return Wallet_SetKey(PR_FALSE);
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
si_KeyResetTime() {
|
||||
Wallet_KeyResetTime();
|
||||
}
|
||||
|
||||
PRIVATE PRBool
|
||||
si_KeyTimedOut() {
|
||||
return Wallet_KeyTimedOut();
|
||||
}
|
||||
|
||||
PRIVATE PRInt32
|
||||
si_KeySize() {
|
||||
return Wallet_KeySize();
|
||||
|
@ -1021,7 +1033,7 @@ si_GetUser(char* URLName, PRBool pickFirstUser, char* userText) {
|
|||
}
|
||||
|
||||
/* have user select a username from the list */
|
||||
char * selectUser = Wallet_Localize("SelectUser");
|
||||
PRUnichar * selectUser = Wallet_Localize("SelectUser");
|
||||
if (user_count == 0) {
|
||||
/* not first data node for any saved user, so simply pick first user */
|
||||
if (url->chosen_user) {
|
||||
|
@ -1045,7 +1057,7 @@ si_GetUser(char* URLName, PRBool pickFirstUser, char* userText) {
|
|||
} else {
|
||||
user = NULL;
|
||||
}
|
||||
PR_FREEIF(selectUser);
|
||||
Recycle(selectUser);
|
||||
url->chosen_user = user;
|
||||
PR_Free(list);
|
||||
PR_Free(users);
|
||||
|
@ -1139,7 +1151,7 @@ si_GetURLAndUserForChangeForm(char* password)
|
|||
}
|
||||
|
||||
/* query user */
|
||||
char * msg = Wallet_Localize("SelectUserWhosePasswordIsBeingChanged");
|
||||
PRUnichar * msg = Wallet_Localize("SelectUserWhosePasswordIsBeingChanged");
|
||||
if (user_count && si_SelectDialog(msg, list, &user_count)) {
|
||||
user = users[user_count];
|
||||
url = urls[user_count];
|
||||
|
@ -1155,7 +1167,7 @@ si_GetURLAndUserForChangeForm(char* password)
|
|||
} else {
|
||||
user = NULL;
|
||||
}
|
||||
PR_FREEIF(msg);
|
||||
Recycle(msg);
|
||||
|
||||
/* free allocated strings */
|
||||
while (--list2 > list) {
|
||||
|
@ -1680,12 +1692,18 @@ SI_LoadSignonData(PRBool fullLoad) {
|
|||
|
||||
if (fullLoad) {
|
||||
si_RestartKey();
|
||||
char * message = Wallet_Localize("IncorrectKey_TryAgain?");
|
||||
PRUnichar * message = Wallet_Localize("IncorrectKey_TryAgain?");
|
||||
if (si_KeyTimedOut()) {
|
||||
si_RemoveAllSignonData();
|
||||
}
|
||||
while (!si_SetKey()) {
|
||||
if ((Wallet_CancelKey() || Wallet_KeySize() < 0) || !si_ConfirmYN(message)) {
|
||||
Recycle(message);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Recycle(message);
|
||||
si_KeyResetTime();
|
||||
}
|
||||
|
||||
nsInputFileStream strmx(dirSpec + signonFileName);
|
||||
|
@ -1837,12 +1855,18 @@ si_SaveSignonDataLocked(PRBool fullSave) {
|
|||
|
||||
if (fullSave) {
|
||||
si_RestartKey();
|
||||
char * message = Wallet_Localize("IncorrectKey_TryAgain?");
|
||||
PRUnichar * message = Wallet_Localize("IncorrectKey_TryAgain?");
|
||||
if (si_KeyTimedOut()) {
|
||||
si_RemoveAllSignonData();
|
||||
}
|
||||
while (!si_SetKey()) {
|
||||
if (Wallet_CancelKey() || (Wallet_KeySize() < 0) || !si_ConfirmYN(message)) {
|
||||
Recycle(message);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Recycle(message);
|
||||
si_KeyResetTime();
|
||||
|
||||
/* do not save signons if user didn't know the key */
|
||||
if (!si_KeySet()) {
|
||||
|
@ -1978,21 +2002,18 @@ si_OkToSave(char *URLName, char *userName) {
|
|||
}
|
||||
|
||||
if (!si_RememberSignons && !si_GetNotificationPref()) {
|
||||
char* notification = 0;
|
||||
char * message = Wallet_Localize("PasswordNotification1");
|
||||
StrAllocCopy(notification, message);
|
||||
PR_FREEIF(message);
|
||||
message = Wallet_Localize("PasswordNotification2");
|
||||
StrAllocCat(notification, message);
|
||||
PR_FREEIF(message);
|
||||
PRUnichar * notification1 = Wallet_Localize("PasswordNotification1");
|
||||
PRUnichar * notification2 = Wallet_Localize("PasswordNotification2");
|
||||
nsString s = nsString(notification1) + nsString(notification2);
|
||||
PRUnichar * message = (PRUnichar*)(s.GetUnicode());
|
||||
Recycle(notification1);
|
||||
Recycle(notification2);
|
||||
si_SetNotificationPref(PR_TRUE);
|
||||
if (!si_ConfirmYN(notification)) {
|
||||
PR_Free (notification);
|
||||
if (!si_ConfirmYN(message)) {
|
||||
SI_SetBoolPref(pref_rememberSignons, PR_FALSE);
|
||||
return PR_FALSE;
|
||||
}
|
||||
SI_SetBoolPref(pref_rememberSignons, PR_TRUE); /* this is unnecessary */
|
||||
PR_Free (notification);
|
||||
SI_SetBoolPref(pref_rememberSignons, PR_TRUE);
|
||||
}
|
||||
|
||||
strippedURLName = si_StrippedURL(URLName);
|
||||
|
@ -2001,17 +2022,17 @@ si_OkToSave(char *URLName, char *userName) {
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
char * message = Wallet_Localize("WantToSavePassword?");
|
||||
PRUnichar * message = Wallet_Localize("WantToSavePassword?");
|
||||
PRInt32 button;
|
||||
if ((button = si_3ButtonConfirm(message)) != 1) {
|
||||
if (button == -1) {
|
||||
si_PutReject(strippedURLName, userName, PR_TRUE);
|
||||
}
|
||||
PR_Free(strippedURLName);
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
return PR_FALSE;
|
||||
}
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
PR_Free(strippedURLName);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -2363,8 +2384,6 @@ SINGSIGN_PromptUsernameAndPassword
|
|||
}
|
||||
|
||||
/* cleanup and return */
|
||||
PR_FREEIF(user);
|
||||
PR_FREEIF(pwd);
|
||||
PR_FREEIF(username);
|
||||
PR_FREEIF(password);
|
||||
PR_FREEIF(host);
|
||||
|
|
|
@ -623,7 +623,7 @@ wallet_GetWalletNotificationPref(void) {
|
|||
|
||||
#define PROPERTIES_URL "chrome://wallet/locale/wallet.properties"
|
||||
|
||||
PUBLIC char*
|
||||
PUBLIC PRUnichar *
|
||||
Wallet_Localize(char* genericString) {
|
||||
nsresult ret;
|
||||
nsAutoString v("");
|
||||
|
@ -641,7 +641,7 @@ Wallet_Localize(char* genericString) {
|
|||
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get net service\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsIURI *url = nsnull;
|
||||
|
||||
|
@ -656,7 +656,7 @@ Wallet_Localize(char* genericString) {
|
|||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create URI\n");
|
||||
nsServiceManager::ReleaseService(kIOServiceCID, pNetService);
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
ret = uri->QueryInterface(nsIURI::GetIID(), (void**)&url);
|
||||
|
@ -666,7 +666,7 @@ Wallet_Localize(char* genericString) {
|
|||
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create URL\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
/* create a bundle for the localization */
|
||||
|
@ -675,7 +675,7 @@ Wallet_Localize(char* genericString) {
|
|||
kIStringBundleServiceIID, (nsISupports**) &pStringService);
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get string service\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsILocale* locale = nsnull;
|
||||
nsIStringBundle* bundle = nsnull;
|
||||
|
@ -692,7 +692,7 @@ Wallet_Localize(char* genericString) {
|
|||
#ifdef NECKO
|
||||
nsCRT::free(spec);
|
||||
#endif /* NECKO */
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
ret = pStringService->CreateBundle(spec, locale, &bundle);
|
||||
#ifdef NECKO
|
||||
|
@ -704,7 +704,7 @@ Wallet_Localize(char* genericString) {
|
|||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create instance\n");
|
||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
|
||||
|
@ -721,9 +721,9 @@ Wallet_Localize(char* genericString) {
|
|||
NS_RELEASE(bundle);
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get string from name\n");
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
return v.ToNewCString();
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
/**********************/
|
||||
|
@ -731,7 +731,7 @@ Wallet_Localize(char* genericString) {
|
|||
/**********************/
|
||||
|
||||
PUBLIC PRBool
|
||||
Wallet_Confirm(char * szMessage)
|
||||
Wallet_Confirm(PRUnichar * szMessage)
|
||||
{
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
|
||||
|
@ -748,7 +748,7 @@ Wallet_Confirm(char * szMessage)
|
|||
}
|
||||
|
||||
PUBLIC PRBool
|
||||
Wallet_ConfirmYN(char * szMessage)
|
||||
Wallet_ConfirmYN(PRUnichar * szMessage)
|
||||
{
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
|
||||
|
@ -769,7 +769,7 @@ Wallet_ConfirmYN(char * szMessage)
|
|||
}
|
||||
|
||||
PUBLIC PRInt32
|
||||
Wallet_3ButtonConfirm(char * szMessage)
|
||||
Wallet_3ButtonConfirm(PRUnichar * szMessage)
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
|
@ -802,7 +802,7 @@ Wallet_3ButtonConfirm(char * szMessage)
|
|||
}
|
||||
|
||||
PUBLIC void
|
||||
Wallet_Alert(char * szMessage)
|
||||
Wallet_Alert(PRUnichar * szMessage)
|
||||
{
|
||||
#ifdef NECKO
|
||||
nsresult res;
|
||||
|
@ -831,7 +831,7 @@ Wallet_Alert(char * szMessage)
|
|||
}
|
||||
|
||||
PUBLIC PRBool
|
||||
Wallet_CheckConfirmYN(char * szMessage, char * szCheckMessage, PRBool* checkValue)
|
||||
Wallet_CheckConfirmYN(PRUnichar * szMessage, char * szCheckMessage, PRBool* checkValue)
|
||||
{
|
||||
#ifdef NECKO
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
|
@ -880,7 +880,7 @@ Wallet_CheckConfirmYN(char * szMessage, char * szCheckMessage, PRBool* checkValu
|
|||
#endif
|
||||
}
|
||||
|
||||
char * wallet_GetString(char * szMessage)
|
||||
char * wallet_GetString(PRUnichar * szMessage)
|
||||
{
|
||||
#ifdef NECKO
|
||||
nsString password;
|
||||
|
@ -930,7 +930,7 @@ char * wallet_GetString(char * szMessage)
|
|||
#endif
|
||||
}
|
||||
|
||||
char * wallet_GetDoubleString(char * szMessage, char * szMessage2, PRBool& matched)
|
||||
char * wallet_GetDoubleString(PRUnichar * szMessage, PRUnichar * szMessage2, PRBool& matched)
|
||||
{
|
||||
nsString password, password2;
|
||||
PRBool retval;
|
||||
|
@ -1209,8 +1209,8 @@ Wallet_KeySet() {
|
|||
return keySet;
|
||||
}
|
||||
|
||||
PRIVATE PRBool
|
||||
wallet_KeyTimedOut() {
|
||||
PUBLIC PRBool
|
||||
Wallet_KeyTimedOut() {
|
||||
time_t curTime = time(NULL);
|
||||
if (Wallet_KeySet() && (curTime > keyExpiresTime)) {
|
||||
keySet = PR_FALSE;
|
||||
|
@ -1219,8 +1219,8 @@ wallet_KeyTimedOut() {
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
wallet_KeyResetTime() {
|
||||
PUBLIC void
|
||||
Wallet_KeyResetTime() {
|
||||
if (Wallet_KeySet()) {
|
||||
keyExpiresTime = time(NULL) + keyDuration;
|
||||
}
|
||||
|
@ -1319,9 +1319,9 @@ Wallet_SetKey(PRBool isNewkey) {
|
|||
PRBool useDefaultKey = PR_FALSE;
|
||||
|
||||
if (Wallet_KeySize() < 0) { /* no key has yet been established */
|
||||
char * message = Wallet_Localize("firstPassword");
|
||||
char * message2 = Wallet_Localize("confirmPassword");
|
||||
char * mismatch = Wallet_Localize("confirmFailed_TryAgain?");
|
||||
PRUnichar * message = Wallet_Localize("firstPassword");
|
||||
PRUnichar * message2 = Wallet_Localize("confirmPassword");
|
||||
PRUnichar * mismatch = Wallet_Localize("confirmFailed_TryAgain?");
|
||||
PRBool matched;
|
||||
for (;;) {
|
||||
newkey = wallet_GetDoubleString(message, message2, matched);
|
||||
|
@ -1330,9 +1330,9 @@ Wallet_SetKey(PRBool isNewkey) {
|
|||
}
|
||||
/* password confirmation failed, ask user if he wants to try again */
|
||||
if ((newkey == NULL) || (!Wallet_Confirm(mismatch))) {
|
||||
PR_FREEIF(mismatch);
|
||||
PR_FREEIF(message);
|
||||
PR_FREEIF(message2);
|
||||
Recycle(mismatch);
|
||||
Recycle(message);
|
||||
Recycle(message2);
|
||||
keyCancel = PR_TRUE;
|
||||
return FALSE; /* user does not want to try again */
|
||||
}
|
||||
|
@ -1341,7 +1341,7 @@ Wallet_SetKey(PRBool isNewkey) {
|
|||
PR_FREEIF(message);
|
||||
PR_FREEIF(message2);
|
||||
} else { /* key has previously been established */
|
||||
char * message;
|
||||
PRUnichar * message;
|
||||
if (isNewkey) { /* user is changing his key */
|
||||
message = Wallet_Localize("newPassword");
|
||||
} else {
|
||||
|
@ -1353,12 +1353,12 @@ Wallet_SetKey(PRBool isNewkey) {
|
|||
} else { /* ask the user for his key */
|
||||
newkey = wallet_GetString(message);
|
||||
if (newkey == NULL) {
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
keyCancel = PR_TRUE;
|
||||
return PR_FALSE; /* user pressed cancel -- does not want to enter a new key */
|
||||
}
|
||||
}
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
}
|
||||
|
||||
if (PL_strlen(newkey) == 0) { /* user entered a zero-length key */
|
||||
|
@ -2101,26 +2101,26 @@ wallet_Initialize(PRBool fetchTables) {
|
|||
}
|
||||
|
||||
/* see if key has timed out */
|
||||
if (wallet_KeyTimedOut()) {
|
||||
if (Wallet_KeyTimedOut()) {
|
||||
wallet_keyInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
if (!wallet_keyInitialized) {
|
||||
Wallet_RestartKey();
|
||||
char * message = Wallet_Localize("IncorrectKey_TryAgain?");
|
||||
PRUnichar * message = Wallet_Localize("IncorrectKey_TryAgain?");
|
||||
while (!Wallet_SetKey(PR_FALSE)) {
|
||||
if (Wallet_CancelKey() || (Wallet_KeySize() < 0) || !Wallet_Confirm(message)) {
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
wallet_ReadFromFile(schemaValueFileName, wallet_SchemaToValue_list, PR_TRUE, PR_TRUE);
|
||||
wallet_keyInitialized = PR_TRUE;
|
||||
}
|
||||
|
||||
/* restart key timeout period */
|
||||
wallet_KeyResetTime();
|
||||
Wallet_KeyResetTime();
|
||||
|
||||
#if DEBUG
|
||||
// fprintf(stdout,"Field to Schema table \n");
|
||||
|
@ -2402,8 +2402,8 @@ wallet_OKToCapture(char* urlName) {
|
|||
}
|
||||
|
||||
/* ask user if we should capture the values on this form */
|
||||
char * message = Wallet_Localize("WantToCaptureForm?");
|
||||
char * checkMessage = Wallet_Localize("NeverSave");
|
||||
PRUnichar * message = Wallet_Localize("WantToCaptureForm?");
|
||||
PRUnichar * checkMessage = Wallet_Localize("NeverSave");
|
||||
PRBool checkValue;
|
||||
PRBool result = Wallet_CheckConfirmYN(message, checkMessage, &checkValue);
|
||||
if (!result) {
|
||||
|
@ -2416,8 +2416,8 @@ wallet_OKToCapture(char* urlName) {
|
|||
delete url;
|
||||
}
|
||||
}
|
||||
PR_FREEIF(checkMessage);
|
||||
PR_FREEIF(message);
|
||||
Recycle(checkMessage);
|
||||
Recycle(message);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
@ -2935,9 +2935,9 @@ WLLT_Prefill(nsIPresShell* shell, PRBool quick) {
|
|||
/* return if no elements were put into the list */
|
||||
if (LIST_COUNT(wallet_PrefillElement_list) == 0) {
|
||||
if (Wallet_KeySet()) {
|
||||
char * message = Wallet_Localize("noPrefills");
|
||||
PRUnichar * message = Wallet_Localize("noPrefills");
|
||||
Wallet_Alert(message);
|
||||
PR_FREEIF(message);
|
||||
Recycle(message);
|
||||
}
|
||||
return NS_ERROR_FAILURE; // indicates to caller not to display preview screen
|
||||
}
|
||||
|
@ -3209,16 +3209,14 @@ WLLT_OnSubmit(nsIContent* formNode) {
|
|||
if ((count>=3) && !wallet_GetWalletNotificationPref()) {
|
||||
|
||||
/* conditions all met, now give notification */
|
||||
char* notification = 0;
|
||||
char * message = Wallet_Localize("WalletNotification1");
|
||||
StrAllocCopy(notification, message);
|
||||
PR_FREEIF(message);
|
||||
message = Wallet_Localize("WalletNotification2");
|
||||
StrAllocCat(notification, message);
|
||||
PR_FREEIF(message);
|
||||
PRUnichar * notification1 = Wallet_Localize("WalletNotification1");
|
||||
PRUnichar * notification2 = Wallet_Localize("WalletNotification2");
|
||||
nsString s = nsString(notification1) + nsString(notification2);
|
||||
PRUnichar * message = (PRUnichar*)(s.GetUnicode());
|
||||
wallet_SetWalletNotificationPref(PR_TRUE);
|
||||
Wallet_Alert(notification);
|
||||
PR_Free (notification);
|
||||
Wallet_Alert(message);
|
||||
Recycle(notification1);
|
||||
Recycle(notification2);
|
||||
}
|
||||
#else
|
||||
/* save form if it meets all necessary conditions */
|
||||
|
|
Загрузка…
Ссылка в новой задаче