moving new nsIPromptService to WindowWatcher lib. adding nsIPrompt creator. bug 72112 continued. r=ccarlen,hyatt,pinkerton
This commit is contained in:
Родитель
5f87642a56
Коммит
df835bda3b
|
@ -745,9 +745,6 @@ embedding/browser/photon/src/Makefile
|
|||
embedding/browser/photon/tests/Makefile
|
||||
embedding/components/Makefile
|
||||
embedding/components/build/Makefile
|
||||
embedding/components/promptservice/Makefile
|
||||
embedding/components/promptservice/public/Makefile
|
||||
embedding/components/promptservice/src/Makefile
|
||||
embedding/components/windowwatcher/Makefile
|
||||
embedding/components/windowwatcher/public/Makefile
|
||||
embedding/components/windowwatcher/src/Makefile
|
||||
|
|
|
@ -24,6 +24,6 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = promptservice windowwatcher appstartup build
|
||||
DIRS = windowwatcher appstartup build
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -27,13 +27,12 @@ MODULE = embedcomponents
|
|||
LIBRARY_NAME = embedcomponents
|
||||
SHORT_LIBNAME = embedcmp
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = js xpcom string promptservice windowwatcher embed_base
|
||||
REQUIRES = js xpcom string windowwatcher embed_base
|
||||
|
||||
CPPSRCS = nsModule.cpp
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
EXTRA_DSO_LIBS = \
|
||||
promptservice_s \
|
||||
windowwatcher_s \
|
||||
appstartupnotifier_s \
|
||||
$(NULL)
|
||||
|
@ -46,7 +45,6 @@ endif
|
|||
else
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/libpromptservice_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libwindowwatcher_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libappstartupnotifier_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
@ -58,7 +56,6 @@ endif
|
|||
endif
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../promptservice/src \
|
||||
-I$(srcdir)/../windowwatcher/src \
|
||||
-I$(srcdir)/../appstartup/src \
|
||||
$(NULL)
|
||||
|
|
|
@ -35,13 +35,11 @@ LLIBS = \
|
|||
$(LIBNSPR) \
|
||||
$(DIST)\lib\js3250.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\promptservice_s.lib \
|
||||
$(DIST)\lib\windowwatcher_s.lib \
|
||||
$(DIST)\lib\appstartupnotifier_s.lib \
|
||||
$(NULL)
|
||||
|
||||
INCS = $(INCS) \
|
||||
-I$(DEPTH)\embedding\components\promptservice\src \
|
||||
-I$(DEPTH)\embedding\components\windowwatcher\src \
|
||||
-I$(DEPTH)\embedding\components\appstartup\src \
|
||||
$(NULL)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
DEPTH=..\..
|
||||
|
||||
DIRS= \
|
||||
promptservice \
|
||||
windowwatcher \
|
||||
appstartup \
|
||||
build \
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
nsIPromptService.idl
|
||||
nsIWindowWatcher.idl
|
||||
nsPIWindowWatcher.idl
|
||||
|
|
|
@ -29,7 +29,8 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = windowwatcher
|
||||
XPIDL_MODULE = windowwatcher
|
||||
|
||||
XPIDLSRCS = nsIWindowWatcher.idl \
|
||||
XPIDLSRCS = nsIPromptService.idl \
|
||||
nsIWindowWatcher.idl \
|
||||
nsPIWindowWatcher.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ DEPTH=..\..\..\..
|
|||
MODULE=windowwatcher
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIPromptService.idl \
|
||||
.\nsIWindowWatcher.idl \
|
||||
.\nsPIWindowWatcher.idl \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/* This is the interface to the embeddable prompt service; the service
|
||||
that implements nsIPrompt. Its interface is designed to be just
|
||||
nsIPrompt, each method modified to take a parent window parameter.
|
||||
See nsIPrompt for all documentation and ancillary documentation.
|
||||
|
||||
One note: in all cases, the parent window parameter can be null.
|
||||
However, these windows are all intended to have parents. So when
|
||||
no parent is specified, the implementation should try hard to find
|
||||
a suitable foster parent. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, uuid(1630C61A-325E-49ca-8759-A31B16C47AA5)]
|
||||
interface nsIPromptService : nsISupports
|
||||
{
|
||||
%{C++
|
||||
enum {eMsg=0, eCheckboxMsg=1, eIconURL=2, eTitleMessage=3, eEditfield1Msg=4,
|
||||
eEditfield2Msg=5, eEditfield1Value=6, eEditfield2Value=7,
|
||||
eButton0Text=8, eButton1Text=9, eButton2Text=10, eButton3Text=11,
|
||||
eDialogTitle=12};
|
||||
enum {eButtonPressed=0, eCheckboxState=1, eNumberButtons=2,
|
||||
eNumberEditfields=3, eEditField1Password=4};
|
||||
%}
|
||||
|
||||
void alert(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text);
|
||||
|
||||
void alertCheck(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring checkMsg,
|
||||
out boolean checkValue);
|
||||
|
||||
boolean confirm(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text);
|
||||
|
||||
boolean confirmCheck(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring checkMsg,
|
||||
out boolean checkValue);
|
||||
|
||||
boolean prompt(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring passwordRealm,
|
||||
in PRUint32 savePassword,
|
||||
in wstring defaultText,
|
||||
out wstring result);
|
||||
|
||||
boolean promptUsernameAndPassword(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring passwordRealm,
|
||||
in PRUint32 savePassword,
|
||||
out wstring user,
|
||||
out wstring pwd);
|
||||
|
||||
boolean promptPassword(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring passwordRealm,
|
||||
in PRUint32 savePassword,
|
||||
out wstring pwd);
|
||||
|
||||
boolean select(in nsIDOMWindow parent,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in PRUint32 count,
|
||||
[array, size_is(count)] in wstring selectList,
|
||||
out long outSelection);
|
||||
|
||||
void universalDialog(in nsIDOMWindow parent,
|
||||
in wstring titleMessage,
|
||||
in wstring dialogTitle,
|
||||
in wstring text,
|
||||
in wstring checkboxMsg,
|
||||
in wstring button0Text,
|
||||
in wstring button1Text,
|
||||
in wstring button2Text,
|
||||
in wstring button3Text,
|
||||
in wstring editfield1Msg,
|
||||
in wstring editfield2Msg,
|
||||
inout wstring editfield1Value,
|
||||
inout wstring editfield2Value,
|
||||
in wstring iconURL,
|
||||
inout boolean checkboxState,
|
||||
in PRInt32 numberButtons,
|
||||
in PRInt32 numberEditfields,
|
||||
in PRInt32 editField1Password,
|
||||
out PRInt32 buttonPressed);
|
||||
};
|
||||
|
||||
%{C++
|
||||
// {1630C61A-325E-49ca-8759-A31B16C47AA5}
|
||||
#define NS_PROMPTSERVICE_IID \
|
||||
{0x1630C61A, 0x325E, 0x49ca, {0x87, 0x59, 0xA3, 0x1B, 0x16, 0xC4, 0x7A, 0xA5}}
|
||||
%}
|
||||
|
|
@ -45,6 +45,7 @@ and that windows remove themselves from the service when they are closed.
|
|||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIObserver;
|
||||
interface nsIPrompt;
|
||||
interface nsISimpleEnumerator;
|
||||
interface nsIWindowCreator;
|
||||
|
||||
|
@ -101,6 +102,13 @@ interface nsIWindowWatcher : nsISupports {
|
|||
|
||||
nsISimpleEnumerator getWindowEnumerator();
|
||||
|
||||
/** Return a newly created nsIPrompt implementation.
|
||||
@param aParent the parent window used for posing alerts. can be null.
|
||||
@return a new nsIPrompt object
|
||||
*/
|
||||
|
||||
nsIPrompt getNewPrompter(in nsIDOMWindow aParent);
|
||||
|
||||
/** Set the window creator callback. It must be filled in by the app.
|
||||
openWindow will use it to create new windows.
|
||||
@param creator the callback. if null, the callback will be cleared
|
||||
|
|
|
@ -26,9 +26,11 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = embedcomponents
|
||||
LIBRARY_NAME = windowwatcher_s
|
||||
REQUIRES = xpcom string dom windowwatcher widget js xpconnect caps layout uriloader necko docshell locale webbrwsr embed_base gfx2
|
||||
REQUIRES = xpcom string dom windowwatcher widget js xpconnect caps layout uriloader necko docshell locale webbrwsr embed_base gfx2 wallet
|
||||
|
||||
CPPSRCS = nsWWJSUtils.cpp \
|
||||
CPPSRCS = nsPrompt.cpp \
|
||||
nsPromptService.cpp \
|
||||
nsWWJSUtils.cpp \
|
||||
nsWindowWatcher.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ MODULE=embedcomponents
|
|||
LIBRARY_NAME=windowwatcher_s
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsPrompt.obj \
|
||||
.\$(OBJDIR)\nsPromptService.obj \
|
||||
.\$(OBJDIR)\nsWWJSUtils.obj \
|
||||
.\$(OBJDIR)\nsWindowWatcher.obj \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsILocale.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsPrompt.h"
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kSingleSignOnPromptCID, NS_SINGLESIGNONPROMPT_CID);
|
||||
|
||||
#define kWebShellLocaleProperties "chrome://global/locale/commonDialogs.properties"
|
||||
|
||||
class AutoStringFree {
|
||||
|
||||
public:
|
||||
AutoStringFree() : mString(0) { }
|
||||
~AutoStringFree() { if (mString) nsCRT::free(mString); }
|
||||
void TakeString(PRUnichar *aString) {
|
||||
if (mString) nsCRT::free(mString);
|
||||
mString = aString;
|
||||
}
|
||||
|
||||
private:
|
||||
PRUnichar *mString;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewPrompter(nsIPrompt **result, nsIDOMWindow *aParent)
|
||||
{
|
||||
nsresult rv;
|
||||
*result = 0;
|
||||
|
||||
nsPrompt *prompter = new nsPrompt(aParent);
|
||||
if (!prompter)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(prompter);
|
||||
rv = prompter->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(prompter);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = prompter;
|
||||
// wrap the base prompt in an nsISingleSignOnPrompt, if available
|
||||
nsCOMPtr<nsISingleSignOnPrompt> siPrompt = do_CreateInstance(kSingleSignOnPromptCID);
|
||||
if (siPrompt) {
|
||||
// then single sign-on is installed
|
||||
rv = siPrompt->SetPromptDialogs(prompter);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*result = siPrompt;
|
||||
NS_RELEASE(prompter); // siPrompt is a strong owner
|
||||
NS_ADDREF(*result);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsPrompt, nsIPrompt)
|
||||
|
||||
nsPrompt::nsPrompt(nsIDOMWindow *aParent)
|
||||
: mParent(aParent)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrompt::Init()
|
||||
{
|
||||
mPromptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
|
||||
return mPromptService ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrompt::GetLocaleString(const PRUnichar *aKey, PRUnichar **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID);
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
nsILocale *locale = nsnull;
|
||||
|
||||
rv = stringService->CreateBundle(kWebShellLocaleProperties, locale, getter_AddRefs(stringBundle));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = stringBundle->GetStringFromName(aKey, aResult);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::Alert(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("Alert").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->Alert(mParent, title, text);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::AlertCheck(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* checkMsg,
|
||||
PRBool *checkValue)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("Alert").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->AlertCheck(mParent, title, text, checkMsg, checkValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::Confirm(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("Confirm").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->Confirm(mParent, title, text, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::ConfirmCheck(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* checkMsg,
|
||||
PRBool *checkValue,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("ConfirmCheck").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->ConfirmCheck(mParent, title, text, checkMsg, checkValue, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::Prompt(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRUint32 savePassword,
|
||||
const PRUnichar* defaultText,
|
||||
PRUnichar* *result,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("Prompt").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->Prompt(mParent, title, text,
|
||||
passwordRealm, savePassword,
|
||||
defaultText, result, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::PromptUsernameAndPassword(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRUint32 savePassword,
|
||||
PRUnichar* *user,
|
||||
PRUnichar* *pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("PromptUsernameAndPassword").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->PromptUsernameAndPassword(mParent, title, text,
|
||||
passwordRealm, savePassword,
|
||||
user, pwd, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::PromptPassword(const PRUnichar* dialogTitle,
|
||||
const PRUnichar* text,
|
||||
const PRUnichar* passwordRealm,
|
||||
PRUint32 savePassword,
|
||||
PRUnichar* *pwd,
|
||||
PRBool *_retval)
|
||||
{
|
||||
// XXX: ignore passwordRealm and savePassword here?
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("PromptPassword").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->PromptPassword(mParent, title, text,
|
||||
passwordRealm, savePassword,
|
||||
pwd, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::Select(const PRUnichar *dialogTitle,
|
||||
const PRUnichar* inMsg,
|
||||
PRUint32 inCount,
|
||||
const PRUnichar **inList,
|
||||
PRInt32 *outSelection,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
AutoStringFree stringOwner;
|
||||
PRUnichar *title = NS_CONST_CAST(PRUnichar *, dialogTitle);
|
||||
|
||||
if (!title) {
|
||||
rv = GetLocaleString(NS_LITERAL_STRING("Select").get(), &title);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
stringOwner.TakeString(title);
|
||||
}
|
||||
|
||||
return mPromptService->Select(mParent, title, inMsg,
|
||||
inCount, inList, outSelection, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrompt::UniversalDialog(const PRUnichar *inTitleMessage,
|
||||
const PRUnichar *inDialogTitle,
|
||||
const PRUnichar *inMsg,
|
||||
const PRUnichar *inCheckboxMsg,
|
||||
const PRUnichar *inButton0Text,
|
||||
const PRUnichar *inButton1Text,
|
||||
const PRUnichar *inButton2Text,
|
||||
const PRUnichar *inButton3Text,
|
||||
const PRUnichar *inEditfield1Msg,
|
||||
const PRUnichar *inEditfield2Msg,
|
||||
PRUnichar **inoutEditfield1Value,
|
||||
PRUnichar **inoutEditfield2Value,
|
||||
const PRUnichar *inIConURL,
|
||||
PRBool *inoutCheckboxState,
|
||||
PRInt32 inNumberButtons,
|
||||
PRInt32 inNumberEditfields,
|
||||
PRInt32 inEditField1Password,
|
||||
PRInt32 *outButtonPressed)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(inDialogTitle, "UniversalDialog must have a dialog title supplied");
|
||||
rv = mPromptService->UniversalDialog(mParent,
|
||||
inTitleMessage,
|
||||
inDialogTitle,
|
||||
inMsg,
|
||||
inCheckboxMsg,
|
||||
inButton0Text,
|
||||
inButton1Text,
|
||||
inButton2Text,
|
||||
inButton3Text,
|
||||
inEditfield1Msg,
|
||||
inEditfield2Msg,
|
||||
inoutEditfield1Value,
|
||||
inoutEditfield2Value,
|
||||
inIConURL,
|
||||
inoutCheckboxState,
|
||||
inNumberButtons,
|
||||
inNumberEditfields,
|
||||
inEditField1Password,
|
||||
outButtonPressed);
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIPromptService.h"
|
||||
|
||||
class nsPrompt : public nsIPrompt {
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROMPT
|
||||
|
||||
nsPrompt(nsIDOMWindow *window);
|
||||
virtual ~nsPrompt() {}
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMWindow> mParent;
|
||||
nsCOMPtr<nsIPromptService> mPromptService;
|
||||
|
||||
nsresult GetLocaleString(const PRUnichar *aKey, PRUnichar **aResult);
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewPrompter(nsIPrompt **result, nsIDOMWindow *aParent);
|
||||
|
|
@ -0,0 +1,455 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsPromptService.h"
|
||||
|
||||
#include "nsXPComFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
|
||||
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
|
||||
|
||||
const char *kPromptURL="chrome://global/content/commonDialog.xul";
|
||||
const char *kSelectPromptURL="chrome://global/content/selectDialog.xul";
|
||||
const char *kQuestionIconURL ="chrome://global/skin/question-icon.gif";
|
||||
const char *kAlertIconURL ="chrome://global/skin/alert-icon.gif";
|
||||
const char *kWarningIconURL ="chrome://global/skin/message-icon.gif";
|
||||
|
||||
/****************************************************************
|
||||
************************* ParamBlock ***************************
|
||||
****************************************************************/
|
||||
|
||||
class ParamBlock {
|
||||
|
||||
public:
|
||||
ParamBlock() {
|
||||
mBlock = 0;
|
||||
}
|
||||
~ParamBlock() {
|
||||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return nsComponentManager::CreateInstance(kDialogParamBlockCID,
|
||||
0, NS_GET_IID(nsIDialogParamBlock),
|
||||
(void**) &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
||||
private:
|
||||
nsIDialogParamBlock *mBlock;
|
||||
};
|
||||
|
||||
|
||||
/****************************************************************
|
||||
************************ nsPromptService ***********************
|
||||
****************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPromptService, nsIPromptService)
|
||||
|
||||
nsPromptService::nsPromptService() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPromptService::~nsPromptService() {
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPromptService::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mWatcher = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::Alert(nsIDOMWindow *parent,
|
||||
const PRUnichar *dialogTitle, const PRUnichar *text)
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(eNumberButtons, 1);
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url;
|
||||
url.AssignWithConversion(kAlertIconURL);
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::AlertCheck(nsIDOMWindow *parent,
|
||||
const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *checkMsg, PRBool *checkValue)
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt( eNumberButtons,1 );
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url;
|
||||
url.AssignWithConversion(kAlertIconURL);
|
||||
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
block->SetString(eCheckboxMsg, checkMsg);
|
||||
block->SetInt(eCheckboxState, *checkValue);
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
block->GetInt(eCheckboxState, checkValue);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::Confirm(nsIDOMWindow *parent,
|
||||
const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Stuff in Parameters
|
||||
block->SetInt(eNumberButtons, 2);
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url;
|
||||
url.AssignWithConversion(kQuestionIconURL);
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
PRInt32 buttonPressed = 0;
|
||||
block->GetInt(eButtonPressed, &buttonPressed);
|
||||
*_retval = buttonPressed ? PR_FALSE : PR_TRUE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::ConfirmCheck(nsIDOMWindow *parent,
|
||||
const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *checkMsg, PRBool *checkValue,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt( eNumberButtons,2 );
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url; url.AssignWithConversion( kQuestionIconURL );
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
block->SetString(eCheckboxMsg, checkMsg);
|
||||
block->SetInt(eCheckboxState, *checkValue);
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
PRInt32 tempInt = 0;
|
||||
block->GetInt(eButtonPressed, &tempInt);
|
||||
*_retval = tempInt ? PR_FALSE : PR_TRUE;
|
||||
|
||||
block->GetInt(eCheckboxState, & tempInt);
|
||||
*checkValue = PRBool( tempInt );
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::UniversalDialog(nsIDOMWindow *parent,
|
||||
const PRUnichar *titleMessage, const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text, const PRUnichar *checkboxMsg,
|
||||
const PRUnichar *button0Text, const PRUnichar *button1Text,
|
||||
const PRUnichar *button2Text, const PRUnichar *button3Text,
|
||||
const PRUnichar *editfield1Msg, const PRUnichar *editfield2Msg,
|
||||
PRUnichar **editfield1Value, PRUnichar **editfield2Value,
|
||||
const PRUnichar *iconURL, PRBool *checkboxState,
|
||||
PRInt32 numberButtons, PRInt32 numberEditfields,
|
||||
PRInt32 editfield1Password, PRInt32 *buttonPressed)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
/* check for at least one button */
|
||||
if (numberButtons < 1)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
/* load up input parameters */
|
||||
|
||||
block->SetString(eTitleMessage, titleMessage);
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
block->SetString(eMsg, text);
|
||||
block->SetString(eCheckboxMsg, checkboxMsg);
|
||||
if (numberButtons >= 4)
|
||||
block->SetString(eButton3Text, button3Text);
|
||||
|
||||
if (numberButtons >= 3)
|
||||
block->SetString(eButton2Text, button2Text);
|
||||
|
||||
if (numberButtons >= 2)
|
||||
block->SetString(eButton1Text, button1Text);
|
||||
|
||||
if (numberButtons >= 1)
|
||||
block->SetString(eButton0Text, button0Text);
|
||||
|
||||
if (numberEditfields >= 2) {
|
||||
block->SetString(eEditfield2Msg, editfield2Msg);
|
||||
block->SetString(eEditfield2Value, *editfield2Value);
|
||||
}
|
||||
if (numberEditfields >= 1) {
|
||||
block->SetString(eEditfield1Msg, editfield1Msg);
|
||||
block->SetString(eEditfield1Value, *editfield1Value);
|
||||
block->SetInt(eEditField1Password, editfield1Password);
|
||||
}
|
||||
if (iconURL)
|
||||
block->SetString(eIconURL, iconURL);
|
||||
else
|
||||
block->SetString(eIconURL, NS_ConvertASCIItoUCS2(kQuestionIconURL).GetUnicode());
|
||||
|
||||
if (checkboxMsg)
|
||||
block->SetInt(eCheckboxState, *checkboxState);
|
||||
|
||||
block->SetInt(eNumberButtons, numberButtons);
|
||||
block->SetInt(eNumberEditfields, numberEditfields);
|
||||
|
||||
/* perform the dialog */
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
/* get back output parameters */
|
||||
|
||||
if (buttonPressed)
|
||||
block->GetInt(eButtonPressed, buttonPressed);
|
||||
|
||||
if (checkboxMsg && checkboxState)
|
||||
block->GetInt(eCheckboxState, checkboxState);
|
||||
|
||||
if (numberEditfields >= 2 && editfield2Value)
|
||||
block->GetString(eEditfield2Value, editfield2Value);
|
||||
|
||||
if (numberEditfields >= 1 && editfield1Value)
|
||||
block->GetString(eEditfield1Value, editfield1Value);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// XXX use passwordRealm and savePassword, here and in
|
||||
// PromptUsernameAndPassword and PromptPassword
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::Prompt(nsIDOMWindow *parent, const PRUnichar *dialogTitle,
|
||||
const PRUnichar *text, const PRUnichar *passwordRealm,
|
||||
PRUint32 savePassword, const PRUnichar *defaultText,
|
||||
PRUnichar **result, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(eNumberButtons, 2);
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url; url.AssignWithConversion(kQuestionIconURL);
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
block->SetInt(eNumberEditfields, 1);
|
||||
block->SetString(eEditfield1Value, defaultText);
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
block->GetString(eEditfield1Value, result);
|
||||
PRInt32 tempInt = 0;
|
||||
block->GetInt(eButtonPressed, &tempInt);
|
||||
*_retval = tempInt ? PR_FALSE : PR_TRUE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
|
||||
const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm, PRUint32 savePassword,
|
||||
PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(eNumberButtons, 2);
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url;
|
||||
url.AssignWithConversion(kQuestionIconURL);
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
block->SetInt( eNumberEditfields, 2 );
|
||||
block->SetString(eEditfield1Value, *user);
|
||||
block->SetString(eEditfield2Value, *pwd);
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
block->GetString(eEditfield1Value, user);
|
||||
block->GetString(eEditfield2Value, pwd);
|
||||
PRInt32 tempInt = 0;
|
||||
block->GetInt(eButtonPressed, &tempInt);
|
||||
*_retval = tempInt ? PR_FALSE : PR_TRUE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPromptService::PromptPassword(nsIDOMWindow *parent,
|
||||
const PRUnichar *dialogTitle, const PRUnichar *text,
|
||||
const PRUnichar *passwordRealm, PRUint32 savePassword,
|
||||
PRUnichar **pwd, PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(eNumberButtons, 2);
|
||||
block->SetString(eMsg, text);
|
||||
|
||||
block->SetString(eDialogTitle, dialogTitle);
|
||||
|
||||
nsString url;
|
||||
url.AssignWithConversion(kQuestionIconURL);
|
||||
block->SetString(eIconURL, url.GetUnicode());
|
||||
block->SetInt(eNumberEditfields, 1);
|
||||
block->SetInt(eEditField1Password, 1);
|
||||
|
||||
rv = DoDialog(parent, block, kPromptURL);
|
||||
|
||||
block->GetString(eEditfield1Value, pwd);
|
||||
PRInt32 tempInt = 0;
|
||||
block->GetInt(eButtonPressed, &tempInt);
|
||||
*_retval = tempInt ? PR_FALSE : PR_TRUE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPromptService::Select(nsIDOMWindow *parent, const PRUnichar *dialogTitle,
|
||||
const PRUnichar* text, PRUint32 count,
|
||||
const PRUnichar **selectList, PRInt32 *outSelection,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
const PRInt32 eSelection = 2;
|
||||
ParamBlock block;
|
||||
rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetNumberStrings(count + 2);
|
||||
if (dialogTitle)
|
||||
block->SetString(0, dialogTitle);
|
||||
|
||||
block->SetString(1, text);
|
||||
block->SetInt(eSelection, count);
|
||||
for (PRUint32 i = 2; i <= count+1; i++) {
|
||||
nsAutoString temp(selectList[i-2]);
|
||||
const PRUnichar* text = temp.GetUnicode();
|
||||
block->SetString(i, text);
|
||||
}
|
||||
|
||||
*outSelection = -1;
|
||||
rv = DoDialog(parent, block, kSelectPromptURL);
|
||||
|
||||
PRInt32 buttonPressed = 0;
|
||||
block->GetInt(eButtonPressed, &buttonPressed);
|
||||
block->GetInt(eSelection, outSelection);
|
||||
*_retval = buttonPressed ? PR_FALSE : PR_TRUE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPromptService::DoDialog(nsIDOMWindow *aParent,
|
||||
nsIDialogParamBlock *aParamBlock, const char *aChromeURL)
|
||||
{
|
||||
NS_ENSURE_ARG(aParamBlock);
|
||||
NS_ENSURE_ARG(aChromeURL);
|
||||
if (!mWatcher)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// get a parent, if at all possible
|
||||
// (though we'd rather this didn't fail, it's OK if it does. so there's
|
||||
// no failure or null check.)
|
||||
nsCOMPtr<nsIDOMWindow> activeParent; // retain ownership for method lifetime
|
||||
if (!aParent) {
|
||||
mWatcher->GetActiveWindow(getter_AddRefs(activeParent));
|
||||
aParent = activeParent;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> arguments(do_QueryInterface(aParamBlock));
|
||||
nsCOMPtr<nsIDOMWindow> dialog;
|
||||
mWatcher->OpenWindow(aParent, aChromeURL, "_blank",
|
||||
"centerscreen,chrome,modal,titlebar", arguments,
|
||||
getter_AddRefs(dialog));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsPromptService_h
|
||||
#define __nsPromptService_h
|
||||
|
||||
// {A2112D6A-0E28-421f-B46A-25C0B308CBD0}
|
||||
#define NS_PROMPTSERVICE_CID \
|
||||
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
|
||||
#define NS_PROMPTSERVICE_CONTRACTID \
|
||||
"@mozilla.org/embedcomp/prompt-service;1"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
||||
class nsIDOMWindow;
|
||||
class nsIDialogParamBlock;
|
||||
|
||||
class nsPromptService: public nsIPromptService {
|
||||
|
||||
public:
|
||||
|
||||
nsPromptService();
|
||||
virtual ~nsPromptService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_NSIPROMPTSERVICE
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
private:
|
||||
|
||||
nsresult DoDialog(nsIDOMWindow *aParent,
|
||||
nsIDialogParamBlock *aParamBlock,
|
||||
const char *aChromeURL);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> mWatcher;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsWWJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPrompt.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#include "nsIBaseWindow.h"
|
||||
|
@ -703,6 +704,12 @@ nsWindowWatcher::GetWindowEnumerator(nsISimpleEnumerator** _retval)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindowWatcher::GetNewPrompter(nsIDOMWindow *aParent, nsIPrompt **_retval)
|
||||
{
|
||||
return NS_NewPrompter(_retval, aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindowWatcher::SetWindowCreator(nsIWindowCreator *creator)
|
||||
{
|
||||
|
|
|
@ -83,7 +83,6 @@ components/libwebbrwsr.so ; wtf! it is needed?!
|
|||
components/mozbrwsr.xpt
|
||||
components/webBrowser_core.xpt
|
||||
components/libembedcomponents.so
|
||||
components/promptservice.xpt
|
||||
components/windowwatcher.xpt
|
||||
|
||||
; find functionality
|
||||
|
|
|
@ -86,7 +86,6 @@ components\editor.xpt
|
|||
components\webbrwsr.dll
|
||||
components\webBrowser_core.xpt
|
||||
components\embedcomponents.dll
|
||||
components\promptservice.xpt
|
||||
components\windowwatcher.xpt
|
||||
|
||||
; find functionality
|
||||
|
|
|
@ -212,7 +212,6 @@ bin/components/xml-rpc.xpt
|
|||
bin/components/nsDictionary.js
|
||||
bin/components/nsXmlRpcClient.js
|
||||
bin/components/libxremote_client.so
|
||||
bin/components/promptservice.xpt
|
||||
bin/components/windowwatcher.xpt
|
||||
bin/components/xmlextras.xpt
|
||||
bin/components/libxmlextras.so
|
||||
|
|
|
@ -190,7 +190,6 @@ bin\components\urildr.dll
|
|||
bin\components\uriloader.xpt
|
||||
bin\components\exthandler.xpt
|
||||
bin\components\util.xpt
|
||||
bin\components\promptservice.xpt
|
||||
bin\components\wallet.dll
|
||||
bin\components\wallet.xpt
|
||||
bin\components\walleteditor.xpt
|
||||
|
|
Загрузка…
Ссылка в новой задаче