86063 and 134614. add ctrl+shift+f shortcut for "search the web" and make "search the web" go to the user's selected search engine. r=aaronl,sgehani, sr=hewitt.

This commit is contained in:
jruderman%hmc.edu 2002-06-19 00:50:20 +00:00
Родитель 5ad14210fa
Коммит d5eb2bb1ef
9 изменённых файлов: 59 добавлений и 9 удалений

Просмотреть файл

@ -822,7 +822,7 @@ function OpenSearch(tabName, forceDialogFlag, searchStr, newWindowFlag)
defaultSearchURL = fallbackDefaultSearchURL;
if (!searchStr) {
loadURI(gNavigatorRegionBundle.getString("otherSearchURL"));
BrowserSearchInternet();
} else {
//Check to see if location bar field is a url
@ -904,6 +904,37 @@ function isSearchPanelOpen()
);
}
function BrowserSearchInternet()
{
try {
var searchEngineURI = pref.getCharPref("browser.search.defaultengine");
if (searchEngineURI) {
var searchRoot = getSearchUrl("searchForm");
if (searchRoot) {
loadURI(searchRoot);
return;
} else {
// Get a search URL and guess that the front page of the site has a search form.
var searchDS = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
.getService(Components.interfaces.nsIInternetSearchService);
searchURL = searchDS.GetInternetSearchURL(searchEngineURI, "ABC", 0, 0, {value:0});
if (searchURL) {
searchRoot = searchURL.match(/[a-z]+:\/\/[a-z.-]+/);
if (searchRoot) {
loadURI(searchRoot + "/");
return;
}
}
}
}
} catch (ex) {
}
// Fallback if the stuff above fails: use the hard-coded search engine
loadURI(gNavigatorRegionBundle.getString("otherSearchURL"));
}
//Note: BrowserNewEditorWindow() was moved to globalOverlay.xul and renamed to NewEditorWindow()
function BrowserOpenWindow()

Просмотреть файл

@ -90,6 +90,9 @@
<key id="addBookmarkAsKb" key="&addCurPageCmd.commandkey;" command="Browser:AddBookmarkAs" modifiers="accel,shift"/>
<key id="manBookmarkKb" key="&manBookmarksCmd.commandkey;" command="Browser:ManageBookmark" modifiers="accel"/>
<!-- Tools Menu -->
<key id="searchInternetKb" key="&searchInternet.commandKey;" modifiers="accel,shift" command="Browser:SearchInternet"/>
<!-- Misc -->
<key id="key_stop" keycode="VK_ESCAPE" oncommand="BrowserStop();"/>
<!-- the amazing fishcam dept. -->
@ -160,6 +163,10 @@
<command id="Browser:Forward" oncommand="BrowserForward();" observes="canGoForward"/>
<commandset id="viewZoomCommands"/>
<commandset id="tasksCommands"/>
<!-- Tools Menu -->
<command id="Browser:SearchInternet" oncommand="BrowserSearchInternet();"/>
</commandset>
<broadcasterset id="navBroadcasters">
@ -346,7 +353,7 @@
<menu id="tasksMenu">
<menupopup id="taskPopup">
<menuitem id="menu_searchWeb" label="&searchInternetCmd.label;" accesskey="&searchInternetCmd.accesskey;" oncommand="loadXURL('urn:clienturl:srchmenu:srchinternet');"/>
<menuitem id="menu_searchWeb" label="&searchInternetCmd.label;" key="searchInternetKb" accesskey="&searchInternetCmd.accesskey;" command="Browser:SearchInternet"/>
<menuseparator id="navBeginGlobalItems"/>
</menupopup>
</menu>

Просмотреть файл

@ -119,6 +119,7 @@
<!ENTITY searchInternetCmd.label "Search the Web">
<!ENTITY searchInternetCmd.accesskey "S">
<!ENTITY searchInternet.commandKey "f">
<!ENTITY goMenu.label "Go">
<!ENTITY goMenu.accesskey "g">

Просмотреть файл

@ -12,6 +12,7 @@
action = "http://info.netscape.com/fwd/clk61srsid/http://search.netscape.com/search.psp"
actionButton = "http://info.netscape.com/fwd/clk61srurl1/http://search.netscape.com/search.psp?search="
actionBar = "http://info.netscape.com/fwd/clk61srurl2/http://search.netscape.com/search.psp?search="
searchForm = "http://search.netscape.com/nscp_index.adp"
>
<INPUT NAME="search" USER>

Просмотреть файл

@ -6,6 +6,7 @@
name = "LXR @ mozilla.org"
method = "get"
action = "http://lxr.mozilla.org/seamonkey/search"
searchForm = "http://lxr.mozilla.org/seamonkey/search"
>
<input name="string" user>

Просмотреть файл

@ -6,6 +6,7 @@
name = "mozilla.org"
method = "get"
action = "http://www.mozilla.org/htdig-cgi/htsearch"
searchForm = "http://www.mozilla.org/search.html"
>
<input name="config" value="htdig">

Просмотреть файл

@ -386,6 +386,7 @@ nsIRDFResource *InternetSearchDataSource::kNC_Description;
nsIRDFResource *InternetSearchDataSource::kNC_Version;
nsIRDFResource *InternetSearchDataSource::kNC_actionButton;
nsIRDFResource *InternetSearchDataSource::kNC_actionBar;
nsIRDFResource *InternetSearchDataSource::kNC_searchForm;
nsIRDFResource *InternetSearchDataSource::kNC_LastText;
nsIRDFResource *InternetSearchDataSource::kNC_URL;
nsIRDFResource *InternetSearchDataSource::kRDF_InstanceOf;
@ -454,6 +455,7 @@ InternetSearchDataSource::InternetSearchDataSource(void)
gRDFService->GetResource(NC_NAMESPACE_URI "Version", &kNC_Version);
gRDFService->GetResource(NC_NAMESPACE_URI "actionButton", &kNC_actionButton);
gRDFService->GetResource(NC_NAMESPACE_URI "actionBar", &kNC_actionBar);
gRDFService->GetResource(NC_NAMESPACE_URI "searchForm", &kNC_searchForm);
gRDFService->GetResource(NC_NAMESPACE_URI "LastText", &kNC_LastText);
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_InstanceOf);
@ -520,6 +522,7 @@ InternetSearchDataSource::~InternetSearchDataSource (void)
NS_IF_RELEASE(kNC_Version);
NS_IF_RELEASE(kNC_actionButton);
NS_IF_RELEASE(kNC_actionBar);
NS_IF_RELEASE(kNC_searchForm);
NS_IF_RELEASE(kNC_LastText);
NS_IF_RELEASE(kNC_URL);
NS_IF_RELEASE(kRDF_InstanceOf);
@ -3341,6 +3344,17 @@ InternetSearchDataSource::updateDataHintsInGraph(nsIRDFResource *engine, const P
}
}
nsAutoString searchFormValue;
if (NS_SUCCEEDED(rv = GetData(dataUni, "search", 0, "searchForm", searchFormValue)))
{
nsCOMPtr<nsIRDFLiteral> searchFormLiteral;
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(searchFormValue.get(),
getter_AddRefs(searchFormLiteral))))
{
rv = updateAtom(mInner, engine, kNC_searchForm, searchFormLiteral, nsnull);
}
}
PRBool updatePrivateFiles = PR_FALSE;

Просмотреть файл

@ -82,6 +82,7 @@ private:
static nsIRDFResource *kNC_Version;
static nsIRDFResource *kNC_actionButton;
static nsIRDFResource *kNC_actionBar;
static nsIRDFResource *kNC_searchForm;
static nsIRDFResource *kNC_LastText;
static nsIRDFResource *kNC_URL;
static nsIRDFResource *kRDF_InstanceOf;

Просмотреть файл

@ -46,13 +46,6 @@
<NC:content>http://www.mozilla.org/projects/l10n/mlp_status.html#contrib</NC:content>
</RDF:Description>
<!-- Search Menu -->
<RDF:Description about='urn:clienturl:srchmenu:srchinternet'>
<NC:title>Search Internet</NC:title>
<NC:content>http://home.netscape.com/bookmark/6_0/ssearch.html</NC:content>
</RDF:Description>
<!-- Composer -->
<RDF:Description about='urn:clienturl:composer:spellcheckers'>