зеркало из https://github.com/mozilla/pjs.git
Bug 399476 - Ts and Txul improvements for the places-smart-folders container, note the feature isn't re-enabled yet. r=sspitzer.
This commit is contained in:
Родитель
390b7ed0f4
Коммит
2e9add89dc
|
@ -328,26 +328,36 @@ function initPlacesDefaultQueries() {
|
|||
if (createdDefaultQueries)
|
||||
return;
|
||||
|
||||
try {
|
||||
var placesFolderTitle = PlacesUtils.getString("placesFolderTitle");
|
||||
var recentlyCreatedBookmarksTitle = PlacesUtils.getString("recentlyCreatedBookmarksTitle");
|
||||
var recentlyVisitedBookmarksTitle = PlacesUtils.getString("recentlyVisitedBookmarksTitle");
|
||||
var mostVisitedBookmarksTitle = PlacesUtils.getString("mostVisitedBookmarksTitle");
|
||||
var recentlyUsedTagsTitle = PlacesUtils.getString("recentlyUsedTagsTitle");
|
||||
var mostUsedTagsTitle = PlacesUtils.getString("mostUsedTagsTitle");
|
||||
var mostVisitedSitesTitle = PlacesUtils.getString("mostVisitedSitesTitle");
|
||||
|
||||
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
var bmsvc = PlacesUtils.bookmarks;
|
||||
var callback = {
|
||||
runBatched: function() {
|
||||
var placesFolderTitle =
|
||||
PlacesUtils.getString("placesFolderTitle");
|
||||
var recentlyCreatedBookmarksTitle =
|
||||
PlacesUtils.getString("recentlyCreatedBookmarksTitle");
|
||||
var recentlyVisitedBookmarksTitle =
|
||||
PlacesUtils.getString("recentlyVisitedBookmarksTitle");
|
||||
var mostVisitedBookmarksTitle =
|
||||
PlacesUtils.getString("mostVisitedBookmarksTitle");
|
||||
var recentlyUsedTagsTitle =
|
||||
PlacesUtils.getString("recentlyUsedTagsTitle");
|
||||
var mostUsedTagsTitle =
|
||||
PlacesUtils.getString("mostUsedTagsTitle");
|
||||
var mostVisitedSitesTitle =
|
||||
PlacesUtils.getString("mostVisitedSitesTitle");
|
||||
|
||||
var bookmarksRoot = PlacesUtils.bookmarksRootId;
|
||||
var unfiledRoot = PlacesUtils.unfiledRootId;
|
||||
var tagRoot = PlacesUtils.tagRootId;
|
||||
var defaultIndex = bmsvc.DEFAULT_INDEX;
|
||||
|
||||
var placesFolder = bmsvc.createFolder(bmsvc.toolbarFolder, placesFolderTitle,
|
||||
0 /* index = 0, make it the first folder */);
|
||||
// index = 0, make it the first folder
|
||||
var placesFolder = bmsvc.createFolder(bmsvc.toolbarFolder,
|
||||
placesFolderTitle,
|
||||
0);
|
||||
|
||||
var maxResults = 10; // XXX should this be a pref? see bug #399268
|
||||
// XXX should this be a pref? see bug #399268
|
||||
var maxResults = 10;
|
||||
|
||||
// exclude queries so that user created "saved searches"
|
||||
// and these queries (added automatically) are excluded
|
||||
|
@ -359,14 +369,14 @@ function initPlacesDefaultQueries() {
|
|||
"&excludeItemIfParentHasAnnotation=livemark%2FfeedURI" +
|
||||
"&maxResults=" + maxResults +
|
||||
"&excludeQueries=1"),
|
||||
bmsvc.DEFAULT_INDEX, recentlyCreatedBookmarksTitle);
|
||||
defaultIndex, recentlyCreatedBookmarksTitle);
|
||||
|
||||
var recentlyVisitedBookmarksItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + bookmarksRoot + "&folder=" + unfiledRoot +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING +
|
||||
"&minVisits=1&maxResults=" + maxResults),
|
||||
bmsvc.DEFAULT_INDEX, recentlyVisitedBookmarksTitle);
|
||||
defaultIndex, recentlyVisitedBookmarksTitle);
|
||||
|
||||
var mostVisitedBookmarksItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + bookmarksRoot + "&folder=" + unfiledRoot +
|
||||
|
@ -374,7 +384,7 @@ function initPlacesDefaultQueries() {
|
|||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
|
||||
"&minVisits=1&maxResults=" + maxResults),
|
||||
bmsvc.DEFAULT_INDEX, mostVisitedBookmarksTitle);
|
||||
defaultIndex, mostVisitedBookmarksTitle);
|
||||
|
||||
var recentlyUsedTagsItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + tagRoot +
|
||||
|
@ -385,7 +395,7 @@ function initPlacesDefaultQueries() {
|
|||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
|
||||
"&resolveNullBookmarkTitles=1" +
|
||||
"&maxResults=" + maxResults),
|
||||
bmsvc.DEFAULT_INDEX, recentlyUsedTagsTitle);
|
||||
defaultIndex, recentlyUsedTagsTitle);
|
||||
|
||||
var mostUsedTagsItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:folder=" + tagRoot +
|
||||
|
@ -395,7 +405,7 @@ function initPlacesDefaultQueries() {
|
|||
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_COUNT_DESCENDING +
|
||||
"&resolveNullBookmarkTitles=1" +
|
||||
"&maxResults=" + maxResults),
|
||||
bmsvc.DEFAULT_INDEX, mostUsedTagsTitle);
|
||||
defaultIndex, mostUsedTagsTitle);
|
||||
|
||||
var mostVisitedSitesItem = bmsvc.insertBookmark(placesFolder,
|
||||
IO.newURI("place:queryType=" +
|
||||
|
@ -403,10 +413,14 @@ function initPlacesDefaultQueries() {
|
|||
"&sort=" +
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
|
||||
"&maxResults=" + maxResults),
|
||||
bmsvc.DEFAULT_INDEX, mostVisitedSitesTitle);
|
||||
defaultIndex, mostVisitedSitesTitle);
|
||||
}
|
||||
catch(ex) {
|
||||
} finally {
|
||||
}
|
||||
|
||||
try {
|
||||
bmsvc.runInBatchMode(callback, null)
|
||||
}
|
||||
finally {
|
||||
prefBranch.setBoolPref("browser.places.createdDefaultQueries", true);
|
||||
}
|
||||
}
|
||||
|
@ -1056,8 +1070,8 @@ function delayedStartup()
|
|||
sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
|
||||
}
|
||||
|
||||
initBookmarksToolbar();
|
||||
initPlacesDefaultQueries();
|
||||
initBookmarksToolbar();
|
||||
PlacesUtils.bookmarks.addObserver(gBookmarksObserver, false);
|
||||
PlacesStarButton.init();
|
||||
|
||||
|
|
|
@ -47,20 +47,6 @@
|
|||
<binding id="places-menupopup"
|
||||
extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
#if 0
|
||||
// Support an asyncinit attribute that causes the view to populate
|
||||
// itself only after the window has been shown. This is to ensure we
|
||||
// do not regress browser window show time (Ts/Txul)
|
||||
if (this.hasAttribute("asyncinit")) {
|
||||
var self = this;
|
||||
//setTimeout(function() { self._init(); }, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
this._init();
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
this._resultNode = null;
|
||||
if (this._result) {
|
||||
|
@ -69,8 +55,12 @@
|
|||
}
|
||||
]]></destructor>
|
||||
|
||||
<method name="_init">
|
||||
<field name="_initialized">false</field>
|
||||
<method name="_ensureInitialized">
|
||||
<body><![CDATA[
|
||||
if (this._initialized)
|
||||
return;
|
||||
|
||||
this._controller = new PlacesController(this);
|
||||
this.controllers.appendController(this._controller);
|
||||
|
||||
|
@ -80,6 +70,7 @@
|
|||
// Do the initial build.
|
||||
this.place = this.place;
|
||||
}
|
||||
this._initialized = true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -93,8 +84,7 @@
|
|||
|
||||
<method name="onPopupShowing">
|
||||
<body><![CDATA[
|
||||
if (!this._resultNode)
|
||||
this._init();
|
||||
this._ensureInitialized();
|
||||
|
||||
if (!this._resultNode.containerOpen)
|
||||
this._resultNode.containerOpen = true;
|
||||
|
@ -936,6 +926,7 @@
|
|||
<method name="buildContextMenu">
|
||||
<parameter name="aPopup"/>
|
||||
<body><![CDATA[
|
||||
this._ensureInitialized();
|
||||
this.focus();
|
||||
return this.controller.buildContextMenu(aPopup);
|
||||
]]></body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче