mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 07:17:30 +09:00
Add Pale Moon
This commit is contained in:
parent
dcd9973243
commit
fe8028fa2e
1173 changed files with 143053 additions and 934 deletions
|
|
@ -0,0 +1,2 @@
|
|||
component {6bcb9bde-9018-4443-a071-c32653469597} PlacesProtocolHandler.js
|
||||
contract @mozilla.org/network/protocol;1?name=place {6bcb9bde-9018-4443-a071-c32653469597}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2 et
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const SCHEME = "place";
|
||||
const URL = "chrome://browser/content/places/content-ui/controller.xhtml";
|
||||
|
||||
function PlacesProtocolHandler() {}
|
||||
|
||||
PlacesProtocolHandler.prototype = {
|
||||
scheme: SCHEME,
|
||||
defaultPort: -1,
|
||||
protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
|
||||
Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
|
||||
Ci.nsIProtocolHandler.URI_NORELATIVE |
|
||||
Ci.nsIProtocolHandler.URI_NOAUTH,
|
||||
|
||||
newURI: function PPH_newURI(aSpec, aOriginCharset, aBaseUri) {
|
||||
let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
|
||||
uri.spec = aSpec;
|
||||
return uri;
|
||||
},
|
||||
|
||||
newChannel: function PPH_newChannel(aUri) {
|
||||
let chan = NetUtil.newChannel(URL);
|
||||
chan.originalURI = aUri;
|
||||
return chan;
|
||||
},
|
||||
|
||||
allowPort: function PPH_allowPort(aPort, aScheme) {
|
||||
return false;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.nsIProtocolHandler
|
||||
]),
|
||||
|
||||
classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}")
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);
|
||||
1337
application/palemoon/components/places/PlacesUIUtils.jsm
Normal file
1337
application/palemoon/components/places/PlacesUIUtils.jsm
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,658 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* The panel is initialized based on data given in the js object passed
|
||||
* as window.arguments[0]. The object must have the following fields set:
|
||||
* @ action (String). Possible values:
|
||||
* - "add" - for adding a new item.
|
||||
* @ type (String). Possible values:
|
||||
* - "bookmark"
|
||||
* @ loadBookmarkInSidebar - optional, the default state for the
|
||||
* "Load this bookmark in the sidebar" field.
|
||||
* - "folder"
|
||||
* @ URIList (Array of nsIURI objects) - optional, list of uris to
|
||||
* be bookmarked under the new folder.
|
||||
* - "livemark"
|
||||
* @ uri (nsIURI object) - optional, the default uri for the new item.
|
||||
* The property is not used for the "folder with items" type.
|
||||
* @ title (String) - optional, the default title for the new item.
|
||||
* @ description (String) - optional, the default description for the new
|
||||
* item.
|
||||
* @ defaultInsertionPoint (InsertionPoint JS object) - optional, the
|
||||
* default insertion point for the new item.
|
||||
* @ keyword (String) - optional, the default keyword for the new item.
|
||||
* @ postData (String) - optional, POST data to accompany the keyword.
|
||||
* @ charSet (String) - optional, character-set to accompany the keyword.
|
||||
* 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
|
||||
* with the given uri. If the dialog is set to adding a folder with
|
||||
* bookmark items under it (see URIList), a default static title is
|
||||
* used ("[Folder Name]").
|
||||
* 2) The index field of the default insertion point is ignored if
|
||||
* the folder picker is shown.
|
||||
* - "edit" - for editing a bookmark item or a folder.
|
||||
* @ type (String). Possible values:
|
||||
* - "bookmark"
|
||||
* @ itemId (Integer) - the id of the bookmark item.
|
||||
* - "folder" (also applies to livemarks)
|
||||
* @ itemId (Integer) - the id of the folder.
|
||||
* @ hiddenRows (Strings array) - optional, list of rows to be hidden
|
||||
* regardless of the item edited or added by the dialog.
|
||||
* Possible values:
|
||||
* - "title"
|
||||
* - "location"
|
||||
* - "description"
|
||||
* - "keyword"
|
||||
* - "tags"
|
||||
* - "loadInSidebar"
|
||||
* - "feedLocation"
|
||||
* - "siteLocation"
|
||||
* - "folderPicker" - hides both the tree and the menu.
|
||||
* @ readOnly (Boolean) - optional, states if the panel should be read-only
|
||||
*
|
||||
* window.arguments[0].performed is set to true if any transaction has
|
||||
* been performed by the dialog.
|
||||
*/
|
||||
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
const BOOKMARK_ITEM = 0;
|
||||
const BOOKMARK_FOLDER = 1;
|
||||
const LIVEMARK_CONTAINER = 2;
|
||||
|
||||
const ACTION_EDIT = 0;
|
||||
const ACTION_ADD = 1;
|
||||
|
||||
var elementsHeight = new Map();
|
||||
|
||||
var BookmarkPropertiesPanel = {
|
||||
|
||||
/** UI Text Strings */
|
||||
__strings: null,
|
||||
get _strings() {
|
||||
if (!this.__strings) {
|
||||
this.__strings = document.getElementById("stringBundle");
|
||||
}
|
||||
return this.__strings;
|
||||
},
|
||||
|
||||
_action: null,
|
||||
_itemType: null,
|
||||
_itemId: -1,
|
||||
_uri: null,
|
||||
_loadInSidebar: false,
|
||||
_title: "",
|
||||
_description: "",
|
||||
_URIs: [],
|
||||
_keyword: "",
|
||||
_postData: null,
|
||||
_charSet: "",
|
||||
_feedURI: null,
|
||||
_siteURI: null,
|
||||
|
||||
_defaultInsertionPoint: null,
|
||||
_hiddenRows: [],
|
||||
_batching: false,
|
||||
_readOnly: false,
|
||||
|
||||
/**
|
||||
* This method returns the correct label for the dialog's "accept"
|
||||
* button based on the variant of the dialog.
|
||||
*/
|
||||
_getAcceptLabel: function BPP__getAcceptLabel() {
|
||||
if (this._action == ACTION_ADD) {
|
||||
if (this._URIs.length)
|
||||
return this._strings.getString("dialogAcceptLabelAddMulti");
|
||||
|
||||
if (this._itemType == LIVEMARK_CONTAINER)
|
||||
return this._strings.getString("dialogAcceptLabelAddLivemark");
|
||||
|
||||
if (this._dummyItem || this._loadInSidebar)
|
||||
return this._strings.getString("dialogAcceptLabelAddItem");
|
||||
|
||||
return this._strings.getString("dialogAcceptLabelSaveItem");
|
||||
}
|
||||
return this._strings.getString("dialogAcceptLabelEdit");
|
||||
},
|
||||
|
||||
/**
|
||||
* This method returns the correct title for the current variant
|
||||
* of this dialog.
|
||||
*/
|
||||
_getDialogTitle: function BPP__getDialogTitle() {
|
||||
if (this._action == ACTION_ADD) {
|
||||
if (this._itemType == BOOKMARK_ITEM)
|
||||
return this._strings.getString("dialogTitleAddBookmark");
|
||||
if (this._itemType == LIVEMARK_CONTAINER)
|
||||
return this._strings.getString("dialogTitleAddLivemark");
|
||||
|
||||
// add folder
|
||||
NS_ASSERT(this._itemType == BOOKMARK_FOLDER, "Unknown item type");
|
||||
if (this._URIs.length)
|
||||
return this._strings.getString("dialogTitleAddMulti");
|
||||
|
||||
return this._strings.getString("dialogTitleAddFolder");
|
||||
}
|
||||
if (this._action == ACTION_EDIT) {
|
||||
return this._strings.getFormattedString("dialogTitleEdit", [this._title]);
|
||||
}
|
||||
return "";
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines the initial data for the item edited or added by this dialog
|
||||
*/
|
||||
_determineItemInfo: function BPP__determineItemInfo() {
|
||||
var dialogInfo = window.arguments[0];
|
||||
this._action = dialogInfo.action == "add" ? ACTION_ADD : ACTION_EDIT;
|
||||
this._hiddenRows = dialogInfo.hiddenRows ? dialogInfo.hiddenRows : [];
|
||||
if (this._action == ACTION_ADD) {
|
||||
NS_ASSERT("type" in dialogInfo, "missing type property for add action");
|
||||
|
||||
if ("title" in dialogInfo)
|
||||
this._title = dialogInfo.title;
|
||||
|
||||
if ("defaultInsertionPoint" in dialogInfo) {
|
||||
this._defaultInsertionPoint = dialogInfo.defaultInsertionPoint;
|
||||
}
|
||||
else
|
||||
this._defaultInsertionPoint =
|
||||
new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
Ci.nsITreeView.DROP_ON);
|
||||
|
||||
switch (dialogInfo.type) {
|
||||
case "bookmark":
|
||||
this._itemType = BOOKMARK_ITEM;
|
||||
if ("uri" in dialogInfo) {
|
||||
NS_ASSERT(dialogInfo.uri instanceof Ci.nsIURI,
|
||||
"uri property should be a uri object");
|
||||
this._uri = dialogInfo.uri;
|
||||
if (typeof(this._title) != "string") {
|
||||
this._title = this._getURITitleFromHistory(this._uri) ||
|
||||
this._uri.spec;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._uri = PlacesUtils._uri("about:blank");
|
||||
this._title = this._strings.getString("newBookmarkDefault");
|
||||
this._dummyItem = true;
|
||||
}
|
||||
|
||||
if ("loadBookmarkInSidebar" in dialogInfo)
|
||||
this._loadInSidebar = dialogInfo.loadBookmarkInSidebar;
|
||||
|
||||
if ("keyword" in dialogInfo) {
|
||||
this._keyword = dialogInfo.keyword;
|
||||
this._isAddKeywordDialog = true;
|
||||
if ("postData" in dialogInfo)
|
||||
this._postData = dialogInfo.postData;
|
||||
if ("charSet" in dialogInfo)
|
||||
this._charSet = dialogInfo.charSet;
|
||||
}
|
||||
break;
|
||||
|
||||
case "folder":
|
||||
this._itemType = BOOKMARK_FOLDER;
|
||||
if (!this._title) {
|
||||
if ("URIList" in dialogInfo) {
|
||||
this._title = this._strings.getString("bookmarkAllTabsDefault");
|
||||
this._URIs = dialogInfo.URIList;
|
||||
}
|
||||
else
|
||||
this._title = this._strings.getString("newFolderDefault");
|
||||
this._dummyItem = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case "livemark":
|
||||
this._itemType = LIVEMARK_CONTAINER;
|
||||
if ("feedURI" in dialogInfo)
|
||||
this._feedURI = dialogInfo.feedURI;
|
||||
if ("siteURI" in dialogInfo)
|
||||
this._siteURI = dialogInfo.siteURI;
|
||||
|
||||
if (!this._title) {
|
||||
if (this._feedURI) {
|
||||
this._title = this._getURITitleFromHistory(this._feedURI) ||
|
||||
this._feedURI.spec;
|
||||
}
|
||||
else
|
||||
this._title = this._strings.getString("newLivemarkDefault");
|
||||
}
|
||||
}
|
||||
|
||||
if ("description" in dialogInfo)
|
||||
this._description = dialogInfo.description;
|
||||
}
|
||||
else { // edit
|
||||
NS_ASSERT("itemId" in dialogInfo);
|
||||
this._itemId = dialogInfo.itemId;
|
||||
this._title = PlacesUtils.bookmarks.getItemTitle(this._itemId);
|
||||
this._readOnly = !!dialogInfo.readOnly;
|
||||
|
||||
switch (dialogInfo.type) {
|
||||
case "bookmark":
|
||||
this._itemType = BOOKMARK_ITEM;
|
||||
|
||||
this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
|
||||
// keyword
|
||||
this._keyword = PlacesUtils.bookmarks
|
||||
.getKeywordForBookmark(this._itemId);
|
||||
// Load In Sidebar
|
||||
this._loadInSidebar = PlacesUtils.annotations
|
||||
.itemHasAnnotation(this._itemId,
|
||||
PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO);
|
||||
break;
|
||||
|
||||
case "folder":
|
||||
this._itemType = BOOKMARK_FOLDER;
|
||||
PlacesUtils.livemarks.getLivemark({ id: this._itemId })
|
||||
.then(aLivemark => {
|
||||
this._itemType = LIVEMARK_CONTAINER;
|
||||
this._feedURI = aLivemark.feedURI;
|
||||
this._siteURI = aLivemark.siteURI;
|
||||
this._fillEditProperties();
|
||||
|
||||
let acceptButton = document.documentElement.getButton("accept");
|
||||
acceptButton.disabled = !this._inputIsValid();
|
||||
|
||||
let newHeight = window.outerHeight +
|
||||
this._element("descriptionField").boxObject.height;
|
||||
window.resizeTo(window.outerWidth, newHeight);
|
||||
}, () => undefined);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Description
|
||||
if (PlacesUtils.annotations
|
||||
.itemHasAnnotation(this._itemId, PlacesUIUtils.DESCRIPTION_ANNO)) {
|
||||
this._description = PlacesUtils.annotations
|
||||
.getItemAnnotation(this._itemId,
|
||||
PlacesUIUtils.DESCRIPTION_ANNO);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method returns the title string corresponding to a given URI.
|
||||
* If none is available from the bookmark service (probably because
|
||||
* the given URI doesn't appear in bookmarks or history), we synthesize
|
||||
* a title from the first 100 characters of the URI.
|
||||
*
|
||||
* @param aURI
|
||||
* nsIURI object for which we want the title
|
||||
*
|
||||
* @returns a title string
|
||||
*/
|
||||
_getURITitleFromHistory: function BPP__getURITitleFromHistory(aURI) {
|
||||
NS_ASSERT(aURI instanceof Ci.nsIURI);
|
||||
|
||||
// get the title from History
|
||||
return PlacesUtils.history.getPageTitle(aURI);
|
||||
},
|
||||
|
||||
/**
|
||||
* This method should be called by the onload of the Bookmark Properties
|
||||
* dialog to initialize the state of the panel.
|
||||
*/
|
||||
onDialogLoad: function BPP_onDialogLoad() {
|
||||
this._determineItemInfo();
|
||||
|
||||
document.title = this._getDialogTitle();
|
||||
var acceptButton = document.documentElement.getButton("accept");
|
||||
acceptButton.label = this._getAcceptLabel();
|
||||
|
||||
// Do not use sizeToContent, otherwise, due to bug 90276, the dialog will
|
||||
// grow at every opening.
|
||||
// Since elements can be uncollapsed asynchronously, we must observe their
|
||||
// mutations and resize the dialog using a cached element size.
|
||||
this._height = window.outerHeight;
|
||||
this._mutationObserver = new MutationObserver(mutations => {
|
||||
for (let mutation of mutations) {
|
||||
let target = mutation.target;
|
||||
let id = target.id;
|
||||
if (!/^editBMPanel_.*(Row|Checkbox)$/.test(id))
|
||||
continue;
|
||||
|
||||
let collapsed = target.getAttribute("collapsed") === "true";
|
||||
let wasCollapsed = mutation.oldValue === "true";
|
||||
if (collapsed == wasCollapsed)
|
||||
continue;
|
||||
|
||||
if (collapsed) {
|
||||
this._height -= elementsHeight.get(id);
|
||||
elementsHeight.delete(id);
|
||||
} else {
|
||||
elementsHeight.set(id, target.boxObject.height);
|
||||
this._height += elementsHeight.get(id);
|
||||
}
|
||||
window.resizeTo(window.outerWidth, this._height);
|
||||
}
|
||||
});
|
||||
|
||||
this._mutationObserver.observe(document,
|
||||
{ subtree: true,
|
||||
attributeOldValue: true,
|
||||
attributeFilter: ["collapsed"] });
|
||||
|
||||
// Some controls are flexible and we want to update their cached size when
|
||||
// the dialog is resized.
|
||||
window.addEventListener("resize", this);
|
||||
|
||||
this._beginBatch();
|
||||
|
||||
switch (this._action) {
|
||||
case ACTION_EDIT:
|
||||
this._fillEditProperties();
|
||||
acceptButton.disabled = this._readOnly;
|
||||
break;
|
||||
case ACTION_ADD:
|
||||
this._fillAddProperties();
|
||||
// if this is an uri related dialog disable accept button until
|
||||
// the user fills an uri value.
|
||||
if (this._itemType == BOOKMARK_ITEM)
|
||||
acceptButton.disabled = !this._inputIsValid();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!this._readOnly) {
|
||||
// Listen on uri fields to enable accept button if input is valid
|
||||
if (this._itemType == BOOKMARK_ITEM) {
|
||||
this._element("locationField")
|
||||
.addEventListener("input", this, false);
|
||||
if (this._isAddKeywordDialog) {
|
||||
this._element("keywordField")
|
||||
.addEventListener("input", this, false);
|
||||
}
|
||||
}
|
||||
else if (this._itemType == LIVEMARK_CONTAINER) {
|
||||
this._element("feedLocationField")
|
||||
.addEventListener("input", this, false);
|
||||
this._element("siteLocationField")
|
||||
.addEventListener("input", this, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// nsIDOMEventListener
|
||||
handleEvent: function BPP_handleEvent(aEvent) {
|
||||
var target = aEvent.target;
|
||||
switch (aEvent.type) {
|
||||
case "input":
|
||||
if (target.id == "editBMPanel_locationField" ||
|
||||
target.id == "editBMPanel_feedLocationField" ||
|
||||
target.id == "editBMPanel_siteLocationField" ||
|
||||
target.id == "editBMPanel_keywordField") {
|
||||
// Check uri fields to enable accept button if input is valid
|
||||
document.documentElement
|
||||
.getButton("accept").disabled = !this._inputIsValid();
|
||||
}
|
||||
break;
|
||||
case "resize":
|
||||
for (let [id, oldHeight] of elementsHeight) {
|
||||
let newHeight = document.getElementById(id).boxObject.height;
|
||||
this._height += - oldHeight + newHeight;
|
||||
elementsHeight.set(id, newHeight);
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_beginBatch: function BPP__beginBatch() {
|
||||
if (this._batching)
|
||||
return;
|
||||
|
||||
PlacesUtils.transactionManager.beginBatch(null);
|
||||
this._batching = true;
|
||||
},
|
||||
|
||||
_endBatch: function BPP__endBatch() {
|
||||
if (!this._batching)
|
||||
return;
|
||||
|
||||
PlacesUtils.transactionManager.endBatch(false);
|
||||
this._batching = false;
|
||||
},
|
||||
|
||||
_fillEditProperties: function BPP__fillEditProperties() {
|
||||
gEditItemOverlay.initPanel(this._itemId,
|
||||
{ hiddenRows: this._hiddenRows,
|
||||
forceReadOnly: this._readOnly });
|
||||
},
|
||||
|
||||
_fillAddProperties: function BPP__fillAddProperties() {
|
||||
this._createNewItem();
|
||||
// Edit the new item
|
||||
gEditItemOverlay.initPanel(this._itemId,
|
||||
{ hiddenRows: this._hiddenRows });
|
||||
// Empty location field if the uri is about:blank, this way inserting a new
|
||||
// url will be easier for the user, Accept button will be automatically
|
||||
// disabled by the input listener until the user fills the field.
|
||||
var locationField = this._element("locationField");
|
||||
if (locationField.value == "about:blank")
|
||||
locationField.value = "";
|
||||
},
|
||||
|
||||
// nsISupports
|
||||
QueryInterface: function BPP_QueryInterface(aIID) {
|
||||
if (aIID.equals(Ci.nsIDOMEventListener) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Cr.NS_NOINTERFACE;
|
||||
},
|
||||
|
||||
_element: function BPP__element(aID) {
|
||||
return document.getElementById("editBMPanel_" + aID);
|
||||
},
|
||||
|
||||
onDialogUnload: function BPP_onDialogUnload() {
|
||||
// gEditItemOverlay does not exist anymore here, so don't rely on it.
|
||||
this._mutationObserver.disconnect();
|
||||
delete this._mutationObserver;
|
||||
|
||||
window.removeEventListener("resize", this);
|
||||
|
||||
// Calling removeEventListener with arguments which do not identify any
|
||||
// currently registered EventListener on the EventTarget has no effect.
|
||||
this._element("locationField")
|
||||
.removeEventListener("input", this, false);
|
||||
this._element("feedLocationField")
|
||||
.removeEventListener("input", this, false);
|
||||
this._element("siteLocationField")
|
||||
.removeEventListener("input", this, false);
|
||||
},
|
||||
|
||||
onDialogAccept: function BPP_onDialogAccept() {
|
||||
// We must blur current focused element to save its changes correctly
|
||||
document.commandDispatcher.focusedElement.blur();
|
||||
// The order here is important! We have to uninit the panel first, otherwise
|
||||
// late changes could force it to commit more transactions.
|
||||
gEditItemOverlay.uninitPanel(true);
|
||||
this._endBatch();
|
||||
window.arguments[0].performed = true;
|
||||
},
|
||||
|
||||
onDialogCancel: function BPP_onDialogCancel() {
|
||||
// The order here is important! We have to uninit the panel first, otherwise
|
||||
// changes done as part of Undo may change the panel contents and by
|
||||
// that force it to commit more transactions.
|
||||
gEditItemOverlay.uninitPanel(true);
|
||||
this._endBatch();
|
||||
PlacesUtils.transactionManager.undoTransaction();
|
||||
window.arguments[0].performed = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* This method checks to see if the input fields are in a valid state.
|
||||
*
|
||||
* @returns true if the input is valid, false otherwise
|
||||
*/
|
||||
_inputIsValid: function BPP__inputIsValid() {
|
||||
if (this._itemType == BOOKMARK_ITEM &&
|
||||
!this._containsValidURI("locationField"))
|
||||
return false;
|
||||
if (this._isAddKeywordDialog && !this._element("keywordField").value.length)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether the XUL textbox with the given ID contains a
|
||||
* string that can be converted into an nsIURI.
|
||||
*
|
||||
* @param aTextboxID
|
||||
* the ID of the textbox element whose contents we'll test
|
||||
*
|
||||
* @returns true if the textbox contains a valid URI string, false otherwise
|
||||
*/
|
||||
_containsValidURI: function BPP__containsValidURI(aTextboxID) {
|
||||
try {
|
||||
var value = this._element(aTextboxID).value;
|
||||
if (value) {
|
||||
PlacesUIUtils.createFixedURI(value);
|
||||
return true;
|
||||
}
|
||||
} catch (e) { }
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* [New Item Mode] Get the insertion point details for the new item, given
|
||||
* dialog state and opening arguments.
|
||||
*
|
||||
* The container-identifier and insertion-index are returned separately in
|
||||
* the form of [containerIdentifier, insertionIndex]
|
||||
*/
|
||||
_getInsertionPointDetails: function BPP__getInsertionPointDetails() {
|
||||
var containerId = this._defaultInsertionPoint.itemId;
|
||||
var indexInContainer = this._defaultInsertionPoint.index;
|
||||
|
||||
return [containerId, indexInContainer];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a transaction for creating a new bookmark item representing the
|
||||
* various fields and opening arguments of the dialog.
|
||||
*/
|
||||
_getCreateNewBookmarkTransaction:
|
||||
function BPP__getCreateNewBookmarkTransaction(aContainer, aIndex) {
|
||||
var annotations = [];
|
||||
var childTransactions = [];
|
||||
|
||||
if (this._description) {
|
||||
let annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO,
|
||||
type : Ci.nsIAnnotationService.TYPE_STRING,
|
||||
flags : 0,
|
||||
value : this._description,
|
||||
expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
||||
let editItemTxn = new PlacesSetItemAnnotationTransaction(-1, annoObj);
|
||||
childTransactions.push(editItemTxn);
|
||||
}
|
||||
|
||||
if (this._loadInSidebar) {
|
||||
let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO,
|
||||
value : true };
|
||||
let setLoadTxn = new PlacesSetItemAnnotationTransaction(-1, annoObj);
|
||||
childTransactions.push(setLoadTxn);
|
||||
}
|
||||
|
||||
if (this._postData) {
|
||||
let postDataTxn = new PlacesEditBookmarkPostDataTransaction(-1, this._postData);
|
||||
childTransactions.push(postDataTxn);
|
||||
}
|
||||
|
||||
//XXX TODO: this should be in a transaction!
|
||||
if (this._charSet && !PrivateBrowsingUtils.isWindowPrivate(window))
|
||||
PlacesUtils.setCharsetForURI(this._uri, this._charSet);
|
||||
|
||||
let createTxn = new PlacesCreateBookmarkTransaction(this._uri,
|
||||
aContainer,
|
||||
aIndex,
|
||||
this._title,
|
||||
this._keyword,
|
||||
annotations,
|
||||
childTransactions);
|
||||
|
||||
return new PlacesAggregatedTransaction(this._getDialogTitle(),
|
||||
[createTxn]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a childItems-transactions array representing the URIList with
|
||||
* which the dialog has been opened.
|
||||
*/
|
||||
_getTransactionsForURIList: function BPP__getTransactionsForURIList() {
|
||||
var transactions = [];
|
||||
for (var i = 0; i < this._URIs.length; ++i) {
|
||||
var uri = this._URIs[i];
|
||||
var title = this._getURITitleFromHistory(uri);
|
||||
var createTxn = new PlacesCreateBookmarkTransaction(uri, -1,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
title);
|
||||
transactions.push(createTxn);
|
||||
}
|
||||
return transactions;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a transaction for creating a new folder item representing the
|
||||
* various fields and opening arguments of the dialog.
|
||||
*/
|
||||
_getCreateNewFolderTransaction:
|
||||
function BPP__getCreateNewFolderTransaction(aContainer, aIndex) {
|
||||
var annotations = [];
|
||||
var childItemsTransactions;
|
||||
if (this._URIs.length)
|
||||
childItemsTransactions = this._getTransactionsForURIList();
|
||||
|
||||
if (this._description)
|
||||
annotations.push(this._getDescriptionAnnotation(this._description));
|
||||
|
||||
return new PlacesCreateFolderTransaction(this._title, aContainer,
|
||||
aIndex, annotations,
|
||||
childItemsTransactions);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a transaction for creating a new live-bookmark item representing
|
||||
* the various fields and opening arguments of the dialog.
|
||||
*/
|
||||
_getCreateNewLivemarkTransaction:
|
||||
function BPP__getCreateNewLivemarkTransaction(aContainer, aIndex) {
|
||||
return new PlacesCreateLivemarkTransaction(this._feedURI, this._siteURI,
|
||||
this._title,
|
||||
aContainer, aIndex);
|
||||
},
|
||||
|
||||
/**
|
||||
* Dialog-accept code-path for creating a new item (any type)
|
||||
*/
|
||||
_createNewItem: function BPP__getCreateItemTransaction() {
|
||||
var [container, index] = this._getInsertionPointDetails();
|
||||
var txn;
|
||||
|
||||
switch (this._itemType) {
|
||||
case BOOKMARK_FOLDER:
|
||||
txn = this._getCreateNewFolderTransaction(container, index);
|
||||
break;
|
||||
case LIVEMARK_CONTAINER:
|
||||
txn = this._getCreateNewLivemarkTransaction(container, index);
|
||||
break;
|
||||
default: // BOOKMARK_ITEM
|
||||
txn = this._getCreateNewBookmarkTransaction(container, index);
|
||||
}
|
||||
|
||||
PlacesUtils.transactionManager.doTransaction(txn);
|
||||
this._itemId = PlacesUtils.bookmarks.getIdForItemAt(container, index);
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||
|
||||
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
||||
%editBookmarkOverlayDTD;
|
||||
]>
|
||||
|
||||
<dialog id="bookmarkproperties"
|
||||
buttons="accept, cancel"
|
||||
buttoniconaccept="save"
|
||||
ondialogaccept="BookmarkPropertiesPanel.onDialogAccept();"
|
||||
ondialogcancel="BookmarkPropertiesPanel.onDialogCancel();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="BookmarkPropertiesPanel.onDialogLoad();"
|
||||
onunload="BookmarkPropertiesPanel.onDialogUnload();"
|
||||
style="min-width: 30em;"
|
||||
persist="screenX screenY width">
|
||||
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="stringBundle"
|
||||
src="chrome://browser/locale/places/bookmarkProperties.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/bookmarkProperties.js"/>
|
||||
|
||||
<vbox id="editBookmarkPanelContent"/>
|
||||
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function init() {
|
||||
document.getElementById("bookmarks-view").place =
|
||||
"place:queryType=1&folder=" + window.top.PlacesUIUtils.allBookmarksFolderId;
|
||||
}
|
||||
|
||||
function searchBookmarks(aSearchString) {
|
||||
var tree = document.getElementById('bookmarks-view');
|
||||
if (!aSearchString)
|
||||
tree.place = tree.place;
|
||||
else
|
||||
tree.applyFilter(aSearchString,
|
||||
[PlacesUtils.bookmarksMenuFolderId,
|
||||
PlacesUtils.unfiledBookmarksFolderId,
|
||||
PlacesUtils.toolbarFolderId]);
|
||||
}
|
||||
|
||||
window.addEventListener("SidebarFocused",
|
||||
function()
|
||||
document.getElementById("search-box").focus(),
|
||||
false);
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE page SYSTEM "chrome://browser/locale/places/places.dtd">
|
||||
|
||||
<page id="bookmarksPanel"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="init();"
|
||||
onunload="SidebarUtils.setMouseoverURL('');">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/bookmarks/bookmarksPanel.js"/>
|
||||
|
||||
<commandset id="placesCommands"/>
|
||||
<commandset id="editMenuCommands"/>
|
||||
<keyset id="placesCommandKeys"/>
|
||||
<menupopup id="placesContext"/>
|
||||
|
||||
<!-- Bookmarks and history tooltip -->
|
||||
<tooltip id="bhTooltip"/>
|
||||
|
||||
<hbox id="sidebar-search-container" align="center">
|
||||
<label id="sidebar-search-label"
|
||||
value="&search.label;" accesskey="&search.accesskey;" control="search-box"/>
|
||||
<textbox id="search-box" flex="1" type="search" class="compact"
|
||||
aria-controls="bookmarks-view"
|
||||
oncommand="searchBookmarks(this.value);"/>
|
||||
</hbox>
|
||||
|
||||
<tree id="bookmarks-view" class="sidebar-placesTree" type="places"
|
||||
flex="1"
|
||||
hidecolumnpicker="true"
|
||||
context="placesContext"
|
||||
onkeypress="SidebarUtils.handleTreeKeyPress(event);"
|
||||
onclick="SidebarUtils.handleTreeClick(this, event, true);"
|
||||
onmousemove="SidebarUtils.handleTreeMouseMove(event);"
|
||||
onmouseout="SidebarUtils.setMouseoverURL('');">
|
||||
<treecols>
|
||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||
</treecols>
|
||||
<treechildren id="bookmarks-view-children" view="bookmarks-view"
|
||||
class="sidebar-placesTreechildren" flex="1" tooltip="bhTooltip"/>
|
||||
</tree>
|
||||
</page>
|
||||
1744
application/palemoon/components/places/content/browserPlacesViews.js
Normal file
1744
application/palemoon/components/places/content/browserPlacesViews.js
Normal file
File diff suppressed because it is too large
Load diff
1895
application/palemoon/components/places/content/controller.js
Normal file
1895
application/palemoon/components/places/content/controller.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,47 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xul-overlay href="chrome://browser/content/downloads/allDownloadsViewOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % downloadsDTD SYSTEM "chrome://browser/locale/downloads/downloads.dtd">
|
||||
%downloadsDTD;
|
||||
]>
|
||||
|
||||
<overlay id="downloadsViewOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
const DOWNLOADS_QUERY = "place:transition=" +
|
||||
Components.interfaces.nsINavHistoryService.TRANSITION_DOWNLOAD +
|
||||
"&sort=" +
|
||||
Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
|
||||
|
||||
ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY,
|
||||
function() new DownloadsPlacesView(document.getElementById("downloadsRichListBox"), false),
|
||||
{ showDetailsPane: false,
|
||||
toolbarSet: "back-button, forward-button, organizeButton, clearDownloadsButton, libraryToolbarSpacer, searchFilter" });
|
||||
]]></script>
|
||||
|
||||
<window id="places">
|
||||
<commandset id="downloadCommands"/>
|
||||
<menupopup id="downloadsContextMenu"/>
|
||||
</window>
|
||||
|
||||
<deck id="placesViewsDeck">
|
||||
<richlistbox id="downloadsRichListBox"/>
|
||||
</deck>
|
||||
|
||||
<toolbar id="placesToolbar">
|
||||
<toolbarbutton id="clearDownloadsButton"
|
||||
#ifdef XP_MACOSX
|
||||
class="tabbable"
|
||||
#endif
|
||||
insertbefore="libraryToolbarSpacer"
|
||||
label="&clearDownloadsButton.label;"
|
||||
command="downloadsCmd_clearDownloads"
|
||||
tooltiptext="&clearDownloadsButton.tooltip;"/>
|
||||
</toolbar>
|
||||
|
||||
</overlay>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,228 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
|
||||
%editBookmarkOverlayDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
|
||||
<overlay id="editBookmarkOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<vbox id="editBookmarkPanelContent" flex="1">
|
||||
<broadcaster id="paneElementsBroadcaster"/>
|
||||
|
||||
<hbox id="editBMPanel_selectionCount" hidden="true" pack="center">
|
||||
<label id="editBMPanel_itemsCountText"/>
|
||||
</hbox>
|
||||
|
||||
<grid id="editBookmarkPanelGrid" flex="1">
|
||||
<columns id="editBMPanel_columns">
|
||||
<column id="editBMPanel_labelColumn" />
|
||||
<column flex="1" id="editBMPanel_editColumn" />
|
||||
</columns>
|
||||
<rows id="editBMPanel_rows">
|
||||
<row id="editBMPanel_nameRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<label value="&editBookmarkOverlay.name.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.name.accesskey;"
|
||||
control="editBMPanel_namePicker"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<textbox id="editBMPanel_namePicker"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_locationRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<label value="&editBookmarkOverlay.location.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.location.accesskey;"
|
||||
control="editBMPanel_locationField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<textbox id="editBMPanel_locationField"
|
||||
class="uri-element"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_feedLocationRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<label value="&editBookmarkOverlay.feedLocation.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.feedLocation.accesskey;"
|
||||
control="editBMPanel_feedLocationField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<textbox id="editBMPanel_feedLocationField"
|
||||
class="uri-element"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_siteLocationRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<label value="&editBookmarkOverlay.siteLocation.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.siteLocation.accesskey;"
|
||||
control="editBMPanel_siteLocationField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<textbox id="editBMPanel_siteLocationField"
|
||||
class="uri-element"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_folderRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<label value="&editBookmarkOverlay.folder.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
control="editBMPanel_folderMenuList"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<hbox flex="1" align="center">
|
||||
<menulist id="editBMPanel_folderMenuList"
|
||||
class="folder-icon"
|
||||
flex="1"
|
||||
oncommand="gEditItemOverlay.onFolderMenuListCommand(event);"
|
||||
observes="paneElementsBroadcaster">
|
||||
<menupopup>
|
||||
<!-- Static item for special folders -->
|
||||
<menuitem id="editBMPanel_toolbarFolderItem"
|
||||
class="menuitem-iconic folder-icon"/>
|
||||
<menuitem id="editBMPanel_bmRootItem"
|
||||
class="menuitem-iconic folder-icon"/>
|
||||
<menuitem id="editBMPanel_unfiledRootItem"
|
||||
class="menuitem-iconic folder-icon"/>
|
||||
<menuseparator id="editBMPanel_chooseFolderSeparator"/>
|
||||
<menuitem id="editBMPanel_chooseFolderMenuItem"
|
||||
label="&editBookmarkOverlay.choose.label;"
|
||||
class="menuitem-iconic folder-icon"/>
|
||||
<menuseparator id="editBMPanel_foldersSeparator" hidden="true"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<button id="editBMPanel_foldersExpander"
|
||||
class="expander-down"
|
||||
tooltiptext="&editBookmarkOverlay.foldersExpanderDown.tooltip;"
|
||||
tooltiptextdown="&editBookmarkOverlay.foldersExpanderDown.tooltip;"
|
||||
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
||||
oncommand="gEditItemOverlay.toggleFolderTreeVisibility();"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</hbox>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_folderTreeRow"
|
||||
collapsed="true"
|
||||
flex="1">
|
||||
<spacer/>
|
||||
<vbox flex="1">
|
||||
<tree id="editBMPanel_folderTree"
|
||||
flex="1"
|
||||
class="placesTree"
|
||||
type="places"
|
||||
height="150"
|
||||
minheight="150"
|
||||
editable="true"
|
||||
onselect="gEditItemOverlay.onFolderTreeSelect();"
|
||||
hidecolumnpicker="true"
|
||||
observes="paneElementsBroadcaster">
|
||||
<treecols>
|
||||
<treecol anonid="title" flex="1" primary="true" hideheader="true"/>
|
||||
</treecols>
|
||||
<treechildren flex="1"/>
|
||||
</tree>
|
||||
|
||||
<hbox id="editBMPanel_newFolderBox">
|
||||
<button label="&editBookmarkOverlay.newFolderButton.label;"
|
||||
id="editBMPanel_newFolderButton"
|
||||
accesskey="&editBookmarkOverlay.newFolderButton.accesskey;"
|
||||
oncommand="gEditItemOverlay.newFolder();"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_tagsRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<label value="&editBookmarkOverlay.tags.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.tags.accesskey;"
|
||||
control="editBMPanel_tagsField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<hbox flex="1" align="center">
|
||||
<textbox id="editBMPanel_tagsField"
|
||||
type="autocomplete"
|
||||
class="padded"
|
||||
flex="1"
|
||||
autocompletesearch="places-tag-autocomplete"
|
||||
completedefaultindex="true"
|
||||
tabscrolling="true"
|
||||
showcommentcolumn="true"
|
||||
observes="paneElementsBroadcaster"
|
||||
placeholder="&editBookmarkOverlay.tagsEmptyDesc.label;"/>
|
||||
<button id="editBMPanel_tagsSelectorExpander"
|
||||
class="expander-down"
|
||||
tooltiptext="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||
tooltiptextdown="&editBookmarkOverlay.tagsExpanderDown.tooltip;"
|
||||
tooltiptextup="&editBookmarkOverlay.expanderUp.tooltip;"
|
||||
oncommand="gEditItemOverlay.toggleTagsSelector();"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</hbox>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_tagsSelectorRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<spacer/>
|
||||
<listbox id="editBMPanel_tagsSelector"
|
||||
height="150"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_keywordRow"
|
||||
align="center"
|
||||
collapsed="true">
|
||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||
<label value="&editBookmarkOverlay.keyword.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.keyword.accesskey;"
|
||||
control="editBMPanel_keywordField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<textbox id="editBMPanel_keywordField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
|
||||
<row id="editBMPanel_descriptionRow"
|
||||
collapsed="true">
|
||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||
<label value="&editBookmarkOverlay.description.label;"
|
||||
class="editBMPanel_rowLabel"
|
||||
accesskey="&editBookmarkOverlay.description.accesskey;"
|
||||
control="editBMPanel_descriptionField"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
<textbox id="editBMPanel_descriptionField"
|
||||
multiline="true"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<checkbox id="editBMPanel_loadInSidebarCheckbox"
|
||||
collapsed="true"
|
||||
label="&editBookmarkOverlay.loadInSidebar.label;"
|
||||
accesskey="&editBookmarkOverlay.loadInSidebar.accesskey;"
|
||||
oncommand="gEditItemOverlay.onLoadInSidebarCheckboxCommand();"
|
||||
observes="paneElementsBroadcaster">
|
||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||
</checkbox>
|
||||
|
||||
<!-- If the ids are changing or additional fields are being added, be sure
|
||||
to sync the values in places.js -->
|
||||
<broadcaster id="additionalInfoBroadcaster"/>
|
||||
|
||||
</vbox>
|
||||
</overlay>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var gHistoryTree;
|
||||
var gSearchBox;
|
||||
var gHistoryGrouping = "";
|
||||
var gSearching = false;
|
||||
|
||||
function HistorySidebarInit()
|
||||
{
|
||||
gHistoryTree = document.getElementById("historyTree");
|
||||
gSearchBox = document.getElementById("search-box");
|
||||
|
||||
gHistoryGrouping = document.getElementById("viewButton").
|
||||
getAttribute("selectedsort");
|
||||
|
||||
if (gHistoryGrouping == "site")
|
||||
document.getElementById("bysite").setAttribute("checked", "true");
|
||||
else if (gHistoryGrouping == "visited")
|
||||
document.getElementById("byvisited").setAttribute("checked", "true");
|
||||
else if (gHistoryGrouping == "lastvisited")
|
||||
document.getElementById("bylastvisited").setAttribute("checked", "true");
|
||||
else if (gHistoryGrouping == "dayandsite")
|
||||
document.getElementById("bydayandsite").setAttribute("checked", "true");
|
||||
else
|
||||
document.getElementById("byday").setAttribute("checked", "true");
|
||||
|
||||
searchHistory("");
|
||||
}
|
||||
|
||||
function GroupBy(groupingType)
|
||||
{
|
||||
gHistoryGrouping = groupingType;
|
||||
searchHistory(gSearchBox.value);
|
||||
}
|
||||
|
||||
function searchHistory(aInput)
|
||||
{
|
||||
var query = PlacesUtils.history.getNewQuery();
|
||||
var options = PlacesUtils.history.getNewQueryOptions();
|
||||
|
||||
const NHQO = Ci.nsINavHistoryQueryOptions;
|
||||
var sortingMode;
|
||||
var resultType;
|
||||
|
||||
switch (gHistoryGrouping) {
|
||||
case "visited":
|
||||
resultType = NHQO.RESULTS_AS_URI;
|
||||
sortingMode = NHQO.SORT_BY_VISITCOUNT_DESCENDING;
|
||||
break;
|
||||
case "lastvisited":
|
||||
resultType = NHQO.RESULTS_AS_URI;
|
||||
sortingMode = NHQO.SORT_BY_DATE_DESCENDING;
|
||||
break;
|
||||
case "dayandsite":
|
||||
resultType = NHQO.RESULTS_AS_DATE_SITE_QUERY;
|
||||
break;
|
||||
case "site":
|
||||
resultType = NHQO.RESULTS_AS_SITE_QUERY;
|
||||
sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
|
||||
break;
|
||||
case "day":
|
||||
default:
|
||||
resultType = NHQO.RESULTS_AS_DATE_QUERY;
|
||||
break;
|
||||
}
|
||||
|
||||
if (aInput) {
|
||||
query.searchTerms = aInput;
|
||||
if (gHistoryGrouping != "visited" && gHistoryGrouping != "lastvisited") {
|
||||
sortingMode = NHQO.SORT_BY_FRECENCY_DESCENDING;
|
||||
resultType = NHQO.RESULTS_AS_URI;
|
||||
}
|
||||
}
|
||||
|
||||
options.sortingMode = sortingMode;
|
||||
options.resultType = resultType;
|
||||
options.includeHidden = !!aInput;
|
||||
|
||||
// call load() on the tree manually
|
||||
// instead of setting the place attribute in history-panel.xul
|
||||
// otherwise, we will end up calling load() twice
|
||||
gHistoryTree.load([query], options);
|
||||
}
|
||||
|
||||
window.addEventListener("SidebarFocused",
|
||||
function()
|
||||
gSearchBox.focus(),
|
||||
false);
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE page [
|
||||
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
|
||||
%placesDTD;
|
||||
]>
|
||||
|
||||
<!-- we need to keep id="history-panel" for upgrade and switching
|
||||
between versions of the browser -->
|
||||
|
||||
<page id="history-panel" orient="vertical"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="HistorySidebarInit();"
|
||||
onunload="SidebarUtils.setMouseoverURL('');">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/history-panel.js"/>
|
||||
|
||||
<commandset id="editMenuCommands"/>
|
||||
<commandset id="placesCommands"/>
|
||||
|
||||
<keyset id="editMenuKeys">
|
||||
#ifdef XP_MACOSX
|
||||
<key id="key_delete2" keycode="VK_BACK" command="cmd_delete"/>
|
||||
#endif
|
||||
</keyset>
|
||||
|
||||
<!-- required to overlay the context menu -->
|
||||
<menupopup id="placesContext"/>
|
||||
|
||||
<!-- Bookmarks and history tooltip -->
|
||||
<tooltip id="bhTooltip"/>
|
||||
|
||||
<hbox id="sidebar-search-container" align="center">
|
||||
<label id="sidebar-search-label"
|
||||
value="&find.label;" accesskey="&find.accesskey;"
|
||||
control="search-box"/>
|
||||
<textbox id="search-box" flex="1" type="search" class="compact"
|
||||
aria-controls="historyTree"
|
||||
oncommand="searchHistory(this.value);"/>
|
||||
<button id="viewButton" style="min-width:0px !important;" type="menu"
|
||||
label="&view.label;" accesskey="&view.accesskey;" selectedsort="day"
|
||||
persist="selectedsort">
|
||||
<menupopup>
|
||||
<menuitem id="bydayandsite" label="&byDayAndSite.label;"
|
||||
accesskey="&byDayAndSite.accesskey;" type="radio"
|
||||
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'dayandsite'); GroupBy('dayandsite');"/>
|
||||
<menuitem id="bysite" label="&bySite.label;"
|
||||
accesskey="&bySite.accesskey;" type="radio"
|
||||
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'site'); GroupBy('site');"/>
|
||||
<menuitem id="byday" label="&byDate.label;"
|
||||
accesskey="&byDate.accesskey;"
|
||||
type="radio"
|
||||
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'day'); GroupBy('day');"/>
|
||||
<menuitem id="byvisited" label="&byMostVisited.label;"
|
||||
accesskey="&byMostVisited.accesskey;"
|
||||
type="radio"
|
||||
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'visited'); GroupBy('visited');"/>
|
||||
<menuitem id="bylastvisited" label="&byLastVisited.label;"
|
||||
accesskey="&byLastVisited.accesskey;"
|
||||
type="radio"
|
||||
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'lastvisited'); GroupBy('lastvisited');"/>
|
||||
</menupopup>
|
||||
</button>
|
||||
</hbox>
|
||||
|
||||
<tree id="historyTree"
|
||||
class="sidebar-placesTree"
|
||||
flex="1"
|
||||
type="places"
|
||||
context="placesContext"
|
||||
hidecolumnpicker="true"
|
||||
onkeypress="SidebarUtils.handleTreeKeyPress(event);"
|
||||
onclick="SidebarUtils.handleTreeClick(this, event, true);"
|
||||
onmousemove="SidebarUtils.handleTreeMouseMove(event);"
|
||||
onmouseout="SidebarUtils.setMouseoverURL('');">
|
||||
<treecols>
|
||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||
</treecols>
|
||||
<treechildren class="sidebar-placesTreechildren" flex="1" tooltip="bhTooltip"/>
|
||||
</tree>
|
||||
</page>
|
||||
488
application/palemoon/components/places/content/menu.xml
Normal file
488
application/palemoon/components/places/content/menu.xml
Normal file
|
|
@ -0,0 +1,488 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
<bindings id="placesMenuBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="places-popup-base"
|
||||
extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox class="menupopup-drop-indicator-bar" hidden="true">
|
||||
<xul:image class="menupopup-drop-indicator" mousethrough="always"/>
|
||||
</xul:vbox>
|
||||
<xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical"
|
||||
smoothscroll="false">
|
||||
<children/>
|
||||
</xul:arrowscrollbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
|
||||
<field name="_indicatorBar">
|
||||
document.getAnonymousElementByAttribute(this, "class",
|
||||
"menupopup-drop-indicator-bar");
|
||||
</field>
|
||||
|
||||
<field name="_scrollBox">
|
||||
document.getAnonymousElementByAttribute(this, "class",
|
||||
"popup-internal-box");
|
||||
</field>
|
||||
|
||||
<!-- This is the view that manage the popup -->
|
||||
<field name="_rootView">PlacesUIUtils.getViewForNode(this);</field>
|
||||
|
||||
<!-- Check if we should hide the drop indicator for the target -->
|
||||
<method name="_hideDropIndicator">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
let target = aEvent.target;
|
||||
|
||||
// Don't draw the drop indicator outside of markers.
|
||||
// The markers are hidden, since otherwise sometimes popups acquire
|
||||
// scrollboxes on OS X, so we can't use them directly.
|
||||
let firstChildTop = this._startMarker.nextSibling.boxObject.y;
|
||||
let lastChildBottom = this._endMarker.previousSibling.boxObject.y +
|
||||
this._endMarker.previousSibling.boxObject.height;
|
||||
let betweenMarkers = target.boxObject.y >= firstChildTop ||
|
||||
target.boxObject.y <= lastChildBottom;
|
||||
|
||||
// Hide the dropmarker if current node is not a Places node.
|
||||
return !(target && target._placesNode && betweenMarkers);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- This function returns information about where to drop when
|
||||
dragging over this popup insertion point -->
|
||||
<method name="_getDropPoint">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
// Can't drop if the menu isn't a folder
|
||||
let resultNode = this._placesNode;
|
||||
|
||||
if (!PlacesUtils.nodeIsFolder(resultNode) ||
|
||||
PlacesControllerDragHelper.disallowInsertion(resultNode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var dropPoint = { ip: null, folderElt: null };
|
||||
|
||||
// The element we are dragging over
|
||||
let elt = aEvent.target;
|
||||
if (elt.localName == "menupopup")
|
||||
elt = elt.parentNode;
|
||||
|
||||
// Calculate positions taking care of arrowscrollbox
|
||||
let eventY = aEvent.layerY;
|
||||
let scrollbox = this._scrollBox;
|
||||
let scrollboxOffset = scrollbox.scrollBoxObject.y -
|
||||
(scrollbox.boxObject.y - this.boxObject.y);
|
||||
let eltY = elt.boxObject.y - scrollboxOffset;
|
||||
let eltHeight = elt.boxObject.height;
|
||||
|
||||
if (!elt._placesNode) {
|
||||
// If we are dragging over a non places node drop at the end.
|
||||
dropPoint.ip = new InsertionPoint(
|
||||
PlacesUtils.getConcreteItemId(resultNode),
|
||||
-1,
|
||||
Ci.nsITreeView.DROP_ON);
|
||||
// We can set folderElt if we are dropping over a static menu that
|
||||
// has an internal placespopup.
|
||||
let isMenu = elt.localName == "menu" ||
|
||||
(elt.localName == "toolbarbutton" &&
|
||||
elt.getAttribute("type") == "menu");
|
||||
if (isMenu && elt.lastChild &&
|
||||
elt.lastChild.hasAttribute("placespopup"))
|
||||
dropPoint.folderElt = elt;
|
||||
return dropPoint;
|
||||
}
|
||||
if ((PlacesUtils.nodeIsFolder(elt._placesNode) &&
|
||||
!PlacesUIUtils.isContentsReadOnly(elt._placesNode)) ||
|
||||
PlacesUtils.nodeIsTagQuery(elt._placesNode)) {
|
||||
// This is a folder or a tag container.
|
||||
if (eventY - eltY < eltHeight * 0.20) {
|
||||
// If mouse is in the top part of the element, drop above folder.
|
||||
dropPoint.ip = new InsertionPoint(
|
||||
PlacesUtils.getConcreteItemId(resultNode),
|
||||
-1,
|
||||
Ci.nsITreeView.DROP_BEFORE,
|
||||
PlacesUtils.nodeIsTagQuery(elt._placesNode),
|
||||
elt._placesNode.itemId);
|
||||
return dropPoint;
|
||||
}
|
||||
else if (eventY - eltY < eltHeight * 0.80) {
|
||||
// If mouse is in the middle of the element, drop inside folder.
|
||||
dropPoint.ip = new InsertionPoint(
|
||||
PlacesUtils.getConcreteItemId(elt._placesNode),
|
||||
-1,
|
||||
Ci.nsITreeView.DROP_ON,
|
||||
PlacesUtils.nodeIsTagQuery(elt._placesNode));
|
||||
dropPoint.folderElt = elt;
|
||||
return dropPoint;
|
||||
}
|
||||
}
|
||||
else if (eventY - eltY <= eltHeight / 2) {
|
||||
// This is a non-folder node or a readonly folder.
|
||||
// If the mouse is above the middle, drop above this item.
|
||||
dropPoint.ip = new InsertionPoint(
|
||||
PlacesUtils.getConcreteItemId(resultNode),
|
||||
-1,
|
||||
Ci.nsITreeView.DROP_BEFORE,
|
||||
PlacesUtils.nodeIsTagQuery(elt._placesNode),
|
||||
elt._placesNode.itemId);
|
||||
return dropPoint;
|
||||
}
|
||||
|
||||
// Drop below the item.
|
||||
dropPoint.ip = new InsertionPoint(
|
||||
PlacesUtils.getConcreteItemId(resultNode),
|
||||
-1,
|
||||
Ci.nsITreeView.DROP_AFTER,
|
||||
PlacesUtils.nodeIsTagQuery(elt._placesNode),
|
||||
elt._placesNode.itemId);
|
||||
return dropPoint;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- Sub-menus should be opened when the mouse drags over them, and closed
|
||||
when the mouse drags off. The overFolder object manages opening and
|
||||
closing of folders when the mouse hovers. -->
|
||||
<field name="_overFolder"><![CDATA[({
|
||||
_self: this,
|
||||
_folder: {elt: null,
|
||||
openTimer: null,
|
||||
hoverTime: 350,
|
||||
closeTimer: null},
|
||||
_closeMenuTimer: null,
|
||||
|
||||
get elt() {
|
||||
return this._folder.elt;
|
||||
},
|
||||
set elt(val) {
|
||||
return this._folder.elt = val;
|
||||
},
|
||||
|
||||
get openTimer() {
|
||||
return this._folder.openTimer;
|
||||
},
|
||||
set openTimer(val) {
|
||||
return this._folder.openTimer = val;
|
||||
},
|
||||
|
||||
get hoverTime() {
|
||||
return this._folder.hoverTime;
|
||||
},
|
||||
set hoverTime(val) {
|
||||
return this._folder.hoverTime = val;
|
||||
},
|
||||
|
||||
get closeTimer() {
|
||||
return this._folder.closeTimer;
|
||||
},
|
||||
set closeTimer(val) {
|
||||
return this._folder.closeTimer = val;
|
||||
},
|
||||
|
||||
get closeMenuTimer() {
|
||||
return this._closeMenuTimer;
|
||||
},
|
||||
set closeMenuTimer(val) {
|
||||
return this._closeMenuTimer = val;
|
||||
},
|
||||
|
||||
setTimer: function OF__setTimer(aTime) {
|
||||
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
|
||||
return timer;
|
||||
},
|
||||
|
||||
notify: function OF__notify(aTimer) {
|
||||
// Function to process all timer notifications.
|
||||
|
||||
if (aTimer == this._folder.openTimer) {
|
||||
// Timer to open a submenu that's being dragged over.
|
||||
this._folder.elt.lastChild.setAttribute("autoopened", "true");
|
||||
this._folder.elt.lastChild.showPopup(this._folder.elt);
|
||||
this._folder.openTimer = null;
|
||||
}
|
||||
|
||||
else if (aTimer == this._folder.closeTimer) {
|
||||
// Timer to close a submenu that's been dragged off of.
|
||||
// Only close the submenu if the mouse isn't being dragged over any
|
||||
// of its child menus.
|
||||
var draggingOverChild = PlacesControllerDragHelper
|
||||
.draggingOverChildNode(this._folder.elt);
|
||||
if (draggingOverChild)
|
||||
this._folder.elt = null;
|
||||
this.clear();
|
||||
|
||||
// Close any parent folders which aren't being dragged over.
|
||||
// (This is necessary because of the above code that keeps a folder
|
||||
// open while its children are being dragged over.)
|
||||
if (!draggingOverChild)
|
||||
this.closeParentMenus();
|
||||
}
|
||||
|
||||
else if (aTimer == this.closeMenuTimer) {
|
||||
// Timer to close this menu after the drag exit.
|
||||
var popup = this._self;
|
||||
// if we are no more dragging we can leave the menu open to allow
|
||||
// for better D&D bookmark organization
|
||||
if (PlacesControllerDragHelper.getSession() &&
|
||||
!PlacesControllerDragHelper.draggingOverChildNode(popup.parentNode)) {
|
||||
popup.hidePopup();
|
||||
// Close any parent menus that aren't being dragged over;
|
||||
// otherwise they'll stay open because they couldn't close
|
||||
// while this menu was being dragged over.
|
||||
this.closeParentMenus();
|
||||
}
|
||||
this._closeMenuTimer = null;
|
||||
}
|
||||
},
|
||||
|
||||
// Helper function to close all parent menus of this menu,
|
||||
// as long as none of the parent's children are currently being
|
||||
// dragged over.
|
||||
closeParentMenus: function OF__closeParentMenus() {
|
||||
var popup = this._self;
|
||||
var parent = popup.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "menupopup" && parent._placesNode) {
|
||||
if (PlacesControllerDragHelper.draggingOverChildNode(parent.parentNode))
|
||||
break;
|
||||
parent.hidePopup();
|
||||
}
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
},
|
||||
|
||||
// The mouse is no longer dragging over the stored menubutton.
|
||||
// Close the menubutton, clear out drag styles, and clear all
|
||||
// timers for opening/closing it.
|
||||
clear: function OF__clear() {
|
||||
if (this._folder.elt && this._folder.elt.lastChild) {
|
||||
if (!this._folder.elt.lastChild.hasAttribute("dragover"))
|
||||
this._folder.elt.lastChild.hidePopup();
|
||||
// remove menuactive style
|
||||
this._folder.elt.removeAttribute("_moz-menuactive");
|
||||
this._folder.elt = null;
|
||||
}
|
||||
if (this._folder.openTimer) {
|
||||
this._folder.openTimer.cancel();
|
||||
this._folder.openTimer = null;
|
||||
}
|
||||
if (this._folder.closeTimer) {
|
||||
this._folder.closeTimer.cancel();
|
||||
this._folder.closeTimer = null;
|
||||
}
|
||||
}
|
||||
})]]></field>
|
||||
|
||||
<method name="_cleanupDragDetails">
|
||||
<body><![CDATA[
|
||||
// Called on dragend and drop.
|
||||
PlacesControllerDragHelper.currentDropTarget = null;
|
||||
this._rootView._draggedElt = null;
|
||||
this.removeAttribute("dragover");
|
||||
this.removeAttribute("dragstart");
|
||||
this._indicatorBar.hidden = true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMMenuItemActive"><![CDATA[
|
||||
let elt = event.target;
|
||||
if (elt.parentNode != this)
|
||||
return;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// XXX: The following check is a temporary hack until bug 420033 is
|
||||
// resolved.
|
||||
let parentElt = elt.parent;
|
||||
while (parentElt) {
|
||||
if (parentElt.id == "bookmarksMenuPopup" ||
|
||||
parentElt.id == "goPopup")
|
||||
return;
|
||||
|
||||
parentElt = parentElt.parentNode;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (window.XULBrowserWindow) {
|
||||
let elt = event.target;
|
||||
let placesNode = elt._placesNode;
|
||||
|
||||
var linkURI;
|
||||
if (placesNode && PlacesUtils.nodeIsURI(placesNode))
|
||||
linkURI = placesNode.uri;
|
||||
else if (elt.hasAttribute("targetURI"))
|
||||
linkURI = elt.getAttribute("targetURI");
|
||||
|
||||
if (linkURI)
|
||||
window.XULBrowserWindow.setOverLink(linkURI, null);
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="DOMMenuItemInactive"><![CDATA[
|
||||
let elt = event.target;
|
||||
if (elt.parentNode != this)
|
||||
return;
|
||||
|
||||
if (window.XULBrowserWindow)
|
||||
window.XULBrowserWindow.setOverLink("", null);
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragstart"><![CDATA[
|
||||
if (!event.target._placesNode)
|
||||
return;
|
||||
|
||||
let draggedElt = event.target._placesNode;
|
||||
|
||||
// Force a copy action if parent node is a query or we are dragging a
|
||||
// not-removable node.
|
||||
if (!PlacesControllerDragHelper.canMoveNode(draggedElt))
|
||||
event.dataTransfer.effectAllowed = "copyLink";
|
||||
|
||||
// Activate the view and cache the dragged element.
|
||||
this._rootView._draggedElt = draggedElt;
|
||||
this._rootView.controller.setDataTransfer(event);
|
||||
this.setAttribute("dragstart", "true");
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="drop"><![CDATA[
|
||||
PlacesControllerDragHelper.currentDropTarget = event.target;
|
||||
|
||||
let dropPoint = this._getDropPoint(event);
|
||||
if (dropPoint && dropPoint.ip) {
|
||||
PlacesControllerDragHelper.onDrop(dropPoint.ip, event.dataTransfer);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
this._cleanupDragDetails();
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragover"><![CDATA[
|
||||
PlacesControllerDragHelper.currentDropTarget = event.target;
|
||||
let dt = event.dataTransfer;
|
||||
|
||||
let dropPoint = this._getDropPoint(event);
|
||||
if (!dropPoint || !dropPoint.ip ||
|
||||
!PlacesControllerDragHelper.canDrop(dropPoint.ip, dt)) {
|
||||
this._indicatorBar.hidden = true;
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark this popup as being dragged over.
|
||||
this.setAttribute("dragover", "true");
|
||||
|
||||
if (dropPoint.folderElt) {
|
||||
// We are dragging over a folder.
|
||||
// _overFolder should take the care of opening it on a timer.
|
||||
if (this._overFolder.elt &&
|
||||
this._overFolder.elt != dropPoint.folderElt) {
|
||||
// We are dragging over a new folder, let's clear old values
|
||||
this._overFolder.clear();
|
||||
}
|
||||
if (!this._overFolder.elt) {
|
||||
this._overFolder.elt = dropPoint.folderElt;
|
||||
// Create the timer to open this folder.
|
||||
this._overFolder.openTimer = this._overFolder
|
||||
.setTimer(this._overFolder.hoverTime);
|
||||
}
|
||||
// Since we are dropping into a folder set the corresponding style.
|
||||
dropPoint.folderElt.setAttribute("_moz-menuactive", true);
|
||||
}
|
||||
else {
|
||||
// We are not dragging over a folder.
|
||||
// Clear out old _overFolder information.
|
||||
this._overFolder.clear();
|
||||
}
|
||||
|
||||
// Autoscroll the popup strip if we drag over the scroll buttons.
|
||||
let anonid = event.originalTarget.getAttribute('anonid');
|
||||
let scrollDir = anonid == "scrollbutton-up" ? -1 :
|
||||
anonid == "scrollbutton-down" ? 1 : 0;
|
||||
if (scrollDir != 0) {
|
||||
this._scrollBox.scrollByIndex(scrollDir, false);
|
||||
}
|
||||
|
||||
// Check if we should hide the drop indicator for this target.
|
||||
if (dropPoint.folderElt || this._hideDropIndicator(event)) {
|
||||
this._indicatorBar.hidden = true;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
// We should display the drop indicator relative to the arrowscrollbox.
|
||||
let sbo = this._scrollBox.scrollBoxObject;
|
||||
let newMarginTop = 0;
|
||||
if (scrollDir == 0) {
|
||||
let elt = this.firstChild;
|
||||
while (elt && event.screenY > elt.boxObject.screenY +
|
||||
elt.boxObject.height / 2)
|
||||
elt = elt.nextSibling;
|
||||
newMarginTop = elt ? elt.boxObject.screenY - sbo.screenY :
|
||||
sbo.height;
|
||||
}
|
||||
else if (scrollDir == 1)
|
||||
newMarginTop = sbo.height;
|
||||
|
||||
// Set the new marginTop based on arrowscrollbox.
|
||||
newMarginTop += sbo.y - this._scrollBox.boxObject.y;
|
||||
this._indicatorBar.firstChild.style.marginTop = newMarginTop + "px";
|
||||
this._indicatorBar.hidden = false;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragexit"><![CDATA[
|
||||
PlacesControllerDragHelper.currentDropTarget = null;
|
||||
this.removeAttribute("dragover");
|
||||
|
||||
// If we have not moved to a valid new target clear the drop indicator
|
||||
// this happens when moving out of the popup.
|
||||
let target = event.relatedTarget;
|
||||
if (!target)
|
||||
this._indicatorBar.hidden = true;
|
||||
|
||||
// Close any folder being hovered over
|
||||
if (this._overFolder.elt) {
|
||||
this._overFolder.closeTimer = this._overFolder
|
||||
.setTimer(this._overFolder.hoverTime);
|
||||
}
|
||||
|
||||
// The autoopened attribute is set when this folder was automatically
|
||||
// opened after the user dragged over it. If this attribute is set,
|
||||
// auto-close the folder on drag exit.
|
||||
// We should also try to close this popup if the drag has started
|
||||
// from here, the timer will check if we are dragging over a child.
|
||||
if (this.hasAttribute("autoopened") ||
|
||||
this.hasAttribute("dragstart")) {
|
||||
this._overFolder.closeMenuTimer = this._overFolder
|
||||
.setTimer(this._overFolder.hoverTime);
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragend"><![CDATA[
|
||||
this._cleanupDragDetails();
|
||||
]]></handler>
|
||||
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var gMoveBookmarksDialog = {
|
||||
_nodes: null,
|
||||
|
||||
_foldersTree: null,
|
||||
get foldersTree() {
|
||||
if (!this._foldersTree)
|
||||
this._foldersTree = document.getElementById("foldersTree");
|
||||
|
||||
return this._foldersTree;
|
||||
},
|
||||
|
||||
init: function() {
|
||||
this._nodes = window.arguments[0];
|
||||
|
||||
this.foldersTree.place =
|
||||
"place:excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1&folder=" +
|
||||
PlacesUIUtils.allBookmarksFolderId;
|
||||
},
|
||||
|
||||
onOK: function MBD_onOK(aEvent) {
|
||||
var selectedNode = this.foldersTree.selectedNode;
|
||||
NS_ASSERT(selectedNode,
|
||||
"selectedNode must be set in a single-selection tree with initial selection set");
|
||||
var selectedFolderID = PlacesUtils.getConcreteItemId(selectedNode);
|
||||
|
||||
var transactions = [];
|
||||
for (var i=0; i < this._nodes.length; i++) {
|
||||
// Nothing to do if the node is already under the selected folder
|
||||
if (this._nodes[i].parent.itemId == selectedFolderID)
|
||||
continue;
|
||||
|
||||
let txn = new PlacesMoveItemTransaction(this._nodes[i].itemId,
|
||||
selectedFolderID,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX);
|
||||
transactions.push(txn);
|
||||
}
|
||||
|
||||
if (transactions.length != 0) {
|
||||
let txn = new PlacesAggregatedTransaction("Move Items", transactions);
|
||||
PlacesUtils.transactionManager.doTransaction(txn);
|
||||
}
|
||||
},
|
||||
|
||||
newFolder: function MBD_newFolder() {
|
||||
// The command is disabled when the tree is not focused
|
||||
this.foldersTree.focus();
|
||||
goDoCommand("placesCmd_new:folder");
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||
|
||||
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % moveBookmarksDTD SYSTEM "chrome://browser/locale/places/moveBookmarks.dtd">
|
||||
%moveBookmarksDTD;
|
||||
]>
|
||||
|
||||
<dialog id="moveBookmarkDialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
ondialogaccept="return gMoveBookmarksDialog.onOK(event);"
|
||||
title="&window.title;"
|
||||
onload="gMoveBookmarksDialog.init();"
|
||||
style="&window.style;"
|
||||
screenX="24"
|
||||
screenY="24"
|
||||
persist="screenX screenY width height">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/moveBookmarks.js"/>
|
||||
|
||||
<hbox flex="1">
|
||||
<label id="movetolabel" value="&moveTo.label;" control="foldersTree"/>
|
||||
<hbox flex="1">
|
||||
<tree id="foldersTree"
|
||||
class="placesTree"
|
||||
flex="1"
|
||||
type="places"
|
||||
seltype="single"
|
||||
hidecolumnpicker="true">
|
||||
<treecols>
|
||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||
</treecols>
|
||||
<treechildren id="placesListChildren" view="placesList" flex="1"/>
|
||||
</tree>
|
||||
<vbox>
|
||||
<button id="newFolderButton"
|
||||
label="&newFolderButton.label;"
|
||||
accesskey="&newFolderButton.accesskey;"
|
||||
oncommand="gMoveBookmarksDialog.newFolder();"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#searchFilter {
|
||||
width: 23em;
|
||||
}
|
||||
16
application/palemoon/components/places/content/places.css
Normal file
16
application/palemoon/components/places/content/places.css
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
tree[type="places"] {
|
||||
-moz-binding: url("chrome://browser/content/places/tree.xml#places-tree");
|
||||
}
|
||||
|
||||
.toolbar-drop-indicator {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
menupopup[placespopup="true"] {
|
||||
-moz-binding: url("chrome://browser/content/places/menu.xml#places-popup-base");
|
||||
}
|
||||
1562
application/palemoon/components/places/content/places.js
Normal file
1562
application/palemoon/components/places/content/places.js
Normal file
File diff suppressed because it is too large
Load diff
478
application/palemoon/components/places/content/places.xul
Normal file
478
application/palemoon/components/places/content/places.xul
Normal file
|
|
@ -0,0 +1,478 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/places/organizer.css"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/organizer.css"?>
|
||||
|
||||
<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
|
||||
#else
|
||||
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
|
||||
#endif
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
|
||||
%placesDTD;
|
||||
<!ENTITY % editMenuOverlayDTD SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
|
||||
%editMenuOverlayDTD;
|
||||
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
|
||||
%browserDTD;
|
||||
]>
|
||||
|
||||
<window id="places"
|
||||
title="&places.library.title;"
|
||||
windowtype="Places:Organizer"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload="PlacesOrganizer.init();"
|
||||
onunload="PlacesOrganizer.destroy();"
|
||||
width="&places.library.width;" height="&places.library.height;"
|
||||
screenX="10" screenY="10"
|
||||
toggletoolbar="true"
|
||||
persist="width height screenX screenY sizemode">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/places.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/editBookmarkOverlay.js"/>
|
||||
|
||||
<stringbundleset id="placesStringSet">
|
||||
<stringbundle id="brandStrings" src="chrome://branding/locale/brand.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include ../../../base/content/browserMountPoints.inc
|
||||
#else
|
||||
<commandset id="editMenuCommands"/>
|
||||
<commandset id="placesCommands"/>
|
||||
#endif
|
||||
<keyset id="placesCommandKeys"/>
|
||||
|
||||
<commandset id="organizerCommandSet">
|
||||
<command id="OrganizerCommand_find:all"
|
||||
oncommand="PlacesSearchBox.findAll();"/>
|
||||
<command id="OrganizerCommand_export"
|
||||
oncommand="PlacesOrganizer.exportBookmarks();"/>
|
||||
<command id="OrganizerCommand_import"
|
||||
oncommand="PlacesOrganizer.importFromFile();"/>
|
||||
<command id="OrganizerCommand_browserImport"
|
||||
oncommand="PlacesOrganizer.importFromBrowser();"/>
|
||||
<command id="OrganizerCommand_backup"
|
||||
oncommand="PlacesOrganizer.backupBookmarks();"/>
|
||||
<command id="OrganizerCommand_restoreFromFile"
|
||||
oncommand="PlacesOrganizer.onRestoreBookmarksFromFile();"/>
|
||||
<command id="OrganizerCommand_search:save"
|
||||
oncommand="PlacesOrganizer.saveSearch();"/>
|
||||
<command id="OrganizerCommand_search:moreCriteria"
|
||||
oncommand="PlacesQueryBuilder.addRow();"/>
|
||||
<command id="OrganizerCommand:Back"
|
||||
oncommand="PlacesOrganizer.back();"/>
|
||||
<command id="OrganizerCommand:Forward"
|
||||
oncommand="PlacesOrganizer.forward();"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="placesOrganizerKeyset">
|
||||
<!-- Instantiation Keys -->
|
||||
<key id="placesKey_close" key="&cmd.close.key;" modifiers="accel"
|
||||
oncommand="close();"/>
|
||||
|
||||
<!-- Command Keys -->
|
||||
<key id="placesKey_find:all"
|
||||
command="OrganizerCommand_find:all"
|
||||
key="&cmd.find.key;"
|
||||
modifiers="accel"/>
|
||||
|
||||
<!-- Back/Forward Keys Support -->
|
||||
#ifndef XP_MACOSX
|
||||
<key id="placesKey_goBackKb"
|
||||
keycode="VK_LEFT"
|
||||
command="OrganizerCommand:Back"
|
||||
modifiers="alt"/>
|
||||
<key id="placesKey_goForwardKb"
|
||||
keycode="VK_RIGHT"
|
||||
command="OrganizerCommand:Forward"
|
||||
modifiers="alt"/>
|
||||
#else
|
||||
<key id="placesKey_goBackKb"
|
||||
keycode="VK_LEFT"
|
||||
command="OrganizerCommand:Back"
|
||||
modifiers="accel"/>
|
||||
<key id="placesKey_goForwardKb"
|
||||
keycode="VK_RIGHT"
|
||||
command="OrganizerCommand:Forward"
|
||||
modifiers="accel"/>
|
||||
#endif
|
||||
#ifdef XP_UNIX
|
||||
<key id="placesKey_goBackKb2"
|
||||
key="&goBackCmd.commandKey;"
|
||||
command="OrganizerCommand:Back"
|
||||
modifiers="accel"/>
|
||||
<key id="placesKey_goForwardKb2"
|
||||
key="&goForwardCmd.commandKey;"
|
||||
command="OrganizerCommand:Forward"
|
||||
modifiers="accel"/>
|
||||
#endif
|
||||
</keyset>
|
||||
|
||||
<keyset id="editMenuKeys">
|
||||
#ifdef XP_MACOSX
|
||||
<key id="key_delete2" keycode="VK_BACK" command="cmd_delete"/>
|
||||
#endif
|
||||
</keyset>
|
||||
|
||||
<popupset id="placesPopupset">
|
||||
<menupopup id="placesContext"/>
|
||||
<menupopup id="placesColumnsContext"
|
||||
onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
|
||||
oncommand="ViewMenu.showHideColumn(event.target); event.stopPropagation();"/>
|
||||
</popupset>
|
||||
|
||||
<toolbox id="placesToolbox">
|
||||
<toolbar class="chromeclass-toolbar" id="placesToolbar" align="center">
|
||||
<toolbarbutton id="back-button"
|
||||
command="OrganizerCommand:Back"
|
||||
tooltiptext="&backButton.tooltip;"
|
||||
disabled="true"/>
|
||||
|
||||
<toolbarbutton id="forward-button"
|
||||
command="OrganizerCommand:Forward"
|
||||
tooltiptext="&forwardButton.tooltip;"
|
||||
disabled="true"/>
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
<toolbarbutton type="menu" class="tabbable"
|
||||
onpopupshowing="document.getElementById('placeContent').focus()"
|
||||
#else
|
||||
<menubar id="placesMenu">
|
||||
<menu accesskey="&organize.accesskey;" class="menu-iconic"
|
||||
#endif
|
||||
id="organizeButton" label="&organize.label;"
|
||||
tooltiptext="&organize.tooltip;">
|
||||
<menupopup id="organizeButtonPopup">
|
||||
<menuitem id="newbookmark"
|
||||
command="placesCmd_new:bookmark"
|
||||
label="&cmd.new_bookmark.label;"
|
||||
accesskey="&cmd.new_bookmark.accesskey;"/>
|
||||
<menuitem id="newfolder"
|
||||
command="placesCmd_new:folder"
|
||||
label="&cmd.new_folder.label;"
|
||||
accesskey="&cmd.new_folder.accesskey;"/>
|
||||
<menuitem id="newseparator"
|
||||
command="placesCmd_new:separator"
|
||||
label="&cmd.new_separator.label;"
|
||||
accesskey="&cmd.new_separator.accesskey;"/>
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
<menuseparator id="orgUndoSeparator"/>
|
||||
|
||||
<menuitem id="orgUndo"
|
||||
command="cmd_undo"
|
||||
label="&undoCmd.label;"
|
||||
key="key_undo"
|
||||
accesskey="&undoCmd.accesskey;"/>
|
||||
<menuitem id="orgRedo"
|
||||
command="cmd_redo"
|
||||
label="&redoCmd.label;"
|
||||
key="key_redo"
|
||||
accesskey="&redoCmd.accesskey;"/>
|
||||
|
||||
<menuseparator id="orgCutSeparator"/>
|
||||
|
||||
<menuitem id="orgCut"
|
||||
command="cmd_cut"
|
||||
label="&cutCmd.label;"
|
||||
key="key_cut"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
selection="separator|link|folder|mixed"/>
|
||||
<menuitem id="orgCopy"
|
||||
command="cmd_copy"
|
||||
label="©Cmd.label;"
|
||||
key="key_copy"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
selection="separator|link|folder|mixed"/>
|
||||
<menuitem id="orgPaste"
|
||||
command="cmd_paste"
|
||||
label="&pasteCmd.label;"
|
||||
key="key_paste"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
selection="mutable"/>
|
||||
<menuitem id="orgDelete"
|
||||
command="cmd_delete"
|
||||
label="&deleteCmd.label;"
|
||||
key="key_delete"
|
||||
accesskey="&deleteCmd.accesskey;"/>
|
||||
|
||||
<menuseparator id="selectAllSeparator"/>
|
||||
|
||||
<menuitem id="orgSelectAll"
|
||||
command="cmd_selectAll"
|
||||
label="&selectAllCmd.label;"
|
||||
key="key_selectAll"
|
||||
accesskey="&selectAllCmd.accesskey;"/>
|
||||
|
||||
#endif
|
||||
<menuseparator id="orgMoveSeparator"/>
|
||||
|
||||
<menuitem id="orgMoveBookmarks"
|
||||
command="placesCmd_moveBookmarks"
|
||||
label="&cmd.moveBookmarks.label;"
|
||||
accesskey="&cmd.moveBookmarks.accesskey;"/>
|
||||
#ifdef XP_MACOSX
|
||||
<menuitem id="orgDelete"
|
||||
command="cmd_delete"
|
||||
label="&deleteCmd.label;"
|
||||
key="key_delete"
|
||||
accesskey="&deleteCmd.accesskey;"/>
|
||||
#else
|
||||
<menuseparator id="orgCloseSeparator"/>
|
||||
|
||||
<menuitem id="orgClose"
|
||||
key="placesKey_close"
|
||||
label="&file.close.label;"
|
||||
accesskey="&file.close.accesskey;"
|
||||
oncommand="close();"/>
|
||||
#endif
|
||||
</menupopup>
|
||||
#ifdef XP_MACOSX
|
||||
</toolbarbutton>
|
||||
<toolbarbutton type="menu" class="tabbable"
|
||||
#else
|
||||
</menu>
|
||||
<menu accesskey="&views.accesskey;" class="menu-iconic"
|
||||
#endif
|
||||
id="viewMenu" label="&views.label;"
|
||||
tooltiptext="&views.tooltip;">
|
||||
<menupopup id="viewMenuPopup">
|
||||
|
||||
<menu id="viewColumns"
|
||||
label="&view.columns.label;" accesskey="&view.columns.accesskey;">
|
||||
<menupopup onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
|
||||
oncommand="ViewMenu.showHideColumn(event.target); event.stopPropagation();"/>
|
||||
</menu>
|
||||
|
||||
<menu id="viewSort" label="&view.sort.label;"
|
||||
accesskey="&view.sort.accesskey;">
|
||||
<menupopup onpopupshowing="ViewMenu.populateSortMenu(event);"
|
||||
oncommand="ViewMenu.setSortColumn(event.target.column, null);">
|
||||
<menuitem id="viewUnsorted" type="radio" name="columns"
|
||||
label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;"
|
||||
oncommand="ViewMenu.setSortColumn(null, null);"/>
|
||||
<menuseparator id="directionSeparator"/>
|
||||
<menuitem id="viewSortAscending" type="radio" name="direction"
|
||||
label="&view.sortAscending.label;" accesskey="&view.sortAscending.accesskey;"
|
||||
oncommand="ViewMenu.setSortColumn(null, 'ascending'); event.stopPropagation();"/>
|
||||
<menuitem id="viewSortDescending" type="radio" name="direction"
|
||||
label="&view.sortDescending.label;" accesskey="&view.sortDescending.accesskey;"
|
||||
oncommand="ViewMenu.setSortColumn(null, 'descending'); event.stopPropagation();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menupopup>
|
||||
#ifdef XP_MACOSX
|
||||
</toolbarbutton>
|
||||
<toolbarbutton type="menu" class="tabbable"
|
||||
#else
|
||||
</menu>
|
||||
<menu accesskey="&maintenance.accesskey;" class="menu-iconic"
|
||||
#endif
|
||||
id="maintenanceButton" label="&maintenance.label;"
|
||||
tooltiptext="&maintenance.tooltip;">
|
||||
<menupopup id="maintenanceButtonPopup">
|
||||
<menuitem id="backupBookmarks"
|
||||
command="OrganizerCommand_backup"
|
||||
label="&cmd.backup.label;"
|
||||
accesskey="&cmd.backup.accesskey;"/>
|
||||
<menu id="fileRestoreMenu" label="&cmd.restore2.label;"
|
||||
accesskey="&cmd.restore2.accesskey;">
|
||||
<menupopup id="fileRestorePopup" onpopupshowing="PlacesOrganizer.populateRestoreMenu();">
|
||||
<menuitem id="restoreFromFile"
|
||||
command="OrganizerCommand_restoreFromFile"
|
||||
label="&cmd.restoreFromFile.label;"
|
||||
accesskey="&cmd.restoreFromFile.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem id="fileImport"
|
||||
command="OrganizerCommand_import"
|
||||
label="&importBookmarksFromHTML.label;"
|
||||
accesskey="&importBookmarksFromHTML.accesskey;"/>
|
||||
<menuitem id="fileExport"
|
||||
command="OrganizerCommand_export"
|
||||
label="&exportBookmarksToHTML.label;"
|
||||
accesskey="&exportBookmarksToHTML.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="browserImport"
|
||||
command="OrganizerCommand_browserImport"
|
||||
label="&importOtherBrowser.label;"
|
||||
accesskey="&importOtherBrowser.accesskey;"/>
|
||||
</menupopup>
|
||||
#ifdef XP_MACOSX
|
||||
</toolbarbutton>
|
||||
#else
|
||||
</menu>
|
||||
</menubar>
|
||||
#endif
|
||||
|
||||
<spacer id="libraryToolbarSpacer" flex="1"/>
|
||||
|
||||
<textbox id="searchFilter"
|
||||
clickSelectsAll="true"
|
||||
type="search"
|
||||
aria-controls="placeContent"
|
||||
oncommand="PlacesSearchBox.search(this.value);"
|
||||
collection="bookmarks">
|
||||
</textbox>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
|
||||
<hbox flex="1" id="placesView">
|
||||
<tree id="placesList"
|
||||
class="plain placesTree"
|
||||
type="places"
|
||||
hidecolumnpicker="true" context="placesContext"
|
||||
onselect="PlacesOrganizer.onPlaceSelected(true);"
|
||||
onclick="PlacesOrganizer.onPlacesListClick(event);"
|
||||
onfocus="PlacesOrganizer.updateDetailsPane(event);"
|
||||
seltype="single"
|
||||
persist="width"
|
||||
width="200"
|
||||
minwidth="100"
|
||||
maxwidth="400">
|
||||
<treecols>
|
||||
<treecol anonid="title" flex="1" primary="true" hideheader="true"/>
|
||||
</treecols>
|
||||
<treechildren flex="1"/>
|
||||
</tree>
|
||||
<splitter collapse="none" persist="state"></splitter>
|
||||
<vbox id="contentView" flex="4">
|
||||
<toolbox id="searchModifiers" hidden="true">
|
||||
<toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
|
||||
<label id="scopeBarTitle" value="&search.in.label;"/>
|
||||
<toolbarbutton id="scopeBarAll" class="small-margin"
|
||||
type="radio" group="scopeBar"
|
||||
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
|
||||
label="&search.scopeBookmarks.label;"
|
||||
accesskey="&search.scopeBookmarks.accesskey;"/>
|
||||
<toolbarbutton id="scopeBarHistory" class="small-margin"
|
||||
type="radio" group="scopeBar"
|
||||
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
|
||||
label="&search.scopeHistory.label;"
|
||||
accesskey="&search.scopeHistory.accesskey;"/>
|
||||
<toolbarbutton id="scopeBarDownloads" class="small-margin"
|
||||
type="radio" group="scopeBar"
|
||||
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
|
||||
label="&search.scopeDownloads.label;"
|
||||
accesskey="&search.scopeDownloads.accesskey;"/>
|
||||
<toolbarbutton id="scopeBarFolder" class="small-margin"
|
||||
type="radio" group="scopeBar"
|
||||
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
|
||||
accesskey="&search.scopeFolder.accesskey;"
|
||||
emptytitle="&search.scopeFolder.label;" flex="1"/>
|
||||
<!-- The folder scope button should flex but not take up more room
|
||||
than its label needs. The only simple way to do that is to
|
||||
set a really big flex on the spacer, e.g., 2^31 - 1. -->
|
||||
<spacer flex="2147483647"/>
|
||||
<button id="saveSearch" class="small-margin"
|
||||
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
|
||||
command="OrganizerCommand_search:save"/>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
<deck id="placesViewsDeck"
|
||||
selectedIndex="0"
|
||||
flex="1">
|
||||
<tree id="placeContent"
|
||||
class="plain placesTree"
|
||||
context="placesContext"
|
||||
hidecolumnpicker="true"
|
||||
flex="1"
|
||||
type="places"
|
||||
flatList="true"
|
||||
selectfirstnode="true"
|
||||
enableColumnDrag="true"
|
||||
onfocus="PlacesOrganizer.updateDetailsPane(event)"
|
||||
onselect="PlacesOrganizer.updateDetailsPane(event)"
|
||||
onkeypress="ContentTree.onKeyPress(event);"
|
||||
onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);">
|
||||
<treecols id="placeContentColumns" context="placesColumnsContext">
|
||||
<treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.url.label;" id="placesContentUrl" anonid="url" flex="5"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.lastvisit.label;" id="placesContentDate" anonid="date" flex="1" hidden="true"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.visitcount.label;" id="placesContentVisitCount" anonid="visitCount" flex="1" hidden="true"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.keyword.label;" id="placesContentKeyword" anonid="keyword" flex="1" hidden="true"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.description.label;" id="placesContentDescription" anonid="description" flex="1" hidden="true"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
|
||||
persist="width hidden ordinal sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.parentfolder.label;" id="placesContentParentFolder" anonid="parentFolder" flex="1" hidden="true"
|
||||
persist="width hidden ordinal"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol label="&col.parentfolderpath.label;" id="placesContentParentFolderPath" anonid="parentFolderPath" flex="1" hidden="true"
|
||||
persist="width hidden ordinal"/>
|
||||
</treecols>
|
||||
<treechildren flex="1" onclick="ContentTree.onClick(event);"/>
|
||||
</tree>
|
||||
</deck>
|
||||
<deck id="detailsDeck" style="height: 11em;">
|
||||
<vbox id="itemsCountBox" align="center">
|
||||
<spacer flex="3"/>
|
||||
<label id="itemsCountText"/>
|
||||
<spacer flex="1"/>
|
||||
<description id="selectItemDescription">
|
||||
&detailsPane.selectAnItemText.description;
|
||||
</description>
|
||||
<spacer flex="3"/>
|
||||
</vbox>
|
||||
<vbox id="infoBox" minimal="true">
|
||||
<vbox id="editBookmarkPanelContent" flex="1"/>
|
||||
<hbox id="infoBoxExpanderWrapper" align="center">
|
||||
|
||||
<button type="image" id="infoBoxExpander"
|
||||
class="expander-down"
|
||||
oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
|
||||
<label id="infoBoxExpanderLabel"
|
||||
lesslabel="&detailsPane.less.label;"
|
||||
lessaccesskey="&detailsPane.less.accesskey;"
|
||||
morelabel="&detailsPane.more.label;"
|
||||
moreaccesskey="&detailsPane.more.accesskey;"
|
||||
value="&detailsPane.more.label;"
|
||||
accesskey="&detailsPane.more.accesskey;"
|
||||
control="infoBoxExpander"/>
|
||||
|
||||
</hbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</window>
|
||||
248
application/palemoon/components/places/content/placesOverlay.xul
Normal file
248
application/palemoon/components/places/content/placesOverlay.xul
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!DOCTYPE overlay [
|
||||
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
|
||||
%placesDTD;
|
||||
<!ENTITY % editMenuOverlayDTD SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
|
||||
%editMenuOverlayDTD;
|
||||
]>
|
||||
|
||||
<overlay id="placesOverlay"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
<script type="application/javascript"><![CDATA[
|
||||
// TODO: Bug 406371.
|
||||
// A bunch of browser code depends on us defining these, sad but true :(
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cr = Components.results;
|
||||
|
||||
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
Components.utils.import("resource:///modules/PlacesUIUtils.jsm");
|
||||
]]></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/controller.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/places/treeView.js"/>
|
||||
|
||||
<!-- Bookmarks and history tooltip -->
|
||||
<tooltip id="bhTooltip" noautohide="true"
|
||||
onpopupshowing="return window.top.BookmarksEventHandler.fillInBHTooltip(document, event)">
|
||||
<vbox id="bhTooltipTextBox" flex="1">
|
||||
<label id="bhtTitleText" class="tooltip-label" />
|
||||
<label id="bhtUrlText" crop="center" class="tooltip-label" />
|
||||
</vbox>
|
||||
</tooltip>
|
||||
|
||||
<commandset id="placesCommands"
|
||||
commandupdater="true"
|
||||
events="focus,sort,places"
|
||||
oncommandupdate="goUpdatePlacesCommands();">
|
||||
<command id="placesCmd_open"
|
||||
oncommand="goDoPlacesCommand('placesCmd_open');"/>
|
||||
<command id="placesCmd_open:window"
|
||||
oncommand="goDoPlacesCommand('placesCmd_open:window');"/>
|
||||
<command id="placesCmd_open:privatewindow"
|
||||
oncommand="goDoPlacesCommand('placesCmd_open:privatewindow');"/>
|
||||
<command id="placesCmd_open:tab"
|
||||
oncommand="goDoPlacesCommand('placesCmd_open:tab');"/>
|
||||
|
||||
<command id="placesCmd_new:bookmark"
|
||||
oncommand="goDoPlacesCommand('placesCmd_new:bookmark');"/>
|
||||
<command id="placesCmd_new:livemark"
|
||||
oncommand="goDoPlacesCommand('placesCmd_new:livemark');"/>
|
||||
<command id="placesCmd_new:folder"
|
||||
oncommand="goDoPlacesCommand('placesCmd_new:folder');"/>
|
||||
<command id="placesCmd_new:separator"
|
||||
oncommand="goDoPlacesCommand('placesCmd_new:separator');"/>
|
||||
<command id="placesCmd_show:info"
|
||||
oncommand="goDoPlacesCommand('placesCmd_show:info');"/>
|
||||
<command id="placesCmd_rename"
|
||||
oncommand="goDoPlacesCommand('placesCmd_show:info');"
|
||||
observes="placesCmd_show:info"/>
|
||||
<command id="placesCmd_reload"
|
||||
oncommand="goDoPlacesCommand('placesCmd_reload');"/>
|
||||
<command id="placesCmd_sortBy:name"
|
||||
oncommand="goDoPlacesCommand('placesCmd_sortBy:name');"/>
|
||||
<command id="placesCmd_moveBookmarks"
|
||||
oncommand="goDoPlacesCommand('placesCmd_moveBookmarks');"/>
|
||||
<command id="placesCmd_deleteDataHost"
|
||||
oncommand="goDoPlacesCommand('placesCmd_deleteDataHost');"/>
|
||||
<command id="placesCmd_createBookmark"
|
||||
oncommand="goDoPlacesCommand('placesCmd_createBookmark');"/>
|
||||
<command id="placesCmd_openParentFolder"
|
||||
oncommand="goDoPlacesCommand('placesCmd_openParentFolder');"/>
|
||||
|
||||
<!-- Special versions of cut/copy/paste/delete which check for an open context menu. -->
|
||||
<command id="placesCmd_cut"
|
||||
oncommand="goDoPlacesCommand('placesCmd_cut');"/>
|
||||
<command id="placesCmd_copy"
|
||||
oncommand="goDoPlacesCommand('placesCmd_copy');"/>
|
||||
<command id="placesCmd_paste"
|
||||
oncommand="goDoPlacesCommand('placesCmd_paste');"/>
|
||||
<command id="placesCmd_delete"
|
||||
oncommand="goDoPlacesCommand('placesCmd_delete');"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="placesCommandKeys">
|
||||
<key id="key_placesCmd_openParentFolder"
|
||||
keycode="VK_F1"
|
||||
command="placesCmd_openParentFolder"
|
||||
modifiers="accel,shift"/>
|
||||
</keyset>
|
||||
|
||||
<menupopup id="placesContext"
|
||||
onpopupshowing="this._view = PlacesUIUtils.getViewForNode(document.popupNode);
|
||||
return this._view.buildContextMenu(this);"
|
||||
onpopuphiding="this._view.destroyContextMenu();">
|
||||
<menuitem id="placesContext_open"
|
||||
command="placesCmd_open"
|
||||
label="&cmd.open.label;"
|
||||
accesskey="&cmd.open.accesskey;"
|
||||
default="true"
|
||||
selectiontype="single"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_open:newtab"
|
||||
command="placesCmd_open:tab"
|
||||
label="&cmd.open_tab.label;"
|
||||
accesskey="&cmd.open_tab.accesskey;"
|
||||
selectiontype="single"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_openContainer:tabs"
|
||||
oncommand="var view = PlacesUIUtils.getViewForNode(document.popupNode);
|
||||
view.controller.openSelectionInTabs(event);"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
label="&cmd.open_all_in_tabs.label;"
|
||||
accesskey="&cmd.open_all_in_tabs.accesskey;"
|
||||
selectiontype="single"
|
||||
selection="folder|host|query"/>
|
||||
<menuitem id="placesContext_openLinks:tabs"
|
||||
oncommand="var view = PlacesUIUtils.getViewForNode(document.popupNode);
|
||||
view.controller.openSelectionInTabs(event);"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
label="&cmd.open_all_in_tabs.label;"
|
||||
accesskey="&cmd.open_all_in_tabs.accesskey;"
|
||||
selectiontype="multiple"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_open:newwindow"
|
||||
command="placesCmd_open:window"
|
||||
label="&cmd.open_window.label;"
|
||||
accesskey="&cmd.open_window.accesskey;"
|
||||
selectiontype="single"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_open:newprivatewindow"
|
||||
command="placesCmd_open:privatewindow"
|
||||
label="&cmd.open_private_window.label;"
|
||||
accesskey="&cmd.open_private_window.accesskey;"
|
||||
selectiontype="single"
|
||||
selection="link"
|
||||
hideifprivatebrowsing="true"/>
|
||||
<menuseparator id="placesContext_openSeparator"/>
|
||||
<menuitem id="placesContext_new:bookmark"
|
||||
command="placesCmd_new:bookmark"
|
||||
label="&cmd.new_bookmark.label;"
|
||||
accesskey="&cmd.new_bookmark.accesskey;"
|
||||
selection="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuitem id="placesContext_new:folder"
|
||||
command="placesCmd_new:folder"
|
||||
label="&cmd.new_folder.label;"
|
||||
accesskey="&cmd.context_new_folder.accesskey;"
|
||||
selection="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuitem id="placesContext_new:separator"
|
||||
command="placesCmd_new:separator"
|
||||
label="&cmd.new_separator.label;"
|
||||
accesskey="&cmd.new_separator.accesskey;"
|
||||
closemenu="single"
|
||||
selection="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_newSeparator"/>
|
||||
<menuitem id="placesContext_createBookmark"
|
||||
command="placesCmd_createBookmark"
|
||||
label="&cmd.bookmarkLink.label;"
|
||||
accesskey="&cmd.bookmarkLink.accesskey;"
|
||||
selection="link"
|
||||
forcehideselection="bookmark|tagChild"/>
|
||||
<menuitem id="placesContext_cut"
|
||||
command="placesCmd_cut"
|
||||
label="&cutCmd.label;"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
closemenu="single"
|
||||
selection="bookmark|folder|separator|query"
|
||||
forcehideselection="tagChild|livemarkChild"/>
|
||||
<menuitem id="placesContext_copy"
|
||||
command="placesCmd_copy"
|
||||
label="©Cmd.label;"
|
||||
closemenu="single"
|
||||
accesskey="©Cmd.accesskey;"
|
||||
selection="any"/>
|
||||
<menuitem id="placesContext_paste"
|
||||
command="placesCmd_paste"
|
||||
label="&pasteCmd.label;"
|
||||
closemenu="single"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
selection="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_editSeparator"/>
|
||||
<menuitem id="placesContext_delete"
|
||||
command="placesCmd_delete"
|
||||
label="&deleteCmd.label;"
|
||||
accesskey="&deleteCmd.accesskey;"
|
||||
closemenu="single"
|
||||
selection="bookmark|tagChild|folder|query|dynamiccontainer|separator|host"/>
|
||||
<menuitem id="placesContext_delete_history"
|
||||
command="placesCmd_delete"
|
||||
label="&cmd.delete.label;"
|
||||
accesskey="&cmd.delete.accesskey;"
|
||||
closemenu="single"
|
||||
selection="link"
|
||||
forcehideselection="bookmark"/>
|
||||
<menuitem id="placesContext_deleteHost"
|
||||
command="placesCmd_deleteDataHost"
|
||||
label="&cmd.deleteDomainData.label;"
|
||||
accesskey="&cmd.deleteDomainData.accesskey;"
|
||||
closemenu="single"
|
||||
selection="link|host"
|
||||
selectiontype="single"
|
||||
hideifprivatebrowsing="true"
|
||||
forcehideselection="bookmark"/>
|
||||
<menuseparator id="placesContext_deleteSeparator"/>
|
||||
<menuitem id="placesContext_reload"
|
||||
command="placesCmd_reload"
|
||||
label="&cmd.reloadLivebookmark.label;"
|
||||
accesskey="&cmd.reloadLivebookmark.accesskey;"
|
||||
closemenu="single"
|
||||
selection="livemark/feedURI"/>
|
||||
<menuitem id="placesContext_sortBy:name"
|
||||
command="placesCmd_sortBy:name"
|
||||
label="&cmd.sortby_name.label;"
|
||||
accesskey="&cmd.context_sortby_name.accesskey;"
|
||||
closemenu="single"
|
||||
selection="folder"/>
|
||||
<menuseparator id="placesContext_sortSeparator"/>
|
||||
<menuitem id="placesContext_openParentFolder"
|
||||
command="placesCmd_openParentFolder"
|
||||
label="&cmd.openParentFolder.label;"
|
||||
key="key_placesCmd_openParentFolder"
|
||||
accesskey="&cmd.openParentFolder.accesskey;"
|
||||
selectiontype="single"
|
||||
selection="bookmark"
|
||||
forcehideselection="livemarkChild|livemark/feedURI|PlacesOrganizer/OrganizerQuery"/>
|
||||
<menuseparator id="placesContext_parentFolderSeparator"/>
|
||||
<menuitem id="placesContext_show:info"
|
||||
command="placesCmd_show:info"
|
||||
label="&cmd.properties.label;"
|
||||
accesskey="&cmd.properties.accesskey;"
|
||||
selection="bookmark|folder|query"
|
||||
forcehideselection="livemarkChild"/>
|
||||
</menupopup>
|
||||
|
||||
</overlay>
|
||||
108
application/palemoon/components/places/content/sidebarUtils.js
Normal file
108
application/palemoon/components/places/content/sidebarUtils.js
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
var SidebarUtils = {
|
||||
handleTreeClick: function SU_handleTreeClick(aTree, aEvent, aGutterSelect) {
|
||||
// right-clicks are not handled here
|
||||
if (aEvent.button == 2)
|
||||
return;
|
||||
|
||||
var tbo = aTree.treeBoxObject;
|
||||
var cell = tbo.getCellAt(aEvent.clientX, aEvent.clientY);
|
||||
|
||||
if (cell.row == -1 || cell.childElt == "twisty")
|
||||
return;
|
||||
|
||||
var mouseInGutter = false;
|
||||
if (aGutterSelect) {
|
||||
var rect = tbo.getCoordsForCellItem(cell.row, cell.col, "image");
|
||||
// getCoordsForCellItem returns the x coordinate in logical coordinates
|
||||
// (i.e., starting from the left and right sides in LTR and RTL modes,
|
||||
// respectively.) Therefore, we make sure to exclude the blank area
|
||||
// before the tree item icon (that is, to the left or right of it in
|
||||
// LTR and RTL modes, respectively) from the click target area.
|
||||
var isRTL = window.getComputedStyle(aTree, null).direction == "rtl";
|
||||
if (isRTL)
|
||||
mouseInGutter = aEvent.clientX > rect.x;
|
||||
else
|
||||
mouseInGutter = aEvent.clientX < rect.x;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
var modifKey = aEvent.metaKey || aEvent.shiftKey;
|
||||
#else
|
||||
var modifKey = aEvent.ctrlKey || aEvent.shiftKey;
|
||||
#endif
|
||||
|
||||
var isContainer = tbo.view.isContainer(cell.row);
|
||||
var openInTabs = isContainer &&
|
||||
(aEvent.button == 1 ||
|
||||
(aEvent.button == 0 && modifKey)) &&
|
||||
PlacesUtils.hasChildURIs(tbo.view.nodeForTreeIndex(cell.row));
|
||||
|
||||
if (aEvent.button == 0 && isContainer && !openInTabs) {
|
||||
tbo.view.toggleOpenState(cell.row);
|
||||
return;
|
||||
}
|
||||
else if (!mouseInGutter && openInTabs &&
|
||||
aEvent.originalTarget.localName == "treechildren") {
|
||||
tbo.view.selection.select(cell.row);
|
||||
PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent, aTree);
|
||||
}
|
||||
else if (!mouseInGutter && !isContainer &&
|
||||
aEvent.originalTarget.localName == "treechildren") {
|
||||
// Clear all other selection since we're loading a link now. We must
|
||||
// do this *before* attempting to load the link since openURL uses
|
||||
// selection as an indication of which link to load.
|
||||
tbo.view.selection.select(cell.row);
|
||||
PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent, aTree);
|
||||
}
|
||||
},
|
||||
|
||||
handleTreeKeyPress: function SU_handleTreeKeyPress(aEvent) {
|
||||
// XXX Bug 627901: Post Fx4, this method should take a tree parameter.
|
||||
let tree = aEvent.target;
|
||||
let node = tree.selectedNode;
|
||||
if (node) {
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||
PlacesUIUtils.openNodeWithEvent(node, aEvent, tree);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The following function displays the URL of a node that is being
|
||||
* hovered over.
|
||||
*/
|
||||
handleTreeMouseMove: function SU_handleTreeMouseMove(aEvent) {
|
||||
if (aEvent.target.localName != "treechildren")
|
||||
return;
|
||||
|
||||
var tree = aEvent.target.parentNode;
|
||||
var tbo = tree.treeBoxObject;
|
||||
var cell = tbo.getCellAt(aEvent.clientX, aEvent.clientY);
|
||||
|
||||
// cell.row is -1 when the mouse is hovering an empty area within the tree.
|
||||
// To avoid showing a URL from a previously hovered node for a currently
|
||||
// hovered non-url node, we must clear the moused-over URL in these cases.
|
||||
if (cell.row != -1) {
|
||||
var node = tree.view.nodeForTreeIndex(cell.row);
|
||||
if (PlacesUtils.nodeIsURI(node))
|
||||
this.setMouseoverURL(node.uri);
|
||||
else
|
||||
this.setMouseoverURL("");
|
||||
}
|
||||
else
|
||||
this.setMouseoverURL("");
|
||||
},
|
||||
|
||||
setMouseoverURL: function SU_setMouseoverURL(aURL) {
|
||||
// When the browser window is closed with an open sidebar, the sidebar
|
||||
// unload event happens after the browser's one. In this case
|
||||
// top.XULBrowserWindow has been nullified already.
|
||||
if (top.XULBrowserWindow) {
|
||||
top.XULBrowserWindow.setOverLink(aURL, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
789
application/palemoon/components/places/content/tree.xml
Normal file
789
application/palemoon/components/places/content/tree.xml
Normal file
|
|
@ -0,0 +1,789 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<bindings id="placesTreeBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="places-tree" extends="chrome://global/content/bindings/tree.xml#tree">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
// Force an initial build.
|
||||
if (this.place)
|
||||
this.place = this.place;
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
// Break the treeviewer->result->treeviewer cycle.
|
||||
// Note: unsetting the result's viewer also unsets
|
||||
// the viewer's reference to our treeBoxObject.
|
||||
var result = this.result;
|
||||
if (result) {
|
||||
result.root.containerOpen = false;
|
||||
}
|
||||
|
||||
// Unregister the controllber before unlinking the view, otherwise it
|
||||
// may still try to update commands on a view with a null result.
|
||||
if (this._controller) {
|
||||
this._controller.terminate();
|
||||
this.controllers.removeController(this._controller);
|
||||
}
|
||||
|
||||
this.view = null;
|
||||
]]></destructor>
|
||||
|
||||
<property name="controller"
|
||||
readonly="true"
|
||||
onget="return this._controller"/>
|
||||
|
||||
<!-- overriding -->
|
||||
<property name="view">
|
||||
<getter><![CDATA[
|
||||
try {
|
||||
return this.treeBoxObject.view.wrappedJSObject;
|
||||
}
|
||||
catch(e) {
|
||||
return null;
|
||||
}
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
return this.treeBoxObject.view = val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="associatedElement"
|
||||
readonly="true"
|
||||
onget="return this"/>
|
||||
|
||||
<method name="applyFilter">
|
||||
<parameter name="filterString"/>
|
||||
<parameter name="folderRestrict"/>
|
||||
<parameter name="includeHidden"/>
|
||||
<body><![CDATA[
|
||||
// preserve grouping
|
||||
var queryNode = PlacesUtils.asQuery(this.result.root);
|
||||
var options = queryNode.queryOptions.clone();
|
||||
|
||||
// Make sure we're getting uri results.
|
||||
// We do not yet support searching into grouped queries or into
|
||||
// tag containers, so we must fall to the default case.
|
||||
if (PlacesUtils.nodeIsHistoryContainer(queryNode) ||
|
||||
options.resultType == options.RESULTS_AS_TAG_QUERY ||
|
||||
options.resultType == options.RESULTS_AS_TAG_CONTENTS)
|
||||
options.resultType = options.RESULTS_AS_URI;
|
||||
|
||||
var query = PlacesUtils.history.getNewQuery();
|
||||
query.searchTerms = filterString;
|
||||
|
||||
if (folderRestrict) {
|
||||
query.setFolders(folderRestrict, folderRestrict.length);
|
||||
options.queryType = options.QUERY_TYPE_BOOKMARKS;
|
||||
}
|
||||
|
||||
options.includeHidden = !!includeHidden;
|
||||
|
||||
this.load([query], options);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="load">
|
||||
<parameter name="queries"/>
|
||||
<parameter name="options"/>
|
||||
<body><![CDATA[
|
||||
let result = PlacesUtils.history
|
||||
.executeQueries(queries, queries.length,
|
||||
options);
|
||||
let callback;
|
||||
if (this.flatList) {
|
||||
let onOpenFlatContainer = this.onOpenFlatContainer;
|
||||
if (onOpenFlatContainer)
|
||||
callback = new Function("aContainer", onOpenFlatContainer);
|
||||
}
|
||||
|
||||
if (!this._controller) {
|
||||
this._controller = new PlacesController(this);
|
||||
this.controllers.appendController(this._controller);
|
||||
}
|
||||
|
||||
let treeView = new PlacesTreeView(this.flatList, callback, this._controller);
|
||||
|
||||
// Observer removal is done within the view itself. When the tree
|
||||
// goes away, treeboxobject calls view.setTree(null), which then
|
||||
// calls removeObserver.
|
||||
result.addObserver(treeView, false);
|
||||
this.view = treeView;
|
||||
|
||||
if (this.getAttribute("selectfirstnode") == "true" && treeView.rowCount > 0) {
|
||||
treeView.selection.select(0);
|
||||
}
|
||||
|
||||
this._cachedInsertionPoint = undefined;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<property name="flatList">
|
||||
<getter><![CDATA[
|
||||
return this.getAttribute("flatList") == "true";
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (this.flatList != val) {
|
||||
this.setAttribute("flatList", val);
|
||||
// reload with the last place set
|
||||
if (this.place)
|
||||
this.place = this.place;
|
||||
}
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="onOpenFlatContainer">
|
||||
<getter><![CDATA[
|
||||
return this.getAttribute("onopenflatcontainer");
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (this.onOpenFlatContainer != val) {
|
||||
this.setAttribute("onopenflatcontainer", val);
|
||||
// reload with the last place set
|
||||
if (this.place)
|
||||
this.place = this.place;
|
||||
}
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!--
|
||||
Causes a particular node represented by the specified placeURI to be
|
||||
selected in the tree. All containers above the node in the hierarchy
|
||||
will be opened, so that the node is visible.
|
||||
-->
|
||||
<method name="selectPlaceURI">
|
||||
<parameter name="placeURI"/>
|
||||
<body><![CDATA[
|
||||
// Do nothing if a node matching the given uri is already selected
|
||||
if (this.hasSelection && this.selectedNode.uri == placeURI)
|
||||
return;
|
||||
|
||||
function findNode(container, placeURI, nodesURIChecked) {
|
||||
var containerURI = container.uri;
|
||||
if (containerURI == placeURI)
|
||||
return container;
|
||||
if (nodesURIChecked.indexOf(containerURI) != -1)
|
||||
return null;
|
||||
|
||||
// never check the contents of the same query
|
||||
nodesURIChecked.push(containerURI);
|
||||
|
||||
var wasOpen = container.containerOpen;
|
||||
if (!wasOpen)
|
||||
container.containerOpen = true;
|
||||
for (var i = 0; i < container.childCount; ++i) {
|
||||
var child = container.getChild(i);
|
||||
var childURI = child.uri;
|
||||
if (childURI == placeURI)
|
||||
return child;
|
||||
else if (PlacesUtils.nodeIsContainer(child)) {
|
||||
var nested = findNode(PlacesUtils.asContainer(child), placeURI, nodesURIChecked);
|
||||
if (nested)
|
||||
return nested;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wasOpen)
|
||||
container.containerOpen = false;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var container = this.result.root;
|
||||
NS_ASSERT(container, "No result, cannot select place URI!");
|
||||
if (!container)
|
||||
return;
|
||||
|
||||
var child = findNode(container, placeURI, []);
|
||||
if (child)
|
||||
this.selectNode(child);
|
||||
else {
|
||||
// If the specified child could not be located, clear the selection
|
||||
var selection = this.view.selection;
|
||||
selection.clearSelection();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
Causes a particular node to be selected in the tree, resulting in all
|
||||
containers above the node in the hierarchy to be opened, so that the
|
||||
node is visible.
|
||||
-->
|
||||
<method name="selectNode">
|
||||
<parameter name="node"/>
|
||||
<body><![CDATA[
|
||||
var view = this.view;
|
||||
|
||||
var parent = node.parent;
|
||||
if (parent && !parent.containerOpen) {
|
||||
// Build a list of all of the nodes that are the parent of this one
|
||||
// in the result.
|
||||
var parents = [];
|
||||
var root = this.result.root;
|
||||
while (parent && parent != root) {
|
||||
parents.push(parent);
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
// Walk the list backwards (opening from the root of the hierarchy)
|
||||
// opening each folder as we go.
|
||||
for (var i = parents.length - 1; i >= 0; --i) {
|
||||
var index = view.treeIndexForNode(parents[i]);
|
||||
if (index != Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE &&
|
||||
view.isContainer(index) && !view.isContainerOpen(index))
|
||||
view.toggleOpenState(index);
|
||||
}
|
||||
// Select the specified node...
|
||||
}
|
||||
|
||||
var index = view.treeIndexForNode(node);
|
||||
if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
|
||||
return;
|
||||
|
||||
view.selection.select(index);
|
||||
// ... and ensure it's visible, not scrolled off somewhere.
|
||||
this.treeBoxObject.ensureRowIsVisible(index);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="result">
|
||||
<getter><![CDATA[
|
||||
try {
|
||||
return this.view.QueryInterface(Ci.nsINavHistoryResultObserver).result;
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="place">
|
||||
<getter><![CDATA[
|
||||
return this.getAttribute("place");
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.setAttribute("place", val);
|
||||
|
||||
var queriesRef = { };
|
||||
var queryCountRef = { };
|
||||
var optionsRef = { };
|
||||
PlacesUtils.history.queryStringToQueries(val, queriesRef, queryCountRef, optionsRef);
|
||||
if (queryCountRef.value == 0)
|
||||
queriesRef.value = [PlacesUtils.history.getNewQuery()];
|
||||
if (!optionsRef.value)
|
||||
optionsRef.value = PlacesUtils.history.getNewQueryOptions();
|
||||
|
||||
this.load(queriesRef.value, optionsRef.value);
|
||||
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="hasSelection">
|
||||
<getter><![CDATA[
|
||||
return this.view && this.view.selection.count >= 1;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="selectedNodes">
|
||||
<getter><![CDATA[
|
||||
let nodes = [];
|
||||
if (!this.hasSelection)
|
||||
return nodes;
|
||||
|
||||
let selection = this.view.selection;
|
||||
let rc = selection.getRangeCount();
|
||||
let resultview = this.view;
|
||||
for (let i = 0; i < rc; ++i) {
|
||||
let min = { }, max = { };
|
||||
selection.getRangeAt(i, min, max);
|
||||
|
||||
for (let j = min.value; j <= max.value; ++j)
|
||||
nodes.push(resultview.nodeForTreeIndex(j));
|
||||
}
|
||||
return nodes;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="toggleCutNode">
|
||||
<parameter name="aNode"/>
|
||||
<parameter name="aValue"/>
|
||||
<body><![CDATA[
|
||||
this.view.toggleCutNode(aNode, aValue);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="removableSelectionRanges">
|
||||
<getter><![CDATA[
|
||||
// This property exists in addition to selectedNodes because it
|
||||
// encodes selection ranges (which only occur in list views) into
|
||||
// the return value. For each removed range, the index at which items
|
||||
// will be re-inserted upon the remove transaction being performed is
|
||||
// the first index of the range, so that the view updates correctly.
|
||||
//
|
||||
// For example, if we remove rows 2,3,4 and 7,8 from a list, when we
|
||||
// undo that operation, if we insert what was at row 3 at row 3 again,
|
||||
// it will show up _after_ the item that was at row 5. So we need to
|
||||
// insert all items at row 2, and the tree view will update correctly.
|
||||
//
|
||||
// Also, this function collapses the selection to remove redundant
|
||||
// data, e.g. when deleting this selection:
|
||||
//
|
||||
// http://www.foo.com/
|
||||
// (-) Some Folder
|
||||
// http://www.bar.com/
|
||||
//
|
||||
// ... returning http://www.bar.com/ as part of the selection is
|
||||
// redundant because it is implied by removing "Some Folder". We
|
||||
// filter out all such redundancies since some partial amount of
|
||||
// the folder's children may be selected.
|
||||
//
|
||||
let nodes = [];
|
||||
if (!this.hasSelection)
|
||||
return nodes;
|
||||
|
||||
var selection = this.view.selection;
|
||||
var rc = selection.getRangeCount();
|
||||
var resultview = this.view;
|
||||
// This list is kept independently of the range selected (i.e. OUTSIDE
|
||||
// the for loop) since the row index of a container is unique for the
|
||||
// entire view, and we could have some really wacky selection and we
|
||||
// don't want to blow up.
|
||||
var containers = { };
|
||||
for (var i = 0; i < rc; ++i) {
|
||||
var range = [];
|
||||
var min = { }, max = { };
|
||||
selection.getRangeAt(i, min, max);
|
||||
|
||||
for (var j = min.value; j <= max.value; ++j) {
|
||||
if (this.view.isContainer(j))
|
||||
containers[j] = true;
|
||||
if (!(this.view.getParentIndex(j) in containers))
|
||||
range.push(resultview.nodeForTreeIndex(j));
|
||||
}
|
||||
nodes.push(range);
|
||||
}
|
||||
return nodes;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="draggableSelection"
|
||||
onget="return this.selectedNodes"/>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="selectedNode">
|
||||
<getter><![CDATA[
|
||||
var view = this.view;
|
||||
if (!view || view.selection.count != 1)
|
||||
return null;
|
||||
|
||||
var selection = view.selection;
|
||||
var min = { }, max = { };
|
||||
selection.getRangeAt(0, min, max);
|
||||
|
||||
return this.view.nodeForTreeIndex(min.value);
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<property name="insertionPoint">
|
||||
<getter><![CDATA[
|
||||
// invalidated on selection and focus changes
|
||||
if (this._cachedInsertionPoint !== undefined)
|
||||
return this._cachedInsertionPoint;
|
||||
|
||||
// there is no insertion point for history queries
|
||||
// so bail out now and save a lot of work when updating commands
|
||||
var resultNode = this.result.root;
|
||||
if (PlacesUtils.nodeIsQuery(resultNode) &&
|
||||
PlacesUtils.asQuery(resultNode).queryOptions.queryType ==
|
||||
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
|
||||
return this._cachedInsertionPoint = null;
|
||||
|
||||
var orientation = Ci.nsITreeView.DROP_BEFORE;
|
||||
// If there is no selection, insert at the end of the container.
|
||||
if (!this.hasSelection) {
|
||||
var index = this.view.rowCount - 1;
|
||||
this._cachedInsertionPoint =
|
||||
this._getInsertionPoint(index, orientation);
|
||||
return this._cachedInsertionPoint;
|
||||
}
|
||||
|
||||
// This is a two-part process. The first part is determining the drop
|
||||
// orientation.
|
||||
// * The default orientation is to drop _before_ the selected item.
|
||||
// * If the selected item is a container, the default orientation
|
||||
// is to drop _into_ that container.
|
||||
//
|
||||
// Warning: It may be tempting to use tree indexes in this code, but
|
||||
// you must not, since the tree is nested and as your tree
|
||||
// index may change when folders before you are opened and
|
||||
// closed. You must convert your tree index to a node, and
|
||||
// then use getChildIndex to find your absolute index in
|
||||
// the parent container instead.
|
||||
//
|
||||
var resultView = this.view;
|
||||
var selection = resultView.selection;
|
||||
var rc = selection.getRangeCount();
|
||||
var min = { }, max = { };
|
||||
selection.getRangeAt(rc - 1, min, max);
|
||||
|
||||
// If the sole selection is a container, and we are not in
|
||||
// a flatlist, insert into it.
|
||||
// Note that this only applies to _single_ selections,
|
||||
// if the last element within a multi-selection is a
|
||||
// container, insert _adjacent_ to the selection.
|
||||
//
|
||||
// If the sole selection is the bookmarks toolbar folder, we insert
|
||||
// into it even if it is not opened
|
||||
var itemId =
|
||||
PlacesUtils.getConcreteItemId(resultView.nodeForTreeIndex(max.value));
|
||||
if (selection.count == 1 && resultView.isContainer(max.value) &&
|
||||
!this.flatList)
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
|
||||
this._cachedInsertionPoint =
|
||||
this._getInsertionPoint(max.value, orientation);
|
||||
return this._cachedInsertionPoint;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<method name="_getInsertionPoint">
|
||||
<parameter name="index"/>
|
||||
<parameter name="orientation"/>
|
||||
<body><![CDATA[
|
||||
var result = this.result;
|
||||
var resultview = this.view;
|
||||
var container = result.root;
|
||||
var dropNearItemId = -1;
|
||||
NS_ASSERT(container, "null container");
|
||||
// When there's no selection, assume the container is the container
|
||||
// the view is populated from (i.e. the result's itemId).
|
||||
if (index != -1) {
|
||||
var lastSelected = resultview.nodeForTreeIndex(index);
|
||||
if (resultview.isContainer(index) && orientation == Ci.nsITreeView.DROP_ON) {
|
||||
// If the last selected item is an open container, append _into_
|
||||
// it, rather than insert adjacent to it.
|
||||
container = lastSelected;
|
||||
index = -1;
|
||||
}
|
||||
else if (lastSelected.containerOpen &&
|
||||
orientation == Ci.nsITreeView.DROP_AFTER &&
|
||||
lastSelected.hasChildren) {
|
||||
// If the last selected item is an open container and the user is
|
||||
// trying to drag into it as a first item, really insert into it.
|
||||
container = lastSelected;
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
index = 0;
|
||||
}
|
||||
else {
|
||||
// Use the last-selected node's container.
|
||||
container = lastSelected.parent;
|
||||
|
||||
// See comment in the treeView.js's copy of this method
|
||||
if (!container || !container.containerOpen)
|
||||
return null;
|
||||
|
||||
// Avoid the potentially expensive call to getChildIndex
|
||||
// if we know this container doesn't allow insertion
|
||||
if (PlacesControllerDragHelper.disallowInsertion(container))
|
||||
return null;
|
||||
|
||||
var queryOptions = PlacesUtils.asQuery(result.root).queryOptions;
|
||||
if (queryOptions.sortingMode !=
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE) {
|
||||
// If we are within a sorted view, insert at the end
|
||||
index = -1;
|
||||
}
|
||||
else if (queryOptions.excludeItems ||
|
||||
queryOptions.excludeQueries ||
|
||||
queryOptions.excludeReadOnlyFolders) {
|
||||
// Some item may be invisible, insert near last selected one.
|
||||
// We don't replace index here to avoid requests to the db,
|
||||
// instead it will be calculated later by the controller.
|
||||
index = -1;
|
||||
dropNearItemId = lastSelected.itemId;
|
||||
}
|
||||
else {
|
||||
var lsi = container.getChildIndex(lastSelected);
|
||||
index = orientation == Ci.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PlacesControllerDragHelper.disallowInsertion(container))
|
||||
return null;
|
||||
|
||||
return new InsertionPoint(PlacesUtils.getConcreteItemId(container),
|
||||
index, orientation,
|
||||
PlacesUtils.nodeIsTagQuery(container),
|
||||
dropNearItemId);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<method name="selectAll">
|
||||
<body><![CDATA[
|
||||
this.view.selection.selectAll();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- This method will select the first node in the tree that matches
|
||||
each given item id. It will open any parent nodes that it needs
|
||||
to in order to show the selected items.
|
||||
-->
|
||||
<method name="selectItems">
|
||||
<parameter name="aIDs"/>
|
||||
<parameter name="aOpenContainers"/>
|
||||
<body><![CDATA[
|
||||
// By default, we do search and select within containers which were
|
||||
// closed (note that containers in which nodes were not found are
|
||||
// closed).
|
||||
if (aOpenContainers === undefined)
|
||||
aOpenContainers = true;
|
||||
|
||||
var ids = aIDs; // don't manipulate the caller's array
|
||||
|
||||
// Array of nodes found by findNodes which are to be selected
|
||||
var nodes = [];
|
||||
|
||||
// Array of nodes found by findNodes which should be opened
|
||||
var nodesToOpen = [];
|
||||
|
||||
// A set of URIs of container-nodes that were previously searched,
|
||||
// and thus shouldn't be searched again. This is empty at the initial
|
||||
// start of the recursion and gets filled in as the recursion
|
||||
// progresses.
|
||||
var nodesURIChecked = [];
|
||||
|
||||
/**
|
||||
* Recursively search through a node's children for items
|
||||
* with the given IDs. When a matching item is found, remove its ID
|
||||
* from the IDs array, and add the found node to the nodes dictionary.
|
||||
*
|
||||
* NOTE: This method will leave open any node that had matching items
|
||||
* in its subtree.
|
||||
*/
|
||||
function findNodes(node) {
|
||||
var foundOne = false;
|
||||
// See if node matches an ID we wanted; add to results.
|
||||
// For simple folder queries, check both itemId and the concrete
|
||||
// item id.
|
||||
var index = ids.indexOf(node.itemId);
|
||||
if (index == -1 &&
|
||||
node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT)
|
||||
index = ids.indexOf(PlacesUtils.asQuery(node).folderItemId);
|
||||
|
||||
if (index != -1) {
|
||||
nodes.push(node);
|
||||
foundOne = true;
|
||||
ids.splice(index, 1);
|
||||
}
|
||||
|
||||
if (ids.length == 0 || !PlacesUtils.nodeIsContainer(node) ||
|
||||
nodesURIChecked.indexOf(node.uri) != -1)
|
||||
return foundOne;
|
||||
|
||||
PlacesUtils.asContainer(node);
|
||||
if (!aOpenContainers && !node.containerOpen)
|
||||
return foundOne;
|
||||
|
||||
nodesURIChecked.push(node.uri);
|
||||
|
||||
// Remember the beginning state so that we can re-close
|
||||
// this node if we don't find any additional results here.
|
||||
var previousOpenness = node.containerOpen;
|
||||
node.containerOpen = true;
|
||||
for (var child = 0; child < node.childCount && ids.length > 0;
|
||||
child++) {
|
||||
var childNode = node.getChild(child);
|
||||
var found = findNodes(childNode);
|
||||
if (!foundOne)
|
||||
foundOne = found;
|
||||
}
|
||||
|
||||
// If we didn't find any additional matches in this node's
|
||||
// subtree, revert the node to its previous openness.
|
||||
if (foundOne)
|
||||
nodesToOpen.unshift(node);
|
||||
node.containerOpen = previousOpenness;
|
||||
return foundOne;
|
||||
}
|
||||
|
||||
// Disable notifications while looking for nodes.
|
||||
let result = this.result;
|
||||
let didSuppressNotifications = result.suppressNotifications;
|
||||
if (!didSuppressNotifications)
|
||||
result.suppressNotifications = true
|
||||
try {
|
||||
findNodes(this.result.root);
|
||||
}
|
||||
finally {
|
||||
if (!didSuppressNotifications)
|
||||
result.suppressNotifications = false;
|
||||
}
|
||||
|
||||
// For all the nodes we've found, highlight the corresponding
|
||||
// index in the tree.
|
||||
var resultview = this.view;
|
||||
var selection = this.view.selection;
|
||||
selection.selectEventsSuppressed = true;
|
||||
selection.clearSelection();
|
||||
// Open nodes containing found items
|
||||
for (var i = 0; i < nodesToOpen.length; i++) {
|
||||
nodesToOpen[i].containerOpen = true;
|
||||
}
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var index = resultview.treeIndexForNode(nodes[i]);
|
||||
if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
|
||||
continue;
|
||||
selection.rangedSelect(index, index, true);
|
||||
}
|
||||
selection.selectEventsSuppressed = false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_contextMenuShown">false</field>
|
||||
|
||||
<method name="buildContextMenu">
|
||||
<parameter name="aPopup"/>
|
||||
<body><![CDATA[
|
||||
this._contextMenuShown = true;
|
||||
return this.controller.buildContextMenu(aPopup);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="destroyContextMenu">
|
||||
<parameter name="aPopup"/>
|
||||
this._contextMenuShown = false;
|
||||
<body/>
|
||||
</method>
|
||||
|
||||
<property name="ownerWindow"
|
||||
readonly="true"
|
||||
onget="return window;"/>
|
||||
|
||||
<field name="_active">true</field>
|
||||
<property name="active"
|
||||
onget="return this._active"
|
||||
onset="return this._active = val"/>
|
||||
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="focus"><![CDATA[
|
||||
this._cachedInsertionPoint = undefined;
|
||||
|
||||
// See select handler. We need the sidebar's places commandset to be
|
||||
// updated as well
|
||||
document.commandDispatcher.updateCommands("focus");
|
||||
]]></handler>
|
||||
<handler event="select"><![CDATA[
|
||||
this._cachedInsertionPoint = undefined;
|
||||
|
||||
// This additional complexity is here for the sidebars
|
||||
var win = window;
|
||||
while (true) {
|
||||
win.document.commandDispatcher.updateCommands("focus");
|
||||
if (win == window.top)
|
||||
break;
|
||||
|
||||
win = win.parent;
|
||||
}
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragstart"><![CDATA[
|
||||
if (event.target.localName != "treechildren")
|
||||
return;
|
||||
|
||||
let nodes = this.selectedNodes;
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
let node = nodes[i];
|
||||
|
||||
// Disallow dragging the root node of a tree.
|
||||
if (!node.parent) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
// If this node is child of a readonly container (e.g. a livemark)
|
||||
// or cannot be moved, we must force a copy.
|
||||
if (!PlacesControllerDragHelper.canMoveNode(node)) {
|
||||
event.dataTransfer.effectAllowed = "copyLink";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._controller.setDataTransfer(event);
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragover"><![CDATA[
|
||||
if (event.target.localName != "treechildren")
|
||||
return;
|
||||
|
||||
let cell = this.treeBoxObject.getCellAt(event.clientX, event.clientY);
|
||||
let node = cell.row != -1 ?
|
||||
this.view.nodeForTreeIndex(cell.row) :
|
||||
this.result.root;
|
||||
// cache the dropTarget for the view
|
||||
PlacesControllerDragHelper.currentDropTarget = node;
|
||||
|
||||
// We have to calculate the orientation since view.canDrop will use
|
||||
// it and we want to be consistent with the dropfeedback.
|
||||
let tbo = this.treeBoxObject;
|
||||
let rowHeight = tbo.rowHeight;
|
||||
let eventY = event.clientY - tbo.treeBody.boxObject.y -
|
||||
rowHeight * (cell.row - tbo.getFirstVisibleRow());
|
||||
|
||||
let orientation = Ci.nsITreeView.DROP_BEFORE;
|
||||
|
||||
if (cell.row == -1) {
|
||||
// If the row is not valid we try to insert inside the resultNode.
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
}
|
||||
else if (PlacesUtils.nodeIsContainer(node) &&
|
||||
eventY > rowHeight * 0.75) {
|
||||
// If we are below the 75% of a container the treeview we try
|
||||
// to drop after the node.
|
||||
orientation = Ci.nsITreeView.DROP_AFTER;
|
||||
}
|
||||
else if (PlacesUtils.nodeIsContainer(node) &&
|
||||
eventY > rowHeight * 0.25) {
|
||||
// If we are below the 25% of a container the treeview we try
|
||||
// to drop inside the node.
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
}
|
||||
|
||||
if (!this.view.canDrop(cell.row, orientation, event.dataTransfer))
|
||||
return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
|
||||
<handler event="dragend"><![CDATA[
|
||||
PlacesControllerDragHelper.currentDropTarget = null;
|
||||
]]></handler>
|
||||
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
1765
application/palemoon/components/places/content/treeView.js
Normal file
1765
application/palemoon/components/places/content/treeView.js
Normal file
File diff suppressed because it is too large
Load diff
34
application/palemoon/components/places/jar.mn
Normal file
34
application/palemoon/components/places/jar.mn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
browser.jar:
|
||||
% overlay chrome://browser/content/places/places.xul chrome://browser/content/places/downloadsViewOverlay.xul
|
||||
# Provide another URI for the bookmarkProperties dialog so we can persist the
|
||||
# attributes separately
|
||||
content/browser/places/bookmarkProperties2.xul (content/bookmarkProperties.xul)
|
||||
* content/browser/places/places.xul (content/places.xul)
|
||||
* content/browser/places/places.js (content/places.js)
|
||||
content/browser/places/places.css (content/places.css)
|
||||
content/browser/places/organizer.css (content/organizer.css)
|
||||
content/browser/places/bookmarkProperties.xul (content/bookmarkProperties.xul)
|
||||
content/browser/places/bookmarkProperties.js (content/bookmarkProperties.js)
|
||||
content/browser/places/placesOverlay.xul (content/placesOverlay.xul)
|
||||
* content/browser/places/menu.xml (content/menu.xml)
|
||||
content/browser/places/tree.xml (content/tree.xml)
|
||||
content/browser/places/controller.js (content/controller.js)
|
||||
content/browser/places/treeView.js (content/treeView.js)
|
||||
* content/browser/places/browserPlacesViews.js (content/browserPlacesViews.js)
|
||||
# keep the Places version of the history sidebar at history/history-panel.xul
|
||||
# to prevent having to worry about between versions of the browser
|
||||
* content/browser/history/history-panel.xul (content/history-panel.xul)
|
||||
content/browser/places/history-panel.js (content/history-panel.js)
|
||||
# ditto for the bookmarks sidebar
|
||||
content/browser/bookmarks/bookmarksPanel.xul (content/bookmarksPanel.xul)
|
||||
content/browser/bookmarks/bookmarksPanel.js (content/bookmarksPanel.js)
|
||||
* content/browser/bookmarks/sidebarUtils.js (content/sidebarUtils.js)
|
||||
content/browser/places/moveBookmarks.xul (content/moveBookmarks.xul)
|
||||
content/browser/places/moveBookmarks.js (content/moveBookmarks.js)
|
||||
content/browser/places/editBookmarkOverlay.xul (content/editBookmarkOverlay.xul)
|
||||
content/browser/places/editBookmarkOverlay.js (content/editBookmarkOverlay.js)
|
||||
* content/browser/places/downloadsViewOverlay.xul (content/downloadsViewOverlay.xul)
|
||||
14
application/palemoon/components/places/moz.build
Normal file
14
application/palemoon/components/places/moz.build
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'BrowserPlaces.manifest',
|
||||
'PlacesProtocolHandler.js',
|
||||
]
|
||||
EXTRA_JS_MODULES += [ 'PlacesUIUtils.jsm' ]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue