This commit is contained in:
blakeross%telocity.com 2002-09-30 23:01:26 +00:00
Родитель 88221379d2
Коммит 8275f2bc1d
7 изменённых файлов: 64 добавлений и 71 удалений

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

@ -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);

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

@ -86,9 +86,21 @@
<textbox id="search-box" flex="1"
type="timed" timeout="500"
callback="searchHistory(gSearchBox.value);"/>
<toolbarbutton id="viewButton" type="menu" label="&view.label;" selectedsort="day" persist="selectedsort">
<menupopup>
<menuitem id="byday" label="&byDate.label;" accesskey="&byDate.accesskey;" type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'day'); GroupBy('day');"/>
<menuitem id="bysite" label="&bySite.label;" accesskey="&bySite.accesskey;" type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'site'); GroupBy('none'); SortBy('name');"/>
<menuitem id="byvisited" label="&byMostVisited.label;" accesskey="&byMostVisited.accesskey;"
type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'visited');
GroupBy('none'); SortBy('visited');"/>
</menupopup>
</toolbarbutton>
</hbox>
<tree id="historyTree" flex="1" class="plain"
context="historyMenu"
context="historyMenu" persist="ref"
datasources="rdf:history" ref="NC:HistoryByDate" flags="dont-build-content"
onkeypress="if (event.keyCode == 13) OpenURL(event.ctrlKey || event.metaKey);"
onselect="this.treeBoxObject.view.selectionChanged();
@ -102,14 +114,20 @@
<treeitem uri="rdf:*" rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
<treerow>
<treecell label="rdf:http://home.netscape.com/NC-rdf#Name"/>
<treecell label="rdf:http://home.netscape.com/NC-rdf#VisitCount" hidden="true"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecols id="historyTreeCols">
<treecol flex="1" id="Name" persist="hidden width ordinal"
hideheader="true" primary="true"/>
<treecol flex="1" id="Name" persist="sortActive sortDirection"
hideheader="true" primary="true"
sort="rdf:http://home.netscape.com/NC-rdf#Name"
sortActive="true"/>
<treecol flex="1" id="VisitCount" hidden="true" hideheader="true"
persist="sortActive sortDirection"
sort="rdf:http://home.netscape.com/NC-rdf#VisitCount"/>
</treecols>
</tree>
</page>

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

@ -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");
}

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

@ -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)

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

@ -31,16 +31,9 @@
<!ENTITY menuitem.view.descending.accesskey "z">
<!ENTITY menuitem.view.show_columns.label "Show columns">
<!ENTITY menuitem.view.show_columns.accesskey "S">
<!ENTITY fileMenu.label "File">
<!ENTITY fileMenu.accesskey "F">
<!ENTITY find.label "Find:">
<!ENTITY find.accesskey "n">
<!ENTITY helpMenu.label "Help">
<!ENTITY helpMenu.accesskey "H">
<!ENTITY releaseCmd.label "Release Notes">
<!ENTITY releaseCmd.accesskey "R">
<!ENTITY aboutCmd.label "About &brandShortName;">
<!ENTITY aboutCmd.accesskey "A">
<!ENTITY tree.header.name.label "Title">
<!ENTITY tree.header.name.akey "T">
<!ENTITY tree.header.url.label "Location">
@ -56,3 +49,10 @@
<!ENTITY tree.header.visitcount.label "Visit Count">
<!ENTITY tree.header.visitcount.akey "V">
<!ENTITY collapseExpand.accesskey "e">
<!ENTITY byDate.label "By Date">
<!ENTITY byDate.accesskey "D">
<!ENTITY bySite.label "By Site">
<!ENTITY bySite.accesskey "S">
<!ENTITY view.label "View">
<!ENTITY byMostVisited.label "By Most Visited">
<!ENTITY byMostVisited.accesskey "V">

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

@ -83,6 +83,7 @@ function closeDialog()
unwrapToolbarItems();
persistCurrentSets();
notifyParentComplete();
window.close();
}
function slideOpen()

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

@ -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");
}