This commit was manufactured by cvs2svn to create branch
'MOZILLA_1_8_BRANCH'. git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@214225 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
194
mozilla/calendar/base/content/preferences/advanced.js
Normal file
194
mozilla/calendar/base/content/preferences/advanced.js
Normal file
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Thunderbird preferences
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Scott MacGregor
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Matthew Willis <lilmatt@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
var gAdvancedPane = {
|
||||
_inited: false,
|
||||
init: function advPaneInit() {
|
||||
this._inited = true;
|
||||
this._initMasterPasswordUI();
|
||||
|
||||
var advancedPrefs = document.getElementById("advancedPrefs");
|
||||
var preference = document.getElementById("calendar.preferences.advanced.selectedTabIndex");
|
||||
if (preference.value === null) {
|
||||
return;
|
||||
}
|
||||
advancedPrefs.selectedIndex = preference.value;
|
||||
},
|
||||
|
||||
tabSelectionChanged: function advPaneTabSelectionChanged() {
|
||||
if (!this._inited) {
|
||||
return;
|
||||
}
|
||||
var advancedPrefs = document.getElementById("advancedPrefs");
|
||||
var preference = document.getElementById("calendar.preferences.advanced.selectedTabIndex");
|
||||
preference.valueFromPreferences = advancedPrefs.selectedIndex;
|
||||
},
|
||||
|
||||
showConnections: function advPaneShowConnections() {
|
||||
var url = "chrome://calendar/content/preferences/connection.xul";
|
||||
document.documentElement.openSubDialog(url, "", "chrome,dialog");
|
||||
},
|
||||
|
||||
showConfigEdit: function advPaneShowConfigEdit() {
|
||||
document.documentElement.openWindow("Preferences:ConfigManager",
|
||||
"chrome://global/content/config.xul",
|
||||
"", null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Caches the security module service for multiple use.
|
||||
*/
|
||||
__secModDb: null,
|
||||
get _secModDb() {
|
||||
if (!this.__secModDb) {
|
||||
this.__secModDb =
|
||||
Components.classes["@mozilla.org/security/pkcs11moduledb;1"]
|
||||
.getService(Components.interfaces.nsIPKCS11ModuleDB);
|
||||
}
|
||||
return this.__secModDb;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes Master Password UI: the "Use Master Password" checkbox,
|
||||
* selects the Master Password button to show, and enables/disables it as
|
||||
* necessary. The Master Password is controlled by various bits of NSS
|
||||
* functionality, so the UI for it can't be controlled by the normal
|
||||
* preference bindings.
|
||||
*/
|
||||
_initMasterPasswordUI: function advPaneInitMasterPassword() {
|
||||
var noMP = !this._masterPasswordSet();
|
||||
|
||||
var button = document.getElementById("changeMasterPassword");
|
||||
button.disabled = noMP;
|
||||
|
||||
var checkbox = document.getElementById("useMasterPassword");
|
||||
checkbox.checked = !noMP;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the user has a Master Password set and false otherwise.
|
||||
*/
|
||||
_masterPasswordSet: function advPaneMasterPasswordSet() {
|
||||
var slot = this._secModDb.findSlotByName("");
|
||||
if (slot) {
|
||||
const nsIPKCS11Slot = Components.interfaces.nsIPKCS11Slot;
|
||||
var status = slot.status;
|
||||
// Does the user have a Master Password set?
|
||||
return ((status != nsIPKCS11Slot.SLOT_UNINITIALIZED) &&
|
||||
(status != nsIPKCS11Slot.SLOT_READY));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Enables/disables the Master Password button depending on the state of
|
||||
* the "Use Master Password" checkbox, and prompts for Master Password
|
||||
* removal if one is set. This function is called when the "Use Master
|
||||
* Password" checkbox is changed.
|
||||
*/
|
||||
updateMasterPasswordButton: function advPaneUpdateMasterPasswordButton() {
|
||||
var checkbox = document.getElementById("useMasterPassword");
|
||||
var button = document.getElementById("changeMasterPassword");
|
||||
button.disabled = !checkbox.checked;
|
||||
|
||||
// Unchecking the checkbox should try to immediately remove the Master
|
||||
// Password, because it's impossible to non-destructively remove the
|
||||
// Master Password used to encrypt all the passwords without providing
|
||||
// it (by design), and it would be extremely odd to pop up that dialog
|
||||
// when the user closes the prefwindow and saves his settings.
|
||||
if (!checkbox.checked) {
|
||||
this._removeMasterPassword();
|
||||
} else {
|
||||
this.changeMasterPassword();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays the "Remove Master Password" dialog to allow the user to
|
||||
* remove the current Master Password. When the dialog is dismissed,
|
||||
* the Master Password UI is automatically updated.
|
||||
*/
|
||||
_removeMasterPassword: function advRemoveMasterPassword() {
|
||||
if (this._secmodDB.isFIPSEnabled) {
|
||||
var bundle = document.getElementById("bundlePreferences");
|
||||
var promptSvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
promptSvc.alert(window,
|
||||
bundle.getString("pw_change_failed_title"),
|
||||
bundle.getString("pw_change2empty_in_fips_mode"));
|
||||
} else {
|
||||
var url = "chrome://mozapps/content/preferences/removemp.xul";
|
||||
document.documentElement.openSubDialog(url, "", null);
|
||||
|
||||
}
|
||||
this._initMasterPasswordUI();
|
||||
},
|
||||
|
||||
/**
|
||||
* Displays a dialog in which the Master Password may be changed.
|
||||
*/
|
||||
changeMasterPassword: function advPaneChangeMasterPassword() {
|
||||
var url = "chrome://mozapps/content/preferences/changemp.xul";
|
||||
document.documentElement.openSubDialog(url, "", null);
|
||||
|
||||
this._initMasterPasswordUI();
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows the sites where the user has saved passwords and the associated
|
||||
* login information.
|
||||
*/
|
||||
viewPasswords: function advPaneViewPasswords() {
|
||||
var url = "chrome://passwordmgr/content/passwordManager.xul";
|
||||
document.documentElement.openWindow("Toolkit:PasswordManager", url,
|
||||
"", null);
|
||||
},
|
||||
|
||||
/**
|
||||
* The Extensions checkbox and button are disabled only if the enable
|
||||
* Addon update preference is locked.
|
||||
*/
|
||||
updateAddonUpdateUI: function advPaneUpdateAddonUpdateUI() {
|
||||
var enabledPref = document.getElementById("extensions.update.enabled");
|
||||
var enableAddonUpdate = document.getElementById("enableAddonUpdate");
|
||||
|
||||
enableAddonUpdate.disabled = enabledPref.locked;
|
||||
}
|
||||
};
|
||||
157
mozilla/calendar/base/content/preferences/advanced.xul
Normal file
157
mozilla/calendar/base/content/preferences/advanced.xul
Normal file
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla 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/MPL/
|
||||
-
|
||||
- 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 Thunderbird preferences
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Scott MacGregor
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Matthew Willis <lilmatt@mozilla.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
<!ENTITY % advancedDTD SYSTEM "chrome://calendar/locale/preferences/advanced.dtd">
|
||||
<!ENTITY % connectionDTD SYSTEM "chrome://calendar/locale/preferences/connection.dtd">
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://calendar/locale/global.dtd">
|
||||
<!ENTITY % preferencesDTD SYSTEM "chrome://calendar/locale/preferences/preferences.dtd">
|
||||
%brandDTD;
|
||||
%advancedDTD;
|
||||
%connectionDTD;
|
||||
%globalDTD;
|
||||
%preferencesDTD;
|
||||
]>
|
||||
|
||||
<overlay id="AdvancedPaneOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<prefpane id="paneAdvanced" onpaneload="gAdvancedPane.init();">
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://calendar/content/preferences/advanced.js"/>
|
||||
|
||||
<preferences>
|
||||
<preference id="calendar.preferences.advanced.selectedTabIndex"
|
||||
name="calendar.preferences.advanced.selectedTabIndex"
|
||||
type="int"/>
|
||||
<preference id="signon.rememberSignons"
|
||||
name="signon.rememberSignons"
|
||||
type="bool"/>
|
||||
<preference id="pref.privacy.disable_button.view_passwords"
|
||||
name="pref.privacy.disable_button.view_passwords"
|
||||
type="bool"/>
|
||||
<preference id="extensions.update.enabled"
|
||||
name="extensions.update.enabled"
|
||||
type="bool"
|
||||
onchange="gAdvancedPane.updateAddonUpdateUI();"/>
|
||||
</preferences>
|
||||
|
||||
<tabbox id="advancedPrefs"
|
||||
flex="1"
|
||||
onselect="gAdvancedPane.tabSelectionChanged();">
|
||||
<tabs>
|
||||
<tab label="&pref.calendar.advanced.generalTab.label;"/>
|
||||
<tab label="&pref.calendar.advanced.passwordsTab.label;"/>
|
||||
<tab label="&pref.calendar.advanced.updateTab.label;"/>
|
||||
</tabs>
|
||||
|
||||
<tabpanels flex="1">
|
||||
|
||||
<!-- General -->
|
||||
<tabpanel orient="vertical">
|
||||
<hbox align="center" pack="start">
|
||||
<description flex="1">&pref.proxiesInfo.label;</description>
|
||||
<button id="catProxiesButton"
|
||||
label="&pref.showConnections.label;"
|
||||
accesskey="&pref.showConnections.accesskey;"
|
||||
oncommand="gAdvancedPane.showConnections();"/>
|
||||
</hbox>
|
||||
|
||||
<separator/>
|
||||
|
||||
<hbox align="center" pack="start">
|
||||
<description flex="1">&pref.calendar.advanced.configEdit.caption;</description>
|
||||
<button id="configEditor"
|
||||
label="&pref.calendar.advanced.configEdit.button;"
|
||||
accesskey="&pref.calendar.advanced.configEdit.accesskey;"
|
||||
oncommand="gAdvancedPane.showConfigEdit();"/>
|
||||
</hbox>
|
||||
|
||||
<separator/>
|
||||
</tabpanel>
|
||||
|
||||
<!-- Passwords -->
|
||||
<tabpanel orient="vertical" align="start">
|
||||
<description>&pref.calendar.advanced.savedPasswords.intro;</description>
|
||||
<checkbox id="useMasterPassword"
|
||||
label="&pref.calendar.advanced.useMasterPassword.label;"
|
||||
accesskey="&pref.calendar.advanced.useMasterPassword.accesskey;"
|
||||
oncommand="gAdvancedPane.updateMasterPasswordButton();"
|
||||
class="indent"
|
||||
flex="1"/>
|
||||
<separator/>
|
||||
|
||||
<hbox align="start">
|
||||
<description flex="1">&pref.calendar.advanced.masterPassword.intro;</description>
|
||||
<vbox>
|
||||
<button id="changeMasterPassword"
|
||||
label="&pref.calendar.advanced.changeMasterPassword.label;"
|
||||
accesskey="&pref.calendar.advanced.changeMasterPassword.accesskey;"
|
||||
oncommand="gAdvancedPane.changeMasterPassword();"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<separator flex="1"/>
|
||||
|
||||
<hbox>
|
||||
<button id="viewPasswords"
|
||||
label="&pref.calendar.advanced.viewPasswords.label;"
|
||||
accesskey="&pref.calendar.advanced.viewPasswords.accesskey;"
|
||||
oncommand="gAdvancedPane.viewPasswords();"
|
||||
preference="pref.privacy.disable_button.view_passwords"/>
|
||||
</hbox>
|
||||
</tabpanel>
|
||||
|
||||
<!-- Update -->
|
||||
<tabpanel orient="vertical" align="start">
|
||||
<!-- This is indented like this so we don't hose cvs blame
|
||||
- when we add the rest of the aus stuff. -->
|
||||
<vbox class="indent">
|
||||
<checkbox id="enableAddonUpdate"
|
||||
label="&pref.calendar.advanced.update.enableAddonUpdate.label;"
|
||||
accesskey="&pref.calendar.advanced.update.enableAddonUpdate.accesskey;"
|
||||
preference="extensions.update.enabled"/>
|
||||
</vbox>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
|
||||
<separator/>
|
||||
|
||||
</prefpane>
|
||||
</overlay>
|
||||
@@ -0,0 +1,64 @@
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla 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/MPL/
|
||||
-
|
||||
- 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 Thunderbird Preferences System
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Scott MacGregor
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Matthew Willis <lilmatt@mozilla.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- WARNING! This file contains UTF-8 encoded characters!
|
||||
- If this ==> … <== doesn't look like an ellipsis (three dots in a row),
|
||||
- your editor isn't using UTF-8 encoding and may munge up the document!
|
||||
-->
|
||||
|
||||
<!ENTITY pref.calendar.advanced.generalTab.label "General">
|
||||
<!ENTITY pref.calendar.advanced.passwordsTab.label "Passwords">
|
||||
<!ENTITY pref.calendar.advanced.updateTab.label "Update">
|
||||
|
||||
<!-- General -->
|
||||
<!ENTITY pref.calendar.advanced.configEdit.caption "Advanced Configuration">
|
||||
<!ENTITY pref.calendar.advanced.configEdit.button "Config Editor…">
|
||||
<!ENTITY pref.calendar.advanced.configEdit.accesskey "g">
|
||||
|
||||
<!-- Passwords -->
|
||||
<!ENTITY pref.calendar.advanced.savedPasswords.intro "&brandShortName; can remember password information for all of your calendars so you don't need to re-enter your login details.">
|
||||
<!ENTITY pref.calendar.advanced.useMasterPassword.label "Use a Master Password to encrypt stored passwords">
|
||||
<!ENTITY pref.calendar.advanced.useMasterPassword.accesskey "P">
|
||||
<!ENTITY pref.calendar.advanced.masterPassword.intro "When set, the Master Password protects all your passwords, but you must enter it once per session.">
|
||||
<!ENTITY pref.calendar.advanced.changeMasterPassword.label "Change Master Password…">
|
||||
<!ENTITY pref.calendar.advanced.changeMasterPassword.accesskey "M">
|
||||
<!ENTITY pref.calendar.advanced.viewPasswords.label "View Saved Passwords…">
|
||||
<!ENTITY pref.calendar.advanced.viewPasswords.accesskey "V">
|
||||
|
||||
<!-- Update -->
|
||||
<!ENTITY pref.calendar.advanced.update.enableAddonUpdate.label "Automatically check for updates to installed Add-ons">
|
||||
<!ENTITY pref.calendar.advanced.update.enableAddonUpdate.accesskey "A">
|
||||
Reference in New Issue
Block a user