summaryrefslogtreecommitdiffstats
path: root/application/basilisk/components/preferences
diff options
context:
space:
mode:
Diffstat (limited to 'application/basilisk/components/preferences')
-rw-r--r--application/basilisk/components/preferences/in-content/content.js31
-rw-r--r--application/basilisk/components/preferences/in-content/content.xul24
-rw-r--r--application/basilisk/components/preferences/in-content/sync.js119
-rw-r--r--application/basilisk/components/preferences/in-content/sync.xul8
-rw-r--r--application/basilisk/components/preferences/jar.mn2
-rw-r--r--application/basilisk/components/preferences/translation.js255
-rw-r--r--application/basilisk/components/preferences/translation.xul88
7 files changed, 15 insertions, 512 deletions
diff --git a/application/basilisk/components/preferences/in-content/content.js b/application/basilisk/components/preferences/in-content/content.js
index a957b1dd5..2eac10ca4 100644
--- a/application/basilisk/components/preferences/in-content/content.js
+++ b/application/basilisk/components/preferences/in-content/content.js
@@ -31,18 +31,6 @@ var gContentPane = {
menulist.value = FontBuilder.readFontSelection(menulist);
}
- // Show translation preferences if we may:
- const prefName = "browser.translation.ui.show";
- if (Services.prefs.getBoolPref(prefName)) {
- let row = document.getElementById("translationBox");
- row.removeAttribute("hidden");
- // Showing attribution only for Bing Translator.
- Components.utils.import("resource:///modules/translation/Translation.jsm");
- if (Translation.translationEngine == "bing") {
- document.getElementById("bingAttribution").removeAttribute("hidden");
- }
- }
-
if (AlertsServiceDND) {
let notificationsDoNotDisturbRow =
document.getElementById("notificationsDoNotDisturbRow");
@@ -66,10 +54,6 @@ var gContentPane = {
gContentPane.configureColors);
setEventListener("chooseLanguage", "command",
gContentPane.showLanguages);
- setEventListener("translationAttributionImage", "click",
- gContentPane.openTranslationProviderAttribution);
- setEventListener("translateButton", "command",
- gContentPane.showTranslationExceptions);
setEventListener("notificationsDoNotDisturb", "command",
gContentPane.toggleDoNotDisturbNotifications);
@@ -274,21 +258,6 @@ var gContentPane = {
gSubDialog.open("chrome://browser/content/preferences/languages.xul");
},
- /**
- * Displays the translation exceptions dialog where specific site and language
- * translation preferences can be set.
- */
- showTranslationExceptions: function ()
- {
- gSubDialog.open("chrome://browser/content/preferences/translation.xul");
- },
-
- openTranslationProviderAttribution: function ()
- {
- Components.utils.import("resource:///modules/translation/Translation.jsm");
- Translation.openProviderAttribution();
- },
-
toggleDoNotDisturbNotifications: function (event)
{
AlertsServiceDND.manualDoNotDisturb = event.target.checked;
diff --git a/application/basilisk/components/preferences/in-content/content.xul b/application/basilisk/components/preferences/in-content/content.xul
index 9434cba62..fac864411 100644
--- a/application/basilisk/components/preferences/in-content/content.xul
+++ b/application/basilisk/components/preferences/in-content/content.xul
@@ -22,11 +22,6 @@
<preference id="font.language.group"
name="font.language.group"
type="wstring"/>
-
- <!-- Languages -->
- <preference id="browser.translation.detectLanguage"
- name="browser.translation.detectLanguage"
- type="bool"/>
</preferences>
<script type="application/javascript"
@@ -191,23 +186,4 @@
label="&chooseButton.label;"
accesskey="&chooseButton.accesskey;"/>
</hbox>
-
- <hbox id="translationBox" hidden="true">
- <hbox align="center" flex="1">
- <checkbox id="translate" preference="browser.translation.detectLanguage"
- label="&translateWebPages.label;." accesskey="&translateWebPages.accesskey;"
- onsyncfrompreference="return gContentPane.updateButtons('translateButton',
- 'browser.translation.detectLanguage');"/>
- <hbox id="bingAttribution" hidden="true">
- <label>&translation.options.attribution.beforeLogo;</label>
- <separator orient="vertical" class="thin"/>
- <image id="translationAttributionImage" aria-label="Microsoft Translator"
- src="chrome://browser/content/microsoft-translator-attribution.png"/>
- <separator orient="vertical" class="thin"/>
- <label>&translation.options.attribution.afterLogo;</label>
- </hbox>
- </hbox>
- <button id="translateButton" label="&translateExceptions.label;"
- accesskey="&translateExceptions.accesskey;"/>
- </hbox>
</groupbox>
diff --git a/application/basilisk/components/preferences/in-content/sync.js b/application/basilisk/components/preferences/in-content/sync.js
index 27f7cd48c..2600677a8 100644
--- a/application/basilisk/components/preferences/in-content/sync.js
+++ b/application/basilisk/components/preferences/in-content/sync.js
@@ -306,113 +306,8 @@ var gSyncPane = {
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
- // service.fxAccountsEnabled is false iff sync is already configured for
- // the legacy provider.
- if (service.fxAccountsEnabled) {
- let displayNameLabel = document.getElementById("fxaDisplayName");
- let fxaEmailAddress1Label = document.getElementById("fxaEmailAddress1");
- fxaEmailAddress1Label.hidden = false;
- displayNameLabel.hidden = true;
-
- let profileInfoEnabled;
- try {
- profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled");
- } catch (ex) {}
-
- // determine the fxa status...
- this._showLoadPage(service);
-
- fxAccounts.getSignedInUser().then(data => {
- if (!data) {
- this.page = FXA_PAGE_LOGGED_OUT;
- return false;
- }
- this.page = FXA_PAGE_LOGGED_IN;
- // We are logged in locally, but maybe we are in a state where the
- // server rejected our credentials (eg, password changed on the server)
- let fxaLoginStatus = document.getElementById("fxaLoginStatus");
- let syncReady;
- // Not Verfied implies login error state, so check that first.
- if (!data.verified) {
- fxaLoginStatus.selectedIndex = FXA_LOGIN_UNVERIFIED;
- syncReady = false;
- // So we think we are logged in, so login problems are next.
- // (Although if the Sync identity manager is still initializing, we
- // ignore login errors and assume all will eventually be good.)
- // LOGIN_FAILED_LOGIN_REJECTED explicitly means "you must log back in".
- // All other login failures are assumed to be transient and should go
- // away by themselves, so aren't reflected here.
- } else if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
- fxaLoginStatus.selectedIndex = FXA_LOGIN_FAILED;
- syncReady = false;
- // Else we must be golden (or in an error state we expect to magically
- // resolve itself)
- } else {
- fxaLoginStatus.selectedIndex = FXA_LOGIN_VERIFIED;
- syncReady = true;
- }
- fxaEmailAddress1Label.textContent = data.email;
- document.getElementById("fxaEmailAddress2").textContent = data.email;
- document.getElementById("fxaEmailAddress3").textContent = data.email;
- this._populateComputerName(Weave.Service.clientsEngine.localName);
- let engines = document.getElementById("fxaSyncEngines")
- for (let checkbox of engines.querySelectorAll("checkbox")) {
- checkbox.disabled = !syncReady;
- }
- document.getElementById("fxaChangeDeviceName").disabled = !syncReady;
-
- // Clear the profile image (if any) of the previously logged in account.
- document.getElementById("fxaProfileImage").style.removeProperty("list-style-image");
-
- // If the account is verified the next promise in the chain will
- // fetch profile data.
- return data.verified;
- }).then(isVerified => {
- if (isVerified) {
- return fxAccounts.getSignedInUserProfile();
- }
- return null;
- }).then(data => {
- let fxaLoginStatus = document.getElementById("fxaLoginStatus");
- if (data && profileInfoEnabled) {
- if (data.displayName) {
- fxaLoginStatus.setAttribute("hasName", true);
- displayNameLabel.hidden = false;
- displayNameLabel.textContent = data.displayName;
- } else {
- fxaLoginStatus.removeAttribute("hasName");
- }
- if (data.avatar) {
- let bgImage = "url(\"" + data.avatar + "\")";
- let profileImageElement = document.getElementById("fxaProfileImage");
- profileImageElement.style.listStyleImage = bgImage;
-
- let img = new Image();
- img.onerror = () => {
- // Clear the image if it has trouble loading. Since this callback is asynchronous
- // we check to make sure the image is still the same before we clear it.
- if (profileImageElement.style.listStyleImage === bgImage) {
- profileImageElement.style.removeProperty("list-style-image");
- }
- };
- img.src = data.avatar;
- }
- } else {
- fxaLoginStatus.removeAttribute("hasName");
- }
- }, err => {
- FxAccountsCommon.log.error(err);
- }).catch(err => {
- // If we get here something's really busted
- Cu.reportError(String(err));
- });
-
- // If fxAccountEnabled is false and we are in a "not configured" state,
- // then fxAccounts is probably fully disabled rather than just unconfigured,
- // so handle this case. This block can be removed once we remove support
- // for fxAccounts being disabled.
- } else if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED ||
- Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
+ if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED ||
+ Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
this.page = PAGE_NO_ACCOUNT;
// else: sync was previously configured for the legacy provider, so we
// make the "old" panels available.
@@ -646,6 +541,16 @@ var gSyncPane = {
});
},
+ openQuotaDialog: function () {
+ let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
+ if (win) {
+ win.focus();
+ } else {
+ window.openDialog("chrome://browser/content/sync/quota.xul", "",
+ "centerscreen,chrome,dialog,modal");
+ }
+ },
+
openAddDevice: function () {
if (!Weave.Utils.ensureMPUnlocked())
return;
diff --git a/application/basilisk/components/preferences/in-content/sync.xul b/application/basilisk/components/preferences/in-content/sync.xul
index f1aebf2aa..cf0e81ca1 100644
--- a/application/basilisk/components/preferences/in-content/sync.xul
+++ b/application/basilisk/components/preferences/in-content/sync.xul
@@ -71,6 +71,9 @@
label="&manageAccount.label;"
accesskey="&manageAccount.accesskey;">
<menupopup>
+ <menuitem id="syncViewQuota" label="&viewQuota.label;"
+ oncommand="gSyncPane.openQuotaDialog();"/>
+ <menuseparator/>
<menuitem id="syncChangePassword" label="&changePassword2.label;"/>
<menuitem id="syncResetPassphrase" label="&myRecoveryKey.label;"/>
<menuseparator/>
@@ -91,11 +94,6 @@
<richlistbox id="syncEnginesList"
orient="vertical">
<richlistitem>
- <checkbox label="&engine.addons.label;"
- accesskey="&engine.addons.accesskey;"
- preference="engine.addons"/>
- </richlistitem>
- <richlistitem>
<checkbox label="&engine.bookmarks.label;"
accesskey="&engine.bookmarks.accesskey;"
preference="engine.bookmarks"/>
diff --git a/application/basilisk/components/preferences/jar.mn b/application/basilisk/components/preferences/jar.mn
index d233c7865..5b24e89df 100644
--- a/application/basilisk/components/preferences/jar.mn
+++ b/application/basilisk/components/preferences/jar.mn
@@ -31,5 +31,3 @@ browser.jar:
content/browser/preferences/sanitize.js
content/browser/preferences/selectBookmark.xul
content/browser/preferences/selectBookmark.js
- content/browser/preferences/translation.xul
- content/browser/preferences/translation.js
diff --git a/application/basilisk/components/preferences/translation.js b/application/basilisk/components/preferences/translation.js
deleted file mode 100644
index cd570db0e..000000000
--- a/application/basilisk/components/preferences/translation.js
+++ /dev/null
@@ -1,255 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "gLangBundle", () =>
- Services.strings.createBundle("chrome://global/locale/languageNames.properties"));
-
-const kPermissionType = "translate";
-const kLanguagesPref = "browser.translation.neverForLanguages";
-
-function Tree(aId, aData)
-{
- this._data = aData;
- this._tree = document.getElementById(aId);
- this._tree.view = this;
-}
-
-Tree.prototype = {
- get boxObject() {
- return this._tree.treeBoxObject;
- },
- get isEmpty() {
- return !this._data.length;
- },
- get hasSelection() {
- return this.selection.count > 0;
- },
- getSelectedItems: function() {
- let result = [];
-
- let rc = this.selection.getRangeCount();
- for (let i = 0; i < rc; ++i) {
- let min = {}, max = {};
- this.selection.getRangeAt(i, min, max);
- for (let j = min.value; j <= max.value; ++j)
- result.push(this._data[j]);
- }
-
- return result;
- },
-
- // nsITreeView implementation
- get rowCount() {
- return this._data.length;
- },
- getCellText: function (aRow, aColumn) {
- return this._data[aRow];
- },
- isSeparator: function(aIndex) {
- return false;
- },
- isSorted: function() {
- return false;
- },
- isContainer: function(aIndex) {
- return false;
- },
- setTree: function(aTree) {},
- getImageSrc: function(aRow, aColumn) {},
- getProgressMode: function(aRow, aColumn) {},
- getCellValue: function(aRow, aColumn) {},
- cycleHeader: function(column) {},
- getRowProperties: function(row) {
- return "";
- },
- getColumnProperties: function(column) {
- return "";
- },
- getCellProperties: function(row, column) {
- return "";
- },
- QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView])
-};
-
-function Lang(aCode)
-{
- this.langCode = aCode;
- this._label = gLangBundle.GetStringFromName(aCode);
-}
-
-Lang.prototype = {
- toString: function() {
- return this._label;
- }
-}
-
-var gTranslationExceptions = {
- onLoad: function() {
- if (this._siteTree) {
- // Re-using an open dialog, clear the old observers.
- this.uninit();
- }
-
- // Load site permissions into an array.
- this._sites = [];
- let enumerator = Services.perms.enumerator;
- while (enumerator.hasMoreElements()) {
- let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission);
-
- if (perm.type == kPermissionType &&
- perm.capability == Services.perms.DENY_ACTION) {
- this._sites.push(perm.principal.origin);
- }
- }
- Services.obs.addObserver(this, "perm-changed", false);
- this._sites.sort();
-
- this._siteTree = new Tree("sitesTree", this._sites);
- this.onSiteSelected();
-
- this._langs = this.getLanguageExceptions();
- Services.prefs.addObserver(kLanguagesPref, this, false);
- this._langTree = new Tree("languagesTree", this._langs);
- this.onLanguageSelected();
- },
-
- // Get the list of languages we don't translate as an array.
- getLanguageExceptions: function() {
- let langs = Services.prefs.getCharPref(kLanguagesPref);
- if (!langs)
- return [];
-
- let result = langs.split(",").map(code => new Lang(code));
- result.sort();
-
- return result;
- },
-
- observe: function(aSubject, aTopic, aData) {
- if (aTopic == "perm-changed") {
- if (aData == "cleared") {
- if (!this._sites.length)
- return;
- let removed = this._sites.splice(0, this._sites.length);
- this._siteTree.boxObject.rowCountChanged(0, - removed.length);
- }
- else {
- let perm = aSubject.QueryInterface(Ci.nsIPermission);
- if (perm.type != kPermissionType)
- return;
-
- if (aData == "added") {
- if (perm.capability != Services.perms.DENY_ACTION)
- return;
- this._sites.push(perm.principal.origin);
- this._sites.sort();
- let boxObject = this._siteTree.boxObject;
- boxObject.rowCountChanged(0, 1);
- boxObject.invalidate();
- }
- else if (aData == "deleted") {
- let index = this._sites.indexOf(perm.principal.origin);
- if (index == -1)
- return;
- this._sites.splice(index, 1);
- this._siteTree.boxObject.rowCountChanged(index, -1);
- this.onSiteSelected();
- return;
- }
- }
- this.onSiteSelected();
- }
- else if (aTopic == "nsPref:changed") {
- this._langs = this.getLanguageExceptions();
- let change = this._langs.length - this._langTree.rowCount;
- this._langTree._data = this._langs;
- let boxObject = this._langTree.boxObject;
- if (change)
- boxObject.rowCountChanged(0, change);
- boxObject.invalidate();
- this.onLanguageSelected();
- }
- },
-
- _handleButtonDisabling: function(aTree, aIdPart) {
- let empty = aTree.isEmpty;
- document.getElementById("removeAll" + aIdPart + "s").disabled = empty;
- document.getElementById("remove" + aIdPart).disabled =
- empty || !aTree.hasSelection;
- },
-
- onLanguageSelected: function() {
- this._handleButtonDisabling(this._langTree, "Language");
- },
-
- onSiteSelected: function() {
- this._handleButtonDisabling(this._siteTree, "Site");
- },
-
- onLanguageDeleted: function() {
- let langs = Services.prefs.getCharPref(kLanguagesPref);
- if (!langs)
- return;
-
- let removed = this._langTree.getSelectedItems().map(l => l.langCode);
-
- langs = langs.split(",").filter(l => removed.indexOf(l) == -1);
- Services.prefs.setCharPref(kLanguagesPref, langs.join(","));
- },
-
- onAllLanguagesDeleted: function() {
- Services.prefs.setCharPref(kLanguagesPref, "");
- },
-
- onSiteDeleted: function() {
- let removedSites = this._siteTree.getSelectedItems();
- for (let origin of removedSites) {
- let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
- Services.perms.removeFromPrincipal(principal, kPermissionType);
- }
- },
-
- onAllSitesDeleted: function() {
- if (this._siteTree.isEmpty)
- return;
-
- let removedSites = this._sites.splice(0, this._sites.length);
- this._siteTree.boxObject.rowCountChanged(0, -removedSites.length);
-
- for (let origin of removedSites) {
- let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
- Services.perms.removeFromPrincipal(principal, kPermissionType);
- }
-
- this.onSiteSelected();
- },
-
- onSiteKeyPress: function(aEvent) {
- if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE)
- this.onSiteDeleted();
- },
-
- onLanguageKeyPress: function(aEvent) {
- if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE)
- this.onLanguageDeleted();
- },
-
- onWindowKeyPress: function(aEvent) {
- if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
- window.close();
- },
-
- uninit: function() {
- Services.obs.removeObserver(this, "perm-changed");
- Services.prefs.removeObserver(kLanguagesPref, this);
- }
-};
diff --git a/application/basilisk/components/preferences/translation.xul b/application/basilisk/components/preferences/translation.xul
deleted file mode 100644
index b5dfd1b9b..000000000
--- a/application/basilisk/components/preferences/translation.xul
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
-
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/translation.dtd">
-
-<window id="TranslationDialog" class="windowDialog"
- windowtype="Browser:TranslationExceptions"
- title="&window.title;"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- style="width: &window.width;;"
- onload="gTranslationExceptions.onLoad();"
- onunload="gTranslationExceptions.uninit();"
- persist="screenX screenY width height"
- onkeypress="gTranslationExceptions.onWindowKeyPress(event);">
-
- <script src="chrome://browser/content/preferences/translation.js"/>
-
- <stringbundle id="bundlePreferences"
- src="chrome://browser/locale/preferences/preferences.properties"/>
-
- <keyset>
- <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
- </keyset>
-
- <vbox class="largeDialogContainer">
- <vbox class="contentPane" flex="1">
- <label id="languagesLabel" control="permissionsTree">&noTranslationForLanguages.label;</label>
- <separator class="thin"/>
- <tree id="languagesTree" flex="1" style="height: 12em;"
- hidecolumnpicker="true"
- onkeypress="gTranslationExceptions.onLanguageKeyPress(event)"
- onselect="gTranslationExceptions.onLanguageSelected();">
- <treecols>
- <treecol id="languageCol" label="&treehead.languageName.label;" flex="1"/>
- </treecols>
- <treechildren/>
- </tree>
- </vbox>
- <hbox align="end">
- <hbox class="actionButtons" flex="1">
- <button id="removeLanguage" disabled="true"
- accesskey="&removeLanguage.accesskey;"
- icon="remove" label="&removeLanguage.label;"
- oncommand="gTranslationExceptions.onLanguageDeleted();"/>
- <button id="removeAllLanguages"
- icon="clear" label="&removeAllLanguages.label;"
- accesskey="&removeAllLanguages.accesskey;"
- oncommand="gTranslationExceptions.onAllLanguagesDeleted();"/>
- <spacer flex="1"/>
- </hbox>
- </hbox>
- <separator/>
- <vbox class="contentPane" flex="1">
- <label id="languagesLabel" control="permissionsTree">&noTranslationForSites.label;</label>
- <separator class="thin"/>
- <tree id="sitesTree" flex="1" style="height: 12em;"
- hidecolumnpicker="true"
- onkeypress="gTranslationExceptions.onSiteKeyPress(event)"
- onselect="gTranslationExceptions.onSiteSelected();">
- <treecols>
- <treecol id="siteCol" label="&treehead.siteName.label;" flex="1"/>
- </treecols>
- <treechildren/>
- </tree>
- </vbox>
- </vbox>
- <hbox align="end">
- <hbox class="actionButtons" flex="1">
- <button id="removeSite" disabled="true"
- accesskey="&removeSite.accesskey;"
- icon="remove" label="&removeSite.label;"
- oncommand="gTranslationExceptions.onSiteDeleted();"/>
- <button id="removeAllSites"
- icon="clear" label="&removeAllSites.label;"
- accesskey="&removeAllSites.accesskey;"
- oncommand="gTranslationExceptions.onAllSitesDeleted();"/>
- <spacer flex="1"/>
- <button oncommand="close();" icon="close"
- label="&button.close.label;" accesskey="&button.close.accesskey;"/>
- </hbox>
- </hbox>
-</window>