Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
nsPromptService Class Reference

#include <nsPromptService.h>

Inheritance diagram for nsPromptService:
Inheritance graph
[legend]
Collaboration diagram for nsPromptService:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  eMsg = 0, eCheckboxMsg = 1, eIconClass = 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, eDefaultButton = 5, eDelayButtonEnable = 6
}

Public Member Functions

 nsPromptService ()
virtual ~nsPromptService ()
nsresult Init ()
void alert (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText)
 Puts up an alert dialog with an OK button.
void alertCheck (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, in wstring aCheckMsg, inout boolean aCheckState)
 Puts up an alert dialog with an OK button and a labeled checkbox.
boolean confirm (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText)
 Puts up a dialog with OK and Cancel buttons.
boolean confirmCheck (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, in wstring aCheckMsg, inout boolean aCheckState)
 Puts up a dialog with OK and Cancel buttons and a labeled checkbox.
PRInt32 confirmEx (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, in unsigned long aButtonFlags, in wstring aButton0Title, in wstring aButton1Title, in wstring aButton2Title, in wstring aCheckMsg, inout boolean aCheckState)
 Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.
boolean prompt (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, inout wstring aValue, in wstring aCheckMsg, inout boolean aCheckState)
 Puts up a dialog with an edit field and an optional, labeled checkbox.
boolean promptUsernameAndPassword (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, inout wstring aUsername, inout wstring aPassword, in wstring aCheckMsg, inout boolean aCheckState)
 Puts up a dialog with an edit field, a password field, and an optional, labeled checkbox.
boolean promptPassword (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, inout wstring aPassword, in wstring aCheckMsg, inout boolean aCheckState)
 Puts up a dialog with a password field and an optional, labeled checkbox.
boolean select (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText, in PRUint32 aCount,[array, size_is(aCount)] in wstring aSelectList, out long aOutSelection)
 Puts up a dialog box which has a list box of strings from which the user may make a single selection.
void doDialog (in nsIDOMWindow aParent, in nsIDialogParamBlock aParamBlock, in string aChromeURL)
void showNonBlockingAlert (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText)
 This shows a non-blocking alert with the specified title and message text.

Public Attributes

const unsigned long BUTTON_POS_0 = 1
 Button Flags.
const unsigned long BUTTON_POS_1 = 1 << 8
const unsigned long BUTTON_POS_2 = 1 << 16
const unsigned long BUTTON_TITLE_OK = 1
 Button Title Flags (used to set the labels of buttons in the prompt)
const unsigned long BUTTON_TITLE_CANCEL = 2
const unsigned long BUTTON_TITLE_YES = 3
const unsigned long BUTTON_TITLE_NO = 4
const unsigned long BUTTON_TITLE_SAVE = 5
const unsigned long BUTTON_TITLE_DONT_SAVE = 6
const unsigned long BUTTON_TITLE_REVERT = 7
const unsigned long BUTTON_TITLE_IS_STRING = 127
const unsigned long BUTTON_POS_0_DEFAULT = 0
 Button Default Flags (used to select which button is the default one)
const unsigned long BUTTON_POS_1_DEFAULT = 1 << 24
const unsigned long BUTTON_POS_2_DEFAULT = 1 << 25
const unsigned long BUTTON_DELAY_ENABLE = 1 << 26
 Causes the buttons to be initially disabled.
const unsigned long STD_OK_CANCEL_BUTTONS
 Selects the standard set of OK/Cancel buttons.
const unsigned long STD_YES_NO_BUTTONS
 Selects the standard set of Yes/No buttons.

Private Member Functions

nsresult GetLocaleString (const char *aKey, PRUnichar **aResult)

Private Attributes

nsCOMPtr< nsIWindowWatchermWatcher

Detailed Description

Definition at line 57 of file nsPromptService.h.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
eMsg 
eCheckboxMsg 
eIconClass 
eTitleMessage 
eEditfield1Msg 
eEditfield2Msg 
eEditfield1Value 
eEditfield2Value 
eButton0Text 
eButton1Text 
eButton2Text 
eButton3Text 
eDialogTitle 

Definition at line 50 of file nsPIPromptService.idl.

anonymous enum [inherited]
Enumerator:
eButtonPressed 
eCheckboxState 
eNumberButtons 
eNumberEditfields 
eEditField1Password 
eDefaultButton 
eDelayButtonEnable 

Definition at line 54 of file nsPIPromptService.idl.


Constructor & Destructor Documentation

Definition at line 94 of file nsPromptService.cpp.

                                  {
}

Member Function Documentation

void nsIPromptService::alert ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText 
) [inherited]

Puts up an alert dialog with an OK button.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
void nsIPromptService::alertCheck ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
in wstring  aCheckMsg,
inout boolean  aCheckState 
) [inherited]

Puts up an alert dialog with an OK button and a labeled checkbox.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aCheckMsgText to appear with the checkbox.
aCheckStateContains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
boolean nsIPromptService::confirm ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText 
) [inherited]

Puts up a dialog with OK and Cancel buttons.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
Returns:
true for OK, false for Cancel
boolean nsIPromptService::confirmCheck ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
in wstring  aCheckMsg,
inout boolean  aCheckState 
) [inherited]

Puts up a dialog with OK and Cancel buttons and a labeled checkbox.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aCheckMsgText to appear with the checkbox.
aCheckStateContains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
Returns:
true for OK, false for Cancel
PRInt32 nsIPromptService::confirmEx ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
in unsigned long  aButtonFlags,
in wstring  aButton0Title,
in wstring  aButton1Title,
in wstring  aButton2Title,
in wstring  aCheckMsg,
inout boolean  aCheckState 
) [inherited]

Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aButtonFlagsA combination of Button Flags.
aButton0TitleUsed when button 0 uses TITLE_IS_STRING
aButton1TitleUsed when button 1 uses TITLE_IS_STRING
aButton2TitleUsed when button 2 uses TITLE_IS_STRING
aCheckMsgText to appear with the checkbox. Null if no checkbox.
aCheckStateContains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
Returns:
index of the button pressed.

Buttons are numbered 0 - 2. The implementation can decide whether the sequence goes from right to left or left to right. Button 0 is the default button unless one of the Button Default Flags is specified.

A button may use a predefined title, specified by one of the Button Title Flags values. Each title value can be multiplied by a position value to assign the title to a particular button. If BUTTON_TITLE_IS_STRING is used for a button, the string parameter for that button will be used. If the value for a button position is zero, the button will not be shown.

In general, aButtonFlags is constructed per the following example:

aButtonFlags = (BUTTON_POS_0) * (BUTTON_TITLE_AAA) + (BUTTON_POS_1) * (BUTTON_TITLE_BBB) + BUTTON_POS_1_DEFAULT;

where "AAA" and "BBB" correspond to one of the button titles.

void nsPIPromptService::doDialog ( in nsIDOMWindow  aParent,
in nsIDialogParamBlock  aParamBlock,
in string  aChromeURL 
) [inherited]
nsresult nsPromptService::GetLocaleString ( const char *  aKey,
PRUnichar **  aResult 
) [private]

Definition at line 665 of file nsPromptService.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID);
  nsCOMPtr<nsIStringBundle> stringBundle;
 
  rv = stringService->CreateBundle(kCommonDialogsProperties, getter_AddRefs(stringBundle));
  if (NS_FAILED(rv)) return NS_ERROR_FAILURE;

  rv = stringBundle->GetStringFromName(NS_ConvertASCIItoUCS2(aKey).get(), aResult);

  return rv;
}

Here is the call graph for this function:

Definition at line 98 of file nsPromptService.cpp.

Here is the call graph for this function:

boolean nsIPromptService::prompt ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
inout wstring  aValue,
in wstring  aCheckMsg,
inout boolean  aCheckState 
) [inherited]

Puts up a dialog with an edit field and an optional, labeled checkbox.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aValueContains the default value for the dialog field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter's value is unmodified.
aCheckMsgText to appear with the checkbox. If null, check box will not be shown.
aCheckStateContains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
Returns:
true for OK, false for Cancel.
boolean nsIPromptService::promptPassword ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
inout wstring  aPassword,
in wstring  aCheckMsg,
inout boolean  aCheckState 
) [inherited]

Puts up a dialog with a password field and an optional, labeled checkbox.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aPasswordContains the default value for the password field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter's value is unmodified.
aCheckMsgText to appear with the checkbox. If null, check box will not be shown.
aCheckStateContains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
Returns:
true for OK, false for Cancel.
boolean nsIPromptService::promptUsernameAndPassword ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
inout wstring  aUsername,
inout wstring  aPassword,
in wstring  aCheckMsg,
inout boolean  aCheckState 
) [inherited]

Puts up a dialog with an edit field, a password field, and an optional, labeled checkbox.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aUsernameContains the default value for the username field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter's value is unmodified.
aPasswordContains the default value for the password field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter's value is unmodified.
aCheckMsgText to appear with the checkbox. If null, check box will not be shown.
aCheckStateContains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
Returns:
true for OK, false for Cancel.
boolean nsIPromptService::select ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText,
in PRUint32  aCount,
[array, size_is(aCount)] in wstring  aSelectList,
out long  aOutSelection 
) [inherited]

Puts up a dialog box which has a list box of strings from which the user may make a single selection.

Parameters:
aParentThe parent window or null.
aDialogTitleText to appear in the title of the dialog.
aTextText to appear in the body of the dialog.
aCountThe length of the aSelectList array parameter.
aSelectListThe list of strings to display.
aOutSelectionContains the index of the selected item in the list when this method returns true.
Returns:
true for OK, false for Cancel.
void nsINonBlockingAlertService::showNonBlockingAlert ( in nsIDOMWindow  aParent,
in wstring  aDialogTitle,
in wstring  aText 
) [inherited]

This shows a non-blocking alert with the specified title and message text.

This function requires a valid parent window with which the alert is associated.

Parameters:
aParentThe parent window. This must not be null.
aDialogTitleText to appear in the title of the alert.
aTextText to appear in the body of the alert.

Member Data Documentation

const unsigned long nsIPromptService::BUTTON_DELAY_ENABLE = 1 << 26 [inherited]

Causes the buttons to be initially disabled.

They are enabled after a timeout expires. The implementation may interpret this loosely as the intent is to ensure that the user does not click through a security dialog too quickly. Strictly speaking, the implementation could choose to ignore this flag.

Definition at line 192 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_POS_0 = 1 [inherited]

Button Flags.

The following flags are combined to form the aButtonFlags parameter passed to confirmEx. See confirmEx for more information on how the flags may be combined. Button Position Flags

Definition at line 162 of file nsIPromptService.idl.

Button Default Flags (used to select which button is the default one)

Definition at line 181 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_POS_1 = 1 << 8 [inherited]

Definition at line 163 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_POS_1_DEFAULT = 1 << 24 [inherited]

Definition at line 182 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_POS_2 = 1 << 16 [inherited]

Definition at line 164 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_POS_2_DEFAULT = 1 << 25 [inherited]

Definition at line 183 of file nsIPromptService.idl.

Definition at line 170 of file nsIPromptService.idl.

Definition at line 174 of file nsIPromptService.idl.

Definition at line 176 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_TITLE_NO = 4 [inherited]

Definition at line 172 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_TITLE_OK = 1 [inherited]

Button Title Flags (used to set the labels of buttons in the prompt)

Definition at line 169 of file nsIPromptService.idl.

Definition at line 175 of file nsIPromptService.idl.

Definition at line 173 of file nsIPromptService.idl.

const unsigned long nsIPromptService::BUTTON_TITLE_YES = 3 [inherited]

Definition at line 171 of file nsIPromptService.idl.

Definition at line 76 of file nsPromptService.h.

Initial value:

Selects the standard set of OK/Cancel buttons.

Definition at line 197 of file nsIPromptService.idl.

Initial value:

Selects the standard set of Yes/No buttons.

Definition at line 203 of file nsIPromptService.idl.


The documentation for this class was generated from the following files: