From 6fb17bc311c977eb18efe33e51d50dac5b09c922 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Fri, 13 Apr 2001 01:53:19 +0000 Subject: [PATCH] removing files no longer used. bug 72112 continues --- xpfe/appshell/src/nsCommonDialogs.cpp | 488 ----------------------- xpfe/appshell/src/nsCommonDialogs.h | 39 -- xpfe/appshell/src/nsDialogParamBlock.cpp | 93 ----- xpfe/appshell/src/nsDialogParamBlock.h | 55 --- xpfe/appshell/src/nsNetSupportDialog.cpp | 223 ----------- xpfe/appshell/src/nsNetSupportDialog.h | 39 -- 6 files changed, 937 deletions(-) delete mode 100644 xpfe/appshell/src/nsCommonDialogs.cpp delete mode 100644 xpfe/appshell/src/nsCommonDialogs.h delete mode 100644 xpfe/appshell/src/nsDialogParamBlock.cpp delete mode 100644 xpfe/appshell/src/nsDialogParamBlock.h delete mode 100644 xpfe/appshell/src/nsNetSupportDialog.cpp delete mode 100644 xpfe/appshell/src/nsNetSupportDialog.h diff --git a/xpfe/appshell/src/nsCommonDialogs.cpp b/xpfe/appshell/src/nsCommonDialogs.cpp deleted file mode 100644 index 87e5faa6cc47..000000000000 --- a/xpfe/appshell/src/nsCommonDialogs.cpp +++ /dev/null @@ -1,488 +0,0 @@ -/* -*- 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) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * Pierre Phaneuf - */ -#include "nsIDOMWindowInternal.h" -#include "nsCommonDialogs.h" -#include "nsCOMPtr.h" -#include "nsIScriptGlobalObject.h" -#include "nsXPComFactory.h" -#include "nsIComponentManager.h" -#include "nsIServiceManager.h" - -static NS_DEFINE_CID( kDialogParamBlockCID, NS_DialogParamBlock_CID); - - - -const char* kPromptURL="chrome://global/content/commonDialog.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"; - -nsCommonDialogs::nsCommonDialogs() -{ - NS_INIT_REFCNT(); -} - -nsCommonDialogs::~nsCommonDialogs() -{ -} - -NS_IMETHODIMP nsCommonDialogs::Alert(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle, const PRUnichar *inMsg) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons, 1 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle,inWindowTitle ); - - nsString url; url.AssignWithConversion( kAlertIconURL ); - block->SetString( eIconURL, url.GetUnicode()); - - rv = DoDialog( inParent, block, kPromptURL ); - - NS_IF_RELEASE( block ); - return rv; -} - - - -NS_IMETHODIMP nsCommonDialogs::AlertCheck(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle,const PRUnichar *inMsg, const PRUnichar *inCheckMsg, PRBool *outCheckValue) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons,1 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle, inWindowTitle ); - - nsString url; url.AssignWithConversion( kAlertIconURL ); - - block->SetString( eIconURL, url.GetUnicode()); - block->SetString( eCheckboxMsg, inCheckMsg ); - block->SetInt(eCheckboxState, *outCheckValue ); - - rv = DoDialog( inParent, block, kPromptURL ); - - block->GetInt(eCheckboxState, outCheckValue ); - - NS_IF_RELEASE( block ); - return rv; -} - -NS_IMETHODIMP nsCommonDialogs::Confirm(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle, const PRUnichar *inMsg, PRBool *_retval) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons,2 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle, inWindowTitle ); - - nsString url; url.AssignWithConversion( kQuestionIconURL ); - block->SetString( eIconURL, url.GetUnicode()); - - rv = DoDialog( inParent, block, kPromptURL ); - - PRInt32 buttonPressed = 0; - block->GetInt( eButtonPressed, &buttonPressed ); - *_retval = buttonPressed ? PR_FALSE : PR_TRUE; - NS_IF_RELEASE( block ); - return rv; -} - -NS_IMETHODIMP nsCommonDialogs::ConfirmCheck(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle,const PRUnichar *inMsg, const PRUnichar *inCheckMsg, PRBool *outCheckValue, PRBool *_retval) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons,2 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle, inWindowTitle ); - - nsString url; url.AssignWithConversion( kQuestionIconURL ); - block->SetString( eIconURL, url.GetUnicode()); - block->SetString( eCheckboxMsg, inCheckMsg ); - block->SetInt(eCheckboxState, *outCheckValue ); - - rv = DoDialog( inParent, block, kPromptURL ); - PRInt32 tempInt = 0; - block->GetInt( eButtonPressed, &tempInt ); - *_retval = tempInt ? PR_FALSE : PR_TRUE; - - block->GetInt(eCheckboxState, & tempInt ); - *outCheckValue = PRBool( tempInt ); - - NS_IF_RELEASE( block ); - 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 - (nsIDOMWindowInternal *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, NS_GET_IID(nsIDialogParamBlock), (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 { - block->SetString(eIconURL, NS_ConvertASCIItoUCS2(kQuestionIconURL).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(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle, const PRUnichar *inMsg, const PRUnichar *inDefaultText, PRUnichar **result, PRBool *_retval) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons,2 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle, inWindowTitle ); - - nsString url; url.AssignWithConversion( kQuestionIconURL ); - block->SetString( eIconURL, url.GetUnicode()); - block->SetInt( eNumberEditfields, 1 ); - block->SetString( eEditfield1Value, inDefaultText ); - - rv = DoDialog( inParent, block, kPromptURL ); - - - block->GetString( eEditfield1Value, result ); - PRInt32 tempInt = 0; - block->GetInt( eButtonPressed, &tempInt ); - *_retval = tempInt ? PR_FALSE : PR_TRUE; - - NS_IF_RELEASE( block ); - return rv; -} - -NS_IMETHODIMP nsCommonDialogs::PromptUsernameAndPassword(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle, const PRUnichar *inMsg, PRUnichar **outUser, PRUnichar **outPassword, PRBool *_retval) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons,2 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle, inWindowTitle ); - - nsString url; url.AssignWithConversion( kQuestionIconURL ); - block->SetString( eIconURL, url.GetUnicode()); - block->SetInt( eNumberEditfields, 2 ); - block->SetString( eEditfield1Value, *outUser ); - block->SetString( eEditfield2Value, *outPassword ); - - - rv = DoDialog( inParent, block, kPromptURL ); - - block->GetString( eEditfield1Value, outUser ); - block->GetString( eEditfield2Value, outPassword ); - PRInt32 tempInt = 0; - block->GetInt( eButtonPressed, &tempInt ); - *_retval = tempInt ? PR_FALSE : PR_TRUE; - NS_IF_RELEASE( block ); - return rv; -} - -NS_IMETHODIMP nsCommonDialogs::PromptPassword(nsIDOMWindowInternal *inParent, const PRUnichar *inWindowTitle, const PRUnichar *inMsg, PRUnichar **outPassword, PRBool *_retval) -{ - nsresult rv; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - // Stuff in Parameters - block->SetInt( eNumberButtons,2 ); - block->SetString( eMsg, inMsg ); - - block->SetString( eDialogTitle, inWindowTitle ); - - nsString url; url.AssignWithConversion( kQuestionIconURL ); - block->SetString( eIconURL, url.GetUnicode()); - block->SetInt( eNumberEditfields, 1 ); - block->SetInt( eEditField1Password, 1 ); - rv = DoDialog( inParent, block, kPromptURL ); - block->GetString( eEditfield1Value, outPassword ); - PRInt32 tempInt = 0; - block->GetInt( eButtonPressed, &tempInt ); - *_retval = tempInt ? PR_FALSE : PR_TRUE; - - NS_IF_RELEASE( block ); - return rv; -} - - - -nsresult nsCommonDialogs::Select(nsIDOMWindowInternal *inParent, const PRUnichar *inDialogTitle, const PRUnichar* inMsg, PRUint32 inCount, const PRUnichar **inList, PRInt32 *outSelection, PRBool *_retval) -{ - nsresult rv; - const PRInt32 eSelection = 2 ; - nsIDialogParamBlock* block = NULL; - rv = nsComponentManager::CreateInstance( kDialogParamBlockCID, - 0, - NS_GET_IID(nsIDialogParamBlock), - (void**)&block ); - - if ( NS_FAILED( rv ) ) - return rv; - block->SetNumberStrings( inCount + 2 ); - if (inDialogTitle) { - block->SetString( 0, inDialogTitle ); - } - - block->SetString(1, inMsg ); - block->SetInt( eSelection, inCount ); - for ( PRUint32 i = 2; i<= inCount+1; i++ ) - { - nsAutoString temp(inList[i-2] ); - const PRUnichar* text = temp.GetUnicode(); - - block->SetString( i, text); - } - *outSelection = -1; - static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID ); - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if ( NS_SUCCEEDED( rv ) ) - { - rv = dialog->DoDialog( inParent, block, "chrome://global/content/selectDialog.xul" ); - - PRInt32 buttonPressed = 0; - block->GetInt( nsICommonDialogs::eButtonPressed, &buttonPressed ); - block->GetInt( eSelection, outSelection ); - *_retval = buttonPressed ? PR_FALSE : PR_TRUE; - NS_IF_RELEASE( block ); - } - return rv; -} - - - NS_IMETHODIMP nsCommonDialogs::DoDialog(nsIDOMWindowInternal* inParent, nsIDialogParamBlock *ioParamBlock, const char *inChromeURL) - { - nsresult rv = NS_OK; - - if ( inParent && ioParamBlock &&inChromeURL ) - { - // Get JS context from parent window. - nsCOMPtr sgo = do_QueryInterface( inParent, &rv ); - if ( NS_SUCCEEDED( rv ) && sgo ) - { - nsCOMPtr context; - sgo->GetContext( getter_AddRefs( context ) ); - if ( context ) - { - JSContext *jsContext = (JSContext*)context->GetNativeContext(); - if ( jsContext ) { - void *stackPtr; - jsval *argv = JS_PushArguments( jsContext, - &stackPtr, - "sss%ip", - inChromeURL, - "_blank", - "centerscreen,chrome,modal,titlebar", - (const nsIID*)(&NS_GET_IID(nsIDialogParamBlock)), - (nsISupports*)ioParamBlock - ); - if ( argv ) { - nsCOMPtr newWindow; - rv = inParent->OpenDialog( jsContext, argv, 4, getter_AddRefs(newWindow) ); - JS_PopArguments( jsContext, stackPtr ); - } - else - { - - NS_WARNING( "JS_PushArguments failed\n" ); - rv = NS_ERROR_FAILURE; - } - } - else - { - NS_WARNING(" GetNativeContext failed\n" ); - rv = NS_ERROR_FAILURE; - } - } - else - { - NS_WARNING( "GetContext failed\n" ); - rv = NS_ERROR_FAILURE; - } - } - else - { - NS_WARNING( "QueryInterface (for nsIScriptGlobalObject) failed \n" ); - } - } - else - { - NS_WARNING( " OpenDialogWithArg was passed a null pointer!\n" ); - rv = NS_ERROR_NULL_POINTER; - } - return rv; - } - -NS_IMPL_ISUPPORTS1(nsCommonDialogs, nsICommonDialogs) diff --git a/xpfe/appshell/src/nsCommonDialogs.h b/xpfe/appshell/src/nsCommonDialogs.h deleted file mode 100644 index e7754881a2df..000000000000 --- a/xpfe/appshell/src/nsCommonDialogs.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- 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) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#ifndef __nsCommonDialogs_h -#define __nsCommonDialogs_h - -#include "nsICommonDialogs.h" - -class nsCommonDialogs: public nsICommonDialogs -{ -public: - nsCommonDialogs(); - virtual ~nsCommonDialogs(); - - NS_DECL_NSICOMMONDIALOGS - NS_DECL_ISUPPORTS -private: -}; - -#endif diff --git a/xpfe/appshell/src/nsDialogParamBlock.cpp b/xpfe/appshell/src/nsDialogParamBlock.cpp deleted file mode 100644 index c970a4b85880..000000000000 --- a/xpfe/appshell/src/nsDialogParamBlock.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- 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) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * Pierre Phaneuf - */ - -#include "nsDialogParamBlock.h" -#include "nsString.h" - -nsDialogParamBlock::nsDialogParamBlock(): mNumStrings( 0 ), mString(NULL ) -{ - NS_INIT_REFCNT(); - - for( PRInt32 i =0; i< kNumInts; i++ ) - mInt[ i ] = 0; -} - -nsDialogParamBlock::~nsDialogParamBlock() -{ - delete [] mString; -} - -NS_IMETHODIMP nsDialogParamBlock::SetNumberStrings( PRInt32 inNumStrings ) -{ - if ( mString != NULL ) - { - return NS_ERROR_ALREADY_INITIALIZED; - } - mString = new nsString[ inNumStrings ]; - if ( !mString ) - return NS_ERROR_OUT_OF_MEMORY; - mNumStrings = inNumStrings; - return NS_OK; -} - - -NS_IMETHODIMP nsDialogParamBlock::GetInt(PRInt32 inIndex, PRInt32 *_retval) -{ - nsresult rv = InBounds( inIndex, kNumInts ); - if ( rv == NS_OK ) - *_retval = mInt[ inIndex ]; - return rv; -} - -NS_IMETHODIMP nsDialogParamBlock::SetInt(PRInt32 inIndex, PRInt32 inInt) -{ - nsresult rv = InBounds( inIndex, kNumInts ); - if ( rv == NS_OK ) - mInt[ inIndex ]= inInt; - return rv; -} - - -NS_IMETHODIMP nsDialogParamBlock::GetString(PRInt32 inIndex, PRUnichar **_retval) -{ - if ( mNumStrings == 0 ) - SetNumberStrings( kNumStrings ); - nsresult rv = InBounds( inIndex, mNumStrings ); - if ( rv == NS_OK ) - *_retval = mString[ inIndex ].ToNewUnicode(); - return rv; -} - -NS_IMETHODIMP nsDialogParamBlock::SetString(PRInt32 inIndex, const PRUnichar *inString) -{ - if ( mNumStrings == 0 ) - SetNumberStrings( kNumStrings ); - nsresult rv = InBounds( inIndex, mNumStrings ); - if ( rv == NS_OK ) - mString[ inIndex ]= inString; - return rv; -} - -NS_IMPL_ADDREF(nsDialogParamBlock); -NS_IMPL_RELEASE(nsDialogParamBlock); -NS_IMPL_QUERY_INTERFACE1(nsDialogParamBlock, nsIDialogParamBlock) diff --git a/xpfe/appshell/src/nsDialogParamBlock.h b/xpfe/appshell/src/nsDialogParamBlock.h deleted file mode 100644 index e6d56a0e8ff0..000000000000 --- a/xpfe/appshell/src/nsDialogParamBlock.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#ifndef __nsDialogParamBlock_h -#define __nsDialogParamBlock_h - -#include "nsIDialogParamBlock.h" -#include "nsString.h" - -class nsDialogParamBlock: public nsIDialogParamBlock -{ - enum {kNumInts = 8, kNumStrings =16 }; -public: - nsDialogParamBlock(); - virtual ~nsDialogParamBlock(); - - NS_DECL_NSIDIALOGPARAMBLOCK - - // COM - NS_DECL_ISUPPORTS -private: - nsresult InBounds( PRInt32 inIndex, PRInt32 inMax ) - { - if ( inIndex >= 0 && inIndex< inMax ) - return NS_OK; - else - return NS_ERROR_ILLEGAL_VALUE; - } - - PRInt32 mInt[ kNumInts ]; - PRInt32 mNumStrings; - nsString* mString; -}; - -#endif - diff --git a/xpfe/appshell/src/nsNetSupportDialog.cpp b/xpfe/appshell/src/nsNetSupportDialog.cpp deleted file mode 100644 index 989ed39fc0a7..000000000000 --- a/xpfe/appshell/src/nsNetSupportDialog.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- 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) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * Pierre Phaneuf - */ - -// Local Includes -#include "nsNetSupportDialog.h" - -// Helper Classes -#include "nsAppShellCIDs.h" -#include "nsCOMPtr.h" - -//Interfaces Needed -#include "nsIAppShellService.h" -#include "nsICommonDialogs.h" -#include "nsIDOMWindowInternal.h" -#include "nsIServiceManager.h" -#include "nsIXULWindow.h" -#include "nsIInterfaceRequestor.h" - -/* Define Class IDs */ -static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); - -PRBool GetNSIPrompt( nsCOMPtr & outPrompt ) -{ - nsCOMPtr appShellService(do_GetService(kAppShellServiceCID)); - if(!appShellService) - return PR_FALSE; - - nsCOMPtr xulWindow; - appShellService->GetHiddenWindow(getter_AddRefs(xulWindow)); - outPrompt = do_GetInterface(xulWindow); - if(outPrompt) - return PR_TRUE; - return PR_FALSE; -} - -nsNetSupportDialog::nsNetSupportDialog() -{ - NS_INIT_REFCNT(); -} - -nsNetSupportDialog::~nsNetSupportDialog() -{ -} - - - -NS_IMETHODIMP nsNetSupportDialog::Alert(const PRUnichar *dialogTitle, const PRUnichar *text) -{ - - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->Alert(dialogTitle, text); - - return rv; -} - -NS_IMETHODIMP nsNetSupportDialog::AlertCheck(const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *checkMsg, - PRBool *checkValue) -{ - - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->AlertCheck(dialogTitle, text, checkMsg, checkValue); - - return rv; -} - - -NS_IMETHODIMP nsNetSupportDialog::Confirm(const PRUnichar *dialogTitle, const PRUnichar *text, PRBool *returnValue) -{ - - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->Confirm(dialogTitle, text, returnValue); - - return rv; -} - -NS_IMETHODIMP nsNetSupportDialog::ConfirmCheck(const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *checkMsg, - PRBool *checkValue, - PRBool *returnValue) -{ - - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->ConfirmCheck(dialogTitle, text, checkMsg, checkValue, returnValue); - - return rv; -} - - - -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) */ -{ - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - { - rv = dialogService->UniversalDialog( - 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 *dialogTitle, - const PRUnichar *text, - const PRUnichar *passwordRealm, - PRUint32 savePassword, - const PRUnichar *defaultText, - PRUnichar **resultText, - PRBool *returnValue) -{ - - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->Prompt(dialogTitle, text, passwordRealm, savePassword, defaultText, resultText, returnValue); - - return rv; -} - -NS_IMETHODIMP nsNetSupportDialog::PromptUsernameAndPassword(const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *passwordRealm, - PRUint32 savePassword, - PRUnichar **user, - PRUnichar **pwd, - PRBool *returnValue) -{ - - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->PromptUsernameAndPassword(dialogTitle, text, passwordRealm, savePassword, user, pwd, returnValue); - return rv; -} - -NS_IMETHODIMP nsNetSupportDialog::PromptPassword(const PRUnichar *dialogTitle, - const PRUnichar *text, - const PRUnichar *passwordRealm, - PRUint32 savePassword, - PRUnichar **pwd, - PRBool *_retval) -{ - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->PromptPassword(dialogTitle, text, passwordRealm, savePassword, pwd, _retval); - - return rv; -} - - -nsresult nsNetSupportDialog::Select(const PRUnichar *inDialogTitle, - const PRUnichar *inMsg, - PRUint32 inCount, - const PRUnichar **inList, - PRInt32 *outSelection, - PRBool *_retval) -{ - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr< nsIPrompt> dialogService; - if( GetNSIPrompt( dialogService ) ) - rv = dialogService->Select( inDialogTitle, inMsg, inCount, inList, outSelection, _retval); - - return rv; -} - -NS_IMPL_ISUPPORTS1( nsNetSupportDialog, nsIPrompt ); diff --git a/xpfe/appshell/src/nsNetSupportDialog.h b/xpfe/appshell/src/nsNetSupportDialog.h deleted file mode 100644 index ba16d15d2214..000000000000 --- a/xpfe/appshell/src/nsNetSupportDialog.h +++ /dev/null @@ -1,39 +0,0 @@ - /* -*- 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) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef _nsNetSupportDialog_h -#define _nsNetSupportDialog_h - -#include "nsINetSupportDialogService.h" - -class nsNetSupportDialog : public nsIPrompt -{ -public: - nsNetSupportDialog(); - virtual ~nsNetSupportDialog(); - - // nsIPrompt - NS_DECL_NSIPROMPT - - // COM - NS_DECL_ISUPPORTS -}; -#endif