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