Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

preferencesDialog

The preferencesDialog class simplifies the access to the preferences dialog.

Method overview

preferencesDialog(in MozMillController controller);
close(in boolean saveChanges);
ElemBase getElement(in object spec);

Attributes

Attribute Type Description
controller MozMillController Controller of the preferences dialog to work on.
paneId
string
Get or set the currently selected pane (available panes: paneMain, paneTabs, paneContent, paneApplications, panePrivacy, paneSecurity, and paneAdvanced).
selectedPane
ElemBase Get the element instance of the currently selected pane.

Methods

preferencesDialog()

Constructor of the preferencesDialog class.

preferencesDialog(
  in MozMillController controller
);
Parameters
controller
Mozmill controller of the preferences dialog to operate on.

close()

Closes the preferences dialog.

close(
  in boolean saveChanges
);
Parameters
saveChanges
Indicates if changes, which have been made in any pane of the preferences dialog, should be saved before the dialog is closed (optional).

getElement()

Retrieves a UI element based on the given spec object.

ElemBase getElement(
  in object spec
);
Parameters
spec
JSON object which specifies the element to retrieve. Use its attributes to specify the exact element. This example shows the correct usage.
spec.type  (string)
spec.subtype (string) spec.value (mixed) Description
"button" "accept" - Get the "OK" ("Close" on Linux) button.
"button" "cancel" - Get the "Cancel" button.
"button" "disclosure" - Get the "More Info" button.
"button" "extra1" - Get the Extra1 button.
"button" "extra2" - Get the Extra2 button.
"button" "help" - Get the "Help" button.
"deck" - - Get the deck which holds all preferences panes.
"deck_pane" - - Get the currently selected pane.
"selector" - - Get the top pane selection box.
"selector_button" - paneId Get the specified button of the pane selection box.
Return value

ElemBase instance of the requested element which matches the specifications.

Examples

// Include necessary modules
var RELATIVE_ROOT = '../../shared-modules';
var MODULE_REQUIRES = ['PrefsAPI'];

var setupModule = function(module) {
  module.controller = mozmill.getBrowserController();
}

var testPreferencesDialog = function()
{
  PrefsAPI.openPreferencesDialog(callbackHandler);
}

var callbackHandler = function(controller)
{
  var prefDialog = new PrefsAPI.preferencesDialog(controller);

  prefDialog.paneId = 'paneMain';
  prefDialog.close();
}

Document Tags and Contributors

 Contributors to this page: Sheppy, Whimboo
 Last updated by: Sheppy,