mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 467670: Bookmark management (part 2), r=gavin
This commit is contained in:
parent
529613465f
commit
c6aaf1ca3a
@ -232,13 +232,15 @@
|
||||
<implementation>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this._itemId = this.getAttribute("itemid");
|
||||
this.init();
|
||||
let itemId = this.getAttribute("itemid");
|
||||
if (itemId)
|
||||
this.init(itemId);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<field name="_itemId"/>
|
||||
<field name="_itemId">null</field>
|
||||
<field name="_uri"/>
|
||||
<field name="_control">null</field>
|
||||
<field name="_isEditing">false</field>
|
||||
|
||||
<field name="_nameField">
|
||||
@ -252,10 +254,11 @@
|
||||
</field>
|
||||
<property name="itemId" onget="return this._itemId"/>
|
||||
<property name="type" onget="return this.getAttribute('type');"/>
|
||||
|
||||
<property name="name" onget="return this._nameField.value"
|
||||
onset="this._nameField.value = val; return val;"/>
|
||||
<property name="uri" onget="return this._uriField.value"
|
||||
onset="this._uriField.value = val; return val;"/>
|
||||
<property name="spec" onget="return this._uriField.value"
|
||||
onset="this._uriField.value = val; return val;"/>
|
||||
<property name="tags" onget="return this._tagsField.value"
|
||||
onset="this._tagsField.value = val; return val;"/>
|
||||
<property name="tagsAsArray" readonly="true">
|
||||
@ -282,10 +285,15 @@
|
||||
<property name="control" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this._control)
|
||||
return this._control;
|
||||
|
||||
let parent = this.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "placelist")
|
||||
return parent;
|
||||
if (parent.localName == "placelist") {
|
||||
this._control = parent;
|
||||
return this._control;
|
||||
}
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
@ -294,8 +302,13 @@
|
||||
</property>
|
||||
|
||||
<method name="init">
|
||||
<parameter name="aItemId"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._itemId = aItemId;
|
||||
if (!this._itemId)
|
||||
return;
|
||||
|
||||
this.name = PlacesUtils.bookmarks.getItemTitle(this._itemId);
|
||||
|
||||
try {
|
||||
@ -303,7 +316,7 @@
|
||||
} catch (e) {}
|
||||
|
||||
if (this._uri) {
|
||||
this.uri = this._uri.spec;
|
||||
this.spec = this._uri.spec;
|
||||
let fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
|
||||
let icon = document.getAnonymousElementByAttribute(this, "anonid", "favicon");
|
||||
icon.src = fis.getFaviconImageForPage(this._uri).spec;
|
||||
@ -381,9 +394,9 @@
|
||||
}
|
||||
|
||||
// If the URI was updated change it in the bookmark
|
||||
if (this._uri.spec != this.uri) {
|
||||
if (this._uri.spec != this.spec) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
uri = ios.newURI(this.uri, null, null);
|
||||
uri = ios.newURI(this.spec, null, null);
|
||||
|
||||
PlacesUtils.bookmarks.changeBookmarkURI(this._itemId, this._uri);
|
||||
}
|
||||
@ -417,14 +430,14 @@
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="selectFolder">
|
||||
<method name="move">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.control)
|
||||
this.control.activeItem = this;
|
||||
|
||||
let control = this.control || this;
|
||||
let code = control.getAttribute("onfolder");
|
||||
let code = control.getAttribute("onmove");
|
||||
if (code) {
|
||||
let func = new Function(code);
|
||||
func.call(control);
|
||||
@ -453,11 +466,11 @@
|
||||
<xul:rows>
|
||||
<xul:row align="center">
|
||||
<xul:textbox anonid="name" readonly="true" xbl:inherits="value=name"/>
|
||||
<xul:hbox anonid="edit-controls" class="bookmark-manage-controls">
|
||||
<xul:button anonid="close-button" class="close-button"
|
||||
oncommand="document.getBindingParent(this).remove()"/>
|
||||
<xul:hbox align="center" anonid="edit-controls" class="bookmark-manage-controls">
|
||||
<xul:image anonid="close-button" class="close-button"
|
||||
onmousedown="document.getBindingParent(this).remove()"/>
|
||||
<xul:button anonid="folder-button" label="&editBookmarkMove.label;"
|
||||
oncommand="document.getBindingParent(this).selectFolder()"/>
|
||||
oncommand="document.getBindingParent(this).move()"/>
|
||||
<xul:button anonid="edit-button" label="&editBookmarkEdit.label;"
|
||||
oncommand="document.getBindingParent(this).startEditing()"/>
|
||||
<xul:button anonid="done-button" label="&editBookmarkDone.label;" hidden="true"
|
||||
@ -500,11 +513,11 @@
|
||||
<xul:rows>
|
||||
<xul:row align="center">
|
||||
<xul:textbox anonid="name" readonly="true" xbl:inherits="value=name"/>
|
||||
<xul:hbox anonid="edit-controls" class="bookmark-manage-controls">
|
||||
<xul:button anonid="close-button" class="close-button"
|
||||
oncommand="document.getBindingParent(this).remove()"/>
|
||||
<xul:hbox align="center" anonid="edit-controls" class="bookmark-manage-controls">
|
||||
<xul:image anonid="close-button" class="close-button"
|
||||
onmousedown="document.getBindingParent(this).remove()"/>
|
||||
<xul:button anonid="folder-button" label="&editBookmarkMove.label;"
|
||||
oncommand="document.getBindingParent(this).selectFolder()"/>
|
||||
oncommand="document.getBindingParent(this).move()"/>
|
||||
<xul:button anonid="edit-button" label="&editBookmarkEdit.label;"
|
||||
oncommand="document.getBindingParent(this).startEditing()"/>
|
||||
<xul:button anonid="done-button" label="&editBookmarkDone.label;" hidden="true"
|
||||
@ -839,6 +852,9 @@
|
||||
if (!aLevel) {
|
||||
while (items.firstChild)
|
||||
items.removeChild(items.firstChild);
|
||||
|
||||
this.appendItem(aRootFolder, Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER, aLevel);
|
||||
aLevel += 24;
|
||||
}
|
||||
|
||||
let childItems = this._getChildren(aRootFolder);
|
||||
@ -867,14 +883,14 @@
|
||||
|
||||
// XXX make a <handler> for the mouseup
|
||||
var self = this;
|
||||
child.addEventListener("mouseup", function(e) { self._fireOpen(e, child); }, false);
|
||||
child.addEventListener("mouseup", function(e) { self._fireSelect(e, child); }, false);
|
||||
|
||||
return child;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_fireOpen">
|
||||
<method name="_fireSelect">
|
||||
<parameter name="aEvent"/>
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
@ -882,10 +898,9 @@
|
||||
// Force the item to be selected
|
||||
this._items.selectedItem = aItem;
|
||||
|
||||
// This is a callback used to forward information to some
|
||||
// external code
|
||||
let func = new Function(this.getAttribute("onopen"));
|
||||
func.call(this);
|
||||
// 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>
|
||||
|
@ -44,10 +44,9 @@ const TOOLBARSTATE_LOADED = 2;
|
||||
const UIMODE_NONE = 0;
|
||||
const UIMODE_URLVIEW = 1;
|
||||
const UIMODE_URLEDIT = 2;
|
||||
const UIMODE_BOOKMARK = 3;
|
||||
const UIMODE_TABS = 4;
|
||||
const UIMODE_CONTROLS = 5;
|
||||
const UIMODE_PANEL = 6;
|
||||
const UIMODE_TABS = 3;
|
||||
const UIMODE_CONTROLS = 4;
|
||||
const UIMODE_PANEL = 5;
|
||||
|
||||
const kMaxEngines = 4;
|
||||
const kDefaultFavIconURL = "chrome://browser/skin/images/default-favicon.png";
|
||||
@ -77,7 +76,6 @@ var BrowserUI = {
|
||||
_autocompleteNavbuttons : null,
|
||||
_favicon : null,
|
||||
_faviconLink : null,
|
||||
_editingBookmark : null,
|
||||
|
||||
_titleChanged : function(aDocument) {
|
||||
var browser = Browser.selectedBrowser;
|
||||
@ -400,7 +398,6 @@ var BrowserUI = {
|
||||
|
||||
this.mode = aMode;
|
||||
|
||||
let bookmark = document.getElementById("bookmark-container");
|
||||
let container = document.getElementById("browser-container");
|
||||
let panelUI = document.getElementById("panel-container");
|
||||
|
||||
@ -408,26 +405,15 @@ var BrowserUI = {
|
||||
this._showToolbar(false);
|
||||
this._editToolbar(false);
|
||||
|
||||
bookmark.hidden = true;
|
||||
panelUI.hidden = true;
|
||||
}
|
||||
else if (aMode == UIMODE_URLEDIT) {
|
||||
this._showToolbar(true);
|
||||
this._editToolbar(true);
|
||||
|
||||
bookmark.hidden = true;
|
||||
panelUI.hidden = true;
|
||||
}
|
||||
else if (aMode == UIMODE_BOOKMARK) {
|
||||
this._showToolbar(true);
|
||||
this._editToolbar(false);
|
||||
|
||||
panelUI.hidden = true;
|
||||
bookmark.hidden = false;
|
||||
bookmark.width = container.boxObject.width;
|
||||
}
|
||||
else if (aMode == UIMODE_PANEL) {
|
||||
bookmark.hidden = true;
|
||||
panelUI.hidden = false;
|
||||
panelUI.width = container.boxObject.width;
|
||||
panelUI.height = container.boxObject.height;
|
||||
@ -439,7 +425,6 @@ var BrowserUI = {
|
||||
else if (aMode == UIMODE_NONE) {
|
||||
this._showToolbar(false);
|
||||
this._edit.reallyClosePopup();
|
||||
bookmark.hidden = true;
|
||||
panelUI.hidden = true;
|
||||
}
|
||||
},
|
||||
@ -592,7 +577,6 @@ var BrowserUI = {
|
||||
this.show(UIMODE_NONE);
|
||||
}
|
||||
else {
|
||||
this.show(UIMODE_BOOKMARK);
|
||||
BookmarkHelper.edit(bookmarkURI);
|
||||
}
|
||||
break;
|
||||
@ -628,22 +612,38 @@ var BrowserUI = {
|
||||
};
|
||||
|
||||
var BookmarkHelper = {
|
||||
_panel: null,
|
||||
_editor: null,
|
||||
|
||||
edit: function(aURI) {
|
||||
var bookmarkEdit = document.getElementById("bookmark-edit");
|
||||
bookmarkEdit.startEditing(aURI);
|
||||
let itemId = PlacesUtils.getMostRecentBookmarkForURI(aURI);
|
||||
if (itemId == -1)
|
||||
return;
|
||||
|
||||
let container = document.getElementById("browser-container");
|
||||
this._panel = document.getElementById("bookmark-container");
|
||||
this._panel.hidden = false;
|
||||
this._panel.width = container.boxObject.width;
|
||||
|
||||
this._editor = document.getElementById("bookmark-edit");
|
||||
this._editor.init(itemId);
|
||||
this._editor.startEditing();
|
||||
|
||||
window.addEventListener("keypress", this, true);
|
||||
},
|
||||
|
||||
close: function() {
|
||||
var bookmarkEdit = document.getElementById("bookmark-edit");
|
||||
window.removeEventListener("keypress", this, true);
|
||||
BrowserUI.show(UIMODE_NONE);
|
||||
BrowserUI.updateStar();
|
||||
|
||||
if (this._editor.isEditing)
|
||||
this._editor.stopEditing();
|
||||
this._panel.hidden = true;
|
||||
},
|
||||
|
||||
handleEvent: function(aEvent) {
|
||||
if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE)
|
||||
document.getElementById("bookmark-edit").stopEditing(true);
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
@ -682,9 +682,9 @@ var BookmarkList = {
|
||||
|
||||
openBookmark: function() {
|
||||
let item = this._bookmarks.activeItem;
|
||||
if (item.uri) {
|
||||
if (item.spec) {
|
||||
this._panel.hidden = true;
|
||||
BrowserUI.goToURI(item.uri)
|
||||
BrowserUI.goToURI(item.spec)
|
||||
}
|
||||
},
|
||||
|
||||
@ -694,7 +694,7 @@ var BookmarkList = {
|
||||
}
|
||||
};
|
||||
|
||||
var FolderHelper = {
|
||||
var FolderPicker = {
|
||||
_control: null,
|
||||
_panel: null,
|
||||
|
||||
@ -715,12 +715,14 @@ var FolderHelper = {
|
||||
this._panel.hidden = true;
|
||||
},
|
||||
|
||||
selectFolder: function() {
|
||||
moveItem: function() {
|
||||
let folders = document.getElementById("folder-items");
|
||||
let folderId = PlacesUtils.bookmarks.getFolderIdForItem(this._control.activeItem.itemId);
|
||||
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(this._control.activeItem.itemId, folders.selectedItem.itemId, PlacesUtils.bookmarks.DEFAULT_INDEX);
|
||||
this._control.removeItem(this._control.activeItem);
|
||||
PlacesUtils.bookmarks.moveItem(itemId, folders.selectedItem.itemId, PlacesUtils.bookmarks.DEFAULT_INDEX);
|
||||
if (this._control.removeItem)
|
||||
this._control.removeItem(this._control.activeItem);
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
|
@ -330,7 +330,8 @@
|
||||
<vbox id="bookmark-container" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
|
||||
<hbox id="bookmark-form" align="start">
|
||||
<image id="bookmark-image" src="chrome://browser/skin/images/starred48.png"/>
|
||||
<placeitem id="bookmark-edit" type="bookmark" flex="1"
|
||||
<placeitem id="bookmark-edit" type="bookmark" flex="1" ui="manage"
|
||||
onmove="FolderPicker.show(this);"
|
||||
onclose="BookmarkHelper.close()"
|
||||
onchange="this.save()"/>
|
||||
</hbox>
|
||||
@ -344,7 +345,8 @@
|
||||
<toolbarbutton id="tool-bookmarks-close" class="urlbar-button"
|
||||
oncommand="BookmarkList.close();"/>
|
||||
</hbox>
|
||||
<placelist id="bookmark-items" type="bookmarks" flex="1" onfolder="FolderHelper.show(this);"
|
||||
<placelist id="bookmark-items" type="bookmarks" flex="1"
|
||||
onmove="FolderPicker.show(this);"
|
||||
onopen="BookmarkList.openBookmark();"/>
|
||||
</vbox>
|
||||
|
||||
@ -352,9 +354,9 @@
|
||||
<hbox id="folder-header" style="height: 60px">
|
||||
<description flex="1">&foldersHeader.label;</description>
|
||||
<toolbarbutton id="tool-folders-close" class="urlbar-button"
|
||||
oncommand="FolderHelper.close()"/>
|
||||
oncommand="FolderPicker.close()"/>
|
||||
</hbox>
|
||||
<placetree id="folder-items" type="bookmarks" mode="folders" flex="1" onopen="FolderHelper.selectFolder();"/>
|
||||
<placetree id="folder-items" type="bookmarks" mode="folders" flex="1" onselect="FolderPicker.moveItem();"/>
|
||||
</vbox>
|
||||
|
||||
</stack>
|
||||
|
@ -429,16 +429,21 @@ placelabel.bookmark-folder {
|
||||
}
|
||||
|
||||
placelist[ui="manage"] .bookmark-manage-controls,
|
||||
placelist[ui="manage"] .bookmark-folder-new {
|
||||
placelist[ui="manage"] .bookmark-folder-new,
|
||||
placeitem[ui="manage"] .bookmark-manage-controls {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
placeitem[ui="manage"] .bookmark-item-image {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-image: url("chrome://browser/skin/images/close-small.png");
|
||||
list-style-image: url("chrome://browser/skin/images/folder_close.png");
|
||||
}
|
||||
|
||||
#popup_autocomplete {
|
||||
@ -577,22 +582,6 @@ findbar {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
#bookmark-grid row {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
#bookmark-buttons {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
#bookmark-close {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-image: url("chrome://browser/skin/images/close-small.png");
|
||||
}
|
||||
|
||||
/* Identity popup -------------------------------------------------------- */
|
||||
/* Popup Icons */
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
BIN
mobile/themes/hildon/images/folder_close.png
Normal file
BIN
mobile/themes/hildon/images/folder_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -15,7 +15,6 @@ classic.jar:
|
||||
browser.css (browser.css)
|
||||
extensions.css (extensions.css)
|
||||
notification.css (notification.css)
|
||||
images/close-small.png (images/close-small.png)
|
||||
images/tab_close.png (images/tab_close.png)
|
||||
images/default-favicon.png (images/default-favicon.png)
|
||||
images/identity.png (images/identity.png)
|
||||
@ -42,3 +41,4 @@ classic.jar:
|
||||
images/navigation_magnifier.gif (images/navigation_magnifier.gif)
|
||||
images/page_buttons.png (images/page_buttons.png)
|
||||
images/folder.png (images/folder.png)
|
||||
images/folder_close.png (images/folder_close.png)
|
||||
|
@ -438,7 +438,7 @@ placelist[ui="manage"] .bookmark-folder-new {
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-image: url("chrome://browser/skin/images/close-small.png");
|
||||
list-style-image: url("chrome://browser/skin/images/folder_close.png");
|
||||
}
|
||||
|
||||
#popup_autocomplete {
|
||||
@ -577,23 +577,6 @@ findbar {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
#bookmark-grid row {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
#bookmark-buttons {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
#bookmark-close {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-image: url("chrome://browser/skin/images/close-small.png");
|
||||
}
|
||||
|
||||
/* Identity popup -------------------------------------------------------- */
|
||||
/* Popup Icons */
|
||||
#identity-popup-icon {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
BIN
mobile/themes/wince/images/folder_close.png
Normal file
BIN
mobile/themes/wince/images/folder_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -15,7 +15,6 @@ classic.jar:
|
||||
browser.css (browser.css)
|
||||
extensions.css (extensions.css)
|
||||
notification.css (notification.css)
|
||||
images/close-small.png (images/close-small.png)
|
||||
images/tab_close.png (images/tab_close.png)
|
||||
images/default-favicon.png (images/default-favicon.png)
|
||||
images/identity.png (images/identity.png)
|
||||
@ -42,3 +41,4 @@ classic.jar:
|
||||
images/navigation_magnifier.gif (images/navigation_magnifier.gif)
|
||||
images/page_buttons.png (images/page_buttons.png)
|
||||
images/folder.png (images/folder.png)
|
||||
images/folder_close.png (images/folder_close.png)
|
||||
|
Loading…
x
Reference in New Issue
Block a user