Bug 329281 'Add Keyword for this Search' does not work w/ Places (r=mano)
git-svn-id: svn://10.0.0.236/trunk@222554 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
6a5c06a219
commit
340e220287
@ -1976,7 +1976,7 @@ function getShortcutOrURI(aURL, aPostDataRef)
|
||||
var cmd = aURL.substr(0, aOffset);
|
||||
var text = aURL.substr(aOffset+1);
|
||||
#ifdef MOZ_PLACES_BOOKMARKS
|
||||
shortcutURI = bookmarkService.getURIForKeyword(cmd);
|
||||
shortcutURI = PlacesUtils.bookmarks.getURIForKeyword(cmd);
|
||||
if (shortcutURI)
|
||||
shortcutURL = shortcutURI.spec;
|
||||
#else
|
||||
@ -5188,7 +5188,8 @@ function AddKeywordForSearchField()
|
||||
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
|
||||
BROWSER_ADD_BM_FEATURES, dialogArgs);
|
||||
#else
|
||||
dump("*** IMPLEMENT ME: Bug 329281\n");
|
||||
var description = PlacesUtils.getDescriptionFromDocument(node.ownerDocument);
|
||||
PlacesUtils.showAddBookmarkUI(makeURI(spec), "", description, null, null, null, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@
|
||||
* item.
|
||||
* @ defaultInsertionPoint (InsertionPoint JS object) - optional, the
|
||||
* default insertion point for the new item.
|
||||
* @ keyword (String) - optional, the default keyword for the new item.
|
||||
* Notes:
|
||||
* 1) If |uri| is set for a bookmark/livemark item and |title| isn't,
|
||||
* the dialog will query the history tables for the title associated
|
||||
@ -213,7 +214,7 @@ var BookmarkPropertiesPanel = {
|
||||
"uri property should be a uri object");
|
||||
this._bookmarkURI = dialogInfo.uri;
|
||||
}
|
||||
if (!this._itemTitle) {
|
||||
if (typeof(this._itemTitle) != "string") {
|
||||
if (this._bookmarkURI) {
|
||||
this._itemTitle =
|
||||
this._getURITitleFromHistory(this._bookmarkURI);
|
||||
@ -227,6 +228,9 @@ var BookmarkPropertiesPanel = {
|
||||
if ("loadBookmarkInSidebar" in dialogInfo)
|
||||
this._loadBookmarkInSidebar = dialogInfo.loadBookmarkInSidebar;
|
||||
|
||||
if ("keyword" in dialogInfo)
|
||||
this._bookmarkKeyword = dialogInfo.keyword;
|
||||
|
||||
break;
|
||||
case "folder":
|
||||
this._action = ACTION_ADD;
|
||||
@ -488,7 +492,7 @@ var BookmarkPropertiesPanel = {
|
||||
if (this._bookmarkURI)
|
||||
this._element("editURLBar").value = this._bookmarkURI.spec;
|
||||
|
||||
if (this._bookmarkKeyword)
|
||||
if (typeof(this._bookmarkKeyword) == "string")
|
||||
this._element("keywordTextfield").value = this._bookmarkKeyword;
|
||||
|
||||
if (this._loadBookmarkInSidebar)
|
||||
|
||||
@ -698,7 +698,7 @@ var PlacesUtils = {
|
||||
/**
|
||||
* Methods to show the bookmarkProperties dialog in its various modes.
|
||||
*
|
||||
* The showMinimialAdd* methods open the dialog by its alternative URI. Thus
|
||||
* The showMinimalAdd* methods open the dialog by its alternative URI. Thus
|
||||
* they persist the dialog dimensions separately from the showAdd* methods.
|
||||
*/
|
||||
|
||||
@ -722,10 +722,13 @@ var PlacesUtils = {
|
||||
* @param [optional] aLoadInSidebar
|
||||
* If true, the dialog will default to load the new item in the
|
||||
* sidebar (as a web panel).
|
||||
* @param [optional] aKeyword
|
||||
* The default keyword for the new bookmark. The keyword field
|
||||
* will be shown in the dialog if this is used.
|
||||
* @return true if any transaction has been performed.
|
||||
*
|
||||
* Notes:
|
||||
* - the location, description, keyword and "load in sidebar" fields are
|
||||
* - the location, description and "load in sidebar" fields are
|
||||
* visible only if there is no initial URI (aURI is null).
|
||||
* - When aDefaultInsertionPoint is not set, the dialog defaults to the
|
||||
* bookmarks root folder.
|
||||
@ -735,7 +738,8 @@ var PlacesUtils = {
|
||||
aDescription,
|
||||
aDefaultInsertionPoint,
|
||||
aShowPicker,
|
||||
aLoadInSidebar) {
|
||||
aLoadInSidebar,
|
||||
aKeyword) {
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "bookmark"
|
||||
@ -760,6 +764,9 @@ var PlacesUtils = {
|
||||
if (aLoadInSidebar)
|
||||
info.loadBookmarkInSidebar = true;
|
||||
|
||||
if (typeof(aKeyword) == "string")
|
||||
info.keyword = aKeyword;
|
||||
|
||||
return this._showBookmarkDialog(info);
|
||||
},
|
||||
|
||||
@ -770,11 +777,14 @@ var PlacesUtils = {
|
||||
*
|
||||
* You can still pass in the various paramaters as the default properties
|
||||
* for the new bookmark.
|
||||
*
|
||||
* The keyword field will be visible only if the aKeyword parameter
|
||||
* was used.
|
||||
*/
|
||||
showMinimalAddBookmarkUI:
|
||||
function PU_showMinimalAddBookmarkUI(aURI, aTitle, aDescription,
|
||||
aDefaultInsertionPoint, aShowPicker,
|
||||
aLoadInSidebar) {
|
||||
aLoadInSidebar, aKeyword) {
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "bookmark",
|
||||
@ -799,6 +809,11 @@ var PlacesUtils = {
|
||||
if (aLoadInSidebar)
|
||||
info.loadBookmarkInSidebar = true;
|
||||
|
||||
if (typeof(aKeyword) == "string")
|
||||
info.keyword = aKeyword;
|
||||
else
|
||||
info.hiddenRows.push("keyword");
|
||||
|
||||
return this._showBookmarkDialog(info, true);
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user