From 5b76c26e70585ccfb4d0088c13a4b83c2ebc1c41 Mon Sep 17 00:00:00 2001 From: "ben%netscape.com" Date: Thu, 2 Mar 2000 06:34:54 +0000 Subject: [PATCH] search appearance tweaks, single click hookup, default search engine hookup (b=26887, 29591, 28103) r=german@netscape.com, waterson@netscape.com (pref hookup) a=jar@netscape.com --- modules/libpref/src/init/all.js | 1 + .../resources/content/pref-search.xul | 20 +++- .../resources/locale/en-US/pref-search.dtd | 5 + .../search/resources/internetresults.xul | 44 +++------ .../search/resources/locale/MANIFEST | 2 + .../locale/en-US/internetresults.dtd | 7 +- .../resources/locale/en-US/search-panel.dtd | 17 ++-- xpfe/components/search/resources/makefile.win | 1 + .../search/resources/search-panel.js | 93 +++++++++++-------- .../search/resources/search-panel.xul | 36 ++++--- 10 files changed, 132 insertions(+), 94 deletions(-) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index c96b6712cb7..332c6bb3d51 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -104,6 +104,7 @@ pref("browser.show_about_as_stupid_modal_window", false); pref("browser.search.defaulturl", "http://search.netscape.com/cgi-bin/search?search="); pref("browser.search.opensidebarsearchpanel", true); pref("browser.search.powermode", 0); +pref("browser.search.use_double_clicks", false); localDefPref("browser.bookmark_location", ""); localDefPref("browser.addressbook_location", ""); diff --git a/xpfe/components/prefwindow/resources/content/pref-search.xul b/xpfe/components/prefwindow/resources/content/pref-search.xul index 084c9a956e7..69064083d99 100755 --- a/xpfe/components/prefwindow/resources/content/pref-search.xul +++ b/xpfe/components/prefwindow/resources/content/pref-search.xul @@ -86,7 +86,25 @@ &openSidebarSearchPanel.label; - + + + &sidebarClickMode.label; + + + + + &useSingleClicks.label; + + + + + + &useDoubleClicks.label; + + + diff --git a/xpfe/components/prefwindow/resources/locale/en-US/pref-search.dtd b/xpfe/components/prefwindow/resources/locale/en-US/pref-search.dtd index 90d4dba46a8..b0b1b7e7cf7 100755 --- a/xpfe/components/prefwindow/resources/locale/en-US/pref-search.dtd +++ b/xpfe/components/prefwindow/resources/locale/en-US/pref-search.dtd @@ -15,3 +15,8 @@ + + + + + diff --git a/xpfe/components/search/resources/internetresults.xul b/xpfe/components/search/resources/internetresults.xul index 2160ee3f09e..5f36944a150 100644 --- a/xpfe/components/search/resources/internetresults.xul +++ b/xpfe/components/search/resources/internetresults.xul @@ -8,42 +8,23 @@ + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + > - - - - + + - - - - - Search - | - Webmail - | - My Netscape - | - Buddy Chat - | - Help - | - Download - - - - - - - - + + - + + + + - + - diff --git a/xpfe/components/search/resources/locale/MANIFEST b/xpfe/components/search/resources/locale/MANIFEST index 9b3fcf3c6c2..264fef6efa1 100755 --- a/xpfe/components/search/resources/locale/MANIFEST +++ b/xpfe/components/search/resources/locale/MANIFEST @@ -4,3 +4,5 @@ en-US:find.dtd en-US:findresults.dtd en-US:internet.dtd en-US:internetresults.dtd +en-US:search-panel.properties + diff --git a/xpfe/components/search/resources/locale/en-US/internetresults.dtd b/xpfe/components/search/resources/locale/en-US/internetresults.dtd index 16ba9062c4b..c1bce4fa263 100755 --- a/xpfe/components/search/resources/locale/en-US/internetresults.dtd +++ b/xpfe/components/search/resources/locale/en-US/internetresults.dtd @@ -26,6 +26,7 @@ - - - + + + + diff --git a/xpfe/components/search/resources/locale/en-US/search-panel.dtd b/xpfe/components/search/resources/locale/en-US/search-panel.dtd index 446ddaef693..086b6871942 100755 --- a/xpfe/components/search/resources/locale/en-US/search-panel.dtd +++ b/xpfe/components/search/resources/locale/en-US/search-panel.dtd @@ -20,12 +20,13 @@ --> - - - + + + - - - - - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/xpfe/components/search/resources/makefile.win b/xpfe/components/search/resources/makefile.win index 4e7882a3bab..1905a6aaa1e 100644 --- a/xpfe/components/search/resources/makefile.win +++ b/xpfe/components/search/resources/makefile.win @@ -59,6 +59,7 @@ CHROME_L10N = \ .\locale\en-US\internetresults.dtd \ .\locale\en-US\search.dtd \ .\locale\en-US\search-panel.dtd \ + .\locale\en-US\search-panel.properties \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/xpfe/components/search/resources/search-panel.js b/xpfe/components/search/resources/search-panel.js index 2e60e79288e..16f092839e0 100644 --- a/xpfe/components/search/resources/search-panel.js +++ b/xpfe/components/search/resources/search-panel.js @@ -23,6 +23,19 @@ var rootNode = null; var textArc = null; var RDF_observer = new Object; +var settingsButton = null; +var settingsButtonText = null; +var bundle = null; +var pref = null; + +// get the click count pref +try { + pref = Components.classes["component://netscape/preferences"].getService(); + if( pref ) + pref = pref.QueryInterface( Components.interfaces.nsIPref ); +} +catch(e) { +} RDF_observer = { @@ -48,8 +61,6 @@ RDF_observer = } } - - function rememberSearchText(targetNode) { if (targetNode) targetNode = targetNode.QueryInterface(Components.interfaces.nsIRDFLiteral); @@ -68,6 +79,11 @@ function rememberSearchText(targetNode) // 3) initialise the checked state of said engines. function SearchPanelStartup() { + settingsButton = document.getElementById("btn.Advanced"); + settingsButtonText = settingsButton.getAttribute("value"); + + bundle = srGetStrBundle( "chrome://search/locale/search-panel.properties" ); + var tree = document.getElementById("Tree"); if (tree) { @@ -96,6 +112,8 @@ function SearchPanelStartup() if (ref) categoryList.setAttribute("ref", ref); } } + + } try { @@ -110,10 +128,16 @@ function SearchPanelStartup() dump("*** lastCategoryName = " + lastCategoryName + "\n"); var categoryList = document.getElementById( "categoryList" ); if( categoryList ) { + //set to default value 'the web' + //hack: hardcoded postion in here replace with a function that finds the entry 'the web' + // set the category name on the advanced panel var categoryText = categoryList.options[ categoryList.selectedIndex ].text; var textElement = document.getElementById( "categoryNameText" ); textElement.setAttribute( "value", categoryText ); + //set the category name on the settings button + settingsButton.value = settingsButtonText + categoryText; + for( var i = 0; i < categoryList.options.length; i++ ) { if( ( lastCategoryName == "" && categoryList.options[i].value == "NC:SearchEngineRoot" ) || @@ -155,6 +179,9 @@ function chooseCategory( aSelectElement ) var categoryText = aSelectElement.options[ aSelectElement.selectedIndex ].text; var textElement = document.getElementById( "categoryNameText" ); textElement.setAttribute( "value", categoryText ); + //set the category name on the settings button + settingsButton.setAttribute("value",settingsButtonText + categoryText + "..."); + //alert("set button to " + settingsButtonText + categoryText);//debug remove var category = aSelectElement.options[ aSelectElement.selectedIndex ].getAttribute("id"); var pref = Components.classes["component://netscape/preferences"].getService(); @@ -375,7 +402,6 @@ function doSearch() var progressNode = top.document.getElementById("statusbar-icon"); if( !stopButtonNode || !searchButtonNode ) return; - dump("*** foo\n"); // hide various columns if( parent.content.isMozillaSearchWindow ) { @@ -393,8 +419,7 @@ function doSearch() return false; if ( !textNode.value ) { - // stringbundle - alert("Enter some text to search for and select at least one location to search."); + alert( bundle.GetStringFromName("enterstringandlocation") ); return false; } // get selected search engines @@ -442,10 +467,17 @@ function doSearch() engineURIs[engineURIs.length] = treeItem.getAttribute( "id" ); } else { - // more than one engine, flip the deck and demand input - switchTab( 1 ); - alert("Select at least one location to search."); - return false; + dump("*** multiple search engines present, selecting the netscape search engine\n"); + for( var i = 0; i < treeChildrenNode.childNodes.length; i++ ) + { + var currItem = treeChildrenNode.childNodes[i]; + dump("*** the current URI is = " + currItem.getAttribute("id") + "\n"); + if( currItem.getAttribute("id").indexOf("Open_Directory") != -1 ) { + + engineURIs[engineURIs.length] = treeItem.getAttribute("id"); + break; + } + } } } @@ -518,7 +550,19 @@ function FOO_doSearch() function openURL(event, treeitem, root) { - if ((event.button != 1) || (event.clickCount != 2)) + try { + if( pref ) { + var prefvalue = pref.GetBoolPref( "browser.search.use_double_clicks" ); + mClickCount = prefvalue ? 2 : 1; + } + else + mClickCount = 1; + } + catch(e) { + mClickCount = 1; + } + + if ((event.button != 1) || (event.clickCount != mClickCount)) return(false); if (treeitem.getAttribute("container") == "true") @@ -650,35 +694,6 @@ function OpenSearch( tabName, forceDialogFlag, aSearchStr, engineURIs ) } } } - - if( autoOpenSearchPanel ) - RevealSearchPanel(); -} - -function RevealSearchPanel() -{ - // rjc Note: the following is all a hack until the sidebar has appropriate APIs - // to check whether its shown/hidden, open/closed, and can show a particular panel - - var sidebar = top.document.getElementById("sidebar-box"); - var sidebar_splitter = top.document.getElementById("sidebar-splitter"); - var searchPanel = top.document.getElementById("urn:sidebar:panel:search"); - - if (sidebar && sidebar_splitter && searchPanel) - { - var is_hidden = sidebar.getAttribute("hidden"); - if (is_hidden && is_hidden == "true") - { - // SidebarShowHide() lives in sidebarOverlay.js - SidebarShowHide(); - } - var splitter_state = sidebar_splitter.getAttribute("state"); - if (splitter_state && splitter_state == "collapsed") { - sidebar_splitter.removeAttribute("state"); - } - // SidebarSelectPanel() lives in sidebarOverlay.js - SidebarSelectPanel(searchPanel); - } } function switchTab( aPageIndex ) diff --git a/xpfe/components/search/resources/search-panel.xul b/xpfe/components/search/resources/search-panel.xul index 2c2085ec30e..f96cbe3eda7 100644 --- a/xpfe/components/search/resources/search-panel.xul +++ b/xpfe/components/search/resources/search-panel.xul @@ -34,20 +34,22 @@ onload="SearchPanelStartup();" onunload="SearchPanelShutdown();"> + - - + + - &search.results.tab; - &search.advanced.tab; + &search.results.tab; + &search.advanced.tab; - + + @@ -112,18 +114,25 @@ + + + - + + - - &whenSearching.label; &within.label; + + + - + - - &useTheseProviders.label; + + + + @@ -148,6 +157,11 @@ + + &explain.label; + + +