bug 171330: dropping foldergroup concept.

opening bookmarks in folder via context menu, middle-click and ctrl-click.
saving group of tabs in folder
+ speed optimizations
This commit is contained in:
chanial%noos.fr 2002-10-03 02:54:05 +00:00
Родитель 89dd3a05d2
Коммит 6ca7c9c655
9 изменённых файлов: 56 добавлений и 48 удалений

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

@ -98,6 +98,7 @@ Contributor(s):
<command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/> <command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/>
<command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/> <command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/>
<command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/> <command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/>
<command id="cmd_bm_openfolder" oncommand="goDoCommand('cmd_bm_openfolder');"/>
<command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/> <command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/>
<command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/> <command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/>
<command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/> <command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/>

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

@ -242,7 +242,7 @@ function onOK()
var url, rSource; var url, rSource;
if (addingGroup()) { if (addingGroup()) {
rSource = BMDS.createGroup(gFld_Name.value); rSource = BMDS.createFolder(gFld_Name.value);
const groups = window.arguments[5]; const groups = window.arguments[5];
for (var i = 0; i < groups.length; ++i) { for (var i = 0; i < groups.length; ++i) {
url = getNormalizedURL(groups[i].url); url = getNormalizedURL(groups[i].url);

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

@ -205,8 +205,8 @@ var BookmarksCommand = {
var commands = []; var commands = [];
// menu order: // menu order:
// //
// bm_open // bm_expandfolder
// bm_openfolder // bm_open, bm_openfolder
// bm_openinnewwindow // bm_openinnewwindow
// bm_openinnewtab // bm_openinnewtab
// --------------------- // ---------------------
@ -233,14 +233,14 @@ var BookmarksCommand = {
"bm_properties"]; "bm_properties"];
break; break;
case "Folder": case "Folder":
commands = ["bm_expandfolder", "bm_managefolder", "bm_separator", commands = ["bm_expandfolder", "bm_openfolder", "bm_managefolder", "bm_separator",
"bm_newfolder", "bm_separator", "bm_newfolder", "bm_separator",
"bm_cut", "bm_copy", "bm_paste", "bm_separator", "bm_cut", "bm_copy", "bm_paste", "bm_separator",
"bm_delete", "bm_separator", "bm_delete", "bm_separator",
"bm_properties"]; "bm_properties"];
break; break;
case "FolderGroup": case "FolderGroup":
commands = ["bm_open", "bm_expandfolder", "bm_separator", commands = ["bm_openfolder", "bm_expandfolder", "bm_separator",
"bm_newfolder", "bm_separator", "bm_newfolder", "bm_separator",
"bm_cut", "bm_copy", "bm_paste", "bm_separator", "bm_cut", "bm_copy", "bm_paste", "bm_separator",
"bm_delete", "bm_separator", "bm_delete", "bm_separator",
@ -339,7 +339,6 @@ var BookmarksCommand = {
manageFolder: function (aSelection) manageFolder: function (aSelection)
{ {
dump("ici:::::::::::::::::::::::::::")
openDialog("chrome://browser/content/bookmarks/bookmarksManager.xul", openDialog("chrome://browser/content/bookmarks/bookmarksManager.xul",
"", "chrome,all,dialog=no", aSelection.item[0].Value); "", "chrome,all,dialog=no", aSelection.item[0].Value);
}, },
@ -465,12 +464,13 @@ var BookmarksCommand = {
if (!aTargetBrowser) if (!aTargetBrowser)
return; return;
for (var i=0; i<aSelection.length; ++i) { for (var i=0; i<aSelection.length; ++i) {
var type = aSelection.type[i];
if (aTargetBrowser == "properties") if (aTargetBrowser == "properties")
openDialog("chrome://browser/content/bookmarks/bookmarksProperties.xul", openDialog("chrome://browser/content/bookmarks/bookmarksProperties.xul",
"", "centerscreen,chrome,resizable=no", aSelection.item[i].Value); "", "centerscreen,chrome,resizable=no", aSelection.item[i].Value);
else if (aSelection.type[i] == "Bookmark") else if (aSelection.type[i] == "Bookmark")
this.openOneBookmark(aSelection.item[i].Value, aTargetBrowser, aDS); this.openOneBookmark(aSelection.item[i].Value, aTargetBrowser, aDS);
else if (aSelection.type[i] == "FolderGroup" || aSelection.type[i] == "Folder") else if (type == "FolderGroup" || type == "Folder" || type == "PersonalToolbarFolder")
this.openGroupBookmark(aSelection.item[i].Value, aTargetBrowser); this.openGroupBookmark(aSelection.item[i].Value, aTargetBrowser);
} }
}, },
@ -481,7 +481,7 @@ var BookmarksCommand = {
var w, browser var w, browser
var url = BookmarksUtils.getProperty(aURI, NC_NS+"URL", aDS) var url = BookmarksUtils.getProperty(aURI, NC_NS+"URL", aDS)
// Ignore "NC:" and empty urls. // Ignore "NC:" and empty urls.
if (url == "" || url.substring(0,3) == "NC:") if (url == "")
return; return;
switch (aTargetBrowser) { switch (aTargetBrowser) {
case "current": case "current":
@ -506,7 +506,7 @@ var BookmarksCommand = {
openGroupBookmark: function (aURI, aTargetBrowser) openGroupBookmark: function (aURI, aTargetBrowser)
{ {
if (aTargetBrowser == "current") { if (aTargetBrowser == "current" || aTargetBrowser == "tab") {
var w = getTopWin(); var w = getTopWin();
var browser = w.document.getElementById("content"); var browser = w.document.getElementById("content");
var resource = RDF.GetResource(aURI); var resource = RDF.GetResource(aURI);
@ -534,7 +534,7 @@ var BookmarksCommand = {
// and focus the content // and focus the content
browser.focus(); browser.focus();
} else { } else {
dump("Open Group in new window/tab: not implemented...\n"); dump("Open Group in new window: not implemented...\n");
} }
}, },
@ -652,9 +652,10 @@ var BookmarksController = {
case "cmd_bm_delete": case "cmd_bm_delete":
case "cmd_bm_selectAll": case "cmd_bm_selectAll":
case "cmd_bm_open": case "cmd_bm_open":
case "cmd_bm_expandfolder":
case "cmd_bm_openinnewwindow": case "cmd_bm_openinnewwindow":
case "cmd_bm_openinnewtab": case "cmd_bm_openinnewtab":
case "cmd_bm_expandfolder":
case "cmd_bm_openfolder":
case "cmd_bm_managefolder": case "cmd_bm_managefolder":
case "cmd_bm_newbookmark": case "cmd_bm_newbookmark":
case "cmd_bm_newfolder": case "cmd_bm_newfolder":
@ -726,7 +727,20 @@ var BookmarksController = {
return isNotRef && length == 1; return isNotRef && length == 1;
case "cmd_bm_openinnewwindow": case "cmd_bm_openinnewwindow":
case "cmd_bm_openinnewtab": case "cmd_bm_openinnewtab":
return true; return true;
case "cmd_bm_openfolder":
for (var i=0; i<aSelection.length; ++i) {
if (aSelection.type[i] == "Bookmark" ||
aSelection.type[i] == "BookmarkSeparator")
return false;
RDFC.Init(BMDS, aSelection.item[i]);
var children = RDFC.GetElements();
while (children.hasMoreElements()) {
if (BookmarksUtils.resolveType(children.getNext()) == "Bookmark")
return true;
}
}
return false;
case "cmd_bm_find": case "cmd_bm_find":
case "cmd_bm_import": case "cmd_bm_import":
case "cmd_bm_export": case "cmd_bm_export":
@ -761,7 +775,6 @@ var BookmarksController = {
doCommand: function (aCommand, aSelection, aTarget) doCommand: function (aCommand, aSelection, aTarget)
{ {
dump(aCommand);
switch (aCommand) { switch (aCommand) {
case "cmd_undo": case "cmd_undo":
case "cmd_bm_undo": case "cmd_bm_undo":
@ -780,6 +793,9 @@ var BookmarksController = {
case "cmd_bm_openinnewtab": case "cmd_bm_openinnewtab":
BookmarksCommand.openBookmark(aSelection, "tab"); BookmarksCommand.openBookmark(aSelection, "tab");
break; break;
case "cmd_bm_openfolder":
BookmarksCommand.openBookmark(aSelection, "current");
break;
case "cmd_bm_managefolder": case "cmd_bm_managefolder":
BookmarksCommand.manageFolder(aSelection); BookmarksCommand.manageFolder(aSelection);
break; break;
@ -842,7 +858,7 @@ var BookmarksController = {
"cmd_bm_setpersonaltoolbarfolder", "cmd_bm_setpersonaltoolbarfolder",
"cmd_bm_setnewbookmarkfolder", "cmd_bm_setnewbookmarkfolder",
"cmd_bm_setnewsearchfolder", "cmd_bm_movebookmark", "cmd_bm_setnewsearchfolder", "cmd_bm_movebookmark",
"cmd_bm_managefolder"]; "cmd_bm_openfolder", "cmd_bm_managefolder"];
for (var i = 0; i < commands.length; ++i) { for (var i = 0; i < commands.length; ++i) {
var enabled = this.isCommandEnabled(commands[i], aSelection, aTarget); var enabled = this.isCommandEnabled(commands[i], aSelection, aTarget);
var commandNode = document.getElementById(commands[i]); var commandNode = document.getElementById(commands[i]);

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

@ -70,12 +70,6 @@
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/> <script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
<commands id="commands"> <commands id="commands">
<commandset id="CommandUpdate_Bookmarks"
commandupdater="true"
events="focus,tree-select"
oncommandupdate="document.getElementById('bookmarks-view').onCommandUpdate();">
</commandset>
<commandset id="selectEditMenuItems"/> <commandset id="selectEditMenuItems"/>
<commandset id="globalEditMenuItems"/> <commandset id="globalEditMenuItems"/>
<commandset id="tasksCommands"/> <commandset id="tasksCommands"/>
@ -91,6 +85,7 @@
<command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/> <command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/>
<command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/> <command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/>
<command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/> <command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/>
<command id="cmd_bm_openfolder" oncommand="goDoCommand('cmd_bm_openfolder');"/>
<command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/> <command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/>
<command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/> <command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/>
<command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/> <command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/>
@ -206,6 +201,11 @@
accesskey="&menuitem.view.command.toolbar.accesskey;" accesskey="&menuitem.view.command.toolbar.accesskey;"
oncommand="goToggleToolbar('command-toolbar', 'viewCommandToolbar'); event.preventBubble();" oncommand="goToggleToolbar('command-toolbar', 'viewCommandToolbar'); event.preventBubble();"
persist="checked"/> persist="checked"/>
<menu id="descending" label="&menuitem.view.show_columns.label;"
accesskey="&menuitem.view.show_columns.accesskey;">
<menupopup id="columnsPopup" onpopupshowing="fillColumnsMenu(event);"
oncommand="onViewMenuColumnItemSelected(event);"/>
</menu>
<menuseparator id="fill-after-this-node"/> <menuseparator id="fill-after-this-node"/>
<menuitem id="natural" label="&menuitem.view.unsorted.label;" <menuitem id="natural" label="&menuitem.view.unsorted.label;"
accesskey="&menuitem.view.unsorted.accesskey;" accesskey="&menuitem.view.unsorted.accesskey;"
@ -221,12 +221,6 @@
type="radio" type="radio"
resource="direction" name="sortDirectionSet"/> resource="direction" name="sortDirectionSet"/>
<menuseparator/> <menuseparator/>
<menu id="descending" label="&menuitem.view.show_columns.label;"
accesskey="&menuitem.view.show_columns.accesskey;">
<menupopup id="columnsPopup" onpopupshowing="fillColumnsMenu(event);"
oncommand="onViewMenuColumnItemSelected(event);"/>
</menu>
<menuseparator/>
<menuitem label="&menuitem.personaltoolbarfolder.label;" <menuitem label="&menuitem.personaltoolbarfolder.label;"
command="cmd_bm_setpersonaltoolbarfolder" command="cmd_bm_setpersonaltoolbarfolder"
accesskey="&menuitem.personaltoolbarfolder.accesskey;"/> accesskey="&menuitem.personaltoolbarfolder.accesskey;"/>

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

@ -50,16 +50,12 @@
<!-- bookmarks & edit commands --> <!-- bookmarks & edit commands -->
<commands id="commands"> <commands id="commands">
<commandset id="CommandUpdate_Bookmarks"
commandupdater="true"
events="click,focus"
oncommandupdate="document.getElementById('bookmarks-view').onCommandUpdate();">
</commandset>
<commandset id="bookmarksItems"> <commandset id="bookmarksItems">
<command id="cmd_bm_open" oncommand="goDoCommand('cmd_bm_open');"/> <command id="cmd_bm_open" oncommand="goDoCommand('cmd_bm_open');"/>
<command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/> <command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/>
<command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/> <command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/>
<command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/> <command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/>
<command id="cmd_bm_openfolder" oncommand="goDoCommand('cmd_bm_openfolder');"/>
<command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/> <command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/>
<command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/> <command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/>
<command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/> <command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/>

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

@ -437,22 +437,22 @@ dump("error in refresh sort:"+e)
return; return;
var browserTarget = BookmarksUtils.getBrowserTargetFromEvent(aEvent); var browserTarget = BookmarksUtils.getBrowserTargetFromEvent(aEvent);
if (this.clickCount == 1 || browserTarget != "current" && if (this.clickCount == 1 || browserTarget != "current" &&
this.clickCount == aClickCount && !this.treeBoxObject.selection.isSelected(row)) this.clickCount == aClickCount && !this.treeBoxObject.selection.isSelected(row)) {
this.treeBoxObject.selection.select(row) this.treeBoxObject.selection.select(row);
this._selection = this.getTreeSelection();
var selection = this.getTreeSelection(); }
this._selection = selection; var selection = this._selection;
var isFolderGroup = selection.type[0] == "FolderGroup";
if (!isFolderGroup && selection.isContainer[0]) { if (selection.type[0] != "FolderGroup" && selection.isContainer[0]) {
if (this.clickCount == 1) { var modifKey = aEvent.shiftKey || aEvent.ctrlKey || aEvent.altKey ||
if (row >= 0) { aEvent.metaKey || aEvent.button == 1;
this.treeBoxObject.view.toggleOpenState(row); if (this.clickCount == 1 && !modifKey) {
} this.treeBoxObject.view.toggleOpenState(row);
if (selection.protocol[0] != "file")
return;
} }
if (selection.protocol[0] != "file") }
return;
}
BookmarksCommand.openBookmark(selection, browserTarget, this.db); BookmarksCommand.openBookmark(selection, browserTarget, this.db);
]]></body> ]]></body>
</method> </method>

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

@ -39,7 +39,7 @@
<!ENTITY button.defaultfolder.label "Use Default"> <!ENTITY button.defaultfolder.label "Use Default">
<!ENTITY button.defaultfolder.accesskey "d"> <!ENTITY button.defaultfolder.accesskey "d">
<!ENTITY selectFolder.label "Choose Folder"> <!ENTITY selectFolder.label "Choose Folder">
<!ENTITY addGroup.label "Bookmark this group of tabs"> <!ENTITY addGroup.label "Bookmark all tabs in a folder">
<!ENTITY addGroup.accesskey "B"> <!ENTITY addGroup.accesskey "B">

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

@ -51,14 +51,14 @@
<!ENTITY menuitem.view.command.toolbar.label "Toolbar"> <!ENTITY menuitem.view.command.toolbar.label "Toolbar">
<!ENTITY menuitem.view.command.toolbar.accesskey "t"> <!ENTITY menuitem.view.command.toolbar.accesskey "t">
<!ENTITY menuitem.view.show_columns.label "Show columns">
<!ENTITY menuitem.view.show_columns.accesskey "S">
<!ENTITY menuitem.view.unsorted.label "Unsorted"> <!ENTITY menuitem.view.unsorted.label "Unsorted">
<!ENTITY menuitem.view.unsorted.accesskey "u"> <!ENTITY menuitem.view.unsorted.accesskey "u">
<!ENTITY menuitem.view.ascending.label "A > Z Sort Order"> <!ENTITY menuitem.view.ascending.label "A > Z Sort Order">
<!ENTITY menuitem.view.ascending.accesskey "a"> <!ENTITY menuitem.view.ascending.accesskey "a">
<!ENTITY menuitem.view.descending.label "Z > A Sort Order"> <!ENTITY menuitem.view.descending.label "Z > A Sort Order">
<!ENTITY menuitem.view.descending.accesskey "z"> <!ENTITY menuitem.view.descending.accesskey "z">
<!ENTITY menuitem.view.show_columns.label "Show columns">
<!ENTITY menuitem.view.show_columns.accesskey "S">
<!ENTITY menuitem.newbookmarkfolder.label "Set as New Bookmark Folder"> <!ENTITY menuitem.newbookmarkfolder.label "Set as New Bookmark Folder">
<!ENTITY menuitem.newbookmarkfolder.accesskey "b"> <!ENTITY menuitem.newbookmarkfolder.accesskey "b">
<!ENTITY menuitem.newinternetsearchfolder.label "Set as New Internet Search Folder"> <!ENTITY menuitem.newinternetsearchfolder.label "Set as New Internet Search Folder">

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

@ -29,6 +29,7 @@ description_NewBookmarkAndSearchFolder = Newly created bookmarks and search resu
cmd_bm_open = Open cmd_bm_open = Open
cmd_bm_expandfolder = Expand cmd_bm_expandfolder = Expand
cmd_bm_collapsefolder = Collapse cmd_bm_collapsefolder = Collapse
cmd_bm_openfolder = Open in tabs
cmd_bm_managefolder = Manage Folder cmd_bm_managefolder = Manage Folder
cmd_bm_find = Find a Bookmark... cmd_bm_find = Find a Bookmark...
cmd_bm_cut = Cut cmd_bm_cut = Cut