Bug 445467 - <search-editor.properties> misses |RemoveCategoryTitle|. r+sr=Neil.
authorSerge Gautherie <sgautherie.bz@free.fr>
Sun, 27 Jul 2008 14:51:55 +0200
changeset 30 4f914bfb27dbe25c712b91e83dab1726ed3cf0a5
parent 29 9708f7dba8d2a325dca45f6fad46f7e5af34fe5c
child 31 2ef7740a6f7ca8676f4d6a2d5e0e6a327db51e15
push idunknown
push userunknown
push dateunknown
bugs445467
Bug 445467 - <search-editor.properties> misses |RemoveCategoryTitle|. r+sr=Neil.
suite/common/search/search-editor.js
suite/common/search/search-editor.xul
suite/common/search/search-panel.xul
suite/locales/en-US/chrome/common/search/search-editor.properties
--- a/suite/common/search/search-editor.js
+++ b/suite/common/search/search-editor.js
@@ -35,19 +35,18 @@
  * 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 ***** */
 
 
 
 // global(s)
-var bundle = srGetStrBundle("chrome://communicator/locale/search/search-editor.properties");
-var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
-promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
+var gSearchBundle;
+var promptService;
 var pref = null;
 var RDF = null;
 var RDFC = null;
 var RDFCUtils = null;
 var catDS = null;
 var internetSearchDS = null;
 
 try
@@ -76,16 +75,20 @@ function debug(msg)
   // uncomment for noise
   // dump(msg+"\n");
 }
 
 
 
 function doLoad()
 {
+  gSearchBundle = document.getElementById("searchBundle");
+  promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                            .getService(Components.interfaces.nsIPromptService);
+
   var categoryList = document.getElementById("categoryList");
   // adjust category popup
   var internetSearch = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"].getService();
   if (internetSearch) internetSearch = internetSearch.QueryInterface(Components.interfaces.nsIInternetSearchService);
   if (internetSearch)
   {
     internetSearchDS = internetSearch.QueryInterface(Components.interfaces.nsIRDFDataSource);
 
@@ -452,18 +455,18 @@ function doMoveDirectionEnabling()
     moveDownButton.setAttribute("disabled", "true");
   else
     moveDownButton.removeAttribute("disabled");
 }
 
 
 function NewCategory()
 {
-  var promptStr = bundle.GetStringFromName("NewCategoryPrompt");
-  var newTitle = bundle.GetStringFromName("NewCategoryTitle");
+  const promptStr = gSearchBundle.getString("NewCategoryPrompt");
+  const newTitle = gSearchBundle.getString("NewCategoryTitle");
   var result = {value:null};
   var confirmed = promptService.prompt(window, newTitle, promptStr, result, null, {value:0});
   if (!confirmed || (!result.value) || result.value == "")      return(false);
 
   var newName = RDF.GetLiteral(result.value);
   if (!newName) return(false);
 
   var categoryRes = RDF.GetResource("NC:SearchCategoryRoot");
@@ -504,18 +507,18 @@ function RenameCategory()
 {
   // make sure we have at least one category
   var categoryPopup = document.getElementById( "categoryPopup" );
   if (!categoryPopup) return(false);
   if (categoryPopup.childNodes.length < 1)  return(false);
 
   var categoryList = document.getElementById( "categoryList" );
   var currentName = categoryList.selectedItem.getAttribute("label");
-  var promptStr = bundle.GetStringFromName("RenameCategoryPrompt");
-  var renameTitle = bundle.GetStringFromName("RenameCategoryTitle");
+  const promptStr = gSearchBundle.getString("RenameCategoryPrompt");
+  const renameTitle = gSearchBundle.getString("RenameCategoryTitle");
   var result = {value:currentName};
   var confirmed = promptService.prompt(window,renameTitle,promptStr,result,null,{value:0});
   if (!confirmed || (!result.value) || (result.value == "") || result.value == currentName)     return(false);
 
   var currentCatID = categoryList.selectedItem.getAttribute("id");
   var currentCatRes = RDF.GetResource(currentCatID);
   if (!currentCatRes) return(false);
 
@@ -546,19 +549,19 @@ function RenameCategory()
 
 function RemoveCategory()
 {
   // make sure we have at least one category
   var categoryPopup = document.getElementById( "categoryPopup" );
   if (!categoryPopup) return(false);
   if (categoryPopup.childNodes.length < 1)  return(false);
 
-  var titleStr = bundle.GetStringFromName("RemoveCategoryTitle");
-  var promptStr = bundle.GetStringFromName("RemoveCategoryPrompt");
-  var yesStr = bundle.GetStringFromName("RemoveCategoryYes");
+  const titleStr = gSearchBundle.getString("RemoveCategoryTitle");
+  const promptStr = gSearchBundle.getString("RemoveCategoryPrompt");
+  const yesStr = gSearchBundle.getString("RemoveCategoryYes");
   var flags = ((promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
                (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1) + 
                promptService.BUTTON_POS_1_DEFAULT);
   if (promptService.confirmEx(window, titleStr, promptStr, flags, yesStr, null, null, null, {value:0}) == 1)
     return false;
 
   var categoryRes = RDF.GetResource("NC:SearchCategoryRoot");
   if (!categoryRes) return(false);
--- a/suite/common/search/search-editor.xul
+++ b/suite/common/search/search-editor.xul
@@ -48,19 +48,21 @@
         xmlns:web="http://home.netscape.com/WEB-rdf#"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         width="540" height="340" x="20" y="20" persist="width height x y"
         windowtype="internetsearch:editor"
         onload="doLoad()" onunload="doUnload()"
         buttons="accept"
         ondialogaccept="return Commit();">
 
-  <script type="application/x-javascript" src="chrome://global/content/strres.js"/>
   <script type="application/x-javascript" src="chrome://communicator/content/search/search-editor.js"/>
- 
+
+  <stringbundle id="searchBundle"
+                src="chrome://communicator/locale/search/search-editor.properties"/>
+
   <hbox flex="1">
   
     <vbox flex="1">
       <listbox id="allengines" seltype="multiple" flex="1"
                datasources="rdf:internetsearch" ref="NC:SearchEngineRoot">
         <listhead>
           <listheader id="NameColumn" sortable="true"
                       label="&allengines.label;" flex="1"
--- a/suite/common/search/search-panel.xul
+++ b/suite/common/search/search-panel.xul
@@ -45,17 +45,16 @@
 <window id="searchPanel"
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       orient="vertical" onload="SearchPanelStartup();"
       onunload="SearchPanelShutdown();" elementtofocus="sidebar-search-text">
 
   <script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js"/>
   <script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
-  <script type="application/x-javascript" src="chrome://global/content/strres.js"/>
   <script type="application/x-javascript" src="chrome://communicator/content/search/search-panel.js"/>
   <script type="application/x-javascript" src="chrome://communicator/content/search/shared.js"/>
 
   <stringbundle id="searchBundle" src="chrome://communicator/locale/search/search-panel.properties"/>
   <stringbundle id="regionalBundle" src="chrome://communicator-region/locale/region.properties"/>
   
   <popupset>
     <popup id="contextual" onpopupshowing="return fillContextMenu('contextual', 'resultList');" >
--- a/suite/locales/en-US/chrome/common/search/search-editor.properties
+++ b/suite/locales/en-US/chrome/common/search/search-editor.properties
@@ -1,6 +1,7 @@
-NewCategoryPrompt=Enter the new category name:
+NewCategoryPrompt=Enter the category name:
 NewCategoryTitle=New Category
 RenameCategoryPrompt=Enter the new category name:
 RenameCategoryTitle=Rename Category
 RemoveCategoryPrompt=Are you sure you want to delete this category?
+RemoveCategoryTitle=Delete Category
 RemoveCategoryYes=&Delete