Bug 1580715 - remove grid usage from EdDictionary.xul, remove Replace button. r=mkmelin
authorKhushil Mistry <khushil324@gmail.com>
Tue, 17 Sep 2019 06:33:00 +0200
changeset 36841 0e468cd9a91b48575751b66e6c3143baa8803efd
parent 36840 c19cbff54c4717476ecc2459af48b9973bd3158c
child 36842 97972953d726e8e891a808dfe9efc1eee3bc6142
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersmkmelin
bugs1580715
Bug 1580715 - remove grid usage from EdDictionary.xul, remove Replace button. r=mkmelin
mail/components/compose/content/dialogs/EdDictionary.js
mail/components/compose/content/dialogs/EdDictionary.xul
mail/locales/en-US/chrome/messenger/messengercompose/EditorPersonalDictionary.dtd
mail/themes/shared/mail/grid-layout.css
--- a/mail/components/compose/content/dialogs/EdDictionary.js
+++ b/mail/components/compose/content/dialogs/EdDictionary.js
@@ -69,41 +69,16 @@ function AddWord() {
     // Rebuild the dialog list
     FillDictionaryList();
 
     SelectWordToAddInList();
     gDialog.WordInput.value = "";
   }
 }
 
-function ReplaceWord() {
-  if (ValidateWordToAdd()) {
-    var selItem = gDialog.DictionaryList.selectedItem;
-    if (selItem) {
-      try {
-        gSpellChecker.RemoveWordFromDictionary(selItem.label);
-      } catch (e) {}
-
-      try {
-        // Add to the dictionary list
-        gSpellChecker.AddWordToDictionary(gWordToAdd);
-
-        // Just change the text on the selected item instead of rebuilding the list.
-        // The items are richlist items, so the label sits in the first child.
-        selItem.firstChild.setAttribute("value", gWordToAdd);
-      } catch (e) {
-        // Rebuild list and select the word - it was probably already in the list
-        dump("Exception occurred adding word in ReplaceWord\n");
-        FillDictionaryList();
-        SelectWordToAddInList();
-      }
-    }
-  }
-}
-
 function RemoveWord() {
   var selIndex = gDialog.DictionaryList.selectedIndex;
   if (selIndex >= 0) {
     var word = gDialog.DictionaryList.selectedItem.label;
 
     // Remove word from list
     gDialog.DictionaryList.selectedItem.remove();
 
--- a/mail/components/compose/content/dialogs/EdDictionary.xul
+++ b/mail/components/compose/content/dialogs/EdDictionary.xul
@@ -1,59 +1,59 @@
 <?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://editor/skin/editor.css" type="text/css"?>
 <?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
+<?xml-stylesheet href="chrome://messenger/skin/shared/grid-layout.css" type="text/css"?>
 <!DOCTYPE dialog SYSTEM "chrome://messenger/locale/messengercompose/EditorPersonalDictionary.dtd">
-<dialog buttons="cancel" title="&windowTitle.label;"
-    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-    persist="screenX screenY"
-    onload="Startup()">
+<dialog title="&windowTitle.label;"
+        buttons="accept"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+        xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        persist="screenX screenY"
+        buttonlabelaccept="&CloseButton.label;"
+        buttonaccesskeyaccept="&CloseButton.accessKey;"
+        onload="Startup()">
 
   <!-- Methods common to all editor dialogs -->
   <script src="chrome://messenger/content/messengercompose/editorUtilities.js"/>
   <script src="chrome://messenger/content/messengercompose/EdDialogCommon.js"/>
   <script src="chrome://messenger/content/messengercompose/EdDictionary.js"/>
 
-  <grid>
-    <columns><column style="width: 15em" flex="1"/><column flex="1"/></columns>
-    <rows>
-      <row>
-        <label value="&wordEditField.label;"
-               control="WordInput"
-               accesskey="&wordEditField.accessKey;"/>
-        <spacer/>
-      </row>
-      <row>
-        <textbox id="WordInput" flex="1"/>
-        <button id="AddWord" oncommand="AddWord()" label="&AddButton.label;"
-                accesskey="&AddButton.accessKey;"/>
-      </row>
-      <row>
-        <label value="&DictionaryList.label;"
-               control="DictionaryList"
-               accesskey="&DictionaryList.accessKey;"/>
-        <spacer/>
-      </row>
-      <row>
-        <richlistbox id="DictionaryList"
-                     class="theme-listbox"
-                     flex="1"
-                     height="150px"/>
-        <vbox flex="1">
-          <button  id="ReplaceWord" oncommand="ReplaceWord()" label="&ReplaceButton.label;"
-                   accesskey="&ReplaceButton.accessKey;"/>
-          <spacer class="spacer"/>
-          <button  id="RemoveWord" oncommand="RemoveWord()" label="&RemoveButton.label;"
-                   accesskey="&RemoveButton.accessKey;"/>
-          <spacer class="spacer"/>
-          <spacer flex="1"/>
-          <button dlgtype="cancel" class="exit-dialog" id="close" label="&CloseButton.label;"
-                  default="true" oncommand="onClose();"
-                  accesskey="&CloseButton.accessKey;"/>
-        </vbox>
-      </row>
-    </rows>
-  </grid>
+  <hbox flex="1">
+    <div xmlns="http://www.w3.org/1999/xhtml" class="grid-two-column">
+      <div class="flex-items-center grid-item-span-row">
+        <xul:label value="&wordEditField.label;"
+                   control="WordInput"
+                   accesskey="&wordEditField.accessKey;"/>
+      </div>
+      <div>
+        <xul:textbox id="WordInput" style="width:15em;"/>
+      </div>
+      <div>
+        <xul:button id="AddWord"
+                    oncommand="AddWord()"
+                    label="&AddButton.label;"
+                    accesskey="&AddButton.accessKey;"/>
+      </div>
+      <div class="flex-items-center grid-item-span-row">
+        <xul:label value="&DictionaryList.label;"
+                   control="DictionaryList"
+                   accesskey="&DictionaryList.accessKey;"/>
+      </div>
+      <div>
+        <xul:richlistbox id="DictionaryList"
+                         class="theme-listbox"
+                         height="150px"
+                         style="width:15em;"/>
+      </div>
+      <div>
+        <xul:button id="RemoveWord"
+                    oncommand="RemoveWord()"
+                    label="&RemoveButton.label;"
+                    accesskey="&RemoveButton.accessKey;"/>
+      </div>
+    </div>
+  </hbox>
 </dialog>
--- a/mail/locales/en-US/chrome/messenger/messengercompose/EditorPersonalDictionary.dtd
+++ b/mail/locales/en-US/chrome/messenger/messengercompose/EditorPersonalDictionary.dtd
@@ -6,15 +6,13 @@
 <!ENTITY windowTitle.label "Personal Dictionary">
 
 <!ENTITY wordEditField.label "New word:">
 <!ENTITY wordEditField.accessKey "N">
 <!ENTITY AddButton.label "Add">
 <!ENTITY AddButton.accessKey "A">
 <!ENTITY DictionaryList.label "Words in dictionary:">
 <!ENTITY DictionaryList.accessKey "W">
-<!ENTITY ReplaceButton.label "Replace">
-<!ENTITY ReplaceButton.accessKey "R">
 <!ENTITY RemoveButton.label "Remove">
 <!ENTITY RemoveButton.accessKey "e">
 
 <!ENTITY CloseButton.label "Close">
 <!ENTITY CloseButton.accessKey "C">
--- a/mail/themes/shared/mail/grid-layout.css
+++ b/mail/themes/shared/mail/grid-layout.css
@@ -24,8 +24,12 @@
 .flex-items-center {
   display: flex;
   align-items: center;
 }
 
 .flex-content-center {
   justify-content: center;
 }
+
+.grid-item-span-row {
+  grid-column: 1 / -1;
+}