bug 48076, remove commonDialogs from wallet module, r=dougt

This commit is contained in:
morse%netscape.com 2000-08-09 03:27:32 +00:00
Родитель 6ea350941c
Коммит e4a1d4dec7
1 изменённых файлов: 24 добавлений и 25 удалений

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

@ -38,7 +38,6 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsICommonDialogs.h"
#include "nsIURL.h"
#include "nsFileStream.h"
@ -73,7 +72,6 @@ static NS_DEFINE_IID(kIDOMHTMLOptionElementIID, NS_IDOMHTMLOPTIONELEMENT_IID);
static NS_DEFINE_IID(kIIOServiceIID, NS_IIOSERVICE_IID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
@ -744,22 +742,24 @@ Wallet_Confirm(PRUnichar * szMessage, nsIDOMWindow* window)
PRBool retval = PR_TRUE; /* default value */
nsresult res;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_FAILED(res)) {
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompt(getter_AddRefs(dialog));
if (!dialog) {
return retval;
}
const nsAutoString message = szMessage;
retval = PR_FALSE; /* in case user exits dialog by clicking X */
res = dialog->Confirm(window, nsnull, message.GetUnicode(), &retval);
res = dialog->Confirm(nsnull, message.GetUnicode(), &retval);
return retval;
}
PUBLIC PRBool
Wallet_ConfirmYN(PRUnichar * szMessage, nsIDOMWindow* window) {
nsresult res;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_FAILED(res)) {
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompt(getter_AddRefs(dialog));
if (!dialog) {
return PR_FALSE;
}
@ -769,7 +769,6 @@ Wallet_ConfirmYN(PRUnichar * szMessage, nsIDOMWindow* window) {
PRUnichar * confirm_string = Wallet_Localize("Confirm");
res = dialog->UniversalDialog(
window, /* parent window */
NULL, /* title message */
confirm_string, /* title text in top line of window */
szMessage, /* this is the main message */
@ -799,8 +798,9 @@ PUBLIC PRInt32
Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindow* window)
{
nsresult res;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_FAILED(res)) {
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompt(getter_AddRefs(dialog));
if (!dialog) {
return 0; /* default value is NO */
}
@ -811,7 +811,6 @@ Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindow* window)
PRUnichar * confirm_string = Wallet_Localize("Confirm");
res = dialog->UniversalDialog(
window, /* parent window */
NULL, /* title message */
confirm_string, /* title text in top line of window */
szMessage, /* this is the main message */
@ -844,14 +843,15 @@ PRIVATE void
wallet_Alert(PRUnichar * szMessage, nsIDOMWindow* window)
{
nsresult res;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_FAILED(res)) {
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompt(getter_AddRefs(dialog));
if (!dialog) {
return; // XXX should return the error
}
const nsAutoString message = szMessage;
PRUnichar * title = Wallet_Localize("CaveatTitle");
res = dialog->Alert(window, title, message.GetUnicode());
res = dialog->Alert(title, message.GetUnicode());
Recycle(title);
return; // XXX should return the error
}
@ -872,9 +872,9 @@ Wallet_CheckConfirmYN
(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue,
nsIDOMWindow* window) {
nsresult res;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_FAILED(res)) {
*checkValue = 0;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompt(getter_AddRefs(dialog));
if (!dialog) {
return PR_FALSE;
}
@ -884,7 +884,6 @@ Wallet_CheckConfirmYN
PRUnichar * confirm_string = Wallet_Localize("Confirm");
res = dialog->UniversalDialog(
window, /* parent window */
NULL, /* title message */
confirm_string, /* title text in top line of window */
szMessage, /* this is the main message */