commondialog service is being replaced by promptservice. bug 72112 continues

This commit is contained in:
danm%netscape.com 2001-04-09 01:35:41 +00:00
Родитель 4bb6451a4a
Коммит d881c56eac
17 изменённых файлов: 117 добавлений и 125 удалений

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

@ -29,7 +29,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = editor
LIBRARY_NAME = editor
IS_COMPONENT = 1
REQUIRES = xpcom string dom js locale layout uriloader widget txmgr htmlparser necko pref view appshell rdf webshell timer txtsvc intl lwbrk docshell chrome caps appcomps xuldoc gfx2 mozcomps
REQUIRES = xpcom string dom js locale layout uriloader widget txmgr htmlparser necko pref view appshell rdf webshell timer txtsvc intl lwbrk docshell chrome caps appcomps xuldoc gfx2 mozcomps windowwatcher
CPPSRCS = \
ChangeAttributeTxn.cpp \

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

@ -80,7 +80,9 @@
#include "nsIFilePicker.h"
#include "nsIFindComponent.h"
#include "nsIPrompt.h"
#include "nsICommonDialogs.h"
#include "nsIDialogParamBlock.h"
#include "nsIPromptService.h"
#include "nsPIPromptService.h"
#include "nsIEditorController.h"
//#include "nsEditorController.h"
@ -138,8 +140,6 @@
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID);
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
@ -1740,8 +1740,8 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
if (!mMailCompose && (!saveAsText && mEditorType == eHTMLTextEditorType) && (title.Length() == 0))
{
// Use a "prompt" common dialog to get title string from user
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_SUCCEEDED(res))
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
PRUnichar *titleUnicode;
nsAutoString captionStr, msgStr1, msgStr2;
@ -1755,11 +1755,11 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
PRBool retVal = PR_FALSE;
if(!mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return NS_ERROR_NOT_INITIALIZED;
res = dialog->Prompt(cwP, captionStr.GetUnicode(), msgStr1.GetUnicode(),
title.GetUnicode(), &titleUnicode, &retVal);
title.GetUnicode(), 0, 0, &titleUnicode, &retVal);
if( retVal == PR_FALSE)
{
@ -2827,17 +2827,17 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti
const nsString *aYesString, const nsString *aNoString)
{
nsEditorShell::EConfirmResult result = nsEditorShell::eCancel;
nsIDialogParamBlock* block = NULL;
nsresult rv = nsComponentManager::CreateInstance(kDialogParamBlockCID, 0,
NS_GET_IID(nsIDialogParamBlock),
nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1",
0, NS_GET_IID(nsIDialogParamBlock),
(void**)&block );
if ( NS_SUCCEEDED(rv) )
{
// Stuff in Parameters
block->SetString( nsICommonDialogs::eMsg, aQuestion.GetUnicode());
block->SetString( nsIPromptService::eMsg, aQuestion.GetUnicode());
nsAutoString url; url.AssignWithConversion( "chrome://global/skin/question-icon.gif" );
block->SetString( nsICommonDialogs::eIconURL, url.GetUnicode());
block->SetString( nsIPromptService::eIconURL, url.GetUnicode());
nsAutoString yesStr, noStr;
// Default is Yes, No, Cancel
@ -2851,34 +2851,34 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti
if (aNoString && aNoString->Length() > 0)
{
noStr.Assign(*aNoString);
block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() );
block->SetString( nsIPromptService::eButton2Text, noStr.GetUnicode() );
}
else
{
// No string for "No" means we only want Yes, Cancel
numberOfButtons = 2;
}
block->SetInt( nsICommonDialogs::eNumberButtons, numberOfButtons );
block->SetInt( nsIPromptService::eNumberButtons, numberOfButtons );
nsAutoString cancelStr;
GetBundleString(NS_LITERAL_STRING("Cancel"), cancelStr);
block->SetString( nsICommonDialogs::eDialogTitle, aTitle.GetUnicode() );
block->SetString( nsIPromptService::eDialogTitle, aTitle.GetUnicode() );
//Note: "button0" is always Ok or Yes action, "button1" is Cancel
block->SetString( nsICommonDialogs::eButton0Text, yesStr.GetUnicode() );
block->SetString( nsICommonDialogs::eButton1Text, cancelStr.GetUnicode() );
block->SetString( nsIPromptService::eButton0Text, yesStr.GetUnicode() );
block->SetString( nsIPromptService::eButton1Text, cancelStr.GetUnicode() );
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if ( NS_SUCCEEDED( rv ) )
nsCOMPtr<nsPIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
PRInt32 buttonPressed = 0;
if(!mContentWindow)
return result;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return result;
rv = dialog->DoDialog( cwP, block, "chrome://global/content/commonDialog.xul" );
block->GetInt( nsICommonDialogs::eButtonPressed, &buttonPressed );
// NOTE: If order of buttons changes in nsICommonDialogs,
block->GetInt( nsIPromptService::eButtonPressed, &buttonPressed );
// NOTE: If order of buttons changes in nsIPromptService,
// then we must change the EConfirmResult enums in nsEditorShell.h
result = nsEditorShell::EConfirmResult(buttonPressed);
}
@ -2894,12 +2894,12 @@ nsEditorShell::Confirm(const nsString& aTitle, const nsString& aQuestion)
nsresult rv;
PRBool result = PR_FALSE;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv) && dialog)
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
if(!mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return NS_ERROR_NOT_INITIALIZED;
rv = dialog->Confirm(cwP, aTitle.GetUnicode(), aQuestion.GetUnicode(), &result);
}
@ -2913,12 +2913,12 @@ nsEditorShell::AlertWithTitle(const PRUnichar *aTitle, const PRUnichar *aMsg)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_ERROR_FAILURE;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv) && dialog)
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
if(!mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return NS_ERROR_NOT_INITIALIZED;
rv = dialog->Alert(cwP, aTitle, aMsg);
}
@ -2930,12 +2930,12 @@ void
nsEditorShell::Alert(const nsString& aTitle, const nsString& aMsg)
{
nsresult rv;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv) && dialog)
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
if(!mContentWindow)
return;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return;
rv = dialog->Alert(cwP, aTitle.GetUnicode(), aMsg.GetUnicode());
}

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

@ -80,7 +80,9 @@
#include "nsIFilePicker.h"
#include "nsIFindComponent.h"
#include "nsIPrompt.h"
#include "nsICommonDialogs.h"
#include "nsIDialogParamBlock.h"
#include "nsIPromptService.h"
#include "nsPIPromptService.h"
#include "nsIEditorController.h"
//#include "nsEditorController.h"
@ -138,8 +140,6 @@
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID);
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
@ -1740,8 +1740,8 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
if (!mMailCompose && (!saveAsText && mEditorType == eHTMLTextEditorType) && (title.Length() == 0))
{
// Use a "prompt" common dialog to get title string from user
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res);
if (NS_SUCCEEDED(res))
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
PRUnichar *titleUnicode;
nsAutoString captionStr, msgStr1, msgStr2;
@ -1755,11 +1755,11 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
PRBool retVal = PR_FALSE;
if(!mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return NS_ERROR_NOT_INITIALIZED;
res = dialog->Prompt(cwP, captionStr.GetUnicode(), msgStr1.GetUnicode(),
title.GetUnicode(), &titleUnicode, &retVal);
title.GetUnicode(), 0, 0, &titleUnicode, &retVal);
if( retVal == PR_FALSE)
{
@ -2827,17 +2827,17 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti
const nsString *aYesString, const nsString *aNoString)
{
nsEditorShell::EConfirmResult result = nsEditorShell::eCancel;
nsIDialogParamBlock* block = NULL;
nsresult rv = nsComponentManager::CreateInstance(kDialogParamBlockCID, 0,
NS_GET_IID(nsIDialogParamBlock),
nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1",
0, NS_GET_IID(nsIDialogParamBlock),
(void**)&block );
if ( NS_SUCCEEDED(rv) )
{
// Stuff in Parameters
block->SetString( nsICommonDialogs::eMsg, aQuestion.GetUnicode());
block->SetString( nsIPromptService::eMsg, aQuestion.GetUnicode());
nsAutoString url; url.AssignWithConversion( "chrome://global/skin/question-icon.gif" );
block->SetString( nsICommonDialogs::eIconURL, url.GetUnicode());
block->SetString( nsIPromptService::eIconURL, url.GetUnicode());
nsAutoString yesStr, noStr;
// Default is Yes, No, Cancel
@ -2851,34 +2851,34 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti
if (aNoString && aNoString->Length() > 0)
{
noStr.Assign(*aNoString);
block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() );
block->SetString( nsIPromptService::eButton2Text, noStr.GetUnicode() );
}
else
{
// No string for "No" means we only want Yes, Cancel
numberOfButtons = 2;
}
block->SetInt( nsICommonDialogs::eNumberButtons, numberOfButtons );
block->SetInt( nsIPromptService::eNumberButtons, numberOfButtons );
nsAutoString cancelStr;
GetBundleString(NS_LITERAL_STRING("Cancel"), cancelStr);
block->SetString( nsICommonDialogs::eDialogTitle, aTitle.GetUnicode() );
block->SetString( nsIPromptService::eDialogTitle, aTitle.GetUnicode() );
//Note: "button0" is always Ok or Yes action, "button1" is Cancel
block->SetString( nsICommonDialogs::eButton0Text, yesStr.GetUnicode() );
block->SetString( nsICommonDialogs::eButton1Text, cancelStr.GetUnicode() );
block->SetString( nsIPromptService::eButton0Text, yesStr.GetUnicode() );
block->SetString( nsIPromptService::eButton1Text, cancelStr.GetUnicode() );
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if ( NS_SUCCEEDED( rv ) )
nsCOMPtr<nsPIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
PRInt32 buttonPressed = 0;
if(!mContentWindow)
return result;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return result;
rv = dialog->DoDialog( cwP, block, "chrome://global/content/commonDialog.xul" );
block->GetInt( nsICommonDialogs::eButtonPressed, &buttonPressed );
// NOTE: If order of buttons changes in nsICommonDialogs,
block->GetInt( nsIPromptService::eButtonPressed, &buttonPressed );
// NOTE: If order of buttons changes in nsIPromptService,
// then we must change the EConfirmResult enums in nsEditorShell.h
result = nsEditorShell::EConfirmResult(buttonPressed);
}
@ -2894,12 +2894,12 @@ nsEditorShell::Confirm(const nsString& aTitle, const nsString& aQuestion)
nsresult rv;
PRBool result = PR_FALSE;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv) && dialog)
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
if(!mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return NS_ERROR_NOT_INITIALIZED;
rv = dialog->Confirm(cwP, aTitle.GetUnicode(), aQuestion.GetUnicode(), &result);
}
@ -2913,12 +2913,12 @@ nsEditorShell::AlertWithTitle(const PRUnichar *aTitle, const PRUnichar *aMsg)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_ERROR_FAILURE;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv) && dialog)
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
if(!mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return NS_ERROR_NOT_INITIALIZED;
rv = dialog->Alert(cwP, aTitle, aMsg);
}
@ -2930,12 +2930,12 @@ void
nsEditorShell::Alert(const nsString& aTitle, const nsString& aMsg)
{
nsresult rv;
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv) && dialog)
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
if(!mContentWindow)
return;
nsCOMPtr<nsIDOMWindowInternal> cwP = do_QueryReferent(mContentWindow);
nsCOMPtr<nsIDOMWindow> cwP = do_QueryReferent(mContentWindow);
if (!cwP) return;
rv = dialog->Alert(cwP, aTitle.GetUnicode(), aMsg.GetUnicode());
}

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

@ -30,7 +30,7 @@ MODULE = p3p
LIBRARY_NAME = p3p
IS_COMPONENT = 1
REQUIRES = p3p xpcom
REQUIRES = p3p xpcom windowwatcher
CPPSRCS = \
nsP3PModule.cpp \

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

@ -47,13 +47,10 @@
#include <nsIScriptGlobalObject.h>
#include <nsIScriptGlobalObjectOwner.h>
#include <nsIPrompt.h>
#include <nsICommonDialogs.h>
#include <prmem.h>
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
NS_IMPL_ISUPPORTS4( nsP3PUI, nsIP3PUI,
nsIP3PCUI,
nsIWebProgressListener,

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

@ -31,14 +31,14 @@
#include <nsIScriptGlobalObject.h>
#include <nsIScriptGlobalObjectOwner.h>
#include <nsLayoutCID.h>
#include <nsICommonDialogs.h>
#include <nsIPromptService.h>
#include <nsIDOMWindow.h>
// ****************************************************************************
// nsP3PUIService Implementation routines
// ****************************************************************************
static NS_DEFINE_CID( kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID );
static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID );
// P3P UI Service generic factory constructor
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT( nsP3PUIService, Init );
@ -369,8 +369,8 @@ nsP3PUIService::WarningNotPrivate(nsIDOMWindowInternal * aDOMWindowInternal)
mPrefServ->GetBoolPref( P3P_PREF_WARNINGNOTPRIVATE, &bWarnPref );
if (bWarnPref) {
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog) {
nsAutoString windowTitle, message, showAgain;
@ -378,8 +378,9 @@ nsP3PUIService::WarningNotPrivate(nsIDOMWindowInternal * aDOMWindowInternal)
mP3PService->GetLocaleString( "WarningNotPrivate", message );
mP3PService->GetLocaleString( "ShowAgain", showAgain );
nsCOMPtr<nsIDOMWindow> parent(do_QueryInterface(aDOMWindowInternal));
PRBool outCheckValue = PR_TRUE;
dialog->AlertCheck( aDOMWindowInternal,
dialog->AlertCheck( parent,
windowTitle.GetUnicode(),
message.GetUnicode(),
showAgain.GetUnicode(),
@ -421,8 +422,8 @@ nsP3PUIService::WarningPartialPrivacy(nsIDOMWindowInternal * aDOMWindowInternal)
mPrefServ->GetBoolPref( P3P_PREF_WARNINGPARTIALPRIVACY, &bWarnPref );
if (bWarnPref) {
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog) {
nsAutoString windowTitle, message, showAgain;
@ -431,7 +432,8 @@ nsP3PUIService::WarningPartialPrivacy(nsIDOMWindowInternal * aDOMWindowInternal)
mP3PService->GetLocaleString( "ShowAgain", showAgain );
PRBool outCheckValue = PR_TRUE;
dialog->AlertCheck( aDOMWindowInternal,
nsCOMPtr<nsIDOMWindow> parent(do_QueryInterface(aDOMWindowInternal));
dialog->AlertCheck( parent,
windowTitle.GetUnicode(),
message.GetUnicode(),
showAgain.GetUnicode(),
@ -459,8 +461,8 @@ nsP3PUIService::WarningPostToNotPrivate(nsIDOMWindowInternal * aDOMWindowInterna
mPrefServ->GetBoolPref( P3P_PREF_WARNINGPOSTTONOTPRIVATE, &bWarnPref );
if (bWarnPref) {
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog) {
nsAutoString windowTitle, message, showAgain;
@ -469,6 +471,7 @@ nsP3PUIService::WarningPostToNotPrivate(nsIDOMWindowInternal * aDOMWindowInterna
mP3PService->GetLocaleString( "ShowAgain", showAgain );
PRBool outCheckValue = PR_TRUE;
nsCOMPtr<nsIDOMWindow> parent(do_QueryInterface(aDOMWindowInternal));
dialog->ConfirmCheck( aDOMWindowInternal,
windowTitle.GetUnicode(),
message.GetUnicode(),
@ -498,8 +501,8 @@ nsP3PUIService::WarningPostToBrokenPolicy(nsIDOMWindowInternal * aDOMWindowInter
mPrefServ->GetBoolPref( P3P_PREF_WARNINGPOSTTOBROKENPOLICY, &bWarn2Pref );
if (bWarn2Pref) {
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog) {
nsAutoString windowTitle, message, showAgain;
@ -508,6 +511,7 @@ nsP3PUIService::WarningPostToBrokenPolicy(nsIDOMWindowInternal * aDOMWindowInter
mP3PService->GetLocaleString( "ShowAgain", showAgain );
PRBool outCheckValue = PR_TRUE;
nsCOMPtr<nsIDOMWindow> parent(do_QueryInterface(aDOMWindowInternal));
dialog->ConfirmCheck( aDOMWindowInternal,
windowTitle.GetUnicode(),
message.GetUnicode(),
@ -537,8 +541,8 @@ nsP3PUIService::WarningPostToNoPolicy(nsIDOMWindowInternal * aDOMWindowInternal,
mPrefServ->GetBoolPref( P3P_PREF_WARNINGPOSTTONOPOLICY, &bWarn3Pref );
if (bWarn3Pref) {
NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog) {
nsAutoString windowTitle, message, showAgain;
@ -547,7 +551,8 @@ nsP3PUIService::WarningPostToNoPolicy(nsIDOMWindowInternal * aDOMWindowInternal,
mP3PService->GetLocaleString( "ShowAgain", showAgain );
PRBool outCheckValue = PR_TRUE;
dialog->ConfirmCheck( aDOMWindowInternal,
nsCOMPtr<nsIDOMWindow> parent(do_QueryInterface(aDOMWindowInternal));
dialog->ConfirmCheck( parent,
windowTitle.GetUnicode(),
message.GetUnicode(),
showAgain.GetUnicode(),

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

@ -58,7 +58,6 @@
#include "nsISecurityEventSink.h"
#include "nsIPrompt.h"
#include "nsICommonDialogs.h"
#include "nsIPref.h"
#include "nsIFormSubmitObserver.h"
@ -68,7 +67,6 @@
#include "nsSSLIOLayer.h"
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define ENTER_SITE_PREF "security.warn_entering_secure"

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

@ -29,7 +29,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = prefmigr
LIBRARY_NAME = nsprefm
IS_COMPONENT = 1
REQUIRES = xpcom string pref appshell intl docshell dom necko rdf js layout locale uriloader widget webbrwsr uconv gfx2 mozcomps
REQUIRES = xpcom string pref appshell intl docshell dom necko rdf js layout locale uriloader widget webbrwsr uconv gfx2 mozcomps windowwatcher
CPPSRCS = \
nsPrefMigration.cpp \

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

@ -27,9 +27,9 @@
#include "nsRepository.h"
#include "nsIAppShellComponentImpl.h"
#include "nsIComponentManager.h"
#include "nsIDialogParamBlock.h"
#include "nsIServiceManager.h"
#include "nsIWindowMediator.h"
#include "nsICommonDialogs.h"
#include "nsIScriptGlobalObject.h"
#include "nsSpecialSystemDirectory.h"
#include "nsFileStream.h"
@ -227,8 +227,6 @@ static NS_DEFINE_IID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID);
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
@ -489,7 +487,7 @@ nsPrefMigration::ShowSpaceDialog(PRInt32 *choice)
// list to the dialog
//-----------------------------------------------------
nsCOMPtr<nsIDialogParamBlock> ioParamBlock;
rv = nsComponentManager::CreateInstance(kDialogParamBlockCID,
rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1",
nsnull,
NS_GET_IID(nsIDialogParamBlock),
getter_AddRefs(ioParamBlock));

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

@ -30,7 +30,6 @@
#include "nsFileSpec.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsICommonDialogs.h"
#include "nsCOMPtr.h"
#include "nsIDOMWindowInternal.h"
#include "nsIFileSpec.h"

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

@ -71,7 +71,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsIBaseWindow.h"
#include "nsICommonDialogs.h"
#include "nsIDialogParamBlock.h"
#include "nsIDOMWindowInternal.h"
#include "nsIWindowMediator.h"
@ -114,10 +114,8 @@
// we want everyone to have the debugging info to the console for now
// to help track down profile manager problems
// when we ship, we'll turn this off
#define DEBUG_profile 1
#undef DEBUG_profile_verbose
#ifdef DEBUG_seth
#define DEBUG_profile_verbose 1
#endif
// ProfileAccess varaible (gProfileDataAccess) to access registry operations
@ -159,7 +157,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
static NS_DEFINE_CID(kPrefConverterCID, NS_PREFCONVERTER_CID);
static NS_DEFINE_IID(kCookieServiceCID, NS_COOKIESERVICE_CID);
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID);
@ -2007,7 +2004,7 @@ nsProfile::ShowProfileWizard(void)
// list to the dialog
//-----------------------------------------------------
nsCOMPtr<nsIDialogParamBlock> ioParamBlock;
rv = nsComponentManager::CreateInstance(kDialogParamBlockCID,
rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1",
nsnull,
NS_GET_IID(nsIDialogParamBlock),
getter_AddRefs(ioParamBlock));

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

@ -150,9 +150,7 @@ static NS_DEFINE_CID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
#ifdef DEBUG_rods
#define DEBUG_MENUSDEL 1
#endif
#include "nsICommonDialogs.h"
static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID );
#include "nsIWebShell.h"
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);

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

@ -34,11 +34,9 @@
#include "rdf.h"
#include "nsIWindowMediator.h"
#include "nsICommonDialogs.h"
#include "nsIDialogParamBlock.h"
// #include "nsAbout.h"
#include "nsIAboutModule.h"
static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID );
#ifdef XP_OS2
#define WIDGET_DLL "WDGTOS2"
@ -87,7 +85,6 @@ static NS_DEFINE_CID(kCCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
static NS_DEFINE_CID(kXPConnectFactoryCID, NS_XPCONNECTFACTORY_CID);
static NS_DEFINE_CID(kProtocolHelperCID, NS_PROTOCOL_HELPER_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_CID( kDialogParamBlockCID, NS_DialogParamBlock_CID );
#define NS_ABOUT_CID \
{ /* {1f1ce501-663a-11d3-b7a0-be426e4e69bc} */ \
0x1f1ce501, 0x663a, 0x11d3, { 0xb7, 0xa0, 0xbe, 0x42, 0x6e, 0x4e, 0x69, 0xbc } \

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

@ -27,7 +27,7 @@
#include "nsWindowsHooksUtil.cpp"
#include "nsIDOMWindowInternal.h"
#include "nsIServiceManager.h"
#include "nsICommonDialogs.h"
#include "nsIPromptService.h"
#include "nsIStringBundle.h"
#include "nsIAllocator.h"
#include "nsICmdLineService.h"
@ -273,12 +273,11 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent ) {
// o We need the common dialog service to show the dialog.
// o We need the string bundle service to fetch the appropriate
// dialog text.
nsCID commonDlgCID = NS_CommonDialog_CID;
nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID;
nsCOMPtr<nsICommonDialogs> commonDlgService( do_GetService( commonDlgCID, &rv ) );
nsCOMPtr<nsIPromptService> promptService( do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIStringBundleService> bundleService( do_GetService( bundleCID, &rv ) );
if ( commonDlgService && bundleService ) {
if ( promptService && bundleService ) {
// Next, get bundle that provides text for dialog.
nsILocale *locale = 0;
nsIStringBundle *bundle;
@ -326,7 +325,7 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent ) {
// o Cancel
// o No
// because UniversalDialog will move "Cancel" to the right.
rv = commonDlgService->UniversalDialog( aParent,
rv = promptService->UniversalDialog( aParent,
0, // title
title, // dlg title
text, // dlg text

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

@ -33,7 +33,7 @@ MODULE = xpinstall
LIBRARY_NAME = xpinstall
SHORT_LIBNAME = xpinstal
IS_COMPONENT = 1
REQUIRES = xpcom string jar chrome necko intl locale libreg js pref appshell widget layout uriloader xpconnect docshell dom gfx2 mozcomps
REQUIRES = xpcom string jar chrome necko intl locale libreg js pref appshell widget layout uriloader xpconnect docshell dom gfx2 mozcomps windowwatcher
# XXX shouldn't need to export this
EXPORTS = nsXPITriggerInfo.h

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

@ -62,7 +62,7 @@
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "nsICommonDialogs.h"
#include "nsIPromptService.h"
#include "nsIPrompt.h"
#ifdef _WINDOWS
@ -94,8 +94,6 @@ static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_IID(kIStringBundleServiceIID, NS_ISTRINGBUNDLESERVICE_IID);
@ -2481,7 +2479,7 @@ void nsInstall::SetInstallURL(const nsString& url) { mInstallURL = url; }
//-----------------------------------------------------------------------------
// GetTranslatedString :
// This is a utility function that translates "Alert" or
// "Confirm" to pass as the title to the CommonDialogs Alert and Confirm
// "Confirm" to pass as the title to the PromptService Alert and Confirm
// functions as the title. If you pass nsnull as the title, you get garbage
// instead of a blank title.
//-----------------------------------------------------------------------------
@ -2504,15 +2502,18 @@ PRUnichar *GetTranslatedString(const PRUnichar* aString)
PRInt32
nsInstall::Alert(nsString& string)
{
nsresult res;
NS_WITH_PROXIED_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, NS_UI_THREAD_EVENTQ, &res);
if (NS_FAILED(res))
return res;
nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> proxiedDialog;
if (proxyman && dialog)
proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIPromptService),
dialog, PROXY_SYNC, getter_AddRefs(proxiedDialog));
if (!proxiedDialog)
return NS_ERROR_FAILURE;
PRUnichar *title = GetTranslatedString(NS_ConvertASCIItoUCS2("Alert").get());
return dialog->Alert(mParent, title, string.GetUnicode());
return proxiedDialog->Alert(mParent, title, string.GetUnicode());
}
PRInt32
@ -2520,10 +2521,14 @@ nsInstall::Confirm(nsString& string, PRBool* aReturn)
{
*aReturn = PR_FALSE; /* default value */
nsresult res;
NS_WITH_PROXIED_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, NS_UI_THREAD_EVENTQ, &res);
if (NS_FAILED(res))
return res;
nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
nsCOMPtr<nsIPromptService> proxiedDialog;
if (proxyman && dialog)
proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIPromptService),
dialog, PROXY_SYNC, getter_AddRefs(proxiedDialog));
if (!proxiedDialog)
return NS_ERROR_FAILURE;
PRUnichar *title = GetTranslatedString(NS_ConvertASCIItoUCS2("Confirm").get());

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

@ -59,7 +59,7 @@
#include "nsProxiedService.h"
#include "nsIAppShellComponentImpl.h"
#include "nsICommonDialogs.h"
#include "nsIPromptService.h"
#include "nsIScriptGlobalObject.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -67,7 +67,6 @@ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID );
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kCommonDialogCID, NS_CommonDialog_CID);
#include "nsIEventQueueService.h"
@ -359,8 +358,8 @@ PRBool nsXPInstallManager::ConfirmChromeInstall(nsIScriptGlobalObject* aGlobalOb
nsCOMPtr<nsIDOMWindowInternal> parentWindow(do_QueryInterface(aGlobalObject));
if (parentWindow)
{
NS_WITH_SERVICE(nsICommonDialogs, dlgService, kCommonDialogCID, &rv);
if (NS_SUCCEEDED(rv))
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dlgService)
{
rv = dlgService->ConfirmCheck( parentWindow,
nsnull,