mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 516958: Remove folder creation from bookmark system, r=vivien
This commit is contained in:
parent
27682c4686
commit
bf1d173724
@ -599,21 +599,6 @@
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="move">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.control)
|
||||
this.control.activeItem = this;
|
||||
|
||||
let control = this.control || this;
|
||||
let code = control.getAttribute("onmove");
|
||||
if (code) {
|
||||
let func = new Function(code);
|
||||
func.call(control);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="updateFields">
|
||||
<body>
|
||||
<![CDATA[
|
||||
@ -647,8 +632,6 @@
|
||||
<xul:hbox anonid="bookmark-manage-controls" align="center" class="bookmark-manage-controls" hidden="true">
|
||||
<xul:button anonid="close-button" class="bookmark-close-button"
|
||||
label="&editBookmarkRemove.label;" oncommand="document.getBindingParent(this).remove()"/>
|
||||
<xul:button anonid="folder-button" class="bookmark-folder-button"
|
||||
label="&editBookmarkMove.label;" oncommand="document.getBindingParent(this).move()"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button anonid="done-button" label="&editBookmarkDone.label;"
|
||||
oncommand="document.getBindingParent(this).stopEditing(true)"/>
|
||||
@ -850,32 +833,6 @@
|
||||
let node = childItems[i];
|
||||
children.appendChild(this.createItem(node));
|
||||
}
|
||||
|
||||
// Add the "<new folder>" item
|
||||
let newFolder = document.createElementNS(XULNS, "button");
|
||||
newFolder.setAttribute("class", "bookmark-folder-new");
|
||||
newFolder.setAttribute("label", this._bundle.GetStringFromName("editBookmarkAddFolder"));
|
||||
children.appendChild(newFolder);
|
||||
|
||||
// XXX Fix me - use <handler>?
|
||||
newFolder.addEventListener("click", function(e) { self.addFolder(); }, false);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addFolder">
|
||||
<body>
|
||||
<![CDATA[
|
||||
let parents = this._parents;
|
||||
let parent = parents.lastChild;
|
||||
if ("itemId" in parent) {
|
||||
let children = this._children;
|
||||
let title = this._bundle.GetStringFromName("editBookmarkNewFolder");
|
||||
let newId = PlacesUtils.bookmarks.createFolder(parent.itemId, title, PlacesUtils.bookmarks.DEFAULT_INDEX);
|
||||
let child = this.createItem({ itemId: newId, title: title, type: Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER });
|
||||
children.insertBefore(child, children.lastChild);
|
||||
child.startEditing(true);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -947,133 +904,6 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="place-tree">
|
||||
<content orient="vertical" flex="1">
|
||||
<xul:richlistbox anonid="items" class="place-tree-items" flex="1"/>
|
||||
</content>
|
||||
<implementation>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._type = this.getAttribute("type");
|
||||
this._mode = this.getAttribute("mode");
|
||||
]]>
|
||||
</constructor>
|
||||
<field name="_type"/>
|
||||
<field name="_mode"/>
|
||||
<field name="_items">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "items");
|
||||
</field>
|
||||
|
||||
<property name="scrollBoxObject" readonly="true" onget="return this._items.scrollBoxObject;"/>
|
||||
|
||||
<property name="selectedItem" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this._items.selectedItem;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="_getChildren">
|
||||
<parameter name="aFolder"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
let items = [];
|
||||
|
||||
let options = PlacesUtils.history.getNewQueryOptions();
|
||||
options.queryType = (this._type == "bookmarks" ? options.QUERY_TYPE_BOOKMARKS : options.QUERY_TYPE_HISTORY);
|
||||
let query = PlacesUtils.history.getNewQuery();
|
||||
|
||||
if (aFolder)
|
||||
query.setFolders([aFolder], 1);
|
||||
let result = PlacesUtils.history.executeQuery(query, options);
|
||||
let rootNode = result.root;
|
||||
rootNode.containerOpen = true;
|
||||
let cc = rootNode.childCount;
|
||||
|
||||
for (var i=0; i<cc; ++i) {
|
||||
var node = rootNode.getChild(i);
|
||||
if (this._mode == "folders" && node.type == node.RESULT_TYPE_FOLDER) {
|
||||
items.push(node);
|
||||
}
|
||||
else if (this._mode == "") {
|
||||
items.push(node);
|
||||
}
|
||||
}
|
||||
rootNode.containerOpen = false;
|
||||
return items;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="openFolder">
|
||||
<parameter name="aRootFolder"/>
|
||||
<parameter name="aLevel"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
aRootFolder = aRootFolder || PlacesUtils.bookmarks.unfiledBookmarksFolder;
|
||||
aLevel = aLevel || 0;
|
||||
|
||||
let items = this._items;
|
||||
if (!aLevel) {
|
||||
while (items.firstChild)
|
||||
items.removeChild(items.firstChild);
|
||||
|
||||
let node = { itemId: aRootFolder, title: PlacesUtils.bookmarks.getItemTitle(aRootFolder), type: Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER };
|
||||
items.appendChild(this.createItem(node, aLevel));
|
||||
aLevel += 24;
|
||||
}
|
||||
|
||||
let childItems = this._getChildren(aRootFolder);
|
||||
for (let i=0; i<childItems.length; i++) {
|
||||
let node = childItems[i];
|
||||
items.appendChild(this.createItem(node, aLevel));
|
||||
|
||||
this.openFolder(node.itemId, aLevel + 24);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="createItem">
|
||||
<parameter name="aItem"/>
|
||||
<parameter name="aLevel"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
let child = document.createElementNS(XULNS, "placelabel");
|
||||
child.setAttribute("type", "folder");
|
||||
child.setAttribute("itemid", aItem.itemId);
|
||||
child.setAttribute("title", aItem.title);
|
||||
child.setAttribute("indent", aLevel);
|
||||
|
||||
// XXX make a <handler>
|
||||
var self = this;
|
||||
child.addEventListener("click", function(e) { self._fireSelect(e, child); }, false);
|
||||
|
||||
return child;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireSelect">
|
||||
<parameter name="aEvent"/>
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Force the item to be selected
|
||||
this._items.selectedItem = aItem;
|
||||
|
||||
// the richlistbox will fire an onselect event, which will bubble to
|
||||
// the placetree onselect handler. We don't need to explicitly fire
|
||||
// anything here.
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
|
||||
<handlers>
|
||||
<handler event="mousedown" phase="capturing">
|
||||
|
@ -880,7 +880,6 @@ var BookmarkHelper = {
|
||||
this._editor.setAttribute("title", title);
|
||||
this._editor.setAttribute("uri", aURI.spec);
|
||||
this._editor.setAttribute("tags", tags.join(", "));
|
||||
this._editor.setAttribute("onmove", "FolderPicker.show(this);");
|
||||
this._editor.setAttribute("onclose", "BookmarkHelper.close()");
|
||||
document.getElementById("bookmark-form").appendChild(this._editor);
|
||||
|
||||
@ -949,41 +948,6 @@ var BookmarkList = {
|
||||
this.close();
|
||||
BrowserUI.goToURI(item.spec);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var FolderPicker = {
|
||||
_control: null,
|
||||
_panel: null,
|
||||
|
||||
show: function(aControl) {
|
||||
this._panel = document.getElementById("folder-container");
|
||||
this._panel.width = window.innerWidth;
|
||||
this._panel.height = window.innerHeight;
|
||||
this._panel.hidden = false;
|
||||
BrowserUI.pushDialog(this);
|
||||
|
||||
this._control = aControl;
|
||||
|
||||
let folders = document.getElementById("folder-items");
|
||||
folders.openFolder();
|
||||
},
|
||||
|
||||
close: function() {
|
||||
this._panel.hidden = true;
|
||||
BrowserUI.popDialog();
|
||||
},
|
||||
|
||||
moveItem: function() {
|
||||
let folders = document.getElementById("folder-items");
|
||||
let itemId = (this._control.activeItem ? this._control.activeItem.itemId : this._control.itemId);
|
||||
let folderId = PlacesUtils.bookmarks.getFolderIdForItem(itemId);
|
||||
if (folders.selectedItem.itemId != folderId) {
|
||||
PlacesUtils.bookmarks.moveItem(itemId, folders.selectedItem.itemId, PlacesUtils.bookmarks.DEFAULT_INDEX);
|
||||
if (this._control.removeItem)
|
||||
this._control.removeItem(this._control.activeItem);
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -71,10 +71,6 @@ placelist {
|
||||
-moz-binding: url("chrome://browser/content/bindings.xml#place-list");
|
||||
}
|
||||
|
||||
placetree {
|
||||
-moz-binding: url("chrome://browser/content/bindings.xml#place-tree");
|
||||
}
|
||||
|
||||
placelabel {
|
||||
-moz-binding: url("chrome://browser/content/bindings.xml#place-label");
|
||||
}
|
||||
|
@ -426,17 +426,7 @@
|
||||
label="&bookmarksManage.label;" oncommand="BookmarkList.toggleManage();"/>
|
||||
<toolbarbutton id="tool-bookmarks-close" class="urlbar-button button-image" command="cmd_close"/>
|
||||
</hbox>
|
||||
<placelist id="bookmark-items" type="bookmarks" flex="1"
|
||||
onmove="FolderPicker.show(this);"
|
||||
onopen="BookmarkList.openBookmark();"/>
|
||||
</vbox>
|
||||
|
||||
<vbox id="folder-container" class="panel-dark" hidden="true" top="0" left="0">
|
||||
<hbox id="folder-header">
|
||||
<description flex="1">&foldersHeader.label;</description>
|
||||
<toolbarbutton id="tool-folders-close" class="urlbar-button button-image" command="cmd_close"/>
|
||||
</hbox>
|
||||
<placetree id="folder-items" type="bookmarks" mode="folders" flex="1" onselect="FolderPicker.moveItem();"/>
|
||||
<placelist id="bookmark-items" type="bookmarks" flex="1" onopen="BookmarkList.openBookmark();"/>
|
||||
</vbox>
|
||||
|
||||
<vbox id="helperapp-container" class="dialog-dark" hidden="true" align="center" top="0" left="0">
|
||||
|
@ -21,10 +21,8 @@
|
||||
|
||||
<!ENTITY bookmarksHeader.label "Bookmarks">
|
||||
<!ENTITY bookmarksManage.label "Manage">
|
||||
<!ENTITY foldersHeader.label "Folders">
|
||||
|
||||
<!ENTITY editBookmarkRemove.label "Remove">
|
||||
<!ENTITY editBookmarkMove.label "Move">
|
||||
<!ENTITY editBookmarkDone.label "Done">
|
||||
<!ENTITY editBookmarkTags.label "Add tags here">
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
# Bookmarks
|
||||
editBookmarkAddFolder=Add a new folder
|
||||
editBookmarkNewFolder=New folder
|
||||
|
||||
# Add-on Manager
|
||||
addonsRestart=Restart to complete changes
|
||||
addonsRestartButton.label=Restart
|
||||
|
@ -405,8 +405,7 @@ toolbarbutton.page-button {
|
||||
}
|
||||
|
||||
/* URL List and autocomplete navigation popup ------------------------------ */
|
||||
#tool-bookmarks-close,
|
||||
#tool-folders-close {
|
||||
#tool-bookmarks-close {
|
||||
min-height: 0 !important;
|
||||
min-width: 0 !important;
|
||||
margin-top: -40px; /* keep pixels */
|
||||
@ -417,17 +416,13 @@ toolbarbutton.page-button {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#bookmarklist-header, #folder-header {
|
||||
#bookmarklist-header {
|
||||
color: rgb(255,255,255);
|
||||
-moz-box-align: center;
|
||||
padding: 2.2mm; /* core spacing */
|
||||
}
|
||||
|
||||
#folder-header {
|
||||
height: 21.4mm; /* fake the height of the URLbar: 17mm + 2.2mm + 2.2mm */
|
||||
}
|
||||
|
||||
#bookmark-items, #folder-items {
|
||||
#bookmark-items {
|
||||
-moz-appearance: none !important;
|
||||
background-color: rgb(255,255,255);
|
||||
padding: 0;
|
||||
@ -501,7 +496,7 @@ placelabel.bookmark-folder {
|
||||
}
|
||||
|
||||
/* folders have a fixed image */
|
||||
placeitem[type=folder] .bookmark-item-image {
|
||||
placeitem[type="folder"] .bookmark-item-image {
|
||||
list-style-image: url("chrome://browser/skin/images/folder-30.png");
|
||||
}
|
||||
|
||||
@ -510,26 +505,17 @@ placeitem[type="folder"] {
|
||||
}
|
||||
|
||||
/* hide the unuseful fields for folder */
|
||||
placeitem[type=folder] .bookmark-item-uri,
|
||||
placeitem[type=folder] .bookmark-item-tags {
|
||||
placeitem[type="folder"] .bookmark-item-uri,
|
||||
placeitem[type="folder"] .bookmark-item-tags {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* control the manage controls */
|
||||
.bookmark-folder-new {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
placelist[ui="manage"] .bookmark-folder-new {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
placelist[ui="manage"] placeitem[type="folder"] {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
placeitem[ui="manage"] .bookmark-close-button,
|
||||
placeitem[ui="manage"] .bookmark-folder-button,
|
||||
placeitem[ui="manage"] .bookmark-item-image {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
@ -233,8 +233,7 @@
|
||||
}
|
||||
|
||||
/* URL List and autocomplete navigation popup ------------------------------ */
|
||||
#tool-bookmarks-close,
|
||||
#tool-folders-close {
|
||||
#tool-bookmarks-close {
|
||||
min-height: 0 !important;
|
||||
min-width: 0 !important;
|
||||
margin-top: -40px; /* keep pixels */
|
||||
@ -242,7 +241,7 @@
|
||||
}
|
||||
|
||||
/* folders have a fixed image */
|
||||
placeitem[type=folder] .bookmark-item-image {
|
||||
placeitem[type="folder"] .bookmark-item-image {
|
||||
list-style-image: url("chrome://browser/skin/images/folder-30.png");
|
||||
}
|
||||
|
||||
|
@ -232,8 +232,7 @@
|
||||
}
|
||||
|
||||
/* URL List and autocomplete navigation popup ------------------------------ */
|
||||
#tool-bookmarks-close,
|
||||
#tool-folders-close {
|
||||
#tool-bookmarks-close {
|
||||
min-height: 0 !important;
|
||||
min-width: 0 !important;
|
||||
margin-top: -18px; /* keep pixels */
|
||||
@ -241,7 +240,7 @@
|
||||
}
|
||||
|
||||
/* folders have a fixed image */
|
||||
placeitem[type=folder] .bookmark-item-image {
|
||||
placeitem[type="folder"] .bookmark-item-image {
|
||||
list-style-image: url("chrome://browser/skin/images/folder-24.png");
|
||||
}
|
||||
|
||||
|
@ -204,17 +204,13 @@ toolbarbutton.page-button {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#bookmarklist-header, #folder-header {
|
||||
#bookmarklist-header {
|
||||
color: rgb(255,255,255);
|
||||
-moz-box-align: center;
|
||||
padding: 1.1mm; /* core spacing */
|
||||
}
|
||||
|
||||
#folder-header {
|
||||
height: 10.7mm; /* fake the height of the URLbar: 8.5mm + 1.1mm + 1.1mm */
|
||||
}
|
||||
|
||||
#bookmark-items, #folder-items {
|
||||
#bookmark-items {
|
||||
-moz-appearance: none !important;
|
||||
background-color: rgb(255,255,255);
|
||||
padding: 0;
|
||||
@ -292,26 +288,17 @@ placeitem[type="folder"] {
|
||||
}
|
||||
|
||||
/* hide the unuseful fields for folder */
|
||||
placeitem[type=folder] .bookmark-item-uri,
|
||||
placeitem[type=folder] .bookmark-item-tags {
|
||||
placeitem[type="folder"] .bookmark-item-uri,
|
||||
placeitem[type="folder"] .bookmark-item-tags {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* control the manage controls */
|
||||
.bookmark-folder-new {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
placelist[ui="manage"] .bookmark-folder-new {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
placelist[ui="manage"] placeitem[type="folder"] {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
placeitem[ui="manage"] .bookmark-close-button,
|
||||
placeitem[ui="manage"] .bookmark-folder-button,
|
||||
placeitem[ui="manage"] .bookmark-item-image {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user