Bug 1456589 - Part 2 Port Bug 1437242 1432614 1438511 1439313 1437583 1437310 1439358 3,6 to SeaMonkey places. r=IanN

Port Bug 1437242 [don't drag browser-sync.js into places.xul].
Port Bug 1432614 [Remove now unnecessary updating and maintenance of Places' root folder titles].
The titles for the root bookmark folders in the database will now never get updated. This
avoids doing maintenance and changing them if the locale changes.
The UI is now responsible for displaying the correct title.
WebExtensions API will get the UI visible names.

Port Bug 1438511 [Copy top window's uidensity attribute in sidebarUtils.js instead of forcing gUIDensity.update()].
Port Bug 1439313 [delay loading Places treeview.js until necessary].
Port Bug 1437583 [Split plural forms for Delete/Add bookmarks in separate strings].
Since the number of tabs is not actually displayed, having two separate strings from 1 vs many is preferable.

Port Bug 1437310 [Fix moving bookmarks across special folders].
Port Bug 1439358 Part 3 [Always raise ViewShowing events and don't update the "current" property].
The ViewShowing event is now called earlier and unconditionally, since we don't set the "current" attribute and call showMainView while the panel is closing anymore.
It is already the case that the ViewShowing event handlers don't depend on the "current" property, so we don't need to keep track of it before ViewShown events are dispatched.

Port Bug 1439358 Part 6 [Decouple view events from view visibility].
This stops redundant ViewHiding and late ViewShown events from being dispatched when the panel is closed during a ViewShowing event or a transition, and stops dispatching ViewHiding events when a view becomes invisible but is still open.
The panelMultiView property on "panelview" nodes is now set to null when the view is closed, indicating that the view can be immediately reused in a different panel. The Places view had to be updated so it doesn't rely on this property during the PanelMultiViewHidden event.
This commit is contained in:
Frank-Rainer Grahl 2018-07-23 22:06:15 +02:00
Родитель 43e92ac762
Коммит 925660f01b
8 изменённых файлов: 44 добавлений и 44 удалений

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

@ -2117,14 +2117,6 @@ this.PlacesPanelview = class extends PlacesViewBase {
return this._events = ["click", "command", "dragend", "dragstart", "ViewHiding", "ViewShown"];
}
get panel() {
return this.panelMultiView.parentNode;
}
get panelMultiView() {
return this._viewElt.panelMultiView;
}
handleEvent(event) {
switch (event.type) {
case "click":
@ -2196,6 +2188,7 @@ this.PlacesPanelview = class extends PlacesViewBase {
uninit(event) {
this._removeEventListeners(this.panelMultiView, this.events);
this._removeEventListeners(window, ["unload"]);
delete this.panelMultiView;
super.uninit(event);
}
@ -2255,10 +2248,6 @@ this.PlacesPanelview = class extends PlacesViewBase {
}
}
_isPopupOpen() {
return this.panel.state == "open" && this.panelMultiView.current == this._viewElt;
}
_onPopupHidden(event) {
let panelview = event.originalTarget;
let placesNode = panelview._placesNode;
@ -2280,6 +2269,7 @@ this.PlacesPanelview = class extends PlacesViewBase {
// we ever get here.
if (event.originalTarget == this._rootElt) {
// Start listening for events from all panels inside the panelmultiview.
this.panelMultiView = this._viewElt.panelMultiView;
this._addEventListeners(this.panelMultiView, this.events);
}
super._onPopupShowing(event);

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

@ -620,15 +620,16 @@ PlacesController.prototype = {
}
}
// Make sure correct PluralForms are diplayed when multiple pages are selected.
var deleteHistoryItem = document.getElementById("placesContext_delete_history");
deleteHistoryItem.label = PlacesUIUtils.getPluralString("cmd.deletePages.label",
metadata.length);
deleteHistoryItem.accessKey = PlacesUIUtils.getString("cmd.deletePages.accesskey");
var createBookmarkItem = document.getElementById("placesContext_createBookmark");
createBookmarkItem.label = PlacesUIUtils.getPluralString("cmd.bookmarkPages.label",
metadata.length);
createBookmarkItem.accessKey = PlacesUIUtils.getString("cmd.bookmarkPages.accesskey");
// Make sure to display the correct string when multiple pages are selected.
let stringId = metadata.length === 1 ? "SinglePage" : "MultiplePages";
let deleteHistoryItem = document.getElementById("placesContext_delete_history");
deleteHistoryItem.label = PlacesUIUtils.getString(`cmd.delete${stringId}.label`);
deleteHistoryItem.accessKey = PlacesUIUtils.getString(`cmd.delete${stringId}.accesskey`);
let createBookmarkItem = document.getElementById("placesContext_createBookmark");
createBookmarkItem.label = PlacesUIUtils.getString(`cmd.bookmark${stringId}.label`);
createBookmarkItem.accessKey = PlacesUIUtils.getString(`cmd.bookmark${stringId}.accesskey`);
return usableItemCount > 0;
},
@ -1381,11 +1382,12 @@ var PlacesControllerDragHelper = {
unwrappedNode.id <= 0 || PlacesUtils.isRootItem(unwrappedNode.id)) {
return false;
}
let parentId = unwrappedNode.parent;
if (parentId <= 0 ||
parentId == PlacesUtils.placesRootId ||
parentId == PlacesUtils.tagsFolderId ||
unwrappedNode.grandParentId == PlacesUtils.tagsFolderId) {
let parentGuid = unwrappedNode.parentGuid;
// If there's no parent Guid, this was likely a virtual query that returns
// bookmarks, such as a tags query.
if (!parentGuid ||
parentGuid == PlacesUtils.bookmarks.rootGuid) {
return false;
}
// leftPaneFolderId and allBookmarksFolderId are lazy getters running
@ -1393,7 +1395,7 @@ var PlacesControllerDragHelper = {
// them first, especially because isCommandEnabled may be called way
// before the left pane folder is even necessary.
if (typeof Object.getOwnPropertyDescriptor(PlacesUIUtils, "leftPaneFolderId").get != "function" &&
(parentId == PlacesUIUtils.leftPaneFolderId)) {
(unwrappedNode.parent == PlacesUIUtils.leftPaneFolderId)) {
return false;
}
return true;

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

@ -437,7 +437,10 @@ var gEditItemOverlay = {
var lastUsed =
PlacesUtils.annotations.getItemAnnotation(folderId, LAST_USED_ANNO);
let guid = await PlacesUtils.promiseItemGuid(folderId);
let title = (await PlacesUtils.bookmarks.fetch(guid)).title;
let bm = await PlacesUtils.bookmarks.fetch(guid);
// Since this could be a root mobile folder, we should get the proper
// title.
let title = PlacesUtils.bookmarks.getLocalizedTitle(bm);
this._recentFolders.push({ folderId, guid, title, lastUsed });
}
this._recentFolders.sort(function(a, b) {

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

@ -162,8 +162,6 @@ var PlacesOrganizer = {
.removeChild(document.getElementById("placesContext_show:info"));
ContentArea.focus();
// sync is currently disabled
// gSync.init();
},
QueryInterface: function PO_QueryInterface(aIID) {

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

@ -23,11 +23,11 @@
"PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm");
ChromeUtils.defineModuleGetter(window,
"PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm");
XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView",
"chrome://communicator/content/places/treeView.js");
]]></script>
<script type="application/javascript"
src="chrome://communicator/content/places/controller.js"/>
<script type="application/javascript"
src="chrome://communicator/content/places/treeView.js"/>
<!-- Bookmarks and history tooltip -->
<tooltip id="bhTooltip" noautohide="true"

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

@ -3,7 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
window.top.gUIDensity.update();
let uidensity = window.top.document.documentElement.getAttribute("uidensity");
if (uidensity) {
document.documentElement.setAttribute("uidensity", uidensity);
}
var SidebarUtils = {
handleTreeClick: function SU_handleTreeClick(aTree, aEvent, aGutterSelect) {

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

@ -18,8 +18,6 @@ function onLibraryReady(organizer) {
// Check titles have been fixed.
for (var i = 0; i < leftPaneQueries.length; i++) {
var query = leftPaneQueries[i];
is(PlacesUtils.bookmarks.getItemTitle(query.itemId),
query.correctTitle, "Title is correct for query " + query.name);
if ("concreteId" in query) {
is(PlacesUtils.bookmarks.getItemTitle(query.concreteId),
query.concreteTitle, "Concrete title is correct for query " + query.name);

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

@ -82,19 +82,24 @@ switchtabResultLabel=Tab
keywordResultLabel=Keyword
searchengineResultLabel=Search
# LOCALIZATION NOTE (lockPrompt.text)
# %S will be replaced with the application name.
lockPrompt.text=The bookmarks and history system will not be functional because one of %Ss files is in use by another application. Some security software can cause this problem.
lockPromptInfoButton.label=Learn More
lockPromptInfoButton.accesskey=L
# LOCALIZATION NOTE (deletePagesLabel): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
cmd.deletePages.label=Delete Page;Delete Pages
cmd.deletePages.accesskey=D
# LOCALIZATION NOTE (cmd.deleteSinglePage.accesskey,
# cmd.deleteMultiplePages.accesskey): these accesskeys can use the same
# character, since they're never displayed at the same time
cmd.deleteSinglePage.label=Delete Page
cmd.deleteSinglePage.accesskey=D
cmd.deleteMultiplePages.label=Delete Pages
cmd.deleteMultiplePages.accesskey=D
# LOCALIZATION NOTE (bookmarkPagesLabel): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
cmd.bookmarkPages.label=Bookmark Page;Bookmark Pages
cmd.bookmarkPages.accesskey=B
# LOCALIZATION NOTE (cmd.bookmarkSinglePage.accesskey,
# cmd.bookmarkMultiplePages.accesskey): these accesskeys can use the same
# character, since they're never displayed at the same time
cmd.bookmarkSinglePage.label=Bookmark Page
cmd.bookmarkSinglePage.accesskey=B
cmd.bookmarkMultiplePages.label=Bookmark Pages
cmd.bookmarkMultiplePages.accesskey=B