Bug 503370 - Library doesn't handle CTRL+F correctly. r=dao

This commit is contained in:
Johan Charlez 2012-05-03 06:22:32 -04:00
parent 9e1803fc9a
commit b5ff7b1465
4 changed files with 18 additions and 32 deletions

View File

@ -241,16 +241,13 @@ var PlacesOrganizer = {
}
// Update the selected folder title where it appears in the UI: the folder
// scope button, "Find in <current collection>" command, and the search box
// emptytext. They must be updated even if the selection hasn't changed --
// scope button, and the search box emptytext.
// They must be updated even if the selection hasn't changed --
// specifically when node's title changes. In that case a selection event
// is generated, this method is called, but the selection does not change.
var folderButton = document.getElementById("scopeBarFolder");
var folderTitle = node.title || folderButton.getAttribute("emptytitle");
folderButton.setAttribute("label", folderTitle);
var cmd = document.getElementById("OrganizerCommand_find:current");
var label = PlacesUIUtils.getFormattedString("findInPrefix", [folderTitle]);
cmd.setAttribute("label", label);
if (PlacesSearchBox.filterCollection == "collection")
PlacesSearchBox.updateCollectionTitle(folderTitle);
@ -925,18 +922,20 @@ var PlacesSearchBox = {
},
/**
* Finds across all bookmarks
* Finds across all history, downloads or all bookmarks.
*/
findAll: function PSB_findAll() {
PlacesQueryBuilder.setScope("bookmarks");
this.focus();
},
/**
* Finds in the currently selected Place.
*/
findCurrent: function PSB_findCurrent() {
PlacesQueryBuilder.setScope("collection");
switch (this.filterCollection) {
case "history":
PlacesQueryBuilder.setScope("history");
break;
case "downloads":
PlacesQueryBuilder.setScope("downloads");
break;
default:
PlacesQueryBuilder.setScope("bookmarks");
break;
}
this.focus();
},
@ -947,12 +946,15 @@ var PlacesSearchBox = {
*/
updateCollectionTitle: function PSB_updateCollectionTitle(aTitle) {
let title = "";
// This is needed when a user performs a folder-specific search
// using the scope bar, removes the search-string, and unfocuses
// the search box, at least until the removal of the scope bar.
if (aTitle) {
title = PlacesUIUtils.getFormattedString("searchCurrentDefault",
[aTitle]);
}
else {
switch(this.filterCollection) {
switch (this.filterCollection) {
case "history":
title = PlacesUIUtils.getString("searchHistory");
break;

View File

@ -99,13 +99,7 @@
<commandset id="organizerCommandSet">
<command id="OrganizerCommand_find:all"
label="&cmd.findInBookmarks.label;"
accesskey="&cmd.findInBookmarks.accesskey;"
oncommand="PlacesSearchBox.findAll();"/>
<command id="OrganizerCommand_find:current"
label="&cmd.findCurrent.label;"
accesskey="&cmd.findCurrent.accesskey;"
oncommand="PlacesSearchBox.findCurrent();"/>
<command id="OrganizerCommand_export"
oncommand="PlacesOrganizer.exportBookmarks();"/>
<command id="OrganizerCommand_import"
@ -137,10 +131,6 @@
command="OrganizerCommand_find:all"
key="&cmd.find.key;"
modifiers="accel"/>
<key id="placesKey_find:current"
command="OrganizerCommand_find:current"
key="&cmd.find.key;"
modifiers="accel,shift"/>
<!-- Back/Forward Keys Support -->
#ifndef XP_MACOSX

View File

@ -23,11 +23,6 @@
<!ENTITY view.sortDescending.label "Z > A Sort Order">
<!ENTITY view.sortDescending.accesskey "Z">
<!ENTITY cmd.findInBookmarks.label "Find in Bookmarks…">
<!ENTITY cmd.findInBookmarks.accesskey "F">
<!ENTITY cmd.findCurrent.label "Find in Current Collection…">
<!ENTITY cmd.findCurrent.accesskey "i">
<!ENTITY importBookmarksFromHTML.label "Import Bookmarks from HTML…">
<!ENTITY importBookmarksFromHTML.accesskey "I">
<!ENTITY exportBookmarksToHTML.label "Export Bookmarks to HTML…">

View File

@ -44,7 +44,6 @@ searchBookmarks=Search Bookmarks
searchHistory=Search History
searchDownloads=Search Downloads
searchCurrentDefault=Search in '%S'
findInPrefix=Find in '%S'…
tabs.openWarningTitle=Confirm open
tabs.openWarningMultipleBranded=You are about to open %S tabs. This might slow down %S while the pages are loading. Are you sure you want to continue?