add UniversalDialog, r=davidm
git-svn-id: svn://10.0.0.236/trunk@56804 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
3fd93a33f0
commit
fd392898f3
@ -169,64 +169,6 @@ Local_SACat(char **destination, const char *source)
|
||||
return *destination;
|
||||
}
|
||||
|
||||
PRBool
|
||||
cookie_CheckConfirmYN(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue) {
|
||||
#ifdef REAL_DIALOG
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
*checkValue = 0;
|
||||
return retval;
|
||||
}
|
||||
const nsString message = szMessage;
|
||||
const nsString checkMessage = szCheckMessage;
|
||||
retval = PR_FALSE; /* in case user exits dialog by clicking X */
|
||||
#ifdef YN_DIALOGS_FIXED
|
||||
res = dialog->ConfirmCheckYN(message.GetUnicode(), checkMessage.GetUnicode(), checkValue, &retval);
|
||||
#else
|
||||
res = dialog->ConfirmCheck(message.GetUnicode(), checkMessage.GetUnicode(), checkValue, &retval);
|
||||
#endif
|
||||
if (NS_FAILED(res)) {
|
||||
*checkValue = 0;
|
||||
}
|
||||
if (*checkValue!=0 && *checkValue!=1) {
|
||||
*checkValue = 0; /* this should never happen but it is happening!!! */
|
||||
}
|
||||
return retval;
|
||||
|
||||
#else
|
||||
|
||||
fprintf(stdout, "%c%s (y/n)? ", '\007', szMessage); /* \007 is BELL */
|
||||
char c;
|
||||
PRBool result;
|
||||
for (;;) {
|
||||
c = getchar();
|
||||
if (tolower(c) == 'y') {
|
||||
result = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
if (tolower(c) == 'n') {
|
||||
result = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fprintf(stdout, "%c%s y/n? ", '\007', szCheckMessage); /* \007 is BELL */
|
||||
for (;;) {
|
||||
c = getchar();
|
||||
if (tolower(c) == 'y') {
|
||||
*checkValue = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
if (tolower(c) == 'n') {
|
||||
*checkValue = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRIVATE PRUnichar*
|
||||
cookie_Localize(char* genericString) {
|
||||
nsresult ret;
|
||||
@ -301,6 +243,81 @@ cookie_Localize(char* genericString) {
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
PRBool
|
||||
cookie_CheckConfirmYN(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue) {
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
*checkValue = 0;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
|
||||
PRUnichar * yes_string = cookie_Localize("Yes");
|
||||
PRUnichar * no_string = cookie_Localize("No");
|
||||
PRUnichar * confirm_string = cookie_Localize("Confirm");
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
NULL, /* title message */
|
||||
confirm_string, /* title text in top line of window */
|
||||
szMessage, /* this is the main message */
|
||||
szCheckMessage, /* This is the checkbox message */
|
||||
yes_string, /* first button text */
|
||||
no_string, /* second button text */
|
||||
NULL, /* third button text */
|
||||
NULL, /* fourth button text */
|
||||
NULL, /* first edit field label */
|
||||
NULL, /* second edit field label */
|
||||
NULL, /* first edit field initial and final value */
|
||||
NULL, /* second edit field initial and final value */
|
||||
nsString("chrome://global/skin/question-icon.gif").GetUnicode() ,
|
||||
checkValue, /* initial and final value of checkbox */
|
||||
2, /* number of buttons */
|
||||
0, /* number of edit fields */
|
||||
0, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
*checkValue = 0;
|
||||
}
|
||||
if (*checkValue!=0 && *checkValue!=1) {
|
||||
*checkValue = 0; /* this should never happen but it is happening!!! */
|
||||
}
|
||||
Recycle(yes_string);
|
||||
Recycle(no_string);
|
||||
Recycle(confirm_string);
|
||||
return (buttonPressed == 0);
|
||||
|
||||
#ifdef yyy
|
||||
/* following is an example of the most general usage of UniversalDialog */
|
||||
PRUnichar* inoutEdit1 = nsString("Edit field1 initial value").GetUnicode();
|
||||
PRUnichar* inoutEdit2 = nsString("Edit field2 initial value").GetUnicode();
|
||||
PRBool inoutCheckbox = PR_TRUE;
|
||||
PRInt32 buttonPressed;
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
nsString("Title Message").GetUnicode(),
|
||||
nsString("Dialog Title").GetUnicode(),
|
||||
nsString("This is the main message").GetUnicode(),
|
||||
nsString("This is the checkbox message").GetUnicode(),
|
||||
nsString("First Button").GetUnicode(),
|
||||
nsString("Second Button").GetUnicode(),
|
||||
nsString("Third Button").GetUnicode(),
|
||||
nsString("Fourth Button").GetUnicode(),
|
||||
nsString("First Edit field").GetUnicode(),
|
||||
nsString("Second Edit field").GetUnicode(),
|
||||
&inoutEdit1,
|
||||
&inoutEdit2,
|
||||
nsString("chrome://global/skin/question-icon.gif").GetUnicode() ,
|
||||
&inoutCheckbox,
|
||||
4, /* number of buttons */
|
||||
2, /* number of edit fields */
|
||||
0, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
PRIVATE nsresult cookie_ProfileDirectory(nsFileSpec& dirSpec) {
|
||||
nsIFileSpec* spec =
|
||||
NS_LocateFileOrDirectory(nsSpecialFileSpec::App_UserProfileDirectory50);
|
||||
@ -312,7 +329,6 @@ PRIVATE nsresult cookie_ProfileDirectory(nsFileSpec& dirSpec) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write a line to a file
|
||||
* return NS_OK if no error occurs
|
||||
|
||||
@ -24,12 +24,14 @@ Yes = Yes
|
||||
No = No
|
||||
AtEndOfSession = at end of session
|
||||
|
||||
Confirm = Confirm
|
||||
|
||||
# LOCALIZATION NOTE (PermissionToSetACookie) : Be careful about %1$s. Do Not localize it.
|
||||
PermissionToSetACookie = The site %1$s wants permission to set a cookie.
|
||||
PermissionToSetACookie = The site %1$s wants to set a cookie. Do you want to allow it?
|
||||
# LOCALIZATION NOTE (PermissionToSetSecondCookie): Be careful about %1$s. Do Not localize it.
|
||||
PermissionToSetSecondCookie = The site %1$s wants permission to set another cookie. You already have one cookie from this site.
|
||||
PermissionToSetSecondCookie = The site %1$s wants to set a second cookie. Do you want to allow it?
|
||||
# LOCALIZATION NOTE (PermissionToSetAnotherCookie): Be careful about %1$s, %2$d. Do Not localize them.
|
||||
PermissionToSetAnotherCookie = The site %1$s wants permission to set another cookie. You already have %2$d cookies from this site.
|
||||
PermissionToSetAnotherCookie = The site %1$s wants permission to set another cookie. You already have %2$d cookies from this site. Do you want to allow it?
|
||||
# LOCALIZATION NOTE (PermissionToModifyCookie): Be careful about %1$s. Do Not localize it.
|
||||
PermissionToModifyCookie = The site %1$s wants permission to modify an existing cookie.
|
||||
PermissionToModifyCookie = The site %1$s wants to modify an existing cookie. Do you want to allow it?
|
||||
RememberThisDecision = Remember this decision
|
||||
|
||||
@ -722,57 +722,94 @@ Wallet_Confirm(PRUnichar * szMessage)
|
||||
}
|
||||
|
||||
PUBLIC PRBool
|
||||
Wallet_ConfirmYN(PRUnichar * szMessage)
|
||||
{
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
|
||||
Wallet_ConfirmYN(PRUnichar * szMessage) {
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
return retval;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
const nsString message = szMessage;
|
||||
retval = PR_FALSE; /* in case user exits dialog by clicking X */
|
||||
#ifdef YN_DIALOGS_FIXED
|
||||
res = dialog->ConfirmYN(message.GetUnicode(), &retval);
|
||||
#else
|
||||
res = dialog->Confirm(message.GetUnicode(), &retval);
|
||||
#endif
|
||||
return retval;
|
||||
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
|
||||
PRUnichar * yes_string = Wallet_Localize("Yes");
|
||||
PRUnichar * no_string = Wallet_Localize("No");
|
||||
PRUnichar * confirm_string = Wallet_Localize("Confirm");
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
NULL, /* title message */
|
||||
confirm_string, /* title text in top line of window */
|
||||
szMessage, /* this is the main message */
|
||||
NULL, /* This is the checkbox message */
|
||||
yes_string, /* first button text */
|
||||
no_string, /* second button text */
|
||||
NULL, /* third button text */
|
||||
NULL, /* fourth button text */
|
||||
NULL, /* first edit field label */
|
||||
NULL, /* second edit field label */
|
||||
NULL, /* first edit field initial and final value */
|
||||
NULL, /* second edit field initial and final value */
|
||||
NULL, /* icon: question mark by default */
|
||||
NULL, /* initial and final value of checkbox */
|
||||
2, /* number of buttons */
|
||||
0, /* number of edit fields */
|
||||
0, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
|
||||
Recycle(yes_string);
|
||||
Recycle(no_string);
|
||||
Recycle(confirm_string);
|
||||
return (buttonPressed == 0);
|
||||
}
|
||||
|
||||
|
||||
PUBLIC PRInt32
|
||||
Wallet_3ButtonConfirm(PRUnichar * szMessage)
|
||||
{
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
return 1; /* default value is yes */
|
||||
return 0; /* default value is NO */
|
||||
}
|
||||
|
||||
const nsString message = szMessage;
|
||||
#ifdef YesNoNeverDialogExists
|
||||
PRInt32 retval = 0; /* in case user exits dialog by clicking X */
|
||||
res = dialog->3ButtonConfirm(message.GetUnicode(), &retval);
|
||||
return retval;
|
||||
#else
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
#ifdef YN_DIALOGS_FIXED
|
||||
res = dialog->ConfirmYN(message.GetUnicode(), &retval);
|
||||
#else
|
||||
res = dialog->Confirm(message.GetUnicode(), &retval);
|
||||
#endif
|
||||
if (retval) {
|
||||
return 1; /* user said yes */
|
||||
}
|
||||
const nsString message2 = "Remember this decision for this site?";
|
||||
res = dialog->Confirm(message2.GetUnicode(), &retval);
|
||||
if (retval) {
|
||||
return -1; /* user said never */
|
||||
PRInt32 buttonPressed = 1; /* default of NO if user exits dialog by clickin X */
|
||||
PRUnichar * yes_string = Wallet_Localize("Yes");
|
||||
PRUnichar * no_string = Wallet_Localize("No");
|
||||
PRUnichar * never_string = Wallet_Localize("Never");
|
||||
PRUnichar * confirm_string = Wallet_Localize("Confirm");
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
NULL, /* title message */
|
||||
confirm_string, /* title text in top line of window */
|
||||
szMessage, /* this is the main message */
|
||||
NULL, /* This is the checkbox message */
|
||||
yes_string, /* first button text */
|
||||
no_string, /* second button text */
|
||||
never_string, /* third button text */
|
||||
NULL, /* fourth button text */
|
||||
NULL, /* first edit field label */
|
||||
NULL, /* second edit field label */
|
||||
NULL, /* first edit field initial and final value */
|
||||
NULL, /* second edit field initial and final value */
|
||||
NULL, /* icon: question mark by default */
|
||||
NULL, /* initial and final value of checkbox */
|
||||
3, /* number of buttons */
|
||||
0, /* number of edit fields */
|
||||
0, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
|
||||
Recycle(yes_string);
|
||||
Recycle(no_string);
|
||||
Recycle(never_string);
|
||||
Recycle(confirm_string);
|
||||
|
||||
if (buttonPressed == 0) {
|
||||
return 1; /* YES button pressed */
|
||||
} else if (buttonPressed == 1) {
|
||||
return 0; /* NO button pressed */
|
||||
} else if (buttonPressed == 2) {
|
||||
return -1; /* NEVER button pressed */
|
||||
} else {
|
||||
return 0; /* should never happen */
|
||||
}
|
||||
return 0; /* user said no */
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
@ -790,93 +827,135 @@ Wallet_Alert(PRUnichar * szMessage)
|
||||
}
|
||||
|
||||
PUBLIC PRBool
|
||||
Wallet_CheckConfirmYN(PRUnichar * szMessage, char * szCheckMessage, PRBool* checkValue)
|
||||
{
|
||||
PRBool retval = PR_TRUE; /* default value */
|
||||
|
||||
Wallet_CheckConfirmYN(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue) {
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
*checkValue = 0;
|
||||
return retval;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
const nsString message = szMessage;
|
||||
const nsString checkMessage = szCheckMessage;
|
||||
retval = PR_FALSE; /* in case user exits dialog by clicking X */
|
||||
#ifdef YN_DIALOGS_FIXED
|
||||
res = dialog->ConfirmCheckYN(message.GetUnicode(), checkMessage.GetUnicode(), checkValue, &retval);
|
||||
#else
|
||||
res = dialog->ConfirmCheck(message.GetUnicode(), checkMessage.GetUnicode(), checkValue, &retval);
|
||||
#endif
|
||||
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
|
||||
PRUnichar * yes_string = Wallet_Localize("Yes");
|
||||
PRUnichar * no_string = Wallet_Localize("No");
|
||||
PRUnichar * confirm_string = Wallet_Localize("Confirm");
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
NULL, /* title message */
|
||||
confirm_string, /* title text in top line of window */
|
||||
szMessage, /* this is the main message */
|
||||
szCheckMessage, /* This is the checkbox message */
|
||||
yes_string, /* first button text */
|
||||
no_string, /* second button text */
|
||||
NULL, /* third button text */
|
||||
NULL, /* fourth button text */
|
||||
NULL, /* first edit field label */
|
||||
NULL, /* second edit field label */
|
||||
NULL, /* first edit field initial and final value */
|
||||
NULL, /* second edit field initial and final value */
|
||||
NULL, /* icon: question mark by default */
|
||||
checkValue, /* initial and final value of checkbox */
|
||||
2, /* number of buttons */
|
||||
0, /* number of edit fields */
|
||||
0, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
*checkValue = 0;
|
||||
}
|
||||
if (*checkValue!=0 && *checkValue!=1) {
|
||||
*checkValue = 0; /* this should never happen but it is happening!!! */
|
||||
}
|
||||
return retval;
|
||||
Recycle(yes_string);
|
||||
Recycle(no_string);
|
||||
Recycle(confirm_string);
|
||||
return (buttonPressed == 0);
|
||||
}
|
||||
|
||||
char * wallet_GetString(PRUnichar * szMessage)
|
||||
char * wallet_GetString(PRUnichar * szMessage, PRUnichar * szMessage1)
|
||||
{
|
||||
nsString password;
|
||||
PRBool retval;
|
||||
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
return NULL; // XXX should return the error
|
||||
}
|
||||
|
||||
const nsString message = szMessage;
|
||||
PRUnichar* pwd;
|
||||
retval = PR_FALSE; /* in case user exits dialog by clicking X */
|
||||
res = dialog->PromptPassword(message.GetUnicode(), nsnull /* window title */, &pwd, &retval);
|
||||
PRUnichar* pwd = NULL;
|
||||
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
|
||||
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
NULL, /* title message */
|
||||
prompt_string, /* title text in top line of window */
|
||||
szMessage, /* this is the main message */
|
||||
NULL, /* This is the checkbox message */
|
||||
NULL, /* first button text, becomes OK by default */
|
||||
NULL, /* second button text, becomes CANCEL by default */
|
||||
NULL, /* third button text */
|
||||
NULL, /* fourth button text */
|
||||
szMessage1, /* first edit field label */
|
||||
NULL, /* second edit field label */
|
||||
&pwd, /* first edit field initial and final value */
|
||||
NULL, /* second edit field initial and final value */
|
||||
NULL, /* icon: question mark by default */
|
||||
NULL, /* initial and final value of checkbox */
|
||||
2, /* number of buttons */
|
||||
1, /* number of edit fields */
|
||||
1, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
|
||||
Recycle(prompt_string);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return NULL;
|
||||
}
|
||||
password = pwd;
|
||||
delete[] pwd;
|
||||
|
||||
if (retval) {
|
||||
if (buttonPressed == 0) {
|
||||
return password.ToNewCString();
|
||||
} else {
|
||||
return NULL; /* user pressed cancel */
|
||||
}
|
||||
}
|
||||
|
||||
char * wallet_GetDoubleString(PRUnichar * szMessage, PRUnichar * szMessage2, PRBool& matched)
|
||||
char * wallet_GetDoubleString(PRUnichar * szMessage, PRUnichar * szMessage1, PRUnichar * szMessage2, PRBool& matched)
|
||||
{
|
||||
nsString password, password2;
|
||||
PRBool retval;
|
||||
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
return NULL; // XXX should return the error
|
||||
}
|
||||
|
||||
const nsString message = szMessage;
|
||||
const nsString message2 = szMessage2;
|
||||
PRUnichar* pwd;
|
||||
PRUnichar* pwd2;
|
||||
retval = PR_FALSE; /* in case user exits dialog by clicking X */
|
||||
PRUnichar* pwd = NULL;
|
||||
PRUnichar* pwd2 = NULL;
|
||||
PRInt32 buttonPressed = 1; /* in case user exits dialog by clickin X */
|
||||
PRUnichar * prompt_string = Wallet_Localize("PromptForPassword");
|
||||
|
||||
res = dialog->UniversalDialog(
|
||||
NULL, /* title message */
|
||||
prompt_string, /* title text in top line of window */
|
||||
szMessage, /* this is the main message */
|
||||
NULL, /* This is the checkbox message */
|
||||
NULL, /* first button text, becomes OK by default */
|
||||
NULL, /* second button text, becomes CANCEL by default */
|
||||
NULL, /* third button text */
|
||||
NULL, /* fourth button text */
|
||||
szMessage1, /* first edit field label */
|
||||
szMessage2, /* second edit field label */
|
||||
&pwd, /* first edit field initial and final value */
|
||||
&pwd2, /* second edit field initial and final value */
|
||||
NULL, /* icon: question mark by default */
|
||||
NULL, /* initial and final value of checkbox */
|
||||
2, /* number of buttons */
|
||||
2, /* number of edit fields */
|
||||
1, /* is first edit field a password field */
|
||||
&buttonPressed);
|
||||
|
||||
Recycle(prompt_string);
|
||||
|
||||
#ifdef PROMPT_DOUBLE_PASSWORD
|
||||
res = dialog->PromptDoublePassword
|
||||
(message.GetUnicode(), message2.GetUnicode(), &pwd, &pwd2, &retval);
|
||||
#else
|
||||
res = dialog->PromptPassword(message.GetUnicode(), nsnull /* window title */, &pwd, &retval);
|
||||
if (NS_FAILED(res)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!retval) {
|
||||
delete[] pwd;
|
||||
return NULL; /* user pressed cancel */
|
||||
}
|
||||
res = dialog->PromptPassword(message2.GetUnicode(), nsnull /* window title */, &pwd2, &retval);
|
||||
#endif
|
||||
if (NS_FAILED(res)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -886,7 +965,7 @@ char * wallet_GetDoubleString(PRUnichar * szMessage, PRUnichar * szMessage2, PRB
|
||||
delete[] pwd2;
|
||||
matched = (password == password2);
|
||||
|
||||
if (retval) {
|
||||
if (buttonPressed == 0) {
|
||||
return password.ToNewCString();
|
||||
} else {
|
||||
return NULL; /* user pressed cancel */
|
||||
@ -1233,11 +1312,12 @@ Wallet_SetKey(PRBool isNewkey) {
|
||||
|
||||
if (Wallet_KeySize() < 0) { /* no key has yet been established */
|
||||
PRUnichar * message = Wallet_Localize("firstPassword");
|
||||
PRUnichar * message1 = Wallet_Localize("enterPassword");
|
||||
PRUnichar * message2 = Wallet_Localize("confirmPassword");
|
||||
PRUnichar * mismatch = Wallet_Localize("confirmFailed_TryAgain?");
|
||||
PRBool matched;
|
||||
for (;;) {
|
||||
newkey = wallet_GetDoubleString(message, message2, matched);
|
||||
newkey = wallet_GetDoubleString(message, message1, message2, matched);
|
||||
if ((newkey != NULL) && matched) {
|
||||
break; /* break out of loop if both passwords matched */
|
||||
}
|
||||
@ -1245,6 +1325,7 @@ Wallet_SetKey(PRBool isNewkey) {
|
||||
if ((newkey == NULL) || (!Wallet_Confirm(mismatch))) {
|
||||
Recycle(mismatch);
|
||||
Recycle(message);
|
||||
Recycle(message1);
|
||||
Recycle(message2);
|
||||
keyCancel = PR_TRUE;
|
||||
return FALSE; /* user does not want to try again */
|
||||
@ -1252,9 +1333,11 @@ Wallet_SetKey(PRBool isNewkey) {
|
||||
}
|
||||
PR_FREEIF(mismatch);
|
||||
PR_FREEIF(message);
|
||||
Recycle(message1);
|
||||
PR_FREEIF(message2);
|
||||
} else { /* key has previously been established */
|
||||
PRUnichar * message;
|
||||
PRUnichar * message1 = Wallet_Localize("enterPassword");
|
||||
PRUnichar * message2 = Wallet_Localize("confirmPassword");
|
||||
PRUnichar * mismatch = Wallet_Localize("confirmFailed_TryAgain?");
|
||||
PRBool matched;
|
||||
@ -1269,7 +1352,7 @@ Wallet_SetKey(PRBool isNewkey) {
|
||||
} else { /* ask the user for his key */
|
||||
if (isNewkey) { /* user is changing his password */
|
||||
for (;;) {
|
||||
newkey = wallet_GetDoubleString(message, message2, matched);
|
||||
newkey = wallet_GetDoubleString(message, message1, message2, matched);
|
||||
if ((newkey != NULL) && matched) {
|
||||
break; /* break out of loop if both passwords matched */
|
||||
}
|
||||
@ -1277,16 +1360,18 @@ Wallet_SetKey(PRBool isNewkey) {
|
||||
if ((newkey == NULL) || (!Wallet_Confirm(mismatch))) {
|
||||
Recycle(mismatch);
|
||||
Recycle(message);
|
||||
Recycle(message1);
|
||||
Recycle(message2);
|
||||
keyCancel = PR_TRUE;
|
||||
return FALSE; /* user does not want to try again */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newkey = wallet_GetString(message);
|
||||
newkey = wallet_GetString(message, message1);
|
||||
}
|
||||
if (newkey == NULL) {
|
||||
Recycle(message);
|
||||
Recycle(message1);
|
||||
Recycle(message2);
|
||||
Recycle(mismatch);
|
||||
keyCancel = PR_TRUE;
|
||||
@ -1294,6 +1379,7 @@ Wallet_SetKey(PRBool isNewkey) {
|
||||
}
|
||||
}
|
||||
Recycle(message);
|
||||
Recycle(message1);
|
||||
Recycle(message2);
|
||||
Recycle(mismatch);
|
||||
}
|
||||
|
||||
@ -23,7 +23,8 @@ WantToSavePassword? = Do you want to save the user name and password for this fo
|
||||
firstPassword = Select a key for your database (leave field blank if you don't want to use a key).
|
||||
password = Enter your database key.
|
||||
newPassword = Select a new key for your database (leave field blank if you don't want to use a key).
|
||||
confirmPassword = Confirm your key by entering it again
|
||||
enterPassword = Enter a key
|
||||
confirmPassword = Confirm the key
|
||||
confirmFailed_TryAgain? = Keys did not match. Do you want to try again?
|
||||
SelectUser = Select a username to be entered on this form
|
||||
SelectUserWhosePasswordIsBeingChanged = Select the user whose password is being changed.
|
||||
@ -31,3 +32,8 @@ PasswordNotification = For your convenience, the browser can remember your user
|
||||
WalletNotification = You can save information that you enter on forms and later automatically prefill that information on other forms. To save such information, select tasks/wallet/capture from the menu while viewing the form.
|
||||
NeverSave = Never save this form
|
||||
noPrefills = There are no fields that can be prefilled.
|
||||
Yes = Yes
|
||||
No = No
|
||||
Never = Never
|
||||
Confirm = Confirm
|
||||
PromptForPassword = Prompt For Database Key
|
||||
|
||||
@ -45,21 +45,6 @@ interface nsIPrompt : nsISupports
|
||||
in wstring checkMsg,
|
||||
out boolean checkValue);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with Yes and No buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirmYN(in wstring text);
|
||||
|
||||
/**
|
||||
* Puts up a dialog with Yes and No buttons, and
|
||||
* a message with a single checkbox.
|
||||
* @return true for OK, false for Cancel
|
||||
*/
|
||||
boolean confirmCheckYN(in wstring text,
|
||||
in wstring checkMsg,
|
||||
out boolean checkValue);
|
||||
|
||||
/**
|
||||
* Puts up a text input dialog with OK and Cancel buttons.
|
||||
* @return true for OK, false for Cancel
|
||||
@ -91,4 +76,30 @@ interface nsIPrompt : nsISupports
|
||||
in PRUint32 inCount,
|
||||
[array,size_is(inCount) ] in string inList,
|
||||
out long outSelection );
|
||||
|
||||
|
||||
/**
|
||||
* Put up a universal dialog
|
||||
*/
|
||||
void UniversalDialog
|
||||
(in wstring inTitleMessage,
|
||||
in wstring inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
in wstring inMsg, /* main message for dialog */
|
||||
in wstring inCheckboxMsg, /* message for checkbox */
|
||||
in wstring inButton0Text, /* text for first button */
|
||||
in wstring inButton1Text, /* text for second button */
|
||||
in wstring inButton2Text, /* text for third button */
|
||||
in wstring inButton3Text, /* text for fourth button */
|
||||
in wstring inEditfield1Msg, /*message for first edit field */
|
||||
in wstring inEditfield2Msg, /* message for second edit field */
|
||||
inout wstring inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
inout wstring inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
in wstring inIConURL, /* url of icon to be displayed in dialog */
|
||||
inout boolean inoutCheckboxState, /* initial and final state of checkbox */
|
||||
in PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
in PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
in PRInt32 inEditField1Password, /* ??? */
|
||||
out PRInt32 outButtonPressed); /* number of button that was pressed (0 to 3) */
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -2190,13 +2190,6 @@ nsBrowserWindow::Confirm(const PRUnichar *text,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::ConfirmYN(const PRUnichar *text,
|
||||
PRBool *result)
|
||||
{
|
||||
return Confirm(text, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::ConfirmCheck(const PRUnichar *text,
|
||||
const PRUnichar *checkMsg,
|
||||
@ -2206,15 +2199,6 @@ nsBrowserWindow::ConfirmCheck(const PRUnichar *text,
|
||||
return Confirm(text, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::ConfirmCheckYN(const PRUnichar *text,
|
||||
const PRUnichar *checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *result)
|
||||
{
|
||||
return Confirm(text, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Prompt(const PRUnichar *text,
|
||||
const PRUnichar *defaultText,
|
||||
@ -2297,6 +2281,34 @@ nsresult nsBrowserWindow::Select(const PRUnichar *, const PRUnichar *, PRUint32
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::UniversalDialog
|
||||
(const PRUnichar *inTitleMessage,
|
||||
const PRUnichar *inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
const PRUnichar *inMsg, /* main message for dialog */
|
||||
const PRUnichar *inCheckboxMsg, /* message for checkbox */
|
||||
const PRUnichar *inButton0Text, /* text for first button */
|
||||
const PRUnichar *inButton1Text, /* text for second button */
|
||||
const PRUnichar *inButton2Text, /* text for third button */
|
||||
const PRUnichar *inButton3Text, /* text for fourth button */
|
||||
const PRUnichar *inEditfield1Msg, /*message for first edit field */
|
||||
const PRUnichar *inEditfield2Msg, /* message for second edit field */
|
||||
PRUnichar **inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
PRUnichar **inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
const PRUnichar *inIConURL, /* url of icon to be displayed in dialog */
|
||||
/* examples are
|
||||
"chrome://global/skin/question-icon.gif" for question mark,
|
||||
"chrome://global/skin/alert-icon.gif" for exclamation mark
|
||||
*/
|
||||
PRBool *inoutCheckboxState, /* initial and final state of check box */
|
||||
PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
PRInt32 inEditField1Password, /* is first edit field a password field */
|
||||
PRInt32 *outButtonPressed) /* number of button that was pressed (0 to 3) */
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// Toolbar support
|
||||
|
||||
@ -96,6 +96,31 @@ enum { eButtonPressed = 0, eCheckboxState = 1, eNumberButtons = 2, eNumberEditfi
|
||||
in PRUint32 inCount,
|
||||
[array,size_is(inCount) ] in string inList,
|
||||
out long outSelection );
|
||||
|
||||
/**
|
||||
* Put up a universal dialog
|
||||
*/
|
||||
void UniversalDialog
|
||||
(in nsIDOMWindow inParent,
|
||||
in wstring inTitleMessage,
|
||||
in wstring inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
in wstring inMsg, /* main message for dialog */
|
||||
in wstring inCheckboxMsg, /* message for checkbox */
|
||||
in wstring inButton0Text, /* text for first button */
|
||||
in wstring inButton1Text, /* text for second button */
|
||||
in wstring inButton2Text, /* text for third button */
|
||||
in wstring inButton3Text, /* text for fourth button */
|
||||
in wstring inEditfield1Msg, /*message for first edit field */
|
||||
in wstring inEditfield2Msg, /* message for second edit field */
|
||||
inout wstring inEditfield1Value, /* initial and final value for first edit field */
|
||||
inout wstring inEditfield2Value, /* initial and final value for second edit field */
|
||||
in wstring inIConURL, /* url of icon to be displayed in dialog */
|
||||
inout boolean outCheckboxState, /* initial and final state of check box */
|
||||
in PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
in PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
in PRInt32 inEditField1Password, /* is first edit field a password field */
|
||||
out PRInt32 outButtonPressed); /* number of button that was pressed (0 to 3) */
|
||||
|
||||
/*
|
||||
Core Dialog function
|
||||
*/
|
||||
|
||||
@ -161,6 +161,115 @@ NS_IMETHODIMP nsCommonDialogs::ConfirmCheck(nsIDOMWindow *inParent, const PRUni
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Note: It would be nice if someone someday converts all the other dialogs so that they
|
||||
all call UniversalDialog rather than calling on DoDialog directly. This should save
|
||||
a few bytes of memory
|
||||
*/
|
||||
NS_IMETHODIMP nsCommonDialogs::UniversalDialog
|
||||
(nsIDOMWindow *inParent,
|
||||
const PRUnichar *inTitleMessage,
|
||||
const PRUnichar *inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
const PRUnichar *inMsg, /* main message for dialog */
|
||||
const PRUnichar *inCheckboxMsg, /* message for checkbox */
|
||||
const PRUnichar *inButton0Text, /* text for first button */
|
||||
const PRUnichar *inButton1Text, /* text for second button */
|
||||
const PRUnichar *inButton2Text, /* text for third button */
|
||||
const PRUnichar *inButton3Text, /* text for fourth button */
|
||||
const PRUnichar *inEditfield1Msg, /*message for first edit field */
|
||||
const PRUnichar *inEditfield2Msg, /* message for second edit field */
|
||||
PRUnichar **inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
PRUnichar **inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
const PRUnichar *inIConURL, /* url of icon to be displayed in dialog */
|
||||
/* examples are
|
||||
"chrome://global/skin/question-icon.gif" for question mark,
|
||||
"chrome://global/skin/alert-icon.gif" for exclamation mark
|
||||
*/
|
||||
PRBool *inoutCheckboxState, /* initial and final state of check box */
|
||||
PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
PRInt32 inEditField1Password, /* is first edit field a password field */
|
||||
PRInt32 *outButtonPressed) /* number of button that was pressed (0 to 3) */
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
/* check for at least one button */
|
||||
if (inNumberButtons < 1) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* create parameter block */
|
||||
|
||||
nsIDialogParamBlock* block = NULL;
|
||||
rv = nsComponentManager::CreateInstance
|
||||
(kDialogParamBlockCID, 0, nsIDialogParamBlock::GetIID(), (void**)&block );
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* load up input parameters */
|
||||
|
||||
block->SetString(eTitleMessage, inTitleMessage);
|
||||
block->SetString(eDialogTitle, inDialogTitle);
|
||||
block->SetString(eMsg, inMsg);
|
||||
block->SetString(eCheckboxMsg, inCheckboxMsg);
|
||||
if (inNumberButtons >= 4) {
|
||||
block->SetString(eButton3Text, inButton3Text);
|
||||
}
|
||||
if (inNumberButtons >= 3) {
|
||||
block->SetString(eButton2Text, inButton2Text);
|
||||
}
|
||||
if (inNumberButtons >= 2) {
|
||||
block->SetString(eButton1Text, inButton1Text);
|
||||
}
|
||||
if (inNumberButtons >= 1) {
|
||||
block->SetString(eButton0Text, inButton0Text);
|
||||
}
|
||||
if (inNumberEditfields >= 2) {
|
||||
block->SetString(eEditfield2Msg, inEditfield2Msg);
|
||||
block->SetString(eEditfield2Value, *inoutEditfield2Value);
|
||||
}
|
||||
if (inNumberEditfields >= 1) {
|
||||
block->SetString(eEditfield1Msg, inEditfield1Msg);
|
||||
block->SetString(eEditfield1Value, *inoutEditfield1Value);
|
||||
block->SetInt(eEditField1Password, inEditField1Password);
|
||||
}
|
||||
if (inIConURL) {
|
||||
block->SetString(eIconURL, inIConURL);
|
||||
} else {
|
||||
nsString url(kQuestionIconURL);
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
}
|
||||
if (inCheckboxMsg) {
|
||||
block->SetInt(eCheckboxState, *inoutCheckboxState);
|
||||
}
|
||||
block->SetInt(eNumberButtons, inNumberButtons);
|
||||
block->SetInt(eNumberEditfields, inNumberEditfields);
|
||||
|
||||
/* perform the dialog */
|
||||
|
||||
rv = DoDialog(inParent, block, kPromptURL);
|
||||
|
||||
/* get back output parameters */
|
||||
|
||||
if (outButtonPressed) {
|
||||
block->GetInt(eButtonPressed, outButtonPressed);
|
||||
}
|
||||
if (inCheckboxMsg && inoutCheckboxState) {
|
||||
block->GetInt(eCheckboxState, inoutCheckboxState);
|
||||
}
|
||||
if ((inNumberEditfields >= 2) && inoutEditfield2Value) {
|
||||
block->GetString(eEditfield2Value, inoutEditfield2Value);
|
||||
}
|
||||
if ((inNumberEditfields >= 1) && inoutEditfield1Value) {
|
||||
block->GetString(eEditfield1Value, inoutEditfield1Value);
|
||||
}
|
||||
|
||||
/* destroy parameter block and return */
|
||||
|
||||
NS_IF_RELEASE(block);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCommonDialogs::Prompt(nsIDOMWindow *inParent, const PRUnichar *inWindowTitle, const PRUnichar *inMsg, const PRUnichar *inDefaultText, PRUnichar **result, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -418,33 +418,49 @@ NS_IMETHODIMP nsNetSupportDialog::ConfirmCheck(const PRUnichar *text,
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::ConfirmYN(const PRUnichar *text, PRBool *returnValue)
|
||||
NS_IMETHODIMP nsNetSupportDialog::UniversalDialog
|
||||
(const PRUnichar *inTitleMessage,
|
||||
const PRUnichar *inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
const PRUnichar *inMsg, /* main message for dialog */
|
||||
const PRUnichar *inCheckboxMsg, /* message for checkbox */
|
||||
const PRUnichar *inButton0Text, /* text for first button */
|
||||
const PRUnichar *inButton1Text, /* text for second button */
|
||||
const PRUnichar *inButton2Text, /* text for third button */
|
||||
const PRUnichar *inButton3Text, /* text for fourth button */
|
||||
const PRUnichar *inEditfield1Msg, /*message for first edit field */
|
||||
const PRUnichar *inEditfield2Msg, /* message for second edit field */
|
||||
PRUnichar **inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
PRUnichar **inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
const PRUnichar *inIConURL, /* url of icon to be displayed in dialog */
|
||||
/* examples are
|
||||
"chrome://global/skin/question-icon.gif" for question mark,
|
||||
"chrome://global/skin/alert-icon.gif" for exclamation mark
|
||||
*/
|
||||
PRBool *inoutCheckboxState, /* initial and final state of check box */
|
||||
PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
PRInt32 inEditField1Password, /* is first edit field a password field */
|
||||
PRInt32 *outButtonPressed) /* number of button that was pressed (0 to 3) */
|
||||
{
|
||||
Init();
|
||||
nsAutoString aText(text);
|
||||
mMsg = &aText;
|
||||
mReturnValue = returnValue;
|
||||
nsString url( "chrome://navigator/content/NetSupportConfirmYN.xul") ;
|
||||
DoDialog( url );
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv);
|
||||
if ( NS_SUCCEEDED ( rv ) )
|
||||
{
|
||||
nsCOMPtr< nsIDOMWindow> window;
|
||||
windowMediator->GetMostRecentWindow( NULL, getter_AddRefs( window ) );
|
||||
nsCOMPtr<nsICommonDialogs> dialogService;
|
||||
rv = nsComponentManager::CreateInstance( kCommonDialogsCID,0, nsICommonDialogs::GetIID(),
|
||||
(void**)&dialogService );
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::ConfirmCheckYN(const PRUnichar *text,
|
||||
const PRUnichar *checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *returnValue)
|
||||
{
|
||||
|
||||
Init();
|
||||
nsAutoString aText(text);
|
||||
nsAutoString aCheckMsg(checkMsg);
|
||||
mMsg = &aText;
|
||||
mReturnValue = returnValue;
|
||||
mCheckValue = checkValue;
|
||||
mCheckMsg = &aCheckMsg;
|
||||
nsString url( "chrome://navigator/content/NetSupportConfirmCheckYN.xul") ;
|
||||
DoDialog( url );
|
||||
return NS_OK;
|
||||
if( NS_SUCCEEDED ( rv ) )
|
||||
rv = dialogService->UniversalDialog(
|
||||
window, inTitleMessage, inDialogTitle, inMsg, inCheckboxMsg,
|
||||
inButton0Text, inButton1Text, inButton2Text, inButton3Text,
|
||||
inEditfield1Msg, inEditfield2Msg, inoutEditfield1Value,
|
||||
inoutEditfield2Value, inIConURL, inoutCheckboxState, inNumberButtons,
|
||||
inNumberEditfields, inEditField1Password, outButtonPressed);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetSupportDialog::Prompt(const PRUnichar *text,
|
||||
|
||||
@ -2965,6 +2965,54 @@ NS_IMETHODIMP nsWebShellWindow::ConfirmCheck(const PRUnichar *text, const PRUnic
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::UniversalDialog
|
||||
(const PRUnichar *inTitleMessage,
|
||||
const PRUnichar *inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
|
||||
const PRUnichar *inMsg, /* main message for dialog */
|
||||
const PRUnichar *inCheckboxMsg, /* message for checkbox */
|
||||
const PRUnichar *inButton0Text, /* text for first button */
|
||||
const PRUnichar *inButton1Text, /* text for second button */
|
||||
const PRUnichar *inButton2Text, /* text for third button */
|
||||
const PRUnichar *inButton3Text, /* text for fourth button */
|
||||
const PRUnichar *inEditfield1Msg, /*message for first edit field */
|
||||
const PRUnichar *inEditfield2Msg, /* message for second edit field */
|
||||
PRUnichar **inoutEditfield1Value, /* initial and final value for first edit field */
|
||||
PRUnichar **inoutEditfield2Value, /* initial and final value for second edit field */
|
||||
const PRUnichar *inIConURL, /* url of icon to be displayed in dialog */
|
||||
/* examples are
|
||||
"chrome://global/skin/question-icon.gif" for question mark,
|
||||
"chrome://global/skin/alert-icon.gif" for exclamation mark
|
||||
*/
|
||||
PRBool *inoutCheckboxState, /* initial and final state of check box */
|
||||
PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
|
||||
PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
|
||||
PRInt32 inEditField1Password, /* is first edit field a password field */
|
||||
PRInt32 *outButtonPressed) /* number of button that was pressed (0 to 3) */
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
nsIWebShell* tempWebShell;
|
||||
GetWebShell(tempWebShell );
|
||||
nsCOMPtr<nsIWebShell> webShell( dont_AddRef(tempWebShell) );
|
||||
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow))))
|
||||
{
|
||||
NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
|
||||
if ( NS_SUCCEEDED( rv ) )
|
||||
rv = dialog->UniversalDialog(
|
||||
domWindow, inTitleMessage, inDialogTitle, inMsg, inCheckboxMsg,
|
||||
inButton0Text, inButton1Text, inButton2Text, inButton3Text,
|
||||
inEditfield1Msg, inEditfield2Msg, inoutEditfield1Value,
|
||||
inoutEditfield2Value, inIConURL, inoutCheckboxState, inNumberButtons,
|
||||
inNumberEditfields, inEditField1Password, outButtonPressed);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Prompt(const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
@ -3022,16 +3070,6 @@ NS_IMETHODIMP nsWebShellWindow::PromptPassword(const PRUnichar *text, const PRUn
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::ConfirmYN(const PRUnichar *text, PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::ConfirmCheckYN(const PRUnichar *text, const PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShellWindow::Select( const PRUnichar *inDialogTitle, const PRUnichar* inMsg, PRUint32 inCount, const char **inList, PRInt32 *outSelection, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -139,54 +139,102 @@ function commonDialogOnLoad()
|
||||
var element = document.getElementById("checkboxLabel");
|
||||
element.setAttribute("style","display: none;" );
|
||||
}
|
||||
|
||||
// handle the edit fields
|
||||
// dump("set editfields \n");
|
||||
|
||||
|
||||
|
||||
var element = document.getElementById("dialog.password");
|
||||
|
||||
element.value = param.GetString( 7 );
|
||||
|
||||
element = document.getElementById("dialog.loginname");
|
||||
element.value = param.GetString( 6 );
|
||||
var numEditfields = param.GetInt( 3 );
|
||||
switch( numEditfields )
|
||||
{
|
||||
case 2:
|
||||
var element = document.getElementById("dialog.loginname");
|
||||
element.focus();
|
||||
var element = document.getElementById("dialog.password2");
|
||||
element.value = param.GetString( 7 );
|
||||
|
||||
var editMsg = param.GetString( 5 );
|
||||
if (editMsg) {
|
||||
SetElementText("password2.text", editMsg );
|
||||
}
|
||||
|
||||
var editfield1Password = param.GetInt( 4 );
|
||||
if ( editfield1Password == 1 )
|
||||
{
|
||||
var element = document.getElementById("dialog.password1");
|
||||
element.value = param.GetString( 6 );
|
||||
|
||||
var editMsg1 = param.GetString( 4 );
|
||||
if (editMsg1) {
|
||||
SetElementText("password1.text", editMsg1 );
|
||||
}
|
||||
// dump("hiding loginEditField");
|
||||
var element = document.getElementById("loginEditField");
|
||||
element.setAttribute("style","display: none;" );
|
||||
var element = document.getElementById("dialog.password1");
|
||||
element.focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
var element = document.getElementById("dialog.loginname");
|
||||
element.value = param.GetString( 6 );
|
||||
|
||||
var editMsg1 = param.GetString( 4 );
|
||||
if (editMsg1) {
|
||||
SetElementText("login.text", editMsg1 );
|
||||
}
|
||||
// dump("hiding password1EditField");
|
||||
var element = document.getElementById("password1EditField");
|
||||
element.setAttribute("style","display: none;" );
|
||||
var element = document.getElementById("dialog.loginname");
|
||||
element.focus();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
var editfield1Password = param.GetInt( 4 );
|
||||
if ( editfield1Password == 1 )
|
||||
{
|
||||
// dump("hiding password");
|
||||
var element = document.getElementById("dialog.password1");
|
||||
element.value = param.GetString( 6 );
|
||||
|
||||
// var editMsg1 = param.GetString( 4 );
|
||||
// if (editMsg1) {
|
||||
// SetElementText("password1.text", editMsg1 );
|
||||
// }
|
||||
// Now hide the meaningless text
|
||||
var element = document.getElementById("password1.text");
|
||||
element.setAttribute("style", "display:none;" );
|
||||
// dump("hiding loginEditField and password2EditField");
|
||||
var element = document.getElementById("loginEditField");
|
||||
element.setAttribute("style","display: none;" );
|
||||
// Now hide the meanless text
|
||||
var element = document.getElementById("password.text");
|
||||
element.setAttribute("style", "display:none;" );
|
||||
var element = document.getElementById("dialog.password");
|
||||
var element = document.getElementById("password2EditField");
|
||||
element.setAttribute("style","display: none;" );
|
||||
var element = document.getElementById("dialog.password1");
|
||||
// dump("give keyboard focus to password edit field \n");
|
||||
element.focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
// dump("hiding password");
|
||||
var element = document.getElementById("passwordEditfield");
|
||||
element.setAttribute("style","display: none;" );
|
||||
// Now hide the meanless text
|
||||
var element = document.getElementById("dialog.loginname");
|
||||
element.value = param.GetString( 6 );
|
||||
|
||||
var editMsg1 = param.GetString( 4 );
|
||||
if (editMsg1) {
|
||||
SetElementText("login.text", editMsg1 );
|
||||
}
|
||||
// Now hide the meaningless text
|
||||
var element = document.getElementById("login.text");
|
||||
element.setAttribute("style", "display:none;" );
|
||||
|
||||
// dump("hiding password1EditField and password2EditField");
|
||||
var element = document.getElementById("password1EditField");
|
||||
element.setAttribute("style","display: none;" );
|
||||
var element = document.getElementById("password2EditField");
|
||||
element.setAttribute("style","display: none;" );
|
||||
var element = document.getElementById("dialog.loginname");
|
||||
// dump("give keyboard focus to password edit field \n");
|
||||
element.focus();
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
// dump("hide editfields \n");
|
||||
// dump("hiding all editfields \n");
|
||||
var element = document.getElementById("editFields");
|
||||
element.setAttribute("style","display: none;" );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -221,13 +269,31 @@ function commonDialogOnOK()
|
||||
{
|
||||
// dump("commonDialogOnOK \n");
|
||||
param.SetInt(0, 0 );
|
||||
var element = document.getElementById("dialog.loginname");
|
||||
param.SetString( 6, element.value );
|
||||
// dump(" login name - "+ element.value+ "\n");
|
||||
|
||||
element = document.getElementById("dialog.password");
|
||||
param.SetString( 7, element.value );
|
||||
// dump(" password - "+ element.value+ "\n");
|
||||
var element1, element2;
|
||||
var numEditfields = param.GetInt( 3 );
|
||||
if (numEditfields == 2) {
|
||||
var editfield1Password = param.GetInt( 4 );
|
||||
if ( editfield1Password == 1 ) {
|
||||
element1 = document.getElementById("dialog.password1");
|
||||
} else {
|
||||
element1 = document.getElementById("dialog.loginname");
|
||||
}
|
||||
param.SetString( 6, element1.value );
|
||||
element2 = document.getElementById("dialog.password2");
|
||||
param.SetString( 7, element2.value );
|
||||
// dump(" login name - "+ element1.value+ "\n");
|
||||
// dump(" password - "+ element2.value+ "\n");
|
||||
} else if (numEditfields == 1) {
|
||||
var editfield1Password = param.GetInt( 4 );
|
||||
if ( editfield1Password == 1 ) {
|
||||
element1 = document.getElementById("dialog.password1");
|
||||
param.SetString( 6, element1.value );
|
||||
} else {
|
||||
element1 = document.getElementById("dialog.loginname");
|
||||
param.SetString( 6, element1.value );
|
||||
}
|
||||
// dump(" login name - "+ element2.value+ "\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -32,13 +32,18 @@
|
||||
|
||||
<box id="editFields" align="vertical" >
|
||||
<box align="horizontal" id="loginEditField" >
|
||||
<html:div style="min-width: 6em;" id="login.text">&editfield1.label;</html:div>
|
||||
<html:div style="min-width: 6em;" id="login.text">&editfield0.label;</html:div>
|
||||
<html:input accesskey="u" tabindex="0" type="text" id="dialog.loginname" flex="100%"/>
|
||||
</box>
|
||||
|
||||
<box align="horizontal" id ="passwordEditfield">
|
||||
<html:div style="min-width: 6em;" id="password.text">&editfield2.label;</html:div>
|
||||
<html:input accesskey="p" tabindex="1" type="password" id="dialog.password" flex="100%"/>
|
||||
<box align="horizontal" id ="password1EditField">
|
||||
<html:div style="min-width: 6em;" id="password1.text">&editfield1.label;</html:div>
|
||||
<html:input accesskey="p" tabindex="1" type="password" id="dialog.password1" flex="100%"/>
|
||||
</box>
|
||||
|
||||
<box align="horizontal" id ="password2EditField">
|
||||
<html:div style="min-width: 6em;" id="password2.text">&editfield2.label;</html:div>
|
||||
<html:input accesskey="p" tabindex="1" type="password" id="dialog.password2" flex="100%"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<!-- OK Cancel Buttons -->
|
||||
<!ENTITY header.label "Brief Title">
|
||||
<!ENTITY message.label "Some sample Text goes here.">
|
||||
<!ENTITY editfield1.label "User Name:">
|
||||
<!ENTITY editfield2.label "Password:">
|
||||
<!ENTITY editfield0.label "User Name:">
|
||||
<!ENTITY editfield1.label "Password:">
|
||||
<!ENTITY editfield2.label "Confirm Password:">
|
||||
<!ENTITY checkbox.label "check">
|
||||
Loading…
x
Reference in New Issue
Block a user