mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
315940 - NPOB, general cleanup + 317617 - polish for left bar entries (icons, localization) r=brettw
This commit is contained in:
parent
f2cba9cd77
commit
82e02aaf47
@ -80,6 +80,13 @@ var PlacesController = {
|
||||
},
|
||||
|
||||
buildContextMenu: function PC_buildContextMenu(popup) {
|
||||
if (document.popupNode.hasAttribute("view")) {
|
||||
var view = document.popupNode.getAttribute("view");
|
||||
this.activeView = document.getElementById(view);
|
||||
}
|
||||
|
||||
// Determine availability/enabled state of commands
|
||||
// ...
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -118,23 +125,23 @@ var PlacesController = {
|
||||
*/
|
||||
openLinkInNewTab: function PC_openLinkInNewTab() {
|
||||
var view = this._activeView;
|
||||
view.browserWindow.openNewTabWith(view.selectedNode.url, null, null);
|
||||
view.browserWindow.openNewTabWith(view.selectedURLNode.url, null, null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the selected URL in a new window.
|
||||
*/
|
||||
openLinkInNewWindow: function PP_openLinkInNewWindow() {
|
||||
openLinkInNewWindow: function PC_openLinkInNewWindow() {
|
||||
var view = this._activeView;
|
||||
view.browserWindow.openNewWindowWith(view.selectedNode.url, null, null);
|
||||
view.browserWindow.openNewWindowWith(view.selectedURLNode.url, null, null);
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the selected URL in the current window, replacing the Places page.
|
||||
*/
|
||||
openLinkInCurrentWindow: function PP_openLinkInCurrentWindow() {
|
||||
openLinkInCurrentWindow: function PC_openLinkInCurrentWindow() {
|
||||
var view = this._activeView;
|
||||
view.browserWindow.loadURI(view.selectedNode.url, null, null);
|
||||
view.browserWindow.loadURI(view.selectedURLNode.url, null, null);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -143,7 +150,7 @@ var PlacesController = {
|
||||
* An array of grouping options, see nsINavHistoryQueryOptions
|
||||
* for details.
|
||||
*/
|
||||
setGroupingMode: function PP_setGroupingOptions(options) {
|
||||
setGroupingMode: function PC_setGroupingOptions(options) {
|
||||
var result = this._activeView.view.QueryInterface(Ci.nsINavHistoryResult);
|
||||
var queries = result.getSourceQueries({ });
|
||||
var newOptions = result.sourceQueryOptions.clone();
|
||||
@ -152,6 +159,71 @@ var PlacesController = {
|
||||
this._activeView.load(queries, newOptions);
|
||||
},
|
||||
|
||||
/**
|
||||
* Group the current content view by domain
|
||||
*/
|
||||
groupBySite: function PC_groupBySite() {
|
||||
var modes = [Ci.nsINavHistoryQueryOptions.GROUP_BY_DOMAIN,
|
||||
Ci.nsINavHistoryQueryOptions.GROUP_BY_HOST];
|
||||
this.setGroupingMode(modes);
|
||||
},
|
||||
|
||||
/**
|
||||
* Ungroup the current content view (i.e. show individual pages)
|
||||
*/
|
||||
groupByPage: function PC_groupByPage() {
|
||||
this.setGroupingMode([]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new Bookmark folder somewhere. Prompts the user for the name
|
||||
* of the folder.
|
||||
*/
|
||||
newFolder: function PC_newFolder() {
|
||||
var view = this._activeView;
|
||||
|
||||
var ps =
|
||||
Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Ci.nsIPromptService);
|
||||
var bundle = document.getElementById("placeBundle");
|
||||
var title = bundle.getString("newFolderTitle");
|
||||
var text = bundle.getString("newFolderMessage");
|
||||
var value = { value: bundle.getString("newFolderDefault") };
|
||||
if (ps.prompt(window, title, text, value, null, { })) {
|
||||
var ip = view.insertionPoint;
|
||||
LOG("Insertion Point = " + ip.toSource());
|
||||
|
||||
var bms =
|
||||
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
LOG("Insert Folder: " + value.value + " into: " + ip.container + " at: " + ip.index);
|
||||
var folder = bms.createFolder(ip.container, value.value, ip.index);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes the selection
|
||||
*/
|
||||
remove: function() {
|
||||
var bms =
|
||||
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
var ios =
|
||||
Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
var nodes = this._activeView.getSelectionNodes();
|
||||
for (var i = 0; i < nodes.length; ++i) {
|
||||
var node = nodes[i];
|
||||
if (node.folderId) {
|
||||
LOG("Remove Folder: " + node.folderId);
|
||||
bms.removeFolder(node.folderId);
|
||||
}
|
||||
else {
|
||||
LOG("Remove: " + node.url + " from: " + node.parent.folderId);
|
||||
bms.removeItem(node.parent.folderId, ios.newURI(node.url, null, null));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -7,3 +7,7 @@ tree {
|
||||
-moz-binding: url("chrome://browser/content/places/places.xml#places-tree");
|
||||
}
|
||||
|
||||
button {
|
||||
-moz-binding: url("chrome://browser/content/places/places.xml#command-button");
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,22 @@ var PlacesUIHook = {
|
||||
_placesURI: "chrome://browser/content/places/places.xul",
|
||||
|
||||
init: function PUIH_init(placesList) {
|
||||
this._topWindow = placesList.browserWindow;
|
||||
this._tabbrowser = this._topWindow.getBrowser();
|
||||
try {
|
||||
this._topWindow = placesList.browserWindow;
|
||||
this._tabbrowser = this._topWindow.getBrowser();
|
||||
|
||||
// Hook into the tab strip to get notifications about when the Places Page is
|
||||
// selected so that the browser UI can be modified.
|
||||
var self = this;
|
||||
function onTabSelect(event) {
|
||||
self.onTabSelect(event);
|
||||
// Hook into the tab strip to get notifications about when the Places Page is
|
||||
// selected so that the browser UI can be modified.
|
||||
var self = this;
|
||||
function onTabSelect(event) {
|
||||
self.onTabSelect(event);
|
||||
}
|
||||
this._tabbrowser.mTabContainer.addEventListener("select", onTabSelect, false);
|
||||
|
||||
this._showPlacesUI();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
this._tabbrowser.mTabContainer.addEventListener("select", onTabSelect, false);
|
||||
|
||||
this._showPlacesUI();
|
||||
},
|
||||
|
||||
uninit: function PUIH_uninit() {
|
||||
@ -108,6 +112,9 @@ var PlacesPage = {
|
||||
BS.FOLDER_CHILDREN |
|
||||
BS.QUERY_CHILDREN);
|
||||
this._places.view = children.QueryInterface(Ci.nsITreeView);
|
||||
|
||||
LOG("Roots:");
|
||||
LOG("Places: " + this._bmsvc.placesRoot + " Menu: " + this._bmsvc.bookmarksRoot + " Toolbar: " + this._bmsvc.placesRoot);
|
||||
},
|
||||
|
||||
uninit: function PP_uninit() {
|
||||
@ -172,23 +179,5 @@ var PlacesPage = {
|
||||
// Hide the Calendar for Bookmark queries.
|
||||
document.getElementById("historyCalendar").hidden = query.onlyBookmarked;
|
||||
},
|
||||
|
||||
/**
|
||||
* Group the current content view by domain
|
||||
*/
|
||||
groupBySite: function PP_groupBySite() {
|
||||
PlacesController.activeView = this._content;
|
||||
var modes = [Ci.nsINavHistoryQueryOptions.GROUP_BY_DOMAIN,
|
||||
Ci.nsINavHistoryQueryOptions.GROUP_BY_HOST];
|
||||
PlacesController.setGroupingMode(modes);
|
||||
},
|
||||
|
||||
/**
|
||||
* Ungroup the current content view (i.e. show individual pages)
|
||||
*/
|
||||
groupByPage: function PP_groupByPage() {
|
||||
PlacesController.activeView = this._content;
|
||||
PlacesController.setGroupingMode([]);
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -130,7 +130,7 @@
|
||||
|
||||
<method name="getSelectionNodes">
|
||||
<body><![CDATA[
|
||||
var result = this.view.queryInterface(Ci.nsINavHistoryResult);
|
||||
var result = this.view.QueryInterface(Ci.nsINavHistoryResult);
|
||||
var selection = this.view.selection;
|
||||
var rc = selection.getRangeCount();
|
||||
var nodes = [];
|
||||
@ -146,6 +146,21 @@
|
||||
</method>
|
||||
|
||||
<property name="selectedNode">
|
||||
<getter><![CDATA[
|
||||
var view = this.view;
|
||||
var selection = view.selection;
|
||||
var rc = selection.getRangeCount();
|
||||
if (rc != 1)
|
||||
return null;
|
||||
var min = { }, max = { };
|
||||
selection.getRangeAt(0, min, max);
|
||||
|
||||
var result = view.QueryInterface(Ci.nsINavHistoryResult);
|
||||
return result.nodeForTreeIndex(min.value);
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="selectedURLNode">
|
||||
<getter><![CDATA[
|
||||
var view = this.view;
|
||||
var selection = view.selection;
|
||||
@ -164,6 +179,28 @@
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="insertionPoint">
|
||||
<getter><![CDATA[
|
||||
var view = this.view;
|
||||
var selection = view.selection;
|
||||
var rc = selection.getRangeCount();
|
||||
var min = { }, max = { };
|
||||
selection.getRangeAt(rc - 1, min, max);
|
||||
|
||||
var result = view.QueryInterface(Ci.nsINavHistoryResult);
|
||||
var lastSelected = result.nodeForTreeIndex(max.value);
|
||||
|
||||
// Any visible selected item will always have a parent. The parent of
|
||||
// an item at the root is the result itself, which can be QI'ed to
|
||||
// nsINavHistoryResult
|
||||
var container = lastSelected.parent;
|
||||
for (var i = 0;
|
||||
i < container.childCount && container.getChild(i) != lastSelected;
|
||||
++i);
|
||||
return { container: 1, index: -1 };
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<property name="browserWindow" onget="return this._browserWindow"/>
|
||||
</implementation>
|
||||
<handlers>
|
||||
@ -173,6 +210,34 @@
|
||||
<handler event="select"><![CDATA[
|
||||
document.commandDispatcher.updateCommands("select");
|
||||
]]></handler>
|
||||
<handler event="click"><![CDATA[
|
||||
if (this.getAttribute("singleclick") == "true") {
|
||||
var view = this.view;
|
||||
var selection = view.selection;
|
||||
var rc = selection.getRangeCount();
|
||||
if (rc != 1)
|
||||
return null;
|
||||
var min = { };
|
||||
selection.getRangeAt(0, min, { });
|
||||
if (!view.isContainerEmpty(min.value))
|
||||
view.toggleOpenState(min.value);
|
||||
}
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="command-button" extends="chrome://global/content/bindings/button.xml#button">
|
||||
<implementation>
|
||||
<method name="updateActiveView">
|
||||
<body><![CDATA[
|
||||
if (this.hasAttribute("view"))
|
||||
PlacesController.activeView = document.getElementById(this.getAttribute("view"));
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click" button="0" action="this.updateActiveView();"/>
|
||||
<handler event="keypress" keycode="VK_SPACE" action="this.updateActiveView();"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -16,6 +16,11 @@
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://browser/content/places/places.js"/>
|
||||
|
||||
<stringbundleset id="stringbundles">
|
||||
<stringbundle id="placeBundle" src="chrome://browser/locale/places/places.properties"/>
|
||||
<stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<commandset id="placesCommands">
|
||||
<command id="placesCmd_find" label="&cmd.find.label;" accesskey="&cmd.find.accesskey;"/>
|
||||
<command id="placesCmd_export" label="&cmd.export.label;" accesskey="&cmd.export.accesskey;"/>
|
||||
@ -33,7 +38,9 @@
|
||||
<commandset>
|
||||
<command id="placesCmd_edit:cut" label="&cmd.edit_cut.label;" accesskey="&cmd.edit_cut.accesskey;"/>
|
||||
<command id="placesCmd_edit:paste" label="&cmd.edit_paste.label;" accesskey="&cmd.edit_paste.accesskey;"/>
|
||||
<command id="placesCmd_edit:delete" label="&cmd.edit_delete.label;" accesskey="&cmd.edit_delete.accesskey;"/>
|
||||
<command id="placesCmd_edit:delete"
|
||||
label="&cmd.edit_delete.label;" accesskey="&cmd.edit_delete.accesskey;"
|
||||
oncommand="PlacesController.remove();"/>
|
||||
<command id="placesCmd_rename" label="&cmd.rename.label;" accesskey="&cmd.rename.accesskey;"/>
|
||||
</commandset>
|
||||
<commandset type="link" readonly="true">
|
||||
@ -50,16 +57,18 @@
|
||||
<command id="placesCmd_open:tabs" label="&cmd.open_tabs.label;" accesskey="&cmd.open_tabs.accesskey;"/>
|
||||
<command id="placesCmd_groupby:site"
|
||||
label="&cmd.groupby_site.label;" accesskey="&cmd.groupby_site.accesskey;"
|
||||
oncommand="PlacesPage.groupBySite();"/>
|
||||
oncommand="PlacesController.groupBySite();"/>
|
||||
<command id="placesCmd_groupby:page"
|
||||
label="&cmd.groupby_page.label;" accesskey="&cmd.groupby_page.accesskey;"
|
||||
oncommand="PlacesPage.groupByPage();"/>
|
||||
oncommand="PlacesController.groupByPage();"/>
|
||||
<command id="placesCmd_groupby:feed" label="&cmd.groupby_feed.label;" accesskey="&cmd.groupby_feed.accesskey;"/>
|
||||
<command id="placesCmd_groupby:post" label="&cmd.groupby_post.label;" accesskey="&cmd.groupby_post.accesskey;"/>
|
||||
</commandset>
|
||||
<commandset type="container">
|
||||
<command id="placesCmd_sortby:name" label="&cmd.sortby_name.label;" accesskey="&cmd.sortby_name.accesskey;"/>
|
||||
<command id="placesCmd_new:folder" label="&cmd.new_folder.label;" accesskey="&cmd.new_folder.accesskey;"/>
|
||||
<command id="placesCmd_new:folder"
|
||||
label="&cmd.new_folder.label;" accesskey="&cmd.new_folder.accesskey;"
|
||||
oncommand="PlacesController.newFolder()"/>
|
||||
<command id="placesCmd_new:separator" label="&cmd.new_separator.label;" accesskey="&cmd.new_separator.accesskey;"/>
|
||||
</commandset>
|
||||
<commandset type="container|feed" readonly="true">
|
||||
@ -74,7 +83,7 @@
|
||||
<key id="placesKey_edit:copy" command="placesCmd_edit:copy" key="&cmd.edit_copy.key;" modifiers="accel"/>
|
||||
<key id="placesKey_edit:paste" command="placesCmd_edit:paste" key="&cmd.edit_paste.key;" modifiers="accel"/>
|
||||
<key id="placesKey_edit:delete" command="placesCmd_edit:delete" keycode="VK_DELETE"/>
|
||||
<key id="placesKey_open" command="placesCmd_open"/>
|
||||
<key id="placesKey_open" command="placesCmd_open" keycode="VK_ENTER"/>
|
||||
<key id="placesKey_open:window" command="placesCmd_open:window" keycode="VK_ENTER" modifiers="shift"/>
|
||||
<key id="placesKey_open:tab" oncommand="placesCmd_open:tab" keycode="VK_ENTER" modifiers="accel"/>
|
||||
<key id="placesKey_show:info" oncommand="placesCmd_show:info" key="&cmd.show_info.key;" modifiers="accel"/>
|
||||
@ -110,16 +119,17 @@
|
||||
<vbox>
|
||||
<tree id="placesList" class="placesTree" flex="1"
|
||||
hidecolumnpicker="true" context="placesContext"
|
||||
onselect="PlacesPage.placeSelected(event);">
|
||||
onselect="PlacesPage.placeSelected(event);"
|
||||
singleclick="true">
|
||||
<treecols>
|
||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||
</treecols>
|
||||
<treechildren id="placesListChildren" flex="1"/>
|
||||
<treechildren id="placesListChildren" view="placesList" flex="1"/>
|
||||
</tree>
|
||||
<vbox id="historyCalendar"
|
||||
onselectionchanged="LOG('FIXME: do history query');"/>
|
||||
<hbox class="commands">
|
||||
<button id="newPlace" command="placesCmd_new:folder"/>
|
||||
<button id="newPlace" view="placesList" command="placesCmd_new:folder"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<splitter id="splitter"/>
|
||||
@ -154,26 +164,32 @@
|
||||
<treecol label="&col.title.label;" id="title" flex="1" primary="true"/>
|
||||
<treecol label="&col.url.label;" id="url" flex="1"/>
|
||||
</treecols>
|
||||
<treechildren id="placesContentChildren" flex="1"/>
|
||||
<treechildren id="placeContentChildren" view="placeContent" flex="1"/>
|
||||
</tree>
|
||||
<hbox>
|
||||
<deck id="commands" flex="1">
|
||||
<hbox class="commands" id="commands_bookmark" flex="1">
|
||||
<button id="newFolder" command="placesCmd_new:folder"/>
|
||||
<button id="newFolder" view="placeContent" command="placesCmd_new:folder"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="saveSearch_bookmark" command="placesCmd_saveSearch" hidden="true"/>
|
||||
</hbox>
|
||||
<hbox class="commands" id="commands_history" flex="1">
|
||||
<button id="groupBy_site" command="placesCmd_groupby:site"/>
|
||||
<button id="groupBy_page" command="placesCmd_groupby:page"/>
|
||||
<button id="groupBy_site" class="commandGroupButton first"
|
||||
view="placeContent" command="placesCmd_groupby:site"/>
|
||||
<spacer class="groupSpacer"/>
|
||||
<button id="groupBy_page" class="commandGroupButton last"
|
||||
view="placeContent" command="placesCmd_groupby:page"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="saveSearch_history" command="placesCmd_saveSearch" hidden="true"/>
|
||||
</hbox>
|
||||
<hbox class="commands" id="commands_feed" flex="1">
|
||||
<button id="subscribe" command="placesCmd_new:folder"/>
|
||||
<separator/>
|
||||
<button id="groupOption0" command="placesCmd_groupby:site"/>
|
||||
<button id="groupOption1" command="placesCmd_groupby:page"/>
|
||||
<button id="groupOption0" class="commandGroupButton first"
|
||||
view="placeContent" command="placesCmd_groupby:site"/>
|
||||
<spacer class="groupSpacer"/>
|
||||
<button id="groupOption1" class="commandGroupButton last"
|
||||
view="placeContent" command="placesCmd_groupby:page"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="saveSearch_feed" command="placesCmd_saveSearch" hidden="true"/>
|
||||
</hbox>
|
||||
|
@ -10,6 +10,7 @@ browser.jar:
|
||||
|
||||
classic.jar:
|
||||
skin/classic/browser/places/places.css (skin-win/places.css)
|
||||
skin/classic/browser/places/icons.png (skin-win/icons.png)
|
||||
|
||||
en-US.jar:
|
||||
locale/browser/places/places.dtd (locale/places.dtd)
|
||||
|
@ -13,3 +13,11 @@ finduri-Hostname-is-=(no host)
|
||||
load-js-data-url-error=For security reasons, javascript or data urls cannot be loaded from the history window or sidebar.
|
||||
noTitle=(no title)
|
||||
localhost=(local files)
|
||||
|
||||
newFolderTitle=New Folder
|
||||
newFolderMessage=Enter a name for the new folder:
|
||||
newFolderDefault=New Folder
|
||||
|
||||
bookmarksMenuName=Bookmarks Menu
|
||||
bookmarksToolbarName=Bookmarks Toolbar
|
||||
|
||||
|
BIN
browser/components/places/skin-win/icons.png
Executable file
BIN
browser/components/places/skin-win/icons.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 282 B |
@ -1,67 +1,96 @@
|
||||
/* Root View */
|
||||
#placesView {
|
||||
-moz-appearance: tabpanels;
|
||||
margin: -10px;
|
||||
padding: 8px 6px 6px 8px;
|
||||
}
|
||||
|
||||
.placesTree {
|
||||
margin: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#placesList {
|
||||
margin: 7px 0px 7px 6px;
|
||||
}
|
||||
|
||||
#placeContent {
|
||||
margin: 0px 6px 7px 0px;
|
||||
}
|
||||
|
||||
#showAdvancedSearch {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
#splitter {
|
||||
border: 0px;
|
||||
width: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#placesContentChildren::-moz-tree-image(title) {
|
||||
/* Place List, Place Content */
|
||||
.placesTree {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#placesList {
|
||||
margin: 7px 0px 7px 6px;
|
||||
}
|
||||
|
||||
#placesListChildren::-moz-tree-twisty {
|
||||
list-style-image: none;
|
||||
width: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#placeContent {
|
||||
margin: 0px 6px 7px 0px;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title) {
|
||||
padding-right: 2px;
|
||||
margin: 0px 2px;
|
||||
list-style-image: url("chrome://global/skin/icons/folder-item.png") !important;
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
}
|
||||
|
||||
#placesContentChildren::-moz-tree-image(title, container) {
|
||||
treechildren::-moz-tree-image(title, container) {
|
||||
-moz-image-region: rect(0px, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#placesContentChildren::-moz-tree-image(title, open) {
|
||||
treechildren::-moz-tree-image(title, container, menu-root) {
|
||||
list-style-image: url("chrome://browser/skin/places/icons.png") !important;
|
||||
-moz-image-region: rect(0px, 16px, 17px, 0px);
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, container, toolbar-root) {
|
||||
list-style-image: url("chrome://browser/skin/places/icons.png") !important;
|
||||
-moz-image-region: rect(17px, 16px, 32px, 0px);
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, open) {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
|
||||
#placesContentChildren::-moz-tree-image(title, separator) {
|
||||
treechildren::-moz-tree-image(title, separator) {
|
||||
list-style-image: none;
|
||||
width: 0px !important;
|
||||
height: 0px !important;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#placesContentChildren::-moz-tree-cell-text(title, separator) {
|
||||
treechildren::-moz-tree-cell-text(title, separator) {
|
||||
color: ThreeDShadow;
|
||||
margin: 0px 5px;
|
||||
}
|
||||
|
||||
#placesContentChildren::-moz-tree-cell-text(title, separator, selected, focus) {
|
||||
treechildren::-moz-tree-cell-text(title, separator, selected, focus) {
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
/* Command Bar */
|
||||
.commands {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.commandGroupButton {
|
||||
margin-left: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
|
||||
.commandGroupButton.first {
|
||||
margin-right: -10px;
|
||||
}
|
||||
|
||||
.commandGroupButton.last {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
/* Search Bar */
|
||||
#searchFilter {
|
||||
-moz-binding: url("chrome://browser/content/places/places.xml#textbox-timed-arbitrary");
|
||||
}
|
||||
@ -80,12 +109,12 @@
|
||||
}
|
||||
|
||||
/* Calendar */
|
||||
|
||||
#historyCalendar {
|
||||
margin: 0px 0px 7px 6px;
|
||||
}
|
||||
|
||||
.calendar-box {
|
||||
-moz-appearance: listbox;
|
||||
border:1px solid black;
|
||||
background-color:white;
|
||||
}
|
||||
|
@ -124,6 +124,14 @@ nsNavBookmarks::Init()
|
||||
|
||||
nsCAutoString buffer;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = bundleService->CreateBundle(
|
||||
"chrome://browser/locale/places/places.properties",
|
||||
getter_AddRefs(mBundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mRoot) {
|
||||
// Locate the bookmarks and toolbar folders
|
||||
buffer.AssignLiteral("SELECT folder_child FROM moz_bookmarks_assoc a JOIN moz_bookmarks_containers c ON a.folder_child = c.id WHERE c.name = ?1 AND a.parent = ");
|
||||
@ -133,7 +141,10 @@ nsNavBookmarks::Init()
|
||||
rv = dbConn->CreateStatement(buffer, getter_AddRefs(locateChild));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = locateChild->BindStringParameter(0, NS_LITERAL_STRING("Bookmarks"));
|
||||
nsXPIDLString bookmarksMenuName;
|
||||
mBundle->GetStringFromName(NS_LITERAL_STRING("bookmarksMenuName").get(),
|
||||
getter_Copies(bookmarksMenuName));
|
||||
rv = locateChild->BindStringParameter(0, bookmarksMenuName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRBool results;
|
||||
rv = locateChild->ExecuteStep(&results);
|
||||
@ -143,7 +154,10 @@ nsNavBookmarks::Init()
|
||||
}
|
||||
rv = locateChild->Reset();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = locateChild->BindStringParameter(0, NS_LITERAL_STRING("Personal Toolbar Folder"));
|
||||
nsXPIDLString bookmarksToolbarName;
|
||||
mBundle->GetStringFromName(NS_LITERAL_STRING("bookmarksToolbarName").get(),
|
||||
getter_Copies(bookmarksToolbarName));
|
||||
rv = locateChild->BindStringParameter(0, bookmarksToolbarName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = locateChild->ExecuteStep(&results);
|
||||
if (results) {
|
||||
@ -168,12 +182,17 @@ nsNavBookmarks::Init()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if (!mBookmarksRoot) {
|
||||
CreateFolder(mRoot, NS_LITERAL_STRING("Bookmarks"), 0, &mBookmarksRoot);
|
||||
nsXPIDLString bookmarksMenuName;
|
||||
mBundle->GetStringFromName(NS_LITERAL_STRING("bookmarksMenuName").get(),
|
||||
getter_Copies(bookmarksMenuName));
|
||||
CreateFolder(mRoot, bookmarksMenuName, 0, &mBookmarksRoot);
|
||||
NS_ASSERTION(mBookmarksRoot != 0, "row id must be non-zero!");
|
||||
}
|
||||
if (!mToolbarRoot) {
|
||||
CreateFolder(mRoot, NS_LITERAL_STRING("Personal Toolbar Folder"), 1,
|
||||
&mToolbarRoot);
|
||||
nsXPIDLString bookmarksToolbarName;
|
||||
mBundle->GetStringFromName(NS_LITERAL_STRING("bookmarksToolbarName").get(),
|
||||
getter_Copies(bookmarksToolbarName));
|
||||
CreateFolder(mRoot, bookmarksToolbarName, 1, &mToolbarRoot);
|
||||
NS_ASSERTION(mToolbarRoot != 0, "row id must be non-zero!");
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsINavBookmarksService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsNavHistory.h"
|
||||
#include "nsBrowserCompsCID.h"
|
||||
|
||||
@ -124,4 +125,6 @@ private:
|
||||
nsCOMPtr<mozIStorageStatement> mDBFolderCount;
|
||||
|
||||
friend class nsNavFolderResultNode;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
};
|
||||
|
@ -196,6 +196,9 @@ const PRInt32 nsNavHistory::kAutoCompleteIndex_Typed = 3;
|
||||
static nsDataHashtable<nsStringHashKey, int>* gTldTypes;
|
||||
static const char* gQuitApplicationMessage = "quit-application";
|
||||
|
||||
nsIAtom* nsNavHistory::sMenuRootAtom = nsnull;
|
||||
nsIAtom* nsNavHistory::sToolbarRootAtom = nsnull;
|
||||
|
||||
nsNavHistory* nsNavHistory::gHistoryService;
|
||||
|
||||
|
||||
@ -207,6 +210,9 @@ nsNavHistory::nsNavHistory() : mNowValid(PR_FALSE),
|
||||
{
|
||||
NS_ASSERTION(! gHistoryService, "YOU ARE CREATING 2 COPIES OF THE HISTORY SERVICE. Everything will break.");
|
||||
gHistoryService = this;
|
||||
|
||||
sMenuRootAtom = NS_NewAtom("menu-root");
|
||||
sToolbarRootAtom = NS_NewAtom("toolbar-root");
|
||||
}
|
||||
|
||||
|
||||
@ -222,6 +228,9 @@ nsNavHistory::~nsNavHistory()
|
||||
// in case somebody creates an extra instance of the service.
|
||||
NS_ASSERTION(gHistoryService == this, "YOU CREATED 2 COPIES OF THE HISTORY SERVICE.");
|
||||
gHistoryService = nsnull;
|
||||
|
||||
NS_IF_RELEASE(sMenuRootAtom);
|
||||
NS_IF_RELEASE(sToolbarRootAtom);
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINavHistory.h"
|
||||
#include "nsIAutoCompleteSearch.h"
|
||||
#include "nsIAutoCompleteResult.h"
|
||||
@ -427,6 +428,9 @@ public:
|
||||
static const PRInt32 kGetInfoIndex_VisitDate;
|
||||
static const PRInt32 kGetInfoIndex_RevHost;
|
||||
|
||||
static nsIAtom* sMenuRootAtom;
|
||||
static nsIAtom* sToolbarRootAtom;
|
||||
|
||||
// Take a result returned from DBGetURLPageInfo and construct a
|
||||
// ResultNode.
|
||||
nsresult RowToResult(mozIStorageValueArray* aRow, PRBool aAsVisits,
|
||||
|
@ -65,6 +65,8 @@
|
||||
#include "prtime.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#define S(x) nsINavHistoryResult::##x
|
||||
|
||||
// emulate string comparison (used for sorting) for PRTime and int
|
||||
inline PRInt32 ComparePRTime(PRTime a, PRTime b)
|
||||
{
|
||||
@ -82,7 +84,6 @@ inline PRInt32 CompareIntegers(PRUint32 a, PRUint32 b)
|
||||
|
||||
// nsNavHistoryResultNode ******************************************************
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsNavHistoryResultNode,
|
||||
nsNavHistoryResultNode, nsINavHistoryResultNode)
|
||||
|
||||
@ -114,7 +115,7 @@ NS_IMETHODIMP nsNavHistoryResultNode::GetUrl(nsACString& aUrl)
|
||||
/* attribute PRInt64 folderId; */
|
||||
NS_IMETHODIMP nsNavHistoryResultNode::GetFolderId(PRInt64 *aID)
|
||||
{
|
||||
*aID = mType == RESULT_TYPE_FOLDER ? mID : 0;
|
||||
*aID = mType == nsINavHistoryResult::RESULT_TYPE_FOLDER ? mID : 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -286,7 +287,8 @@ nsNavHistoryResult::nsNavHistoryResult(nsNavHistory* aHistoryService,
|
||||
}
|
||||
if (aOptions)
|
||||
aOptions->Clone(getter_AddRefs(mSourceOptions));
|
||||
mType = RESULT_TYPE_QUERY;
|
||||
|
||||
mType = nsINavHistoryResult::RESULT_TYPE_QUERY;
|
||||
mFlatIndex = -1;
|
||||
mVisibleIndex = -1;
|
||||
}
|
||||
@ -735,12 +737,12 @@ PRInt32 PR_CALLBACK nsNavHistoryResult::SortComparison_URLLess(
|
||||
}
|
||||
|
||||
PRInt32 value;
|
||||
if (a->mType == nsINavHistoryResultNode::RESULT_TYPE_HOST) {
|
||||
if (a->mType == nsINavHistoryResult::RESULT_TYPE_HOST) {
|
||||
// for host nodes, use title (= host name)
|
||||
nsNavHistoryResult* result = NS_STATIC_CAST(nsNavHistoryResult*, closure);
|
||||
result->mCollation->CompareString(
|
||||
nsICollation::kCollationCaseInSensitive, a->mTitle, b->mTitle, &value);
|
||||
} else if (a->mType == nsINavHistoryResultNode::RESULT_TYPE_DAY) {
|
||||
} else if (a->mType == nsINavHistoryResult::RESULT_TYPE_DAY) {
|
||||
// date nodes use date (skip conflict resolution becuase it uses date too)
|
||||
return ComparePRTime(a->mTime, b->mTime);
|
||||
} else {
|
||||
@ -1007,19 +1009,34 @@ NS_IMETHODIMP nsNavHistoryResult::SetSelection(nsITreeSelection* aSelection)
|
||||
/* void getRowProperties (in long index, in nsISupportsArray properties); */
|
||||
NS_IMETHODIMP nsNavHistoryResult::GetRowProperties(PRInt32 index, nsISupportsArray *properties)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void getCellProperties (in long row, in nsITreeColumn col, in nsISupportsArray properties); */
|
||||
NS_IMETHODIMP nsNavHistoryResult::GetCellProperties(PRInt32 row, nsITreeColumn *col, nsISupportsArray *properties)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
if (row < 0 || row >= mVisibleElements.Count())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsNavHistoryResultNode *node = VisibleElementAt(row);
|
||||
PRInt64 folderId, bookmarksRootId, toolbarRootId;
|
||||
node->GetFolderId(&folderId);
|
||||
|
||||
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID));
|
||||
bms->GetBookmarksRoot(&bookmarksRootId);
|
||||
bms->GetToolbarRoot(&toolbarRootId);
|
||||
if (bookmarksRootId == folderId)
|
||||
properties->AppendElement(nsNavHistory::sMenuRootAtom);
|
||||
else if (toolbarRootId == folderId)
|
||||
properties->AppendElement(nsNavHistory::sToolbarRootAtom);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void getColumnProperties (in nsITreeColumn col, in nsISupportsArray properties); */
|
||||
NS_IMETHODIMP nsNavHistoryResult::GetColumnProperties(nsITreeColumn *col, nsISupportsArray *properties)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
@ -1032,8 +1049,8 @@ NS_IMETHODIMP nsNavHistoryResult::IsContainer(PRInt32 index, PRBool *_retval)
|
||||
|
||||
nsNavHistoryResultNode *node = VisibleElementAt(index);
|
||||
*_retval = (node->mChildren.Count() > 0 ||
|
||||
node->mType == nsINavHistoryResultNode::RESULT_TYPE_FOLDER ||
|
||||
node->mType == nsINavHistoryResultNode::RESULT_TYPE_QUERY);
|
||||
node->mType == nsINavHistoryResult::RESULT_TYPE_FOLDER ||
|
||||
node->mType == nsINavHistoryResult::RESULT_TYPE_QUERY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1205,8 +1222,8 @@ NS_IMETHODIMP nsNavHistoryResult::GetCellText(PRInt32 rowIndex,
|
||||
}
|
||||
case Column_Date:
|
||||
{
|
||||
if (elt->mType == nsINavHistoryResultNode::RESULT_TYPE_HOST ||
|
||||
elt->mType == nsINavHistoryResultNode::RESULT_TYPE_DAY) {
|
||||
if (elt->mType == nsINavHistoryResult::RESULT_TYPE_HOST ||
|
||||
elt->mType == nsINavHistoryResult::RESULT_TYPE_DAY) {
|
||||
// hosts and days shouldn't have a value for the date column. Actually,
|
||||
// you could argue this point, but looking at the results, seeing the
|
||||
// most recently visited date is not what I expect, and gives me no
|
||||
|
Loading…
x
Reference in New Issue
Block a user