Polish search results.

b=106127; r=morse; sr=hewitt; a=asa


git-svn-id: svn://10.0.0.236/trunk@205605 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sgehani%netscape.com 2006-07-29 05:40:01 +00:00
parent 2ba154a7fd
commit 3b655027d9
3 changed files with 27 additions and 19 deletions

View File

@ -121,9 +121,6 @@
oncommand="BookmarksUtils.addBookmark(gContextMenu.linkURL(),
gContextMenu.linkText(),
undefined, true);"/>
<menuitem id="context-searchselect" class="menuitem-iconic"
oncommand="OpenSearch('internet', false, gContextMenu.searchSelected(), true);"/>
<menuseparator id="context-sep-bookmark"/>
<!-- Save ==================================== -->
<menuitem id="context-savepage"
@ -182,6 +179,10 @@
label="&metadataCmd.label;"
accesskey="&metadataCmd.accesskey;"
oncommand="gContextMenu.showMetadata();"/>
<menuseparator id="context-sep-search"/>
<!-- Search ================================== -->
<menuitem id="context-searchselect" class="menuitem-iconic"
oncommand="OpenSearch('internet', false, gContextMenu.searchSelected(), true);"/>
</popup>
</popupset>
</overlay>

View File

@ -161,7 +161,8 @@ nsContextMenu.prototype = {
// Use "Bookmark This Link" if on a link.
this.showItem( "context-bookmarkpage", !this.onLink );
this.showItem( "context-bookmarklink", this.onLink );
this.showItem( "context-searchselect", this.isTextSelected() );
this.setItemAttr( "context-searchselect", "disabled",
!this.isTextSelected() );
},
initClipboardItems : function () {
// Select All is always OK, unless in directory listing.
@ -636,26 +637,31 @@ nsContextMenu.prototype = {
isTextSelected : function() {
var result = false;
var selection = this.searchSelected();
if (selection != "") {
if (!gDefaultEngine)
gDefaultEngine = new nsDefaultEngine();
var searchSelect = document.getElementById('context-searchselect');
if (!gDefaultEngine)
gDefaultEngine = new nsDefaultEngine();
var searchSelect = document.getElementById('context-searchselect');
// format "Search for <selection>" string to show in menu
var searchSelectText = selection.toString();
var bundle = srGetStrBundle("chrome://communicator/locale/contentAreaCommands.properties");
var bundle = srGetStrBundle("chrome://communicator/locale/contentAreaCommands.properties");
var searchSelectText;
if (selection != "") {
searchSelectText = selection.toString();
if (searchSelectText.length > 15)
searchSelectText = searchSelectText.substr(0,15) + "...";
searchSelectText = bundle.formatStringFromName("searchText",
[gDefaultEngine.name, searchSelectText], 2);
searchSelect.setAttribute("label", searchSelectText);
// add icon for default engine we're gonna use to search
// (eliminates last icon if we can't find current engine's icon)
searchSelect.setAttribute("src", gDefaultEngine.icon);
result = true;
} else {
searchSelectText = bundle.GetStringFromName("searchUnknown");
}
// format "Search for <selection>" string to show in menu
searchSelectText = bundle.formatStringFromName("searchText",
[gDefaultEngine.name, searchSelectText], 2);
searchSelect.setAttribute("label", searchSelectText);
// add icon for default engine we're gonna use to search
// (eliminates last icon if we can't find current engine's icon)
searchSelect.setAttribute("src", gDefaultEngine.icon);
return result;
},

View File

@ -3,6 +3,7 @@
saveImageAs=Save Image (%S)...
saveImageAsNoFilename=Save Image...
searchText=Search %S for "%S"
searchUnknown=<select term>
SavePageTitle=Save Web Page
SaveImageTitle=Save Picture