From 8275f2bc1d1858dff8c99eab5a5238c6f39d6d79 Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Mon, 30 Sep 2002 23:01:26 +0000 Subject: [PATCH] Some fixes. --- .../downloads/src/nsDownloadManager.cpp | 2 +- .../history/content/history-panel.xul | 24 ++++- browser/components/history/content/history.js | 89 +++++++------------ browser/components/history/jar.mn | 1 - browser/components/history/locale/history.dtd | 14 +-- toolkit/content/customizeToolbar.js | 1 + toolkit/skin/win/tree.css | 4 +- 7 files changed, 64 insertions(+), 71 deletions(-) diff --git a/browser/components/downloads/src/nsDownloadManager.cpp b/browser/components/downloads/src/nsDownloadManager.cpp index 99425facaacc..e4c6d4588844 100644 --- a/browser/components/downloads/src/nsDownloadManager.cpp +++ b/browser/components/downloads/src/nsDownloadManager.cpp @@ -109,7 +109,7 @@ nsDownloadManager::~nsDownloadManager() NS_IF_RELEASE(gNC_DownloadState); NS_IF_RELEASE(gNC_StatusText); - nsServiceManager::ReleaseService(kRDFServiceCID, gObserverService); + nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService); gRDFService = nsnull; nsServiceManager::ReleaseService("@mozilla.org/observer-service;1", gObserverService); diff --git a/browser/components/history/content/history-panel.xul b/browser/components/history/content/history-panel.xul index 07233a513c77..2ae4f9cf578c 100644 --- a/browser/components/history/content/history-panel.xul +++ b/browser/components/history/content/history-panel.xul @@ -86,9 +86,21 @@ + + + + + + + + - + + diff --git a/browser/components/history/content/history.js b/browser/components/history/content/history.js index 67fcb14bdf1a..d0186cf73f30 100644 --- a/browser/components/history/content/history.js +++ b/browser/components/history/content/history.js @@ -41,7 +41,6 @@ var gHistoryTree; var gLastHostname; var gLastDomain; var gGlobalHistory; -var gPrefService; var gDeleteByHostname; var gDeleteByDomain; var gHistoryBundle; @@ -50,13 +49,6 @@ var gSearchBox; var gHistoryGrouping = ""; var gWindowManager = null; -function HistoryWindowInit() -{ - gHistoryStatus = document.getElementById("statusbar-display"); - HistoryCommonInit(); - gHistoryTree.focus(); -} - function HistoryCommonInit() { gHistoryTree = document.getElementById("historyTree"); @@ -66,49 +58,14 @@ function HistoryCommonInit() gSearchBox = document.getElementById("search-box"); var treeController = new nsTreeController(gHistoryTree); - - if ("arguments" in window && window.arguments[0] && window.arguments.length >= 1) { - // We have been supplied a resource URI to root the tree on - var uri = window.arguments[0]; - gHistoryTree.setAttribute("ref", uri); - if (uri.substring(0,5) == "find:" && - !(window.arguments.length > 1 && window.arguments[1] == "newWindow")) { - // Update the windowtype so that future searches are directed - // there and the window is not re-used for bookmarks. - var windowNode = document.getElementById("history-window"); - windowNode.setAttribute("windowtype", "history:searchresults"); - windowNode.setAttribute("title", gHistoryBundle.getString("search_results_title")); - - } - document.getElementById("groupingMenu").setAttribute("hidden", "true"); - } - else { - gPrefService = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); - try { - gHistoryGrouping = gPrefService.getCharPref("browser.history.grouping"); - } - catch(e) { - gHistoryGrouping = "day"; - } - GroupBy(gHistoryGrouping); - if (gHistoryStatus) { // must be the window - switch(gHistoryGrouping) { - case "none": - document.getElementById("groupByNone").setAttribute("checked", "true"); - break; - case "day": - default: - document.getElementById("groupByDay").setAttribute("checked", "true"); - } - } - else { // must be the sidebar panel - var pb = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); - var pbi = pb.QueryInterface(Components.interfaces.nsIPrefBranchInternal); - pbi.addObserver("browser.history.grouping", groupObserver, false); - } - } - + var mode = document.getElementById("viewButton").getAttribute("selectedsort"); + if (mode == "site") + document.getElementById("bysite").setAttribute("checked", "true"); + else if (mode == "visited") + document.getElementById("byvisited").setAttribute("checked", "true"); + else + document.getElementById("byday").setAttribute("checked", "true"); + gHistoryTree.focus(); gHistoryTree.treeBoxObject.view.selection.select(0); } @@ -270,6 +227,30 @@ function OpenURL(aInNewWindow) return true; } +function SortBy(sortKey) +{ + // Welcome to the end of the world of Lame. + // You can go no further. You are standing on the edge -- teetering, even. + // Look on the bright side: you can rest assured that no code you see in the future + // will even come close to the lameness of the code below. + + switch(sortKey) { + case "visited": + sortKey = "VisitCount"; + sortDirection = "ascending"; + break; + case "name": + sortKey = "Name"; + sortDirection = "natural"; + break; + default: + return; + } + var col = document.getElementById(sortKey); + col.setAttribute("sortDirection", sortDirection); + gHistoryTree.treeBoxObject.view.cycleHeader(sortKey, col); +} + function GroupBy(groupingType) { gHistoryGrouping = groupingType; @@ -286,7 +267,6 @@ function GroupBy(groupingType) gHistoryTree.setAttribute("ref", "NC:HistoryByDate"); break; } - gPrefService.setCharPref("browser.history.grouping", groupingType); } var groupObserver = { @@ -420,8 +400,3 @@ function searchHistory(aInput) gHistoryTree.setAttribute("ref", "find:datasource=history&match=Name&method=contains&text=" + escape(aInput)); } - -function openAboutDialog() -{ - window.openDialog("chrome://browser/content/aboutDialog.xul", "About", "modal,centerscreen,chrome,resizable=no"); -} diff --git a/browser/components/history/jar.mn b/browser/components/history/jar.mn index 8f98315c20df..f5b6efdaf3a1 100644 --- a/browser/components/history/jar.mn +++ b/browser/components/history/jar.mn @@ -5,4 +5,3 @@ browser.jar: en-US.jar: locale/en-US/browser/history/history.dtd (locale/history.dtd) locale/en-US/browser/history/history.properties (locale/history.properties) - diff --git a/browser/components/history/locale/history.dtd b/browser/components/history/locale/history.dtd index 4597056451ee..971fb95c35e8 100644 --- a/browser/components/history/locale/history.dtd +++ b/browser/components/history/locale/history.dtd @@ -31,16 +31,9 @@ - - - - - - - @@ -56,3 +49,10 @@ + + + + + + + \ No newline at end of file diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js index 86fbffa9b35f..80ad32f82da2 100644 --- a/toolkit/content/customizeToolbar.js +++ b/toolkit/content/customizeToolbar.js @@ -83,6 +83,7 @@ function closeDialog() unwrapToolbarItems(); persistCurrentSets(); notifyParentComplete(); + window.close(); } function slideOpen() diff --git a/toolkit/skin/win/tree.css b/toolkit/skin/win/tree.css index 28fcc1a4f182..9dd9175d59a4 100644 --- a/toolkit/skin/win/tree.css +++ b/toolkit/skin/win/tree.css @@ -217,11 +217,11 @@ treechildren:-moz-tree-column(insertafter) { list-style-image: none; } -.treecol-sortdirection[sortDirection="ascending"] { +treecol:not([hideheader="true"] > .treecol-sortdirection[sortDirection="ascending"] { list-style-image: url("chrome://global/skin/tree/sort-asc.gif"); } -.treecol-sortdirection[sortDirection="descending"] { +treecol:not([hideheader="true"] > .treecol-sortdirection[sortDirection="descending"] { list-style-image: url("chrome://global/skin/tree/sort-dsc.gif"); }