mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 09:26:34 +00:00
feat: Add warning for changing the languages requested
This commit is contained in:
@@ -48,12 +48,28 @@ var gZenLooksAndFeel = {
|
||||
},
|
||||
|
||||
_getInitialAccentColor() {
|
||||
return Services.prefs.getStringPref("zen.theme.accent-color", kZenColors[0]);
|
||||
return Services.prefs.getStringPref(
|
||||
"zen.theme.accent-color",
|
||||
kZenColors[0]
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
var gZenWorkspacesSettings = {
|
||||
init() {
|
||||
this.addLanguageWarning();
|
||||
},
|
||||
|
||||
addLanguageWarning() {
|
||||
let chooseLanguage = document.getElementById("languagesBox");
|
||||
|
||||
let fragment = window.MozXULElement.parseXULToFragment(`
|
||||
<hbox class="zenLanguageWarning">
|
||||
<label class="zenLanguageWarning-label"><html:b data-l10n-id="zen-warning-language"/></label>
|
||||
</hbox>
|
||||
`);
|
||||
|
||||
chooseLanguage.after(fragment);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -66,18 +82,18 @@ var gZenCKSSettings = {
|
||||
},
|
||||
|
||||
_addPrefObservers() {
|
||||
Services.prefs.addObserver("zen.keyboard.shortcuts.disable-firefox", this.onDisableFirefoxShortcutsChange.bind(this));
|
||||
Services.prefs.addObserver(
|
||||
"zen.keyboard.shortcuts.disable-firefox",
|
||||
this.onDisableFirefoxShortcutsChange.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
async onDisableFirefoxShortcutsChange(event) {
|
||||
let checked = Services.prefs.getBoolPref("zen.keyboard.shortcuts.disable-firefox");
|
||||
if (checked) return;
|
||||
let buttonIndex = await confirmRestartPrompt(
|
||||
true,
|
||||
1,
|
||||
true,
|
||||
false
|
||||
let checked = Services.prefs.getBoolPref(
|
||||
"zen.keyboard.shortcuts.disable-firefox"
|
||||
);
|
||||
if (checked) return;
|
||||
let buttonIndex = await confirmRestartPrompt(true, 1, true, false);
|
||||
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
|
||||
Services.startup.quit(
|
||||
Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
|
||||
@@ -113,7 +129,10 @@ var gZenCKSSettings = {
|
||||
<html:input readonly="1" class="zenCKSOption-input"/>
|
||||
</hbox>
|
||||
`);
|
||||
document.l10n.setAttributes(fragment.querySelector(".zenCKSOption-label"), l10nId);
|
||||
document.l10n.setAttributes(
|
||||
fragment.querySelector(".zenCKSOption-label"),
|
||||
l10nId
|
||||
);
|
||||
|
||||
let input = fragment.querySelector(".zenCKSOption-input");
|
||||
let shortcut = gZenKeyboardShortcuts.getShortcut(key);
|
||||
@@ -156,15 +175,18 @@ var gZenCKSSettings = {
|
||||
return;
|
||||
}
|
||||
|
||||
let input = document.querySelector(`.zenCKSOption-input[data-key="${this._currentAction}"]`);
|
||||
let input = document.querySelector(
|
||||
`.zenCKSOption-input[data-key="${this._currentAction}"]`
|
||||
);
|
||||
let shortcut = {
|
||||
ctrl: event.ctrlKey,
|
||||
alt: event.altKey,
|
||||
shift: event.shiftKey,
|
||||
meta: event.metaKey
|
||||
meta: event.metaKey,
|
||||
};
|
||||
|
||||
const shortcutWithoutModifiers = !shortcut.ctrl && !shortcut.alt && !shortcut.shift && !shortcut.meta;
|
||||
const shortcutWithoutModifiers =
|
||||
!shortcut.ctrl && !shortcut.alt && !shortcut.shift && !shortcut.meta;
|
||||
|
||||
if (event.key === "Tab" && shortcutWithoutModifiers) {
|
||||
return;
|
||||
@@ -182,7 +204,7 @@ var gZenCKSSettings = {
|
||||
return; // No modifiers, ignore.
|
||||
}
|
||||
|
||||
if (!(["Control", "Alt", "Meta", "Shift"].includes(event.key))) {
|
||||
if (!["Control", "Alt", "Meta", "Shift"].includes(event.key)) {
|
||||
if (event.keycode) {
|
||||
shortcut.keycode = event.keycode;
|
||||
} else {
|
||||
@@ -259,5 +281,5 @@ Preferences.addAll([
|
||||
id: "zen.keyboard.shortcuts.disable-firefox",
|
||||
type: "bool",
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
@@ -3,6 +3,7 @@ pane-zen-looks-title = Look And Feel
|
||||
category-zen-looks =
|
||||
.tooltiptext = { pane-zen-looks-title }
|
||||
|
||||
zen-warning-language = Changing the default language could make it easier for Websites to track you.
|
||||
|
||||
zen-look-and-feel-colors-header = Pick a theme colour
|
||||
zen-look-and-feel-colors-description = Make { -brand-short-name } look and feel the way you like
|
||||
@@ -152,4 +153,4 @@ zen-change-workspace = Cycle Workspaces
|
||||
zen-split-view-grid = Split View Grid
|
||||
zen-split-view-vertical = Split View Vertical
|
||||
zen-split-view-horizontal = Split View Horizontal
|
||||
zen-split-view-close = Close Split View
|
||||
zen-split-view-close = Close Split View
|
Reference in New Issue
Block a user