Reuse single bookmarks window (without using window name). Use window manager service instead. (Sidebar customize dialog uses similar code.) Fix for bug #14038.

This commit is contained in:
slamm%netscape.com 2006-09-14 05:40:47 +00:00
parent 7a77f23d2e
commit b258a555d6

View File

@ -1073,10 +1073,39 @@ function RevealSearchPanel()
bmks.AddBookmark(url, title);
}
function BrowserEditBookmarks()
{
window.open("chrome://bookmarks/content/", "BookmarksWindow", "chrome,menubar,resizable,scrollbars");
// Set up a lame hack to avoid opening two bookmarks.
// Could otherwise happen with two Ctrl-B's in a row.
var gDisableBookmarks = false;
function enableBookmarks() {
gDisableBookmarks = false;
}
function BrowserEditBookmarks()
{
// Use a single sidebar bookmarks dialog
var cwindowManager = Components.classes['component://netscape/rdf/datasource?name=window-mediator'].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var bookmarksWindow = windowManager.GetMostRecentWindow('bookmarks:manager');
if (bookmarksWindow) {
debug("Reuse existing bookmarks window");
bookmarksWindow.focus();
} else {
debug("Open a new bookmarks dialog");
if (true == gDisableBookmarks) {
debug("Recently opened one. Wait a little bit.");
return;
}
gDisableBookmarks = true;
window.open("chrome://bookmarks/content/", "_blank", "chrome,menubar,resizable,scrollbars");
setTimeout(enableBookmarks, 2000);
}
}
function BrowserPrintPreview()
{