[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-102.8.0esr-12.5-1] 2 commits: fixup! Add TorStrings module for localization

Richard Pospesel (@richard) git at gitlab.torproject.org
Mon Feb 27 15:24:08 UTC 2023



Richard Pospesel pushed to branch tor-browser-102.8.0esr-12.5-1 at The Tor Project / Applications / Tor Browser


Commits:
63afd83c by Dan Ballard at 2023-02-27T14:55:03+00:00
fixup! Add TorStrings module for localization

bug 41085: add new strings for bridge removal dialog

- - - - -
6518ee5b by Dan Ballard at 2023-02-27T14:55:03+00:00
fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection

bug 41085: move remove all bridges button and modernize dialoge to proton

- - - - -


5 changed files:

- browser/components/torpreferences/content/connectionPane.js
- browser/components/torpreferences/content/connectionPane.xhtml
- browser/components/torpreferences/content/torPreferences.css
- browser/modules/TorStrings.jsm
- toolkit/torbutton/chrome/locale/en-US/settings.properties


Changes:

=====================================
browser/components/torpreferences/content/connectionPane.js
=====================================
@@ -117,9 +117,9 @@ const gConnectionPane = (function() {
       locationEntries: "#torPreferences-bridges-locationEntries",
       chooseForMe: "#torPreferences-bridges-buttonChooseBridgeForMe",
       currentHeader: "#torPreferences-currentBridges-header",
-      currentHeaderText: "#torPreferences-currentBridges-headerText",
       currentDescription: "#torPreferences-currentBridges-description",
       currentDescriptionText: "#torPreferences-currentBridges-descriptionText",
+      switchLabel: "#torPreferences-currentBridges-enableAll-label",
       switch: "#torPreferences-currentBridges-switch",
       cards: "#torPreferences-currentBridges-cards",
       cardTemplate: "#torPreferences-bridgeCard-template",
@@ -426,10 +426,9 @@ const gConnectionPane = (function() {
       const bridgeHeader = prefpane.querySelector(
         selectors.bridges.currentHeader
       );
-      bridgeHeader.querySelector(
-        selectors.bridges.currentHeaderText
-      ).textContent = TorStrings.settings.bridgeCurrent;
-      const bridgeSwitch = bridgeHeader.querySelector(selectors.bridges.switch);
+      bridgeHeader.textContent = TorStrings.settings.bridgeCurrent;
+      prefpane.querySelector(selectors.bridges.switchLabel).textContent = TorStrings.settings.allBridgesEnabled;
+      const bridgeSwitch = prefpane.querySelector(selectors.bridges.switch);
       bridgeSwitch.addEventListener("change", () => {
         TorSettings.bridges.enabled = bridgeSwitch.checked;
         TorSettings.saveToPrefs();
@@ -860,35 +859,32 @@ const gConnectionPane = (function() {
       }
 
       {
-        const overlay = prefpane.querySelector(selectors.bridges.removeOverlay);
         this._confirmBridgeRemoval = () => {
-          overlay.classList.remove("hidden");
-        };
-        const closeDialog = () => {
-          overlay.classList.add("hidden");
+          const aParentWindow = Services.wm.getMostRecentWindow("navigator:browser");
+
+          const ps = Services.prompt;
+          const btnFlags =
+            ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING +
+            ps.BUTTON_POS_0_DEFAULT +
+            ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
+
+          const notUsed = { value: false };
+          const btnIndex = ps.confirmEx(
+            aParentWindow,
+            TorStrings.settings.bridgeRemoveAllDialogTitle,
+            TorStrings.settings.bridgeRemoveAllDialogDescription,
+            btnFlags,
+            TorStrings.settings.remove,
+            null,
+            null,
+            null,
+            notUsed
+          );
+
+          if (btnIndex === 0) {
+            this.onRemoveAllBridges();
+          }
         };
-        overlay.addEventListener("click", closeDialog);
-        const modal = prefpane.querySelector(selectors.bridges.removeModal);
-        modal.addEventListener("click", e => {
-          e.stopPropagation();
-        });
-        const dismiss = prefpane.querySelector(selectors.bridges.removeDismiss);
-        dismiss.addEventListener("click", closeDialog);
-        const question = prefpane.querySelector(
-          selectors.bridges.removeQuestion
-        );
-        question.textContent = TorStrings.settings.removeBridgesQuestion;
-        const warning = prefpane.querySelector(selectors.bridges.removeWarning);
-        warning.textContent = TorStrings.settings.removeBridgesWarning;
-        const confirm = prefpane.querySelector(selectors.bridges.removeConfirm);
-        confirm.setAttribute("label", TorStrings.settings.remove);
-        confirm.addEventListener("command", () => {
-          this.onRemoveAllBridges();
-          closeDialog();
-        });
-        const cancel = prefpane.querySelector(selectors.bridges.removeCancel);
-        cancel.setAttribute("label", TorStrings.settings.cancel);
-        cancel.addEventListener("command", closeDialog);
       }
 
       // Advanced setup


=====================================
browser/components/torpreferences/content/connectionPane.xhtml
=====================================
@@ -91,12 +91,17 @@
     <button id="torPreferences-bridges-buttonChooseBridgeForMe" class="primary"/>
   </hbox>
   <html:h2 id="torPreferences-currentBridges-header">
-    <html:span id="torPreferences-currentBridges-headerText"/>
-    <html:input type="checkbox" id="torPreferences-currentBridges-switch" class="toggle-button"/>
   </html:h2>
   <description flex="1" id="torPreferences-currentBridges-description">
     <html:span id="torPreferences-currentBridges-descriptionText"/>
   </description>
+  <hbox align="center">
+    <html:input type="checkbox" id="torPreferences-currentBridges-switch" class="toggle-button"/>
+    <html:label id="torPreferences-currentBridges-enableAll-label" for="torPreferences-currentBridges-switch">
+    </html:label>
+    <spacer flex="1"/>
+    <button id="torPreferences-currentBridges-removeAll"/>
+  </hbox>
   <menupopup id="torPreferences-bridgeCard-menu"/>
   <vbox id="torPreferences-bridgeCard-template" class="torPreferences-bridgeCard">
     <hbox class="torPreferences-bridgeCard-heading">
@@ -133,7 +138,6 @@
   <vbox id="torPreferences-currentBridges-cards"></vbox>
   <vbox align="center">
     <button id="torPreferences-currentBridges-showAll"/>
-    <button id="torPreferences-currentBridges-removeAll" class="primary danger-button"/>
   </vbox>
   <html:h2 id="torPreferences-addBridge-header"></html:h2>
   <hbox align="center">
@@ -176,17 +180,4 @@
   </hbox>
 </groupbox>
 
-<html:div id="bridge-remove-overlay" class="hidden">
-  <html:div id="bridge-remove-modal">
-    <html:img id="bridge-remove-dismiss" src="chrome://global/skin/icons/close.svg"/>
-    <html:div id="bridge-remove-icon"/>
-    <html:p id="bridge-remove-question"/>
-    <html:p id="bridge-remove-warning"/>
-    <html:div id="bridge-remove-buttonbar">
-    <button id="bridge-remove-cancel"/>
-    <button id="bridge-remove-confirm"/>
-    </html:div>
-  </html:div>
-</html:div>
-
 </html:template>


=====================================
browser/components/torpreferences/content/torPreferences.css
=====================================
@@ -187,6 +187,12 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before {
   font-weight: 700;
 }
 
+#torPreferences-currentBridges-enableAll-label {
+  /* Block display to work with parent's xul box layout. */
+  display: block;
+  margin-inline: 6px;
+}
+
 /* Bridge cards */
 :root {
   --bridgeCard-animation-time: 0.25s;


=====================================
browser/modules/TorStrings.jsm
=====================================
@@ -111,7 +111,10 @@ const Loader = {
       bridgeCopy: "Copy Bridge Address",
       copied: "Copied!",
       bridgeShowAll: "Show All Bridges",
+      allBridgesEnabled: "Use current bridges",
       bridgeRemoveAll: "Remove All Bridges",
+      bridgeRemoveAllDialogTitle: "Remove all bridges?",
+      bridgeRemoveAllDialogDescription: "If these bridges were received from torproject.org or added manually, this action cannot be undone",
       bridgeAdd: "Add a New Bridge",
       bridgeSelectBrowserBuiltin:
         "Choose from one of Tor Browser’s built-in bridges",


=====================================
toolkit/torbutton/chrome/locale/en-US/settings.properties
=====================================
@@ -43,7 +43,10 @@ settings.bridgeShare=Share this bridge using the QR code or by copying its addre
 settings.bridgeCopy=Copy Bridge Address
 settings.copied=Copied!
 settings.bridgeShowAll=Show All Bridges
+settings.allBridgesEnabled=Use current bridges
 settings.bridgeRemoveAll=Remove All Bridges
+settings.bridgeRemoveAllDialogTitle=Remove all bridges?
+settings.bridgeRemoveAllDialogDescription=If these bridges were received from torproject.org or added manually, this action cannot be undone
 settings.bridgeAdd=Add a New Bridge
 settings.bridgeSelectBrowserBuiltin=Choose from one of Tor Browser’s built-in bridges
 settings.bridgeSelectBuiltin=Select a Built-In Bridge…



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/d814648c0e111d09d8a8662a4b00d88f52989767...6518ee5be023d34cec48235803de07152069967e

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/d814648c0e111d09d8a8662a4b00d88f52989767...6518ee5be023d34cec48235803de07152069967e
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20230227/50d282ed/attachment-0001.htm>


More information about the tbb-commits mailing list