Bug 39416. Made ftp work with single sign-on for more than one user/host.

git-svn-id: svn://10.0.0.236/trunk@70373 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
2000-05-17 07:12:40 +00:00
parent c49a976120
commit 377359d015
14 changed files with 147 additions and 512 deletions

View File

@@ -1866,7 +1866,7 @@ nsDOMWindowPrompter::PromptUsernameAndPassword(const PRUnichar* dialogTitle,
nsresult rv;
nsAutoString title(dialogTitle);
if (title == nsnull)
title.AssignWithConversion("Prompt"); // XXX i18n
title.AssignWithConversion("Username and Password"); // XXX i18n
rv = mCommonDialogs->PromptUsernameAndPassword(mDOMWindow, title.GetUnicode(), text,
user, pwd, _retval);
return rv;
@@ -1884,7 +1884,7 @@ nsDOMWindowPrompter::PromptPassword(const PRUnichar* dialogTitle,
nsresult rv;
nsAutoString title(dialogTitle);
if (title == nsnull)
title.AssignWithConversion("Prompt"); // XXX i18n
title.AssignWithConversion("Password"); // XXX i18n
rv = mCommonDialogs->PromptPassword(mDOMWindow, title.GetUnicode(), text,
pwd, _retval);
return rv;
@@ -1982,272 +1982,3 @@ nsWebShellWindow::GetPrompter(nsIPrompt* *result)
NS_ADDREF(*result);
return NS_OK;
}
#if 0
////////////////////////////////////////////////////////////////////////////////
// nsIPrompt
NS_IMETHODIMP nsWebShellWindow::Alert(const PRUnichar* dialogTitle,
const PRUnichar* text)
{
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);
// todo, put that in a string bundle
nsString defaultTitle; defaultTitle.AssignWithConversion("Alert");
if ( NS_SUCCEEDED( rv ) )
rv = dialog->Alert( domWindow, defaultTitle.GetUnicode(),text );
return rv;
}
NS_IMETHODIMP nsWebShellWindow::Confirm(const PRUnichar* dialogTitle,
const PRUnichar* text,
PRBool *_retval)
{
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;
}
nsString defaultTitle; defaultTitle.AssignWithConversion("Confirm");
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if ( NS_SUCCEEDED( rv ) )
rv = dialog->Confirm( domWindow, defaultTitle.GetUnicode(), text, _retval );
return rv;
}
NS_IMETHODIMP nsWebShellWindow::ConfirmCheck(const PRUnichar* dialogTitle,
const PRUnichar* text,
const PRUnichar* checkMsg,
PRBool *checkValue,
PRBool *_retval)
{
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;
}
// todo, put that in a string bundle
nsString defaultTitle; defaultTitle.AssignWithConversion("Confirm");
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if ( NS_SUCCEEDED( rv ) )
rv =dialog->ConfirmCheck( domWindow,defaultTitle.GetUnicode(), text, checkMsg, checkValue, _retval );
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* dialogTitle,
const PRUnichar* text,
const PRUnichar* passwordRealm,
const PRUnichar* defaultText,
PRUnichar* *result,
PRBool *_retval)
{
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;
}
// todo, put that in a string bundle
nsString defaultTitle; defaultTitle.AssignWithConversion("Prompt");
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if ( NS_SUCCEEDED( rv ) )
rv = dialog->Prompt( domWindow, defaultTitle.GetUnicode(), text, defaultText, result, _retval );
return rv;
}
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const PRUnichar* dialogTitle,
const PRUnichar* text,
const PRUnichar* passwordRealm,
PRBool persistPassword,
PRUnichar* *user,
PRUnichar* *pwd,
PRBool *_retval)
{
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;
}
// todo, put that in a string bundle
nsString defaultTitle; defaultTitle.AssignWithConversion("Prompt Username and Password");
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if ( NS_SUCCEEDED( rv ) )
rv = dialog->PromptUsernameAndPassword( domWindow, defaultTitle.GetUnicode(), text, user, pwd, _retval );
return rv;
}
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const PRUnichar* dialogTitle,
const PRUnichar* text,
const PRUnichar* passwordRealm,
PRBool persistPassword,
PRUnichar* *pwd,
PRBool *_retval)
{
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->PromptPassword( domWindow, dialogTitle, text, pwd, _retval );
return rv;
}
NS_IMETHODIMP nsWebShellWindow::Select( const PRUnichar *inDialogTitle, const PRUnichar* inMsg, PRUint32 inCount, const PRUnichar **inList, PRInt32 *outSelection, PRBool *_retval)
{
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->Select(domWindow, inDialogTitle, inMsg, inCount,inList, outSelection, _retval);
return rv;
}
NS_IMETHODIMP nsWebShellWindow::Alert(const char *key, const PRUnichar *title, const PRUnichar *text)
{
return Alert( text );
}
NS_IMETHODIMP nsWebShellWindow::Confirm(const char *key, const PRUnichar *title, const PRUnichar *text, PRBool *_retval)
{
return Confirm( text, _retval );
}
NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const char *key, const PRUnichar *title, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
{
nsresult res;
NS_WITH_SERVICE(nsIWalletService, wallet, kWalletServiceCID, &res);
if (NS_FAILED(res)) {
return PromptUsernameAndPassword(text, user, pwd, _retval);
}
nsCOMPtr<nsIPrompt> prompter = this;
return wallet->PromptUsernameAndPassword(text, user, pwd, key, prompter, PR_TRUE, _retval);
}
NS_IMETHODIMP nsWebShellWindow::PromptPassword(const char *key, const PRUnichar *title, const PRUnichar *text, PRUnichar **pwd, PRBool *_retval)
{
nsresult res;
NS_WITH_SERVICE(nsIWalletService, wallet, kWalletServiceCID, &res);
if (NS_FAILED(res)) {
return PromptPassword(text, title, pwd, _retval);
}
nsCOMPtr<nsIPrompt> prompter = this;
return wallet->PromptPassword(text, pwd, key, prompter, PR_TRUE, _retval);
}
NS_IMETHODIMP nsWebShellWindow::Prompt(const char *key, const PRUnichar *title, const PRUnichar *text, PRUnichar **value, PRBool *_retval)
{
nsresult res;
NS_WITH_SERVICE(nsIWalletService, wallet, kWalletServiceCID, &res);
if (NS_FAILED(res)) {
return Prompt(text, title, value, _retval);
}
nsCOMPtr<nsIPrompt> prompter = this;
return wallet->Prompt(text, nsnull, value, key, prompter, _retval);
}
#endif