зеркало из https://github.com/mozilla/pjs.git
Bookmarks Window Updates, includes fixes for
27495, 38004, 42080, 43146, 43753, 47494, 50835, 53403, 55447, 55448, 55787 r=blake, a=hyatt
This commit is contained in:
Родитель
27fc1d0eff
Коммит
3cc7841386
|
@ -23,15 +23,10 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* XXX - need to split tree rules out into their own file to
|
||||
* be included by bm window/panel to help with startup time
|
||||
* and bloat.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Home button
|
||||
* Style rules for bookmark items in Navigator.
|
||||
**/
|
||||
|
||||
|
||||
#home-button
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home.gif");
|
||||
|
@ -159,100 +154,3 @@
|
|||
color : ThreeDHighlight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bookmarks tree items
|
||||
**/
|
||||
.treecell-bookmark
|
||||
{
|
||||
list-style-image : inherit;
|
||||
}
|
||||
|
||||
.treeitem-bookmark
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/location.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[container="true"][open="true"][loading="true"]
|
||||
{
|
||||
list-style-image : url("chrome://global/skin/loading.gif") ! important ;
|
||||
}
|
||||
|
||||
.treeitem-bookmark[status="new"]
|
||||
{
|
||||
list-style-image : url("chrome://global/skin/loading.gif") ! important ;
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#Folder"],
|
||||
.treeitem-bookmark[container="true"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-closed.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#Folder"][open="true"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-open.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[container="true"][open="true"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-open.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-closed.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-open.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#BookmarkSeparator"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/location.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#Bookmark"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/location.gif");
|
||||
}
|
||||
|
||||
/**
|
||||
* XXX - need to create some different icons for file system objects
|
||||
**/
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"][open="true"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/directory/file-folder-open.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#FileSystemObject"][container="true"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/directory/file-folder-closed.gif");
|
||||
}
|
||||
|
||||
.treeitem-bookmark[type="http://home.netscape.com/NC-rdf#FileSystemObject"]
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/directory/file-icon.gif");
|
||||
}
|
||||
|
||||
/**
|
||||
* Bookmarks tree
|
||||
**/
|
||||
.bookmarks-panel-tree, .bookmarks-panel-tree > .tree-container-treerows
|
||||
{
|
||||
border : none;
|
||||
}
|
||||
|
||||
#bookmarksTree
|
||||
{
|
||||
border-top : none;
|
||||
border-bottom : none;
|
||||
}
|
||||
|
||||
#navprintplus
|
||||
{
|
||||
display:none !important;
|
||||
}
|
||||
|
||||
|
Двоичные данные
themes/classic/communicator/bookmarks/personal-folder-closed.gif
Двоичные данные
themes/classic/communicator/bookmarks/personal-folder-closed.gif
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 70 B После Ширина: | Высота: | Размер: 0 B |
Двоичные данные
themes/classic/communicator/bookmarks/personal-folder-open.gif
Двоичные данные
themes/classic/communicator/bookmarks/personal-folder-open.gif
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 73 B После Ширина: | Высота: | Размер: 0 B |
|
@ -9,6 +9,7 @@
|
|||
min-width : 47px;
|
||||
margin : 0px;
|
||||
border : 1px solid transparent;
|
||||
color : WindowText;
|
||||
background-color : transparent;
|
||||
-moz-user-focus : ignore;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,37 @@
|
|||
list-style-image : url("chrome://communicator/skin/content-small.gif");
|
||||
}
|
||||
|
||||
/*
|
||||
comment out really bad style rules, but leave them here so future intent is
|
||||
clear
|
||||
|
||||
.tree-sidebar .thumb-box
|
||||
{
|
||||
border : none;
|
||||
}
|
||||
|
||||
.tree-sidebar thumb
|
||||
{
|
||||
border-left : 1px solid ThreeDHighlight;
|
||||
border-top : 1px solid ThreeDHighlight;
|
||||
border-right : 1px solid ThreeDShadow;
|
||||
border-bottom : 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
.tree-sidebar .scrollbarbutton-box
|
||||
{
|
||||
border : none;
|
||||
}
|
||||
|
||||
.tree-sidebar scrollbarbutton
|
||||
{
|
||||
border-left : 1px solid ThreeDHighlight;
|
||||
border-top : 1px solid ThreeDHighlight;
|
||||
border-right : 1px solid ThreeDShadow;
|
||||
border-bottom : 1px solid ThreeDShadow;
|
||||
}
|
||||
*/
|
||||
|
||||
#skinsTree {
|
||||
height : 80px;
|
||||
}
|
||||
|
|
|
@ -303,6 +303,54 @@ menubutton.button-toolbar-4[open="true"] > .menubutton-toolbar-single-internal-b
|
|||
|
||||
/* menubutton button-toolbar-2 */
|
||||
|
||||
/**
|
||||
* Single Menubuttons (for toolbars, etc)
|
||||
*/
|
||||
menubutton.button-toolbar-2
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/menulistBindings.xml#menubutton-single-right") !important;
|
||||
border : 1px solid transparent;
|
||||
margin : 0px;
|
||||
}
|
||||
|
||||
menubutton.button-toolbar-2 > .menubutton-internal-box
|
||||
{
|
||||
border : 1px solid transparent;
|
||||
padding : 2px 2px 2px 4px;
|
||||
vertical-align : middle;
|
||||
}
|
||||
|
||||
menubutton.button-toolbar-2 > .menubutton-internal-box > .menubutton-single-icon
|
||||
{
|
||||
list-style-image : url("chrome://global/skin/scroll-down.gif");
|
||||
padding-left : 2px;
|
||||
}
|
||||
|
||||
menubutton.button-toolbar-2:hover
|
||||
{
|
||||
border : 1px solid threeddarkshadow;
|
||||
}
|
||||
|
||||
menubutton.button-toolbar-2:hover > .menubutton-internal-box
|
||||
{
|
||||
border-left : 1px solid threedhighlight;
|
||||
border-top : 1px solid threedhighlight;
|
||||
border-right : 1px solid threedshadow;
|
||||
border-bottom : 1px solid threedshadow;
|
||||
}
|
||||
|
||||
|
||||
|
||||
menubutton.button-toolbar-2:hover:active > .menubutton-internal-box,
|
||||
menubutton.button-toolbar-2[open="true"] > .menubutton-internal-box
|
||||
{
|
||||
border-left : 1px solid threedshadow;
|
||||
border-top : 1px solid threedshadow;
|
||||
border-right : 1px solid threedhighlight;
|
||||
border-bottom : 1px solid threedhighlight;
|
||||
padding : 3px 1px 1px 5px;
|
||||
}
|
||||
|
||||
menubutton.button-toolbar-2.top {
|
||||
-moz-binding: url("chrome://global/content/menulistBindings.xml#menubutton-single-top");
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ menupopup, popup
|
|||
menupopup > menu,
|
||||
menupopup > menuitem
|
||||
{
|
||||
max-width : 42em; /* should move to content */
|
||||
max-width : 20em; /* should move to content */
|
||||
min-width : 14em; /* should move to content */
|
||||
margin : 0px;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ menupopup > menuitem
|
|||
popup > menu,
|
||||
popup > menuitem
|
||||
{
|
||||
max-width : 42em; /* should move to content */
|
||||
max-width : 20em; /* should move to content */
|
||||
min-width : 8em; /* should move to content */
|
||||
margin : 0px;
|
||||
}
|
||||
|
@ -224,7 +224,11 @@ menuitem[checked="true"][type="radio"][menuactive="true"]
|
|||
padding : 0px;
|
||||
}
|
||||
|
||||
|
||||
#TOOLTIP-tooltipText
|
||||
{
|
||||
margin : 0px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Autorepeatbutton
|
||||
*/
|
||||
|
|
|
@ -103,11 +103,7 @@ tree:focus > treechildren treeitem[selected="true"][current="true"] > treerow
|
|||
border-top : 1px solid ThreeDLightShadow;
|
||||
border-right : 1px solid ThreeDShadow;
|
||||
border-bottom : 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
.treecell-header-box
|
||||
{
|
||||
padding : 0px 4px 0px 4px;
|
||||
padding : 0px 5px 0px 4px;
|
||||
}
|
||||
|
||||
.treecell-header-image-box
|
||||
|
@ -131,6 +127,12 @@ tree:focus > treechildren treeitem[selected="true"][current="true"] > treerow
|
|||
border-bottom : none;
|
||||
border-left : 1px solid transparent;
|
||||
}
|
||||
|
||||
.treecell-header-image
|
||||
{
|
||||
-moz-binding : url("chrome://global/skin/treeBindings.xml#treecell-header-image");
|
||||
padding : 0px;
|
||||
}
|
||||
|
||||
.treecell-header:hover:active > .treecell-header-box,
|
||||
.treecell-inset-header:hover:active > .treecell-header-box
|
||||
|
@ -138,6 +140,25 @@ tree:focus > treechildren treeitem[selected="true"][current="true"] > treerow
|
|||
padding : 1px 4px 0px 5px;
|
||||
}
|
||||
|
||||
.tree-header-image
|
||||
{
|
||||
list-style-image : inherit;
|
||||
}
|
||||
|
||||
.treecell-image
|
||||
{
|
||||
padding : 0px;
|
||||
}
|
||||
|
||||
.treecell-header-image-box
|
||||
{
|
||||
border-left : 1px solid ThreeDLightShadow;
|
||||
border-top : 1px solid ThreeDLightShadow;
|
||||
border-right : 1px solid ThreeDShadow;
|
||||
border-bottom : 1px solid ThreeDShadow;
|
||||
padding : 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.treecell-header-image:hover:active > .treecell-header-image-box
|
||||
{
|
||||
padding : 1px 1px 0px 2px;
|
||||
|
@ -175,6 +196,8 @@ treecell.propertylist {
|
|||
padding-left : 5px;
|
||||
}
|
||||
|
||||
.tree-cell-primary-icon-inline-edit-leaf,
|
||||
.tree-cell-primary-icon-inline-edit-folder,
|
||||
.tree-cell-primary-icon {
|
||||
list-style-image: inherit;
|
||||
padding-right: 2px;
|
||||
|
@ -191,10 +214,12 @@ treecell.propertylist {
|
|||
padding-right: 2px;
|
||||
}
|
||||
|
||||
.tree-cell-primary-icon-inline-edit-leaf,
|
||||
.treecell-indent > .tree-cell-primary-icon {
|
||||
padding-left: 14px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.tree-cell-primary-icon-inline-edit-folder,
|
||||
treeitem[container="true"] > treerow > .treecell-indent > .tree-cell-primary-icon {
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
@ -216,7 +241,6 @@ treeitem[selected="true"][container="true"][open="true"] > treerow > treecell >
|
|||
}
|
||||
|
||||
/* tree header with sort direction indicators */
|
||||
|
||||
.tree-header-sortdirection {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
@ -230,8 +254,43 @@ treeitem[selected="true"][container="true"][open="true"] > treerow > treecell >
|
|||
}
|
||||
|
||||
/* column selection popup menu icon */
|
||||
.treecell-popupcell-menu
|
||||
{
|
||||
border-left : 1px solid threedface;
|
||||
border-top : 1px solid threedface;
|
||||
border-right : 1px solid threedshadow;
|
||||
border-bottom : 1px solid threedshadow;
|
||||
}
|
||||
|
||||
.treecell-popup-icon
|
||||
{
|
||||
list-style-image : url("chrome://global/skin/columnselect.gif");
|
||||
}
|
||||
|
||||
/* Inline Editable Treecells */
|
||||
.textfield-inline-edit
|
||||
{
|
||||
border : 1px solid black !important;
|
||||
margin : 0px !important;
|
||||
}
|
||||
|
||||
.textfield-inline-edit > .textfield-internal-box > .textfield-input
|
||||
{
|
||||
border : 0px !important;
|
||||
padding : 1px !important;
|
||||
margin : 0px !important;
|
||||
}
|
||||
|
||||
.textfield-inline-edit > .textfield-internal-box
|
||||
{
|
||||
border : 0px !important;
|
||||
padding : 0px !important;
|
||||
margin : 0px !important;
|
||||
}
|
||||
|
||||
treerow[mode="inline-edit"]
|
||||
{
|
||||
background-color : none;
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ classic.jar:
|
|||
skin/classic/communicator/bookmarks/bookmark-folder-open.gif (communicator/bookmarks/bookmark-folder-open.gif)
|
||||
skin/classic/communicator/bookmarks/bookmark-folder-button.gif (communicator/bookmarks/bookmark-folder-button.gif)
|
||||
skin/classic/communicator/bookmarks/bookmark-item.gif (communicator/bookmarks/bookmark-item.gif)
|
||||
skin/classic/communicator/bookmarks/bookmarks.css (communicator/bookmarks/bookmarks.css)
|
||||
skin/classic/communicator/bookmarks/bookmark-item-update.gif (communicator/bookmarks/bookmark-item-updated.gif)
|
||||
skin/classic/communicator/bookmarks/home.gif (communicator/bookmarks/home.gif)
|
||||
skin/classic/communicator/bookmarks/home-hover.gif (communicator/bookmarks/home-hover.gif)
|
||||
skin/classic/communicator/bookmarks/home-active.gif (communicator/bookmarks/home-active.gif)
|
||||
|
@ -28,9 +28,12 @@ classic.jar:
|
|||
skin/classic/communicator/bookmarks/personal-folder-closed.gif (communicator/bookmarks/personal-folder-closed.gif)
|
||||
skin/classic/communicator/bookmarks/personal-folder-open.gif (communicator/bookmarks/personal-folder-open.gif)
|
||||
skin/classic/communicator/bookmarks/location.gif (communicator/bookmarks/location.gif)
|
||||
skin/classic/communicator/bookmarks/location-clicked.gif (communicator/bookmarks/location-clicked.gif)
|
||||
skin/classic/communicator/bookmarks/location-hover.gif (communicator/bookmarks/location-hover.gif)
|
||||
skin/classic/communicator/bookmarks/location-clicked.gif (communicator/bookmarks/location-clicked.gif)
|
||||
skin/classic/communicator/bookmarks/location-hover.gif (communicator/bookmarks/location-hover.gif)
|
||||
skin/classic/communicator/bookmarks/iefolder.gif (communicator/bookmarks/iefolder.gif)
|
||||
skin/classic/communicator/bookmarks/bookmarks-tree.css (communicator/bookmarks/bookmarks-tree.css)
|
||||
skin/classic/communicator/bookmarks/schedule.gif (communicator/bookmarks/schedule.gif)
|
||||
skin/classic/communicator/bookmarks/notification.gif (communicator/bookmarks/notification.gif)
|
||||
skin/classic/communicator/directory/directory.css (communicator/directory/directory.css)
|
||||
skin/classic/communicator/directory/file-folder-closed-sel.gif (communicator/directory/file-folder-closed-sel.gif)
|
||||
skin/classic/communicator/directory/file-folder-closed.gif (communicator/directory/file-folder-closed.gif)
|
||||
|
@ -513,3 +516,4 @@ classic.jar:
|
|||
skin/classic/navigator/stop-disabled.gif (navigator/stop-disabled.gif)
|
||||
skin/classic/navigator/stop-hover.gif (navigator/stop-hover.gif)
|
||||
skin/classic/navigator/stop-hover-active.gif (navigator/stop-hover-active.gif)
|
||||
skin/classic/navigator/personalToolbar.css (navigator/personalToolbar.css)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
**/
|
||||
|
||||
@import url(chrome://communicator/skin/);
|
||||
@import url(chrome://communicator/skin/bookmarks/bookmarks.css);
|
||||
@import url(chrome://navigator/skin/personalToolbar.css);
|
||||
@import url(chrome://communicator/skin/sidebar/sidebar.css);
|
||||
|
||||
#content
|
||||
|
|
|
@ -53,11 +53,13 @@ function loadEventHandlers(event)
|
|||
{
|
||||
// Filter out events that are not about the document load we are interested in
|
||||
if (event.target == _content.document) {
|
||||
dump("*** PRE date = " + (new Date()).getUTCMilliseconds() + "\n");
|
||||
UpdateBookmarksLastVisitedDate(event);
|
||||
UpdateInternetSearchResults(event);
|
||||
checkForDirectoryListing();
|
||||
getContentAreaFrameCount();
|
||||
postURLToNativeWidget();
|
||||
dump("*** POST date = " + (new Date()).getUTCMilliseconds() + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ Contributor(s): ______________________________________. -->
|
|||
<script type="text/javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/contentAreaClick.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/contentAreaDD.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bookmarksOverlay.js"/>
|
||||
<script type="text/javascript" src="chrome://navigator/content/navigator.js"/>
|
||||
<script type="text/javascript" src="tooltip.js"/>
|
||||
<script type="text/javascript" src="navigatorDD.js"/>
|
||||
|
@ -190,22 +191,18 @@ Contributor(s): ______________________________________. -->
|
|||
ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarObserver);"
|
||||
ondragexit="nsDragAndDrop.dragExit(event, personalToolbarObserver);"
|
||||
grippytooltip="aTooltip" grippytooltiptext="&personalBar.tooltip;"
|
||||
last-toolbar="true">
|
||||
tbautostretch="always">
|
||||
|
||||
|
||||
|
||||
<!-- "Bookmarks" button on personal toolbar -->
|
||||
|
||||
|
||||
<menubutton hidden="true" persist="hidden" class="button-toolbar bookmarkfolder" id="bookmarks-button"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch rdf:httpindex"
|
||||
ref="NC:BookmarksRoot" container="true" value="&bookmarksButton.label;"
|
||||
flags="dont-test-empty">
|
||||
<menubutton class="button-toolbar bookmarkfolder" id="bookmarks-button"
|
||||
persist="hidden" value="&bookmarksButton.label;"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch rdf:httpindex"
|
||||
ref="NC:BookmarksRoot" container="true" flags="dont-test-empty">
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmarkfolder" uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name" >
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name" >
|
||||
<menupopup/>
|
||||
</menu>
|
||||
</menupopup>
|
||||
|
@ -214,36 +211,41 @@ Contributor(s): ______________________________________. -->
|
|||
<menupopup>
|
||||
<menuseparator uri="rdf:*"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem class="menuitem-iconic bookmarkitem" uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="OpenBookmarkURL(event.target,document.getElementById('BookmarksMenu').database)" />
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
oncommand="OpenBookmarkURL(event,document.getElementById('BookmarksMenu').database)" />
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
<menuitem accesskey="&addCurPageCmd.accesskey;"
|
||||
key="addBookmarkKb" observes="Browser:AddBookmark"/>
|
||||
<menuitem accesskey="&manBookmarksCmd.accesskey;"
|
||||
key="manBookmarkKb" observes="Browser:ManageBookmark"/>
|
||||
key="addBookmarkKb" observes="Browser:AddBookmark"/>
|
||||
<menuitem accesskey="&manBookmarksCmd.accesskey;"
|
||||
key="manBookmarkKb" observes="Browser:ManageBookmark"/>
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menubutton>
|
||||
</menupopup>
|
||||
</menubutton>
|
||||
|
||||
<!-- Personal toolbar items -->
|
||||
<box id="innermostBox" flex="1" style="min-width: 1px;"
|
||||
datasources="rdf:bookmarks" ref="NC:PersonalToolbarFolder" flags="dont-test-empty">
|
||||
|
||||
<box id="innermostBox" flex="1" style="min-width: 1px;" context="contextual"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch rdf:httpindex"
|
||||
ref="NC:PersonalToolbarFolder" flags="dont-test-empty">
|
||||
<template>
|
||||
<rule parent="box" iscontainer="true">
|
||||
<menubutton class="button-toolbar bookmarkfolder" uri="rdf:*"
|
||||
tooltip="aTooltip" tooltiptext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
tooltip="aTooltip" tooltiptext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup/>
|
||||
</menubutton>
|
||||
</rule>
|
||||
|
||||
<rule parent="box" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<toolbarseparator/>
|
||||
</rule>
|
||||
|
||||
<rule parent="box">
|
||||
<button class="button-toolbar bookmarkitem" uri="rdf:*"
|
||||
tooltip="aTooltip" tooltiptext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
|
@ -254,7 +256,7 @@ Contributor(s): ______________________________________. -->
|
|||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmarkfolder" uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup/>
|
||||
</menu>
|
||||
</menupopup>
|
||||
|
@ -267,8 +269,8 @@ Contributor(s): ______________________________________. -->
|
|||
<rule>
|
||||
<menupopup>
|
||||
<menuitem class="menuitem-iconic bookmarkitem" uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)"/>
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
var gRDFService = nsJSComponentManager.getService("@mozilla.org/rdf/rdf-service;1",
|
||||
"nsIRDFService");
|
||||
|
||||
function RDF(aType)
|
||||
function _RDF(aType)
|
||||
{
|
||||
return "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + aType;
|
||||
}
|
||||
|
@ -56,117 +56,94 @@ var RDFUtils = {
|
|||
getValueFromResource: function(aResource)
|
||||
{
|
||||
aResource = aResource.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
return aResource ? target.Value : null;
|
||||
return aResource ? aResource.Value : null;
|
||||
}
|
||||
};
|
||||
|
||||
function isBookmark(aURI)
|
||||
{
|
||||
var rv = true;
|
||||
var typeValue = RDFUtils.getTarget(childWithDatabase.database, uri, RDF("type"));
|
||||
var db = document.getElementById("innermostBox").database;
|
||||
var typeValue = RDFUtils.getTarget(db, aURI, _RDF("type"));
|
||||
typeValue = RDFUtils.getValueFromResource(typeValue);
|
||||
if (typeValue != NC_RDF("BookmarkSeparator") &&
|
||||
typeValue != NC_RDF("Bookmark") &&
|
||||
typeValue != NC_RDF("Folder"))
|
||||
rv = false;
|
||||
return rv;
|
||||
return (typeValue == NC_RDF("BookmarkSeparator") ||
|
||||
typeValue == NC_RDF("Bookmark") ||
|
||||
typeValue == NC_RDF("Folder"))
|
||||
}
|
||||
|
||||
function isPToolbarDNDEnabled()
|
||||
{
|
||||
var prefs = nsJSComponentManager.getService("@mozilla.org/preferences;1",
|
||||
"nsIPref");
|
||||
var dragAndDropEnabled = false;
|
||||
try {
|
||||
dragAndDropEnabled = prefs.GetBoolPref("browser.enable.tb_dnd");
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
|
||||
return dragAndDropEnabled;
|
||||
}
|
||||
|
||||
var personalToolbarObserver = {
|
||||
onDragStart: function (aEvent)
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
// temporary
|
||||
if (!isPToolbarDNDEnabled())
|
||||
return false;
|
||||
|
||||
var personalToolbar = document.getElementById("PersonalToolbar");
|
||||
if (aEvent.target == personalToolbar)
|
||||
return null;
|
||||
if (aEvent.target == personalToolbar) return;
|
||||
|
||||
var childWithDatabase = document.getElementById("innermostBox");
|
||||
var db = document.getElementById("innermostBox").database;
|
||||
var uri = aEvent.target.id;
|
||||
//if (!isBookmark(uri))
|
||||
// return;
|
||||
|
||||
var title = aEvent.target.value;
|
||||
var htmlString = "<A HREF='" + uri + "'>" + title + "</A>";
|
||||
if (!isBookmark(uri)) return;
|
||||
var url = RDFUtils.getTarget(db, uri, NC_RDF("URL"));
|
||||
var name = RDFUtils.getTarget(db, uri, NC_RDF("Name"));
|
||||
|
||||
var flavourList = { };
|
||||
flavourList["moz/toolbaritem"] = { width: 2, data: uri };
|
||||
flavourList["text/x-moz-url"] = { width: 2, data: uri + "\n" + "[ TEMP TITLE ]" };
|
||||
flavourList["text/html"] = { width: 2, data: htmlString };
|
||||
flavourList["text/unicode"] = { width: 2, data: uri };
|
||||
return flavourList;
|
||||
var urlString = url + "\n" + name;
|
||||
var htmlString = "<A HREF='" + uri + "'>" + name + "</A>";
|
||||
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("moz/rdfitem", uri);
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", urlString);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlString);
|
||||
aXferData.data.addDataForFlavour("text/unicode", url);
|
||||
},
|
||||
|
||||
onDrop: function (aEvent, aData, aDragSession)
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
// temporary
|
||||
if (!isPToolbarDNDEnabled())
|
||||
return false;
|
||||
|
||||
var element = aData.data.data;
|
||||
var dropElement = aEvent.target.id;
|
||||
var elementRes = RDFUtils.getResource(element);
|
||||
var elementRes = RDFUtils.getResource(aXferData.data);
|
||||
var dropElementRes = RDFUtils.getResource(dropElement);
|
||||
var personalToolbarRes = RDFUtils.getResource("NC:PersonalToolbarFolder");
|
||||
|
||||
var childDB = document.getElementById("innermostBox").database;
|
||||
var rdfContainer = nsJSComponentManager.createInstance("@mozilla.org/rdf/container;1",
|
||||
"nsIRDFContainer");
|
||||
rdfContainer.Init(childDB, personalToolbarRes);
|
||||
const kCtrContractID = "@mozilla.org/rdf/container;1";
|
||||
const kCtrIID = Components.interfaces.nsIRDFContainer;
|
||||
var rdfContainer = Components.classes[kCtrContractID].getService(kCtrIID);
|
||||
|
||||
var elementIsOnToolbar = rdfContainer.IndexOf(elementRes);
|
||||
if (elementIsOnToolbar > 0)
|
||||
rdfContainer.RemoveElement(elementRes, true);
|
||||
else if (dropIndex == -1)
|
||||
var parentContainer = this.findParentContainer(aDragSession.sourceElement);
|
||||
if (parentContainer)
|
||||
{
|
||||
rdfContainer.Init(childDB, parentContainer);
|
||||
rdfContainer.RemoveElement(elementRes, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// look up this URL's title in global history
|
||||
var potentialTitle = null;
|
||||
var historyDS = gRDFService.GetDataSource("rdf:history");
|
||||
var historyEntry = gRDFService.GetResource(element);
|
||||
var historyTitleProperty = gRDFService.GetResource(NC_RDF("Name"));
|
||||
var titleFromHistory = historyDS.GetTarget(historyEntry, historyTitleProperty, true);
|
||||
var historyTitleProperty = RDFUtils.getResource(NC_RDF("Name"));
|
||||
var titleFromHistory = historyDS.GetTarget(elementRes, historyTitleProperty, true);
|
||||
if (titleFromHistory)
|
||||
titleFromHistory = titleFromHistory.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (titleFromHistory)
|
||||
potentialTitle = titleFromHistory.Value;
|
||||
linkTitle = potentialTitle ? potentialTitle : element;
|
||||
childDB.Assert(gRDFService.GetResource(element, true),
|
||||
gRDFService.GetResource(NC_RDF("Name"), true),
|
||||
gRDFService.GetLiteral(linkTitle),
|
||||
true);
|
||||
childDB.Assert(elementRes, historyTitleProperty,
|
||||
gRDFService.GetLiteral(linkTitle), true);
|
||||
}
|
||||
rdfContainer.Init (childDB, personalToolbarRes);
|
||||
var dropIndex = rdfContainer.IndexOf(dropElementRes);
|
||||
// determine the drop position
|
||||
var dropPosition = this.determineDropPosition(aEvent);
|
||||
switch (dropPosition) {
|
||||
case -1:
|
||||
rdfContainer.Init(childDB, personalToolbarRes);
|
||||
dump("*** elt= " + elementRes.Value + "\n");
|
||||
rdfContainer.InsertElementAt(elementRes, dropIndex, true);
|
||||
break;
|
||||
case 0:
|
||||
// do something here to drop into subfolders
|
||||
var childContainer = nsJSComponentManager.createInstance("@mozilla.org/rdf/container;1",
|
||||
"nsIRDFContainer");
|
||||
childContainer.Init(childDB, dropElementRes);
|
||||
childContainer.AppendElement(elementRes);
|
||||
rdfContainer.Init(childDB, dropElementRes);
|
||||
rdfContainer.AppendElement(elementRes);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
rdfContainer.Init (childDB, personalToolbarRes);
|
||||
rdfContainer.InsertElementAt(elementRes, dropIndex+1, true);
|
||||
break;
|
||||
}
|
||||
|
@ -189,10 +166,6 @@ var personalToolbarObserver = {
|
|||
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
// temporary
|
||||
if (!isPToolbarDNDEnabled())
|
||||
return false;
|
||||
|
||||
var dropPosition = this.determineDropPosition(aEvent);
|
||||
|
||||
if (this.mCurrentDragOverButton != aEvent.target ||
|
||||
|
@ -233,14 +206,11 @@ var personalToolbarObserver = {
|
|||
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
// temporary
|
||||
if (!isPToolbarDNDEnabled())
|
||||
return false;
|
||||
|
||||
var flavourList = { };
|
||||
flavourList["moz/toolbaritem"] = { width: 2, iid: "nsISupportsWString" };
|
||||
flavourList["text/unicode"] = { width: 2, iid: "nsISupportsWString" };
|
||||
return flavourList;
|
||||
var flavourSet = new FlavourSet();
|
||||
flavourSet.appendFlavour("moz/rdfitem");
|
||||
// application/x-moz-file
|
||||
flavourSet.appendFlavour("text/unicode");
|
||||
return flavourSet;
|
||||
},
|
||||
|
||||
determineDropPosition: function (aEvent)
|
||||
|
@ -269,37 +239,70 @@ var personalToolbarObserver = {
|
|||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
// returns the parent resource of the dragged element. This is determined
|
||||
// by inspecting the source element of the drag and walking up the DOM tree
|
||||
// to find the appropriate containing node.
|
||||
findParentContainer: function (aElement)
|
||||
{
|
||||
switch (aElement.localName)
|
||||
{
|
||||
case "button":
|
||||
case "menubutton":
|
||||
var box = aElement.parentNode;
|
||||
return RDFUtils.getResource(box.getAttribute("ref"));
|
||||
case "menu":
|
||||
case "menuitem":
|
||||
var menu = aElement.parentNode.parentNode;
|
||||
return RDFUtils.getResource(menu.id);
|
||||
case "treecell":
|
||||
var treeitem = aElement.parentNode.parentNode.parentNode.parentNode;
|
||||
return RDFUtils.getResource(treeitem.id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// DragProxyIcon
|
||||
//
|
||||
// Called when the user is starting a drag from the proxy icon next to the URL bar. Basically
|
||||
// just gets the url from the url bar and places the data (as plain text) in the drag service.
|
||||
//
|
||||
// This is by no means the final implementation, just another example of what you can do with
|
||||
// JS. Much still left to do here.
|
||||
//
|
||||
|
||||
var proxyIconDNDObserver = {
|
||||
onDragStart: function ()
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
var urlBar = document.getElementById("urlbar");
|
||||
var flavourList = { };
|
||||
flavourList["text/unicode"] = { width: 2, data: urlBar.value };
|
||||
flavourList["text/x-moz-url"] = { width: 2, data: urlBar.value + "\n" + window._content.document.title };
|
||||
|
||||
// XXX - do we want to allow the user to set a blank page to their homepage?
|
||||
// if so then we want to modify this a little to set about:blank as
|
||||
// the homepage in the event of an empty urlbar.
|
||||
if (!urlBar.value) return;
|
||||
|
||||
var urlString = urlBar.value + "\n" + window._content.document.title;
|
||||
var htmlString = "<a href=\"" + urlBar.value + "\">" + urlBar.value + "</a>";
|
||||
flavourList["text/html"] = { width: 2, data: htmlString };
|
||||
return flavourList;
|
||||
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", urlString);
|
||||
aXferData.data.addDataForFlavour("text/unicode", urlBar.value);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlString);
|
||||
}
|
||||
};
|
||||
|
||||
var homeButtonObserver = {
|
||||
onDrop: function (aEvent, aData, aDragSession)
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
var data = aData.length ? aData[0] : aData;
|
||||
var url = retrieveURLFromData(data);
|
||||
var homepage = nsPreferences.getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
|
||||
|
||||
if (homepage)
|
||||
{
|
||||
// XXX find a readable title string for homepage, perhaps do a history lookup.
|
||||
var htmlString = "<a href=\"" + homepage + "\">" + homepage + "</a>";
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", homepage + "\n" + homepage);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlString);
|
||||
aXferData.data.addDataForFlavour("text/unicode", homepage);
|
||||
}
|
||||
},
|
||||
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var url = retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
|
||||
var commonDialogService = nsJSComponentManager.getService("@mozilla.org/appshell/commonDialogs;1",
|
||||
"nsICommonDialogs");
|
||||
var pressedVal = { };
|
||||
|
@ -321,7 +324,8 @@ var homeButtonObserver = {
|
|||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
var statusTextFld = document.getElementById("statusbar-display");
|
||||
statusTextFld.setAttribute("value", gNavigatorBundle.getString("droponhomebutton"));
|
||||
statusTextFld.setAttribute("value", bundle.GetStringFromName("droponhomebutton"));
|
||||
aDragSession.dragAction = Components.interfaces.nsIDragService.DRAGDROP_ACTION_LINK;
|
||||
},
|
||||
|
||||
onDragExit: function (aEvent, aDragSession)
|
||||
|
@ -329,23 +333,12 @@ var homeButtonObserver = {
|
|||
statusTextFld.setAttribute("value", "");
|
||||
},
|
||||
|
||||
onDragStart: function ()
|
||||
{
|
||||
var homepage = nsPreferences.getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
|
||||
var flavourList = { };
|
||||
var htmlString = "<a href=\"" + homepage + "\">" + homepage + "</a>";
|
||||
flavourList["text/x-moz-url"] = { width: 2, data: homepage };
|
||||
flavourList["text/html"] = { width: 2, data: htmlString };
|
||||
flavourList["text/unicode"] = { width: 2, data: homepage };
|
||||
return flavourList;
|
||||
},
|
||||
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
var flavourList = { };
|
||||
//flavourList["moz/toolbaritem"] = { width: 2 };
|
||||
flavourList["text/unicode"] = { width: 2, iid: "nsISupportsWString" };
|
||||
flavourList["application/x-moz-file"] = { width: 2, iid: "nsIFile" };
|
||||
return flavourList;
|
||||
var flavourSet = new FlavourSet();
|
||||
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
||||
flavourSet.appendFlavour("text/x-moz-url");
|
||||
flavourSet.appendFlavour("text/unicode");
|
||||
return flavourSet;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
<broadcaster id="Browser:Home" oncommand="BrowserHome();"/>
|
||||
|
||||
<!-- Bookmarks Menu -->
|
||||
<broadcaster id="Browser:AddBookmark" value="&addCurPageCmd.label;" oncommand="addBookmark(window._content.location.href,window._content.document.title);"/>
|
||||
<broadcaster id="Browser:AddBookmark" value="&addCurPageCmd.label;" oncommand="BookmarksUtils.addBookmarkToWindow(window._content);"/>
|
||||
<broadcaster id="Browser:ManageBookmark" value="&manBookmarksCmd.label;" oncommand="BrowserEditBookmarks();" />
|
||||
|
||||
</broadcasterset>
|
||||
|
|
|
@ -26,16 +26,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// XXX - WARNING - DRAG AND DROP API CHANGE ALERT - XXX
|
||||
// This file has been extensively modified in a checkin planned for Mozilla
|
||||
// 0.8, and the API has been modified. DO NOT MODIFY THIS FILE without
|
||||
// approval from ben@netscape.com, otherwise your changes will be lost.
|
||||
|
||||
|
||||
var gSourceDocument, wasDrag;
|
||||
var contentAreaDNDObserver = {
|
||||
onDragStart: function (aEvent)
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
// under the assumption that content areas won't contain
|
||||
// draggable XBL, we'll ignore the drag if we're dragging XBL
|
||||
|
@ -101,6 +93,7 @@ var contentAreaDNDObserver = {
|
|||
case 'A':
|
||||
urlstring = this.getAnchorUrl(draggedNode);
|
||||
textstring = this.getNodeString(draggedNode);
|
||||
aDragAction.action = Components.interfaces.nsIDragService.DRAGDROP_ACTION_LINK;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -114,10 +107,12 @@ var contentAreaDNDObserver = {
|
|||
// this shouldn't be fatal, and
|
||||
// we should still do the drag if this fails
|
||||
try {
|
||||
this.normalizeSelection(linkNode, domselection);
|
||||
//this.normalizeSelection(linkNode, domselection);
|
||||
} catch (ex) {
|
||||
// non-fatal, so catch & ignore
|
||||
}
|
||||
|
||||
aDragAction.action = Components.interfaces.nsIDragService.DRAGDROP_ACTION_LINK;
|
||||
}
|
||||
else {
|
||||
// Need to throw to indicate that the drag target should not
|
||||
|
@ -136,15 +131,10 @@ var contentAreaDNDObserver = {
|
|||
htmlstring = this.createLinkText(urlstring, urlstring);
|
||||
|
||||
// now create the flavour lists
|
||||
var flavourList = { };
|
||||
if (htmlstring)
|
||||
flavourList["text/html"] = { width: 2, data: htmlstring };
|
||||
if (urlstring)
|
||||
flavourList["text/x-moz-url"] = { width: 2,
|
||||
data: urlstring + "\n" + textstring };
|
||||
if (textstring)
|
||||
flavourList["text/unicode"] = { width: 2, data: textstring };
|
||||
return flavourList;
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", urlstring + "\n" + textstring);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlstring);
|
||||
aXferData.data.addDataForFlavour("text/unicode", textstring);
|
||||
},
|
||||
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
|
@ -153,19 +143,22 @@ var contentAreaDNDObserver = {
|
|||
// a URL dragged from the content area into the very same content area (which is
|
||||
// almost never the desired action). This code is a bit too simplistic and may
|
||||
// have problems with nested frames, but that's not my problem ;)
|
||||
if (aDragSession.sourceDocument == window._content.document)
|
||||
if (aDragSession.sourceDocument == window._content.document) {
|
||||
aDragSession.canDrop = false;
|
||||
return;
|
||||
}
|
||||
|
||||
aDragSession.dragAction = Components.interfaces.nsIDragService.DRAGDROP_ACTION_LINK;
|
||||
},
|
||||
|
||||
onDrop: function (aEvent, aData, aDragSession)
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var data = (('length' in aData) && aData.length) ? aData[0] : aData;
|
||||
var url = retrieveURLFromData(data);
|
||||
if (url.length == 0)
|
||||
return true;
|
||||
var url = retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
|
||||
|
||||
// valid urls don't contain spaces ' '; if we have a space it isn't a valid url so bail out
|
||||
if ( url.indexOf(" ", 0) != -1 )
|
||||
return true;
|
||||
if (!url || !url.length || url.indexOf(" ", 0) != -1)
|
||||
return;
|
||||
|
||||
switch (document.firstChild.getAttribute('windowtype')) {
|
||||
case "navigator:browser":
|
||||
loadShortcutOrURI(url);
|
||||
|
@ -173,18 +166,16 @@ var contentAreaDNDObserver = {
|
|||
case "navigator:view-source":
|
||||
viewSource(url);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
var flavourList = { };
|
||||
flavourList["text/x-moz-url"] = { width: 2, iid: "nsISupportsWString" };
|
||||
flavourList["text/unicode"] = { width: 2, iid: "nsISupportsWString" };
|
||||
flavourList["application/x-moz-file"] = { width: 2, iid: "nsIFile" };
|
||||
return flavourList;
|
||||
var flavourSet = new FlavourSet();
|
||||
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
||||
flavourSet.appendFlavour("text/x-moz-url");
|
||||
flavourSet.appendFlavour("text/unicode");
|
||||
return flavourSet;
|
||||
},
|
||||
|
||||
createLinkText: function(url, text)
|
||||
|
@ -218,11 +209,7 @@ var contentAreaDNDObserver = {
|
|||
|
||||
getAnchorUrl: function(linkNode)
|
||||
{
|
||||
if (linkNode.href)
|
||||
return linkNode.href;
|
||||
else if (linkNode.name)
|
||||
return linkNode.name
|
||||
return null;
|
||||
return linkNode.href || linkNode.name || null;
|
||||
},
|
||||
|
||||
getNodeString: function(node)
|
||||
|
@ -236,28 +223,26 @@ var contentAreaDNDObserver = {
|
|||
};
|
||||
|
||||
|
||||
function retrieveURLFromData (aData)
|
||||
function retrieveURLFromData (aData, flavour)
|
||||
{
|
||||
switch (aData.flavour) {
|
||||
switch (flavour) {
|
||||
case "text/unicode":
|
||||
// this might not be a url, but we'll return it anyway
|
||||
return aData.data.data.toString();
|
||||
break;
|
||||
return aData;
|
||||
case "text/x-moz-url":
|
||||
var data = aData.data.data.toString();
|
||||
var data = aData.toString();
|
||||
var separator = data.indexOf("\n");
|
||||
if (separator != -1)
|
||||
data = data.substr(0, separator);
|
||||
return data;
|
||||
break;
|
||||
case "application/x-moz-file":
|
||||
var dataObj = aData.data.data.QueryInterface(Components.interfaces.nsIFile);
|
||||
if (dataObj) {
|
||||
var fileURL = nsJSComponentManager.createInstance("@mozilla.org/network/standard-url;1",
|
||||
"nsIFileURL");
|
||||
fileURL.file = dataObj;
|
||||
return fileURL.spec;
|
||||
}
|
||||
const kURLContractID = "@mozilla.org/network/standard-url;1";
|
||||
const kFileURLIID = Components.interfaces.nsIFileURL;
|
||||
var fileURL = Components.classes[kURLContractID].createInstance(kFileURLIID);
|
||||
fileURL.file = aData;
|
||||
return fileURL.spec;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -132,22 +132,19 @@ function okToPrefill2(formsArray) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function goPreferences(id, paneURL, paneID)
|
||||
function goPreferences(containerID, paneURL, itemID)
|
||||
{
|
||||
var prefWindowModalityPref;
|
||||
try {
|
||||
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
|
||||
if( pref )
|
||||
pref = pref.QueryInterface( Components.interfaces.nsIPref );
|
||||
if( pref )
|
||||
prefWindowModalityPref = pref.GetBoolPref( "browser.prefWindowModal");
|
||||
var pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
|
||||
prefWindowModalityPref = pref.GetBoolPref( "browser.prefWindowModal");
|
||||
}
|
||||
catch(e) {
|
||||
prefWindowModalityPref = true;
|
||||
}
|
||||
var modality = prefWindowModalityPref ? "yes" : "no";
|
||||
|
||||
var prefWindow = window.openDialog("chrome://communicator/content/pref/pref.xul","PrefWindow", "chrome,titlebar,modal=" + modality+ ",resizable=yes", paneURL, paneID);
|
||||
var prefWindow = openDialog("chrome://communicator/content/pref/pref.xul","PrefWindow", "chrome,titlebar,modal=" + modality+ ",resizable=yes", paneURL, containerID, itemID);
|
||||
}
|
||||
|
||||
function okToCapture() {
|
||||
|
@ -385,7 +382,7 @@ function goUpdatePasteMenuItems()
|
|||
}
|
||||
|
||||
// This used to be BrowserNewEditorWindow in navigator.js
|
||||
function NewEditorWindow()
|
||||
function NewEditorWindow(aPageURL)
|
||||
{
|
||||
// Open editor window with blank page
|
||||
// Kludge to leverage openDialog non-modal!
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIRDFResource;
|
||||
|
||||
[scriptable, uuid(a82e9300-e4af-11d2-8fdf-0008c70adc7b)]
|
||||
interface nsIBookmarksService : nsISupports
|
||||
{
|
||||
|
@ -38,6 +40,13 @@ interface nsIBookmarksService : nsISupports
|
|||
void ReadBookmarks();
|
||||
boolean IsBookmarked(in string aURI);
|
||||
void AddBookmark(in string aURI, in wstring aTitle, in long bmType, in wstring docCharset);
|
||||
|
||||
// Temporary method. This will be replaced in .9 by a more generic node creation mechanism.
|
||||
nsIRDFResource CreateFolder(in wstring aTitle, in nsIRDFResource aRelativeItem, in nsIRDFResource aParentFolder);
|
||||
void AddBookmarkToFolder(in string aURI,
|
||||
in nsIRDFResource aFolder,
|
||||
in wstring aTitle,
|
||||
in wstring docCharSet);
|
||||
void UpdateBookmarkLastVisitedDate(in string aURL, in wstring docCharset);
|
||||
string FindShortcut(in wstring aName);
|
||||
wstring GetLastCharset(in string aURI);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks-tree.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/bookmarks/bookmarks.dtd">
|
||||
|
@ -42,8 +42,8 @@
|
|||
align="vertical">
|
||||
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bm-panel.js" />
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bookmarks.js" />
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bookmarksDD.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bookmarks-temp.js" />
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bookmarksDD-temp.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/nsTreeUtils.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/nsJSComponentManager.js"/>
|
||||
|
|
|
@ -44,10 +44,7 @@ RDFC = RDFC.QueryInterface(Components.interfaces.nsIRDFContainerUtils);
|
|||
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
|
||||
// Init() will fill this in.
|
||||
var bookmark_url = '';
|
||||
|
||||
|
||||
var bookmark_url = "";
|
||||
|
||||
function Init()
|
||||
{
|
||||
|
@ -74,19 +71,11 @@ function Init()
|
|||
if (value) field.value = value;
|
||||
}
|
||||
|
||||
/*
|
||||
// try and set window title
|
||||
var propsWindow = document.getElementById("bmPropsWindow");
|
||||
var nameNode = document.getElementById("name");
|
||||
if (nameNode)
|
||||
{
|
||||
var name = nameNode.value;
|
||||
if (name && name != "")
|
||||
{
|
||||
dump("\n Set window name to '" + name + "'\n");
|
||||
window.title = name;
|
||||
}
|
||||
}
|
||||
*/
|
||||
var title = propsWindow.getAttribute("title");
|
||||
title = title.replace(/\*\*bm_title\*\*/gi, nameNode.value);
|
||||
propsWindow.setAttribute("title", title);
|
||||
|
||||
// check bookmark schedule
|
||||
var value = Bookmarks.GetTarget(RDF.GetResource(bookmark_url),
|
||||
|
@ -196,45 +185,22 @@ function Init()
|
|||
|
||||
if (isContainerFlag)
|
||||
{
|
||||
// If it is a folder, it has no URL.
|
||||
var locationBox = document.getElementById("locationBox");
|
||||
if (locationBox)
|
||||
{
|
||||
dump("Hide location box\n");
|
||||
var parentNode = locationBox.parentNode;
|
||||
parentNode.removeChild(locationBox);
|
||||
}
|
||||
|
||||
// If it is a folder, it has no Shortcut URL.
|
||||
var shortcutBox = document.getElementById("shortcutBox");
|
||||
if (shortcutBox)
|
||||
{
|
||||
dump("Hide shortcut box\n");
|
||||
var parentNode = shortcutBox.parentNode;
|
||||
parentNode.removeChild(shortcutBox);
|
||||
}
|
||||
// If it is a folder, it has no URL or Keyword
|
||||
document.getElementById("locationrow").setAttribute("hidden", "true");
|
||||
document.getElementById("shortcutrow").setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
if ((bookmark_url.indexOf("http://") != 0) && (bookmark_url.indexOf("https://") != 0))
|
||||
{
|
||||
// only allow scheduling of http/https URLs
|
||||
var scheduleTab = document.getElementById("ScheduleTab");
|
||||
if (scheduleTab)
|
||||
{
|
||||
dump("Hide schedule tab\n");
|
||||
var parentNode = scheduleTab.parentNode;
|
||||
parentNode.removeChild(scheduleTab);
|
||||
}
|
||||
}
|
||||
if (bookmark_url.indexOf("http://") != 0 &&
|
||||
bookmark_url.indexOf("https://") != 0) {
|
||||
// only allow scheduling of http/https URLs
|
||||
document.getElementById("ScheduleTab").setAttribute("hidden", "true");
|
||||
document.getElementById("NotifyTab").setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
window.sizeToContent();
|
||||
sizeToContent();
|
||||
|
||||
// set initial focus
|
||||
var nameNode = document.getElementById("name");
|
||||
if (nameNode)
|
||||
{
|
||||
nameNode.focus();
|
||||
}
|
||||
document.getElementById("name").focus();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,155 +23,212 @@
|
|||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks-tree.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/bookmarks/bm-props.dtd" >
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % bmpropsDTD SYSTEM "chrome://communicator/locale/bookmarks/bm-props.dtd">
|
||||
%bmpropsDTD;
|
||||
]>
|
||||
|
||||
<window xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&bookmarks.windowtitle.label;"
|
||||
onload="Init();" style="width: 36em;"
|
||||
class="dialog" orient="vertical">
|
||||
<window id="bmPropsWindow" xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&bookmarks.windowtitle.label;"
|
||||
onload="Init()" style="width: 30em;"
|
||||
class="dialog" orient="vertical">
|
||||
|
||||
<script type="text/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="text/javascript" src="chrome://communicator/content/bookmarks/bm-props.js"/>
|
||||
|
||||
<keyset id="keyset"/>
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<tabcontrol orient="vertical">
|
||||
<tabbox>
|
||||
<tab value="&generalInfo.label;" accesskey="&generalInfo.accesskey;"/>
|
||||
<tab id="ScheduleTab" value="&schedule.label;" accesskey="&schedule.accesskey;"/>
|
||||
<tab id="NotifyTab" value="¬ification.label;" accesskey="¬ification.accesskey;"/>
|
||||
</tabbox>
|
||||
<tabpanel>
|
||||
<box orient="vertical">
|
||||
<box id="nameBox" orient="vertical">
|
||||
<text class="label" value="&bookmarks.name.label;" />
|
||||
<textfield id="name" />
|
||||
</box>
|
||||
|
||||
<box id="locationBox" orient="vertical">
|
||||
<text class="label" value="&bookmarks.location.label;" />
|
||||
<textfield id="url" />
|
||||
</box>
|
||||
|
||||
<box id="shortcutBox" orient="vertical">
|
||||
<text class="label" value="&bookmarks.shortcut.label;" />
|
||||
<textfield id="shortcut" />
|
||||
</box>
|
||||
|
||||
<box id="descriptionBox" orient="vertical" flex="1">
|
||||
<text class="label" value="&bookmarks.description.label;" />
|
||||
<textfield multiline="true" id="description" flex="1"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<titledbox orient="vertical">
|
||||
<title><text value="&checkforupdates.legend.label;" /></title>
|
||||
|
||||
<box autostretch="never">
|
||||
<text class="label" value="&when.label;" />
|
||||
<menulist id="dayRange">
|
||||
<menupopup>
|
||||
<menuitem data="" value="&checknever.label;"/>
|
||||
<menuseparator />
|
||||
<menuitem data="0123456" value="&checkeveryday.label;"/>
|
||||
<menuitem data="12345" value="&checkweekdays.label;"/>
|
||||
<menuitem data="06" value="&checkweekends.label;"/>
|
||||
<menuitem data="1" value="&checkmondays.label;"/>
|
||||
<menuitem data="2" value="&checktuesdays.label;"/>
|
||||
<menuitem data="3" value="&checkwednesdays.label;"/>
|
||||
<menuitem data="4" value="&checkthursdays.label;"/>
|
||||
<menuitem data="5" value="&checkfridays.label;"/>
|
||||
<menuitem data="6" value="&checksaturdays.label;"/>
|
||||
<menuitem data="0" value="&checksundays.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<spring align="horizontal" flex="1" />
|
||||
<text class="label" value="&from.label;" />
|
||||
<menulist id="startHourRange" oncommand="setEndHourRange()">
|
||||
<menupopup>
|
||||
<menuitem data="0" value="&midnight.label;"/>
|
||||
<menuitem data="1" value="&AMone.label;"/>
|
||||
<menuitem data="2" value="&AMtwo.label;"/>
|
||||
<menuitem data="3" value="&AMthree.label;"/>
|
||||
<menuitem data="4" value="&AMfour.label;"/>
|
||||
<menuitem data="5" value="&AMfive.label;"/>
|
||||
<menuitem data="6" value="&AMsix.label;"/>
|
||||
<menuitem data="7" value="&AMseven.label;"/>
|
||||
<menuitem data="8" value="&AMeight.label;"/>
|
||||
<menuitem data="9" value="&AMnine.label;"/>
|
||||
<menuitem data="10" value="&AMten.label;"/>
|
||||
<menuitem data="11" value="&AMeleven.label;"/>
|
||||
<menuitem data="12" value="&noon.label;"/>
|
||||
<menuitem data="13" value="&PMone.label;"/>
|
||||
<menuitem data="14" value="&PMtwo.label;"/>
|
||||
<menuitem data="15" value="&PMthree.label;"/>
|
||||
<menuitem data="16" value="&PMfour.label;"/>
|
||||
<menuitem data="17" value="&PMfive.label;"/>
|
||||
<menuitem data="18" value="&PMsix.label;"/>
|
||||
<menuitem data="19" value="&PMseven.label;"/>
|
||||
<menuitem data="20" value="&PMeight.label;"/>
|
||||
<menuitem data="21" value="&PMnine.label;"/>
|
||||
<menuitem data="22" value="&PMten.label;"/>
|
||||
<menuitem data="23" value="&PMeleven.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</box>
|
||||
<box align="horizontal">
|
||||
<spring align="horizontal" flex="1" />
|
||||
<text value="&to.label;" />
|
||||
<menulist id="endHourRange">
|
||||
<menupopup oncreate="setEndHourRange()">
|
||||
<menuitem data="1" value="&AMone.label;"/>
|
||||
<menuitem data="2" value="&AMtwo.label;"/>
|
||||
<menuitem data="3" value="&AMthree.label;"/>
|
||||
<menuitem data="4" value="&AMfour.label;"/>
|
||||
<menuitem data="5" value="&AMfive.label;"/>
|
||||
<menuitem data="6" value="&AMsix.label;"/>
|
||||
<menuitem data="7" value="&AMseven.label;"/>
|
||||
<menuitem data="8" value="&AMeight.label;"/>
|
||||
<menuitem data="9" value="&AMnine.label;"/>
|
||||
<menuitem data="10" value="&AMten.label;"/>
|
||||
<menuitem data="11" value="&AMeleven.label;"/>
|
||||
<menuitem data="12" value="&noon.label;"/>
|
||||
<menuitem data="13" value="&PMone.label;"/>
|
||||
<menuitem data="14" value="&PMtwo.label;"/>
|
||||
<menuitem data="15" value="&PMthree.label;"/>
|
||||
<menuitem data="16" value="&PMfour.label;"/>
|
||||
<menuitem data="17" value="&PMfive.label;"/>
|
||||
<menuitem data="18" value="&PMsix.label;"/>
|
||||
<menuitem data="19" value="&PMseven.label;"/>
|
||||
<menuitem data="20" value="&PMeight.label;"/>
|
||||
<menuitem data="21" value="&PMnine.label;"/>
|
||||
<menuitem data="22" value="&PMten.label;"/>
|
||||
<menuitem data="23" value="&PMeleven.label;"/>
|
||||
<menuitem data="24" value="&midnight.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</box>
|
||||
<box autostretch="never">
|
||||
<spring align="horizontal" flex="1" />
|
||||
<text class="label" value="&every.label;" />
|
||||
<textfield id="duration" style="width:4em;" value="60" />
|
||||
<text class="label" value="&minutes.label;" />
|
||||
</box>
|
||||
|
||||
<titledbox orient="vertical">
|
||||
<title><text value="¬ifications.legend.label;" /></title>
|
||||
<vbox autostretch="never">
|
||||
<checkbox id="bookmarkIcon" value="¬ification.icon.label;"/>
|
||||
<checkbox id="showAlert" value="¬ification.alert.label;"/>
|
||||
<checkbox id="openWindow" value="¬ification.window.label;"/>
|
||||
<checkbox id="playSound" value="¬ification.sound.label;"/>
|
||||
</vbox>
|
||||
</titledbox>
|
||||
</titledbox>
|
||||
<separator class="thin"/>
|
||||
<box autostretch="never" valign="top">
|
||||
<image class="message-icon"/>
|
||||
<separator class="thin" orient="vertical"/>
|
||||
<html flex="1">&generaldesc.label;</html>
|
||||
</box>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<box class="box-padded" orient="vertical">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<text class="label" value="&bookmarks.name.label;" for="name"/>
|
||||
<textfield id="name"/>
|
||||
</row>
|
||||
<row id="locationrow">
|
||||
<text class="label" value="&bookmarks.location.label;" for="url"/>
|
||||
<textfield id="url" />
|
||||
</row>
|
||||
<row id="shortcutrow">
|
||||
<text class="label" value="&bookmarks.shortcut.label;" for="shortcut"/>
|
||||
<textfield id="shortcut" />
|
||||
</row>
|
||||
<row>
|
||||
<text class="label" value="&bookmarks.description.label;" for="description"/>
|
||||
<textfield multiline="true" wrap="virtual" id="description" flex="1"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<box orient="vertical">
|
||||
<separator class="thin"/>
|
||||
<box autostretch="never" valign="top">
|
||||
<image id="schedule-icon"/>
|
||||
<separator class="thin" orient="vertical"/>
|
||||
<html flex="1">&schedule.description;</html>
|
||||
</box>
|
||||
<separator class="thin"/>
|
||||
<box class="box-padded">
|
||||
<spring flex="1"/>
|
||||
<titledbox orient="vertical">
|
||||
<title class="label" value="&checkforupdates.legend.label;"/>
|
||||
<grid flex="1">
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row autostretch="never">
|
||||
<text class="label" value="&when.label;" for="dayRange"/>
|
||||
<menulist id="dayRange">
|
||||
<menupopup>
|
||||
<menuitem data="" value="&checknever.label;"/>
|
||||
<menuseparator />
|
||||
<menuitem data="0123456" value="&checkeveryday.label;"/>
|
||||
<menuitem data="12345" value="&checkweekdays.label;"/>
|
||||
<menuitem data="06" value="&checkweekends.label;"/>
|
||||
<menuitem data="1" value="&checkmondays.label;"/>
|
||||
<menuitem data="2" value="&checktuesdays.label;"/>
|
||||
<menuitem data="3" value="&checkwednesdays.label;"/>
|
||||
<menuitem data="4" value="&checkthursdays.label;"/>
|
||||
<menuitem data="5" value="&checkfridays.label;"/>
|
||||
<menuitem data="6" value="&checksaturdays.label;"/>
|
||||
<menuitem data="0" value="&checksundays.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row autostretch="never">
|
||||
<text class="label" value="&from.label;" for="startHourRange"/>
|
||||
<box autostretch="never">
|
||||
<menulist id="startHourRange" oncommand="setEndHourRange()">
|
||||
<menupopup>
|
||||
<menuitem data="0" value="&midnight.label;"/>
|
||||
<menuitem data="1" value="&AMone.label;"/>
|
||||
<menuitem data="2" value="&AMtwo.label;"/>
|
||||
<menuitem data="3" value="&AMthree.label;"/>
|
||||
<menuitem data="4" value="&AMfour.label;"/>
|
||||
<menuitem data="5" value="&AMfive.label;"/>
|
||||
<menuitem data="6" value="&AMsix.label;"/>
|
||||
<menuitem data="7" value="&AMseven.label;"/>
|
||||
<menuitem data="8" value="&AMeight.label;"/>
|
||||
<menuitem data="9" value="&AMnine.label;"/>
|
||||
<menuitem data="10" value="&AMten.label;"/>
|
||||
<menuitem data="11" value="&AMeleven.label;"/>
|
||||
<menuitem data="12" value="&noon.label;"/>
|
||||
<menuitem data="13" value="&PMone.label;"/>
|
||||
<menuitem data="14" value="&PMtwo.label;"/>
|
||||
<menuitem data="15" value="&PMthree.label;"/>
|
||||
<menuitem data="16" value="&PMfour.label;"/>
|
||||
<menuitem data="17" value="&PMfive.label;"/>
|
||||
<menuitem data="18" value="&PMsix.label;"/>
|
||||
<menuitem data="19" value="&PMseven.label;"/>
|
||||
<menuitem data="20" value="&PMeight.label;"/>
|
||||
<menuitem data="21" value="&PMnine.label;"/>
|
||||
<menuitem data="22" value="&PMten.label;"/>
|
||||
<menuitem data="23" value="&PMeleven.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<text class="label" value="&to.label;" for="endHourRange"/>
|
||||
<menulist id="endHourRange">
|
||||
<menupopup oncreate="setEndHourRange()">
|
||||
<menuitem data="1" value="&AMone.label;"/>
|
||||
<menuitem data="2" value="&AMtwo.label;"/>
|
||||
<menuitem data="3" value="&AMthree.label;"/>
|
||||
<menuitem data="4" value="&AMfour.label;"/>
|
||||
<menuitem data="5" value="&AMfive.label;"/>
|
||||
<menuitem data="6" value="&AMsix.label;"/>
|
||||
<menuitem data="7" value="&AMseven.label;"/>
|
||||
<menuitem data="8" value="&AMeight.label;"/>
|
||||
<menuitem data="9" value="&AMnine.label;"/>
|
||||
<menuitem data="10" value="&AMten.label;"/>
|
||||
<menuitem data="11" value="&AMeleven.label;"/>
|
||||
<menuitem data="12" value="&noon.label;"/>
|
||||
<menuitem data="13" value="&PMone.label;"/>
|
||||
<menuitem data="14" value="&PMtwo.label;"/>
|
||||
<menuitem data="15" value="&PMthree.label;"/>
|
||||
<menuitem data="16" value="&PMfour.label;"/>
|
||||
<menuitem data="17" value="&PMfive.label;"/>
|
||||
<menuitem data="18" value="&PMsix.label;"/>
|
||||
<menuitem data="19" value="&PMseven.label;"/>
|
||||
<menuitem data="20" value="&PMeight.label;"/>
|
||||
<menuitem data="21" value="&PMnine.label;"/>
|
||||
<menuitem data="22" value="&PMten.label;"/>
|
||||
<menuitem data="23" value="&PMeleven.label;"/>
|
||||
<menuitem data="24" value="&midnight.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</box>
|
||||
</row>
|
||||
<row autostretch="never">
|
||||
<text class="label" value="&every.label;" for="duration"/>
|
||||
<box autostretch="never">
|
||||
<textfield id="duration" size="4" value="60" />
|
||||
<text class="label" value="&minutes.label;" />
|
||||
</box>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</titledbox>
|
||||
<spring flex="1"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<box orient="vertical">
|
||||
<separator class="thin"/>
|
||||
<box autostretch="never" valign="top">
|
||||
<image id="notification-icon"/>
|
||||
<separator class="thin" orient="vertical"/>
|
||||
<html flex="1">¬ification.description;</html>
|
||||
</box>
|
||||
<separator class="thin"/>
|
||||
<box class="box-padded">
|
||||
<spring flex="1"/>
|
||||
<titledbox orient="vertical" autostretch="never">
|
||||
<title value="¬ifications.legend.label;" />
|
||||
<checkbox id="bookmarkIcon" value="¬ification.icon.label;" />
|
||||
<checkbox id="showAlert" value="¬ification.alert.label;" />
|
||||
<checkbox id="openWindow" value="¬ification.window.label;" />
|
||||
<checkbox id="playSound" value="¬ification.sound.label;" />
|
||||
</titledbox>
|
||||
<spring flex="1"/>
|
||||
</box>
|
||||
</box>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
|
||||
<separator/>
|
||||
|
||||
<box id="okCancelButtonsRight"/>
|
||||
|
||||
|
|
|
@ -0,0 +1,839 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the old bookmarks code, included here for the sake of the bookmarks sidebar panel,
|
||||
which will be fixed to use my new code in .9. In the mean time, this file provides a
|
||||
life line to various functionality.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var NC_NS = "http://home.netscape.com/NC-rdf#";
|
||||
var RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
|
||||
function Init() {
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
tree.controllers.appendController(BookmarksController);
|
||||
var children = document.getElementById('treechildren-bookmarks');
|
||||
tree.selectItem(children.firstChild);
|
||||
tree.focus();
|
||||
|
||||
RefreshSort();
|
||||
}
|
||||
|
||||
var BookmarksController = {
|
||||
supportsCommand: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_undo":
|
||||
case "cmd_redo":
|
||||
return false;
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_paste":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
isCommandEnabled: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_undo":
|
||||
case "cmd_redo":
|
||||
return false;
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_paste":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
doCommand: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_undo":
|
||||
case "cmd_redo":
|
||||
break;
|
||||
case "cmd_cut":
|
||||
doCut();
|
||||
break;
|
||||
case "cmd_copy":
|
||||
doCopy();
|
||||
break;
|
||||
case "cmd_paste":
|
||||
doPaste();
|
||||
break;
|
||||
case "cmd_delete":
|
||||
doDelete();
|
||||
break;
|
||||
case "cmd_selectAll":
|
||||
doSelectAll();
|
||||
break;
|
||||
}
|
||||
},
|
||||
onEvent: function(event)
|
||||
{
|
||||
// On blur events set the menu item texts back to the normal values
|
||||
/*if (event == 'blur' )
|
||||
{
|
||||
goSetMenuValue('cmd_undo', 'valueDefault');
|
||||
goSetMenuValue('cmd_redo', 'valueDefault');
|
||||
}*/
|
||||
}
|
||||
};
|
||||
|
||||
function CommandUpdate_Bookmarks()
|
||||
{
|
||||
//goUpdateCommand('button_delete');
|
||||
// get selection info from dir pane
|
||||
/*
|
||||
var oneAddressBookSelected = false;
|
||||
if ( dirTree && dirTree.selectedItems && (dirTree.selectedItems.length == 1) )
|
||||
oneAddressBookSelected = true;
|
||||
|
||||
// get selection info from results pane
|
||||
var selectedCards = GetSelectedAddresses();
|
||||
var oneOrMoreCardsSelected = false;
|
||||
if ( selectedCards )
|
||||
oneOrMoreCardsSelected = true;
|
||||
*/
|
||||
// set commands to enabled / disabled
|
||||
//goSetCommandEnabled('cmd_PrintCard', oneAddressBookSelected);
|
||||
goSetCommandEnabled('bm_cmd_find', true/*oneAddressBookSelected*/);
|
||||
}
|
||||
|
||||
function copySelectionToClipboard()
|
||||
{
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
if (!treeNode) return false;
|
||||
var select_list = treeNode.selectedItems;
|
||||
if (!select_list) return false;
|
||||
if (select_list.length < 1) return false;
|
||||
|
||||
var rdf_uri = "@mozilla.org/rdf/rdf-service;1"
|
||||
var RDF = Components.classes[rdf_uri].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (!RDF) return false;
|
||||
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
if (!Bookmarks) return false;
|
||||
|
||||
var nameRes = RDF.GetResource(NC_NS + "Name");
|
||||
if (!nameRes) return false;
|
||||
|
||||
// Build a url that encodes all the select nodes
|
||||
// as well as their parent nodes
|
||||
var url = "";
|
||||
var text = "";
|
||||
var html = "";
|
||||
|
||||
for (var nodeIndex = 0; nodeIndex < select_list.length; nodeIndex++)
|
||||
{
|
||||
var node = select_list[nodeIndex];
|
||||
if (!node) continue;
|
||||
|
||||
var ID = getAbsoluteID("bookmarksTree", node);
|
||||
if (!ID) continue;
|
||||
|
||||
var IDRes = RDF.GetResource(ID);
|
||||
if (!IDRes) continue;
|
||||
var nameNode = Bookmarks.GetTarget(IDRes, nameRes, true);
|
||||
var theName = "";
|
||||
if (nameNode)
|
||||
nameNode =
|
||||
nameNode.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (nameNode) theName = nameNode.Value;
|
||||
|
||||
url += "ID:{" + ID + "};";
|
||||
url += "NAME:{" + theName + "};";
|
||||
|
||||
if (node.getAttribute("container") == "true")
|
||||
{
|
||||
var type = node.getAttribute("type");
|
||||
if (type == NC_NS + "BookmarkSeparator")
|
||||
{
|
||||
// Note: can't encode separators in text, just html
|
||||
html += "<hr><p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
text += ID + "\r";
|
||||
|
||||
html += "<a href='" + ID + "'>";
|
||||
if (theName != "")
|
||||
{
|
||||
html += theName;
|
||||
}
|
||||
html += "</a><p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (url == "") return false;
|
||||
|
||||
// get some useful components
|
||||
var trans_uri = "@mozilla.org/widget/transferable;1";
|
||||
var trans = Components.classes[trans_uri].createInstance();
|
||||
if (trans) trans = trans.QueryInterface(Components.interfaces.nsITransferable);
|
||||
if (!trans) return false;
|
||||
|
||||
var clip_uri = "@mozilla.org/widget/clipboard;1";
|
||||
var clip = Components.classes[clip_uri].getService();
|
||||
if (clip) clip = clip.QueryInterface(Components.interfaces.nsIClipboard);
|
||||
if (!clip) return false;
|
||||
clip.emptyClipboard(Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
|
||||
// save bookmark's ID
|
||||
trans.addDataFlavor("moz/bookmarkclipboarditem");
|
||||
var data_uri = "@mozilla.org/supports-wstring;1";
|
||||
var data = Components.classes[data_uri].createInstance();
|
||||
if (data) {
|
||||
data = data.QueryInterface(Components.interfaces.nsISupportsWString);
|
||||
}
|
||||
if (!data) return false;
|
||||
data.data = url;
|
||||
// double byte data
|
||||
trans.setTransferData("moz/bookmarkclipboarditem", data, url.length*2);
|
||||
|
||||
if (text != "")
|
||||
{
|
||||
trans.addDataFlavor("text/unicode");
|
||||
|
||||
var textData_uri = "@mozilla.org/supports-wstring;1";
|
||||
var textData = Components.classes[textData_uri].createInstance();
|
||||
if (textData) textData = textData.QueryInterface(Components.interfaces.nsISupportsWString);
|
||||
if (!textData) return false;
|
||||
textData.data = text;
|
||||
// double byte data
|
||||
trans.setTransferData("text/unicode", textData, text.length*2);
|
||||
}
|
||||
if (html != "")
|
||||
{
|
||||
trans.addDataFlavor("text/html");
|
||||
|
||||
var wstring_uri = "@mozilla.org/supports-wstring;1";
|
||||
var htmlData = Components.classes[wstring_uri].createInstance();
|
||||
if (htmlData) {
|
||||
var wstring_interface = Components.interfaces.nsISupportsWString;
|
||||
htmlData = htmlData.QueryInterface(wstring_interface);
|
||||
}
|
||||
if (!htmlData) return false;
|
||||
htmlData.data = html;
|
||||
// double byte data
|
||||
trans.setTransferData("text/html", htmlData, html.length*2);
|
||||
}
|
||||
clip.setData(trans, null,
|
||||
Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
return true;
|
||||
}
|
||||
|
||||
function doCut()
|
||||
{
|
||||
if (copySelectionToClipboard() == true) {
|
||||
doDelete(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function doCopy()
|
||||
{
|
||||
copySelectionToClipboard();
|
||||
return true;
|
||||
}
|
||||
|
||||
function doPaste()
|
||||
{
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
if (!treeNode) return false;
|
||||
var select_list = treeNode.selectedItems;
|
||||
if (!select_list) return false;
|
||||
if (select_list.length != 1) return false;
|
||||
|
||||
var pasteNodeID = select_list[0].getAttribute("id");
|
||||
var isContainerFlag = (select_list[0].getAttribute("container") == "true");
|
||||
|
||||
var clip_uri = "@mozilla.org/widget/clipboard;1";
|
||||
var clip = Components.classes[clip_uri].getService();
|
||||
if (clip) clip = clip.QueryInterface(Components.interfaces.nsIClipboard);
|
||||
if (!clip) return false;
|
||||
|
||||
var trans_uri = "@mozilla.org/widget/transferable;1";
|
||||
var trans = Components.classes[trans_uri].createInstance();
|
||||
if (trans) {
|
||||
trans = trans.QueryInterface(Components.interfaces.nsITransferable);
|
||||
}
|
||||
if (!trans) return false;
|
||||
trans.addDataFlavor("moz/bookmarkclipboarditem");
|
||||
|
||||
clip.getData(trans, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
var data = new Object();
|
||||
var dataLen = new Object();
|
||||
trans.getTransferData("moz/bookmarkclipboarditem", data, dataLen);
|
||||
if (data) {
|
||||
var data_interface = Components.interfaces.nsISupportsWString
|
||||
data = data.value.QueryInterface(data_interface);
|
||||
}
|
||||
var url = null;
|
||||
// double byte data
|
||||
if (data) url = data.data.substring(0, dataLen.value / 2);
|
||||
if (!url) return false;
|
||||
|
||||
var strings = url.split(";");
|
||||
if (!strings) return false;
|
||||
|
||||
var rdf_uri = "@mozilla.org/rdf/rdf-service;1";
|
||||
var RDF = Components.classes[rdf_uri].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (!RDF) return false;
|
||||
var rdfc_uri = "@mozilla.org/rdf/container;1";
|
||||
var RDFC = Components.classes[rdfc_uri].getService();
|
||||
RDFC = RDFC.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
if (!RDFC) return false;
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
if (!Bookmarks) return false;
|
||||
|
||||
var nameRes = RDF.GetResource(NC_NS + "Name");
|
||||
if (!nameRes) return false;
|
||||
|
||||
pasteNodeRes = RDF.GetResource(pasteNodeID);
|
||||
if (!pasteNodeRes) return false;
|
||||
var pasteContainerRes = null;
|
||||
var pasteNodeIndex = -1;
|
||||
if (isContainerFlag == true)
|
||||
{
|
||||
pasteContainerRes = pasteNodeRes;
|
||||
}
|
||||
else
|
||||
{
|
||||
var parID = select_list[0].parentNode.parentNode.getAttribute("ref");
|
||||
if (!parID) {
|
||||
parID = select_list[0].parentNode.parentNode.getAttribute("id");
|
||||
}
|
||||
if (!parID) return false;
|
||||
pasteContainerRes = RDF.GetResource(parID);
|
||||
if (!pasteContainerRes) return false;
|
||||
}
|
||||
RDFC.Init(Bookmarks, pasteContainerRes);
|
||||
|
||||
if (isContainerFlag == false)
|
||||
{
|
||||
pasteNodeIndex = RDFC.IndexOf(pasteNodeRes);
|
||||
if (pasteNodeIndex < 0) return false; // how did that happen?
|
||||
}
|
||||
|
||||
var typeRes = RDF.GetResource(RDF_NS + "type");
|
||||
if (!typeRes) return false;
|
||||
var bmTypeRes = RDF.GetResource(NC_NS + "Bookmark");
|
||||
if (!bmTypeRes) return false;
|
||||
|
||||
var dirty = false;
|
||||
for (var x=0; x<strings.length; x=x+2)
|
||||
{
|
||||
var theID = strings[x];
|
||||
var theName = strings[x+1];
|
||||
if ((theID.indexOf("ID:{") == 0) && (theName.indexOf("NAME:{") == 0))
|
||||
{
|
||||
theID = theID.substr(4, theID.length-5);
|
||||
theName = theName.substr(6, theName.length-7);
|
||||
|
||||
var IDRes = RDF.GetResource(theID);
|
||||
if (!IDRes) continue;
|
||||
|
||||
if (RDFC.IndexOf(IDRes) > 0)
|
||||
continue;
|
||||
|
||||
if (theName != "")
|
||||
{
|
||||
var NameLiteral = RDF.GetLiteral(theName);
|
||||
if (NameLiteral)
|
||||
{
|
||||
Bookmarks.Assert(IDRes, nameRes, NameLiteral, true);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
if (isContainerFlag == true)
|
||||
RDFC.AppendElement(IDRes);
|
||||
else
|
||||
RDFC.InsertElementAt(IDRes, pasteNodeIndex++, true);
|
||||
dirty = true;
|
||||
|
||||
// make sure appropriate bookmark type is set
|
||||
var bmTypeNode = Bookmarks.GetTarget( IDRes, typeRes, true );
|
||||
if (!bmTypeNode)
|
||||
{
|
||||
// set default bookmark type
|
||||
Bookmarks.Assert(IDRes, typeRes, bmTypeRes, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dirty == true)
|
||||
{
|
||||
var rdf_ds_interface = Components.interfaces.nsIRDFRemoteDataSource;
|
||||
var remote = Bookmarks.QueryInterface(rdf_ds_interface);
|
||||
if (remote)
|
||||
remote.Flush();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function doDelete(promptFlag)
|
||||
{
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
if (!treeNode) return false;
|
||||
var select_list = treeNode.selectedItems;
|
||||
if (!select_list) return false;
|
||||
if (select_list.length < 1) return false;
|
||||
|
||||
if (promptFlag == true)
|
||||
{
|
||||
var deleteStr = '';
|
||||
if (select_list.length == 1) {
|
||||
deleteStr = get_localized_string("DeleteItem");
|
||||
} else {
|
||||
deleteStr = get_localized_string("DeleteItems");
|
||||
}
|
||||
var ok = confirm(deleteStr);
|
||||
if (!ok) return false;
|
||||
}
|
||||
|
||||
var RDF_uri = "@mozilla.org/rdf/rdf-service;1";
|
||||
var RDF = Components.classes[RDF_uri].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (!RDF) return false;
|
||||
|
||||
var RDFC_uri = "@mozilla.org/rdf/container;1";
|
||||
var RDFC = Components.classes[RDFC_uri].getService();
|
||||
RDFC = RDFC.QueryInterface(Components.interfaces.nsIRDFContainer);
|
||||
if (!RDFC) return false;
|
||||
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
if (!Bookmarks) return false;
|
||||
|
||||
var dirty = false;
|
||||
|
||||
// note: backwards delete so that we handle odd deletion cases such as
|
||||
// deleting a child of a folder as well as the folder itself
|
||||
for (var nodeIndex=select_list.length-1; nodeIndex>=0; nodeIndex--)
|
||||
{
|
||||
var node = select_list[nodeIndex];
|
||||
if (!node) continue;
|
||||
var ID = node.getAttribute("id");
|
||||
if (!ID) continue;
|
||||
|
||||
// don't allow deletion of various "special" folders
|
||||
if ((ID == "NC:BookmarksRoot") || (ID == "NC:IEFavoritesRoot"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var parentID = node.parentNode.parentNode.getAttribute("ref");
|
||||
if (!parentID) parentID = node.parentNode.parentNode.getAttribute("id");
|
||||
if (!parentID) continue;
|
||||
|
||||
var IDRes = RDF.GetResource(ID);
|
||||
if (!IDRes) continue;
|
||||
var parentIDRes = RDF.GetResource(parentID);
|
||||
if (!parentIDRes) continue;
|
||||
|
||||
RDFC.Init(Bookmarks, parentIDRes);
|
||||
RDFC.RemoveElement(IDRes, true);
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if (dirty == true)
|
||||
{
|
||||
var remote = Bookmarks.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
if (remote)
|
||||
remote.Flush();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function doSelectAll()
|
||||
{
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
if (!treeNode) return false;
|
||||
treeNode.selectAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
function doUnload()
|
||||
{
|
||||
// Get the current window position/size.
|
||||
var x = window.screenX;
|
||||
var y = window.screenY;
|
||||
var h = window.outerHeight;
|
||||
var w = window.outerWidth;
|
||||
|
||||
// Store these into the window attributes (for persistence).
|
||||
var win = document.getElementById("bookmark-window");
|
||||
win.setAttribute("x", x);
|
||||
win.setAttribute("y", y);
|
||||
win.setAttribute("height", h);
|
||||
win.setAttribute("width", w);
|
||||
}
|
||||
|
||||
function BookmarkProperties()
|
||||
{
|
||||
var treeNode = document.getElementById('bookmarksTree');
|
||||
var select_list = treeNode.selectedItems;
|
||||
|
||||
if (select_list.length >= 1) {
|
||||
// don't bother showing properties on bookmark separators
|
||||
var type = select_list[0].getAttribute('type');
|
||||
if (type != NC_NS + "BookmarkSeparator") {
|
||||
window.openDialog("chrome://communicator/content/bookmarks/bm-props.xul",
|
||||
"_blank", "centerscreen,chrome,menubar",
|
||||
select_list[0].getAttribute("id"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function OpenBookmarksFind()
|
||||
{
|
||||
window.openDialog("chrome://communicator/content/bookmarks/bm-find.xul",
|
||||
"FindBookmarksWindow",
|
||||
"dialog=no,close,chrome,resizable", "bookmarks");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getAbsoluteID(root, node)
|
||||
{
|
||||
var url = node.getAttribute("ref");
|
||||
if ((url == null) || (url == ""))
|
||||
{
|
||||
url = node.getAttribute("id");
|
||||
}
|
||||
try
|
||||
{
|
||||
var rootNode = document.getElementById(root);
|
||||
var ds = null;
|
||||
if (rootNode)
|
||||
{
|
||||
ds = rootNode.database;
|
||||
}
|
||||
|
||||
// add support for anonymous resources such as Internet Search results,
|
||||
// IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
var rdf_uri = "@mozilla.org/rdf/rdf-service;1";
|
||||
var rdf = Components.classes[rdf_uri].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf && ds)
|
||||
{
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource(NC_NS + "URL",
|
||||
true);
|
||||
var target = ds.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
function OpenURL(event, node, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.detail != 2)
|
||||
|| (node.nodeName != "treeitem"))
|
||||
return false;
|
||||
|
||||
if (node.getAttribute("container") == "true")
|
||||
return false;
|
||||
|
||||
var url = getAbsoluteID(root, node);
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (url.substring(0, 3) == "NC:")
|
||||
return false;
|
||||
|
||||
if (event.altKey)
|
||||
{
|
||||
BookmarkProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
// get right sized window
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
|
||||
function doContextCmd(cmdName)
|
||||
{
|
||||
// Do some prompting/confirmation for various bookmark
|
||||
// commands that we know about.
|
||||
// If we have values to pass it, they are added to the arguments array
|
||||
|
||||
var nameVal = "";
|
||||
var urlVal = "";
|
||||
var promptStr;
|
||||
|
||||
var picker_uri;
|
||||
var filePicker;
|
||||
|
||||
if (cmdName == NC_NS + "command?cmd=newbookmark")
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
promptStr = get_localized_string("NewBookmarkURLPrompt");
|
||||
urlVal = prompt(promptStr, "");
|
||||
if (!urlVal || urlVal=="") return false;
|
||||
|
||||
// ensure we get a fully qualified URL (protocol colon address)
|
||||
var colonOffset = urlVal.indexOf(":");
|
||||
if (colonOffset > 0) break;
|
||||
alert(get_localized_string("NeedValidURL"));
|
||||
}
|
||||
|
||||
promptStr = get_localized_string("NewBookmarkNamePrompt");
|
||||
nameVal = prompt(promptStr, "");
|
||||
if (!nameVal || nameVal=="") return false;
|
||||
}
|
||||
else if (cmdName == NC_NS + "command?cmd=newfolder")
|
||||
{
|
||||
promptStr = get_localized_string("NewFolderNamePrompt");
|
||||
nameVal = prompt(promptStr, "");
|
||||
if (!nameVal || nameVal=="") return false;
|
||||
}
|
||||
else if ((cmdName == NC_NS + "command?cmd=deletebookmark") ||
|
||||
(cmdName == NC_NS + "command?cmd=deletebookmarkfolder") ||
|
||||
(cmdName == NC_NS + "command?cmd=deletebookmarkseparator"))
|
||||
{
|
||||
return doDelete(true);
|
||||
//var promptStr = get_localized_string("DeleteItems");
|
||||
//if (!confirm(promptStr)) return false;
|
||||
}
|
||||
else if (cmdName == NC_NS + "command?cmd=import")
|
||||
{
|
||||
try
|
||||
{
|
||||
picker_uri = "@mozilla.org/filepicker;1";
|
||||
filePicker = Components.classes[picker_uri].createInstance(nsIFilePicker);
|
||||
if (!filePicker) return false;
|
||||
|
||||
promptStr = get_localized_string("SelectImport");
|
||||
filePicker.init(window, promptStr, nsIFilePicker.modeOpen);
|
||||
filePicker.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterAll);
|
||||
if (filePicker.show() != nsIFilePicker.returnCancel)
|
||||
var filename = filePicker.fileURL.spec;
|
||||
if ((!filename) || (filename == "")) return false;
|
||||
|
||||
urlVal = filename;
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (cmdName == NC_NS + "command?cmd=export")
|
||||
{
|
||||
try
|
||||
{
|
||||
picker_uri = "@mozilla.org/filepicker;1";
|
||||
filePicker = Components.classes[picker_uri].createInstance(nsIFilePicker);
|
||||
if (!filePicker) return false;
|
||||
|
||||
promptStr = get_localized_string("EnterExport");
|
||||
filePicker.init(window, promptStr, nsIFilePicker.modeSave);
|
||||
filePicker.defaultString = "bookmarks.html";
|
||||
filePicker.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterAll);
|
||||
if (filePicker.show() != nsIFilePicker.returnCancel &&
|
||||
filePicker.fileURL.spec &&
|
||||
filePicker.fileURL.spec.length > 0) {
|
||||
urlVal = filePicker.fileURL.spec;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
if (!treeNode) return false;
|
||||
var db = treeNode.database;
|
||||
if (!db) return false;
|
||||
|
||||
var compositeDB = db.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
if (!compositeDB) return false;
|
||||
|
||||
var isupports_uri = "@mozilla.org/rdf/rdf-service;1";
|
||||
var isupports = Components.classes[isupports_uri].getService();
|
||||
if (!isupports) return false;
|
||||
var rdf = isupports.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (!rdf) return false;
|
||||
|
||||
// need a resource for the command
|
||||
var cmdResource = rdf.GetResource(cmdName);
|
||||
if (!cmdResource) return false;
|
||||
cmdResource = cmdResource.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (!cmdResource) return false;
|
||||
|
||||
// set up selection nsISupportsArray
|
||||
var selection_uri = "@mozilla.org/supports-array;1";
|
||||
var selectionInstance = Components.classes[selection_uri].createInstance();
|
||||
var selectionArray = selectionInstance.QueryInterface(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// set up arguments nsISupportsArray
|
||||
var arguments_uri = "@mozilla.org/supports-array;1";
|
||||
var argumentsInstance = Components.classes[arguments_uri].createInstance();
|
||||
var argumentsArray = argumentsInstance.QueryInterface(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// get various arguments (parent, name)
|
||||
var parentArc = rdf.GetResource(NC_NS + "parent");
|
||||
if (!parentArc) return false;
|
||||
var nameArc = rdf.GetResource(NC_NS + "Name");
|
||||
if (!nameArc) return false;
|
||||
var urlArc = rdf.GetResource(NC_NS + "URL");
|
||||
if (!urlArc) return false;
|
||||
|
||||
var select_list = treeNode.selectedItems;
|
||||
|
||||
var uri;
|
||||
var rdfNode;
|
||||
|
||||
if (select_list.length < 1)
|
||||
{
|
||||
// if nothing is selected, default to using the "ref"
|
||||
// on the root of the tree
|
||||
uri = treeNode.getAttribute("ref");
|
||||
if (!uri || uri=="") return false;
|
||||
rdfNode = rdf.GetResource(uri);
|
||||
// add node into selection array
|
||||
if (rdfNode)
|
||||
{
|
||||
selectionArray.AppendElement(rdfNode);
|
||||
}
|
||||
|
||||
// add singular arguments into arguments array
|
||||
if ((nameVal) && (nameVal != ""))
|
||||
{
|
||||
var nameLiteral = rdf.GetLiteral(nameVal);
|
||||
if (!nameLiteral) return false;
|
||||
argumentsArray.AppendElement(nameArc);
|
||||
argumentsArray.AppendElement(nameLiteral);
|
||||
}
|
||||
if ((urlVal) && (urlVal != ""))
|
||||
{
|
||||
var urlLiteral = rdf.GetLiteral(urlVal);
|
||||
if (!urlLiteral) return false;
|
||||
argumentsArray.AppendElement(urlArc);
|
||||
argumentsArray.AppendElement(urlLiteral);
|
||||
}
|
||||
}
|
||||
else for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)
|
||||
{
|
||||
var node = select_list[nodeIndex];
|
||||
if (!node) break;
|
||||
uri = node.getAttribute("ref");
|
||||
if ((uri) || (uri == ""))
|
||||
{
|
||||
uri = node.getAttribute("id");
|
||||
}
|
||||
if (!uri) return false;
|
||||
|
||||
rdfNode = rdf.GetResource(uri);
|
||||
if (!rdfNode) break;
|
||||
|
||||
// add node into selection array
|
||||
selectionArray.AppendElement(rdfNode);
|
||||
|
||||
// get the parent's URI
|
||||
var parentURI = "";
|
||||
var theParent = node.parentNode.parentNode;
|
||||
parentURI = theParent.getAttribute("ref");
|
||||
if ((!parentURI) || (parentURI == ""))
|
||||
{
|
||||
parentURI = theParent.getAttribute("id");
|
||||
}
|
||||
if (parentURI == "") return false;
|
||||
|
||||
var parentNode = rdf.GetResource(parentURI, true);
|
||||
if (!parentNode) return false;
|
||||
|
||||
// add multiple arguments into arguments array
|
||||
argumentsArray.AppendElement(parentArc);
|
||||
argumentsArray.AppendElement(parentNode);
|
||||
|
||||
if ((nameVal) && (nameVal != ""))
|
||||
{
|
||||
var nameLiteral2 = rdf.GetLiteral(nameVal);
|
||||
if (!nameLiteral2) return false;
|
||||
argumentsArray.AppendElement(nameArc);
|
||||
argumentsArray.AppendElement(nameLiteral2);
|
||||
}
|
||||
if ((urlVal) && (urlVal != ""))
|
||||
{
|
||||
var urlLiteral2 = rdf.GetLiteral(urlVal);
|
||||
if (!urlLiteral2) return false;
|
||||
argumentsArray.AppendElement(urlArc);
|
||||
argumentsArray.AppendElement(urlLiteral2);
|
||||
}
|
||||
}
|
||||
|
||||
// do the command
|
||||
compositeDB.DoCommand(selectionArray, cmdResource, argumentsArray);
|
||||
return true;
|
||||
}
|
||||
|
||||
function bookmarkSelect()
|
||||
{
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
var status = document.getElementById("statusbar-text");
|
||||
var val = "";
|
||||
if (tree.selectedItems.length == 1)
|
||||
{
|
||||
val = getAbsoluteID("bookmarksTree", tree.selectedItems[0]);
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (val.substring(0, 3) == "NC:")
|
||||
{
|
||||
val = "";
|
||||
}
|
||||
}
|
||||
status.setAttribute("value", val);
|
||||
return true;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,4 +1,6 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: HTML; indent-tabs-mode: nil; -*- -->
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- -*- Mode: HTML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
|
@ -19,6 +21,7 @@
|
|||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Ben Goodger <ben@netscape.com>
|
||||
Blake Ross <blakeross@telocity.com>
|
||||
|
||||
-->
|
||||
|
@ -30,331 +33,394 @@
|
|||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks-tree.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/bookmarks/bookmarksOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/bookmarks/bookmarks.dtd">
|
||||
|
||||
<window title="&bookmarksWindowTitle.label;" id="bookmark-window" onunload="doUnload()"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:web="http://home.netscape.com/WEB-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="630" height="400" screenX="20" screenY="20"
|
||||
persist="width height screenX screenY sizemode" orient="vertical"
|
||||
onload="Init();"
|
||||
ondraggesture="return TopLevelDrag(event);"
|
||||
windowtype="bookmarks:manager"
|
||||
>
|
||||
<window id="bookmark-window" windowtype="bookmarks:manager"
|
||||
title="&bookmarksWindowTitle.label;"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:web="http://home.netscape.com/WEB-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="630" height="400" screenX="20" screenY="20"
|
||||
persist="width height screenX screenY sizemode" orient="vertical"
|
||||
onload="Startup();" onunload="Shutdown();">
|
||||
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarks.js"/>
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarksDD.js"/>
|
||||
<script src="chrome://global/content/nsTreeUtils.js"/>
|
||||
<script src="chrome://global/content/treePopups.js"/>
|
||||
<script src="chrome://global/content/strres.js"/>
|
||||
<script src="chrome://global/content/globalOverlay.js"/>
|
||||
<script src="chrome://global/content/nsJSComponentManager.js"/>
|
||||
<!-- The order of loading of these script files is IMPORTANT -->
|
||||
|
||||
<commands id="commands">
|
||||
<commandset id="CommandUpdate_Bookmarks"
|
||||
commandupdater="true"
|
||||
events="focus,tree-select"
|
||||
oncommandupdate="CommandUpdate_Bookmarks()"/>
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
<commandset id="globalEditMenuItems">
|
||||
<command id="bm_cmd_find" oncommand="return OpenBookmarksFind();"/>
|
||||
<command id="bm_cmd_properties" oncommand="return BookmarkProperties();"/>
|
||||
</commandset>
|
||||
</commands>
|
||||
<!-- Shared Libraries -->
|
||||
<script src="chrome://global/content/nsTreeUtils.js"></script>
|
||||
<script src="chrome://global/content/strres.js"></script>
|
||||
|
||||
<broadcasterset id="broadcasterset">
|
||||
<!-- File Menu -->
|
||||
<broadcaster id="cmd_newNavigator"/>
|
||||
<broadcaster id="cmd_newEditor"/>
|
||||
<broadcaster id="cmd_close" oncommand="window.close()"/>
|
||||
<broadcaster id="cmd_quit"/>
|
||||
<broadcaster id="bm_cmd_saveas"/>
|
||||
<!-- Edit Menu -->
|
||||
<broadcaster id="cmd_undo"/>
|
||||
<broadcaster id="cmd_cut"/>
|
||||
<broadcaster id="cmd_copy"/>
|
||||
<broadcaster id="cmd_paste"/>
|
||||
<broadcaster id="cmd_delete"/>
|
||||
<broadcaster id="cmd_selectAll"/>
|
||||
<broadcaster id="cmd_preferences"/>
|
||||
</broadcasterset>
|
||||
<!-- XXX - This should SO become an XBL widget -->
|
||||
<script src="chrome://global/content/treePopups.js"></script>
|
||||
<script src="chrome://global/content/globalOverlay.js"></script>
|
||||
|
||||
<!-- Shared Bookmarks Utility Library -->
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarksOverlay.js"></script>
|
||||
<!-- Tree-based Bookmarks UI Utility Library -->
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarksTree.js"></script>
|
||||
<!-- Bookmarks Window -->
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarks.js"></script>
|
||||
|
||||
<keyset id="keyset">
|
||||
<!-- File Menu -->
|
||||
<key id="key_newNavigator"/>
|
||||
<key id="key_newEditor"/>
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
<!-- Edit Menu -->
|
||||
<key id="key_undo"/>
|
||||
<key id="key_cut"/>
|
||||
<key id="key_copy"/>
|
||||
<key id="key_paste"/>
|
||||
<key id="key_delete"/>
|
||||
<key id="key_selectAll"/>
|
||||
<key id="bm_key_find" key="&edit.find.keybinding;" observes="bm_cmd_find" modifiers="accel"/>
|
||||
<key id="bm_key_properties"
|
||||
key="&edit.properties.keybinding;" observes="bm_cmd_properties" modifiers="accel"/>
|
||||
</keyset>
|
||||
<toolbox>
|
||||
<menubar id="main-menubar">
|
||||
<menu id="menu_File">
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem accesskey="&menuitem.newBookmark.accesskey;" value="&menuitem.newBookmark.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=newbookmark');" />
|
||||
<menu id="menu_New">
|
||||
<menupopup id="menu_NewPopup">
|
||||
<menuitem value="&menuitem.newFolder.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=newfolder');"/>
|
||||
<menuitem value="&menuitem.newSeparator.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=newseparator');"/>
|
||||
<!-- Bookmarks Window Drag & Drop -->
|
||||
<script src="chrome://global/content/nsJSComponentManager.js"></script>
|
||||
<script src="chrome://global/content/nsJSSupportsUtils.js"></script>
|
||||
<script src="chrome://global/content/nsDragAndDrop.js"></script>
|
||||
<script src="chrome://global/content/nsTransferable.js"></script>
|
||||
<script src="chrome://communicator/content/bookmarks/bookmarksDD.js"></script>
|
||||
|
||||
<commands id="commands">
|
||||
<commandset id="CommandUpdate_Bookmarks"
|
||||
commandupdater="true"
|
||||
events="focus,tree-select"
|
||||
oncommandupdate="BookmarksTree.prototype.controller.onCommandUpdate()">
|
||||
</commandset>
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
<commandset id="globalEditMenuItems"/>
|
||||
<commandset id="bookmarksItems">
|
||||
<command id="cmd_open" oncommand="goDoCommand('cmd_open');"/>
|
||||
<command id="cmd_openfolder" oncommand="goDoCommand('cmd_openfolder');"/>
|
||||
<command id="cmd_newfolder" oncommand="goDoCommand('cmd_newfolder');"/>
|
||||
<command id="cmd_newbookmark" oncommand="goDoCommand('cmd_newbookmark');"/>
|
||||
<command id="cmd_newseparator" oncommand="goDoCommand('cmd_newseparator');"/>
|
||||
<command id="cmd_find" oncommand="dump('wsdfsdflk\n');goDoCommand('cmd_find');"/>
|
||||
<command id="cmd_setnewbookmarkfolder" oncommand="goDoCommand('cmd_setnewbookmarkfolder');"/>
|
||||
<command id="cmd_setpersonaltoolbarfolder" oncommand="goDoCommand('cmd_setpersonaltoolbarfolder');"/>
|
||||
<command id="cmd_setnewsearchfolder" oncommand="goDoCommand('cmd_setnewsearchfolder');"/>
|
||||
<command id="cmd_properties" oncommand="goDoCommand('cmd_properties');"/>
|
||||
<command id="cmd_rename" oncommand="goDoCommand('cmd_rename');"/>
|
||||
<command id="cmd_openfolderinnewwindow" oncommand="goDoCommand('cmd_openfolderinnewwindow');"/>
|
||||
<command id="cmd_import" oncommand="goDoCommand('cmd_import');"/>
|
||||
<command id="cmd_export" oncommand="goDoCommand('cmd_export');"/>
|
||||
</commandset>
|
||||
</commands>
|
||||
|
||||
<broadcasterset id="broadcasterset">
|
||||
<!-- File Menu -->
|
||||
<broadcaster id="cmd_newNavigator"/>
|
||||
<broadcaster id="cmd_newEditor"/>
|
||||
<broadcaster id="cmd_close" oncommand="close()"/>
|
||||
<broadcaster id="cmd_quit"/>
|
||||
<!-- Edit Menu -->
|
||||
<broadcaster id="cmd_undo"/>
|
||||
<broadcaster id="cmd_cut"/>
|
||||
<broadcaster id="cmd_copy"/>
|
||||
<broadcaster id="cmd_paste"/>
|
||||
<broadcaster id="cmd_delete"/>
|
||||
<broadcaster id="cmd_selectAll"/>
|
||||
<broadcaster id="cmd_preferences"/>
|
||||
</broadcasterset>
|
||||
|
||||
<popupset id="popupset"/>
|
||||
|
||||
<stringbundleset id="stringbundleset"/>
|
||||
|
||||
<keyset id="keyset">
|
||||
<!-- File Menu -->
|
||||
<key id="key_newNavigator"/>
|
||||
<key id="key_newEditor"/>
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
<!-- Edit Menu -->
|
||||
<key id="key_undo"/>
|
||||
<key id="key_cut"/>
|
||||
<key id="key_copy"/>
|
||||
<key id="key_paste"/>
|
||||
<key id="key_delete"/>
|
||||
<key id="key_selectAll"/>
|
||||
<key id="bm_key_find"
|
||||
key="&edit.find.keybinding;"
|
||||
observes="cmd_find" modifiers="accel"/>
|
||||
<key id="bm_key_properties"
|
||||
key="&edit.properties.keybinding;"
|
||||
observes="cmd_properties" modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<toolbox id="bookmarks-toolbox">
|
||||
<menubar id="main-menubar">
|
||||
<menu id="menu_File">
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem value="&command.newBookmark.label;"
|
||||
accesskey="&command.newBookmark.accesskey;"
|
||||
observes="cmd_newbookmark"/>
|
||||
<menuitem value="&command.newFolder.label;" observes="cmd_newfolder"/>
|
||||
<menuitem value="&command.newSeparator.label;" observes="cmd_newseparator"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_close"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="&menuitem.import.label;" observes="cmd_import"/>
|
||||
<menuitem value="&menuitem.export.label;" observes="cmd_export"/>
|
||||
<menuseparator/>
|
||||
<menuitem observes="cmd_properties" key="bm_key_properties"
|
||||
value="&command.properties.label;"
|
||||
accesskey="&command.properties.accesskey;" />
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_newNavigator" observes="cmd_newNavigator"/>
|
||||
<menuitem id="menu_newEditor" observes="cmd_newEditor"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_close"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="&menuitem.import.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=import');" />
|
||||
<menuitem value="&menuitem.export.label;" oncommand="return doContextCmd('http://home.netscape.com/NC-rdf#command?cmd=export');" />
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="menu_Edit">
|
||||
<menupopup>
|
||||
<menuitem id="menu_undo" disabled="true" />
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_cut"/>
|
||||
<menuitem id="menu_copy"/>
|
||||
<menuitem id="menu_paste"/>
|
||||
<menuitem id="menu_delete"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menuitem observes="bm_cmd_find" key="bm_key_find"
|
||||
value="&menuitem.find.label;" accesskey="&menuitem.find.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_preferences" oncommand="goPreferences('navigator.xul', 'chrome://communicator/content/pref/pref-navigator.xul', 'navigator')"/>
|
||||
<menuitem observes="bm_cmd_properties" key="bm_key_properties"
|
||||
value="&menuitem.properties.label;" accesskey="&menuitem.properties.accesskey;" />
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="menu_View">
|
||||
<menupopup oncreate="fillViewMenu(this)">
|
||||
<menuitem type="radio" name="sort_column" id="unsorted_menuitem"
|
||||
value="&menuitem.view.unsorted.label;" accesskey="&menuitem.view.unsorted.accesskey;"
|
||||
oncommand="return SetSortDirection('natural');"/>
|
||||
<menuseparator id="fill_after_this_node" collapsed="true" />
|
||||
<menuseparator id="fill_before_this_node"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_ascending"
|
||||
value="&menuitem.view.ascending.label;" accesskey="&menuitem.view.ascending.accesskey;"
|
||||
oncommand="return SetSortDirection('ascending');"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_descending"
|
||||
value="&menuitem.view.descending.label;" accesskey="&menuitem.view.descending.accesskey;"
|
||||
oncommand="return SetSortDirection('descending');"/>
|
||||
<menuseparator/>
|
||||
<menu value="&menuitem.view.show_columns.label;" accesskey="&menuitem.view.show_columns.accesskey;">
|
||||
<menupopup
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
<menu id="menu_Edit">
|
||||
<menupopup>
|
||||
<menuitem id="menu_undo" disabled="true"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_cut"/>
|
||||
<menuitem id="menu_copy"/>
|
||||
<menuitem id="menu_paste"/>
|
||||
<menuitem id="menu_delete"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menu id="file-bookmarks-menu" value="&command.fileBookmark.label;"
|
||||
accesskey="&command.fileBookmark.accesskey;"
|
||||
ref="NC:BookmarksRoot" datasources="rdf:bookmarks"
|
||||
template="file-bookmarks-template">
|
||||
<menupopup oncreate="fileButton.createPopupHeader(event);"/>
|
||||
</menu>
|
||||
<menuseparator/>pp
|
||||
<menuitem observes="cmd_find" key="bm_key_find"
|
||||
value="&menuitem.find.label;"
|
||||
accesskey="&menuitem.find.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_preferences"
|
||||
oncommand="goPreferences('navigator', 'chrome://communicator/content/bookmarks/pref-bookmarks.xul', 'bookmarks')"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem value="&menuitem.newbookmarkfolder.label;" accesskey="&menuitem.newbookmarkfolder.accesskey;"
|
||||
oncommand="return doContextCmd(NC_NS + 'command?cmd=setnewbookmarkfolder')"/>
|
||||
<menuitem value="&menuitem.newinternetsearchfolder.label;"
|
||||
oncommand="return doContextCmd(NC_NS + 'command?cmd=setnewsearchfolder')"
|
||||
accesskey="&menuitem.newinternetsearchfolder.accesskey;"/>
|
||||
<menuitem value="&menuitem.personaltoolbarfolder.label;"
|
||||
oncommand="return doContextCmd(NC_NS + 'command?cmd=setpersonaltoolbarfolder')"
|
||||
accesskey="&menuitem.personaltoolbarfolder.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tasksMenu" accesskey="t" />
|
||||
<menu id="menu_Help" accesskey="h" />
|
||||
|
||||
<menu id="menu_View">
|
||||
<menupopup oncreate="fillViewMenu(this)">
|
||||
<menuitem id="viewCommandToolbar" type="checkbox" class="menuitem-iconic"
|
||||
value="&menuitem.view.command.toolbar.label;"
|
||||
accesskey="&menuitem.view.command.toolbar.accesskey;"
|
||||
oncommand="goToggleToolbar('command-toolbar', 'viewCommandToolbar');"/>
|
||||
<menuseparator/>
|
||||
<menuitem type="radio" name="sort_column" id="unsorted_menuitem"
|
||||
value="&menuitem.view.unsorted.label;"
|
||||
accesskey="&menuitem.view.unsorted.accesskey;"
|
||||
oncommand="return SetSortDirection('natural');"/>
|
||||
<menuseparator id="fill_after_this_node" collapsed="true" />
|
||||
<menuseparator id="fill_before_this_node"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_ascending"
|
||||
value="&menuitem.view.ascending.label;"
|
||||
accesskey="&menuitem.view.ascending.accesskey;"
|
||||
oncommand="return SetSortDirection('ascending');"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_descending"
|
||||
value="&menuitem.view.descending.label;"
|
||||
accesskey="&menuitem.view.descending.accesskey;"
|
||||
oncommand="return SetSortDirection('descending');"/>
|
||||
<menuseparator/>
|
||||
<menu value="&menuitem.view.show_columns.label;"
|
||||
accesskey="&menuitem.view.show_columns.accesskey;">
|
||||
<menupopup oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem value="&menuitem.newbookmarkfolder.label;"
|
||||
observes="cmd_setnewbookmarkfolder"
|
||||
accesskey="&menuitem.newbookmarkfolder.accesskey;"/>
|
||||
<menuitem value="&menuitem.newinternetsearchfolder.label;"
|
||||
observes="cmd_setnewsearchfolder"
|
||||
accesskey="&menuitem.newinternetsearchfolder.accesskey;"/>
|
||||
<menuitem value="&menuitem.personaltoolbarfolder.label;"
|
||||
observes="cmd_setpersonaltoolbarfolder"
|
||||
accesskey="&menuitem.personaltoolbarfolder.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tasksMenu"/>
|
||||
<menu id="menu_Help"/>
|
||||
</menubar>
|
||||
|
||||
</menubar>
|
||||
</toolbox>
|
||||
<toolbar id="command-toolbar" tbautostretch="always">
|
||||
<button class="button-toolbar-2" id="newfolder" value="&command.newFolder.label;"
|
||||
observes="cmd_newfolder"/>
|
||||
<button class="button-toolbar-2" id="newfolder" value="&command.newSeparator.label;"
|
||||
observes="cmd_newseparator"/>
|
||||
<toolbarseparator/>
|
||||
<menubutton id="file-bookmarks" value="&command.fileBookmark.label;"
|
||||
crop="right" class="button-toolbar-2"
|
||||
ref="NC:BookmarksRoot" datasources="rdf:bookmarks"
|
||||
template="file-bookmarks-template"
|
||||
ondragover="nsDragAndDrop.dragOver(event, fileButton);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, fileButton);">
|
||||
<template id="file-bookmarks-template">
|
||||
<rule iscontainer="true">
|
||||
<menupopup ondestroy="fileButton.onPopupDestroy(event);">
|
||||
<menu uri="rdf:*" persist="open" class="menu-iconic treeitem-bookmark"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup oncreate="fileButton.createPopupHeader(event);"/>
|
||||
</menubutton>
|
||||
<toolbarseparator/>
|
||||
<button class="button-toolbar-2" id="properties" value="&command.properties.label;"
|
||||
observes="cmd_properties"/>
|
||||
<button class="button-toolbar-2" id="rename" value="&command.rename.label;"
|
||||
observes="cmd_rename"/>
|
||||
<button class="button-toolbar-2" id="delete" value="&command.delete.label;"
|
||||
observes="cmd_delete"/>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
|
||||
<tree id="bookmarksTree" ref="NC:NavCenter" context="bmContext"
|
||||
datasources="rdf:bookmarks rdf:files rdf:httpindex rdf:localsearch rdf:internetsearch"
|
||||
multiple="true" flags="dont-test-empty"
|
||||
ondragover="nsDragAndDrop.dragOver(event, bookmarksDNDObserver);"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, bookmarksDNDObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, bookmarksDNDObserver);"
|
||||
onclick="gBookmarksShell.treeClicked(event);"
|
||||
onselect="gBookmarksShell.treeSelect(event);"
|
||||
onkeydown="gBookmarksShell.treeKeyPress(event);"
|
||||
style="height:0px" flex="2">
|
||||
|
||||
<popupset>
|
||||
<popup id="contextual" oncreate="return fillContextMenu('contextual', 'bookmarksTree');" >
|
||||
<menu />
|
||||
</popup>
|
||||
</popupset>
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell autostretch="never"><treeindentation/>
|
||||
<separator class="groove" flex="1"/></treecell>
|
||||
<treecell autostretch="never"><separator class="groove" flex="1"/></treecell>
|
||||
<treecell autostretch="never"><separator class="groove" flex="1"/></treecell>
|
||||
<treecell autostretch="never"><separator class="groove" flex="1"/></treecell>
|
||||
<treecell autostretch="never"><separator class="groove" flex="1"/></treecell>
|
||||
<treecell autostretch="never"><separator class="groove" flex="1"/></treecell>
|
||||
<treecell autostretch="never"><separator class="groove" flex="1"/></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*" persist="open" class="treeitem-bookmark"
|
||||
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading">
|
||||
<treerow>
|
||||
<treecell class="treecell-bookmark treecell-indent-editable"
|
||||
editable="true" value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading" />
|
||||
<treecell crop="right" class="treecell-inline-edit" editable="true"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL"
|
||||
class="treecell-inline-edit" editable="true"/>
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#Description"
|
||||
class="treecell-inline-edit" editable="true"/>
|
||||
<treecell value="rdf:http://home.netscape.com/WEB-rdf#LastVisitDate"/>
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#BookmarkAddDate"/>
|
||||
<treecell value="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<tree id="bookmarksTree" ref="NC:BookmarksRoot" context="contextual"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch rdf:httpindex"
|
||||
multiple="true" flags="dont-test-empty"
|
||||
onselect="bookmarkSelect();"
|
||||
ondragover="return DragOverTree(event);"
|
||||
ondraggesture="return BeginDragTree(event);"
|
||||
ondragdrop="return DropOnTree(event);"
|
||||
style="height:0px" flex="2">
|
||||
<treecolgroup id="theColumns">
|
||||
<treecol id="Name"
|
||||
sortSeparators="true" width="4*" flex="4"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="URL"
|
||||
sortSeparators="true" width="4*" flex="4"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#URL"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="ShortcutURL" hidden="true"
|
||||
sortSeparators="true" width="1*" flex="1"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#ShortcutURL"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="Description" hidden="true"
|
||||
sortSeparators="true" width="1*" flex="1"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#Description"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="LastVisitDate" hidden="true"
|
||||
sortSeparators="true" width="1*" flex="1"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/WEB-rdf#LastVisitDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="BookmarkAddDate" hidden="true"
|
||||
sortSeparators="true" width="1*" flex="1"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#BookmarkAddDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol id="LastModifiedDate" hidden="true"
|
||||
sortSeparators="true" width="1*" flex="1"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/WEB-rdf#LastModifiedDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
|
||||
</treecolgroup>
|
||||
|
||||
<treehead>
|
||||
<treerow id="headRow">
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.name.label;"
|
||||
onclick="return TriStateColumnSort('Name');"
|
||||
observes="Name" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.url.label;"
|
||||
onclick="return TriStateColumnSort('URL');"
|
||||
observes="URL" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.shortcut.label;"
|
||||
onclick="return TriStateColumnSort('ShortcutURL');"
|
||||
observes="ShortcutURL" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.description.label;"
|
||||
onclick="return TriStateColumnSort('Description');"
|
||||
observes="Description" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.lastvisit.label;"
|
||||
onclick="return TriStateColumnSort('LastVisitDate');"
|
||||
observes="LastVisitDate" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.addedon.label;"
|
||||
onclick="return TriStateColumnSort('BookmarkAddDate');"
|
||||
observes="BookmarkAddDate" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.lastmod.label;"
|
||||
onclick="return TriStateColumnSort('LastModifiedDate');"
|
||||
observes="LastModifiedDate" />
|
||||
<treecell class="treecell-header" allowevents="true" id="popupCell">
|
||||
<menu class="treecell-popupcell-menu" autostretch="never">
|
||||
<image class="treecell-popup-icon"/>
|
||||
<menupopup popupanchor="bottomright" popupalign="topright"
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading">
|
||||
<treerow>
|
||||
<treecell><treeindentation/>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
<treecell>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
<treecell>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
<treecell>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
<treecell>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
<treecell>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
<treecell>
|
||||
<separator class="groove" flex="1" align="center"/></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
<treechildren flex="1" id="treechildren-bookmarks"
|
||||
onclick="if (gBookmarksShell) gBookmarksShell.open(event);"/>
|
||||
</tree>
|
||||
|
||||
<statusbar id="status-bar">
|
||||
<statusbarpanel class="statusbarpanel-icononly" id="offline-status"/>
|
||||
<statusbarpanel id="statusbar-text" flex="1"/>
|
||||
</statusbar>
|
||||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*" persist="open" class="treeitem-bookmark"
|
||||
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading">
|
||||
<treerow>
|
||||
<treecell class="treecell-bookmark treecell-indent"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
loading="rdf:http://home.netscape.com/NC-rdf#loading" />
|
||||
<treecell crop="right"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecell
|
||||
value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL"/>
|
||||
<treecell
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Description"/>
|
||||
<treecell
|
||||
value="rdf:http://home.netscape.com/WEB-rdf#LastVisitDate"/>
|
||||
<treecell
|
||||
value="rdf:http://home.netscape.com/NC-rdf#BookmarkAddDate"/>
|
||||
<treecell
|
||||
value="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecolgroup id="theColumns">
|
||||
<treecol id="Name"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="4*" flex="4"
|
||||
resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<splitter class="tree-splitter"/>
|
||||
|
||||
<treecol id="URL"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="4*" flex="4"
|
||||
resource="http://home.netscape.com/NC-rdf#URL"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<splitter class="tree-splitter"/>
|
||||
|
||||
<treecol id="ShortcutURL"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="1*" flex="1"
|
||||
resource="http://home.netscape.com/NC-rdf#ShortcutURL"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<splitter class="tree-splitter"/>
|
||||
|
||||
<treecol id="Description"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="1*" flex="1"
|
||||
resource="http://home.netscape.com/NC-rdf#Description"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<splitter class="tree-splitter"/>
|
||||
|
||||
<treecol id="LastVisitDate"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="1*" flex="1"
|
||||
resource="http://home.netscape.com/WEB-rdf#LastVisitDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<splitter class="tree-splitter"/>
|
||||
|
||||
<treecol id="BookmarkAddDate"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="1*" flex="1"
|
||||
resource="http://home.netscape.com/NC-rdf#BookmarkAddDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
|
||||
<splitter class="tree-splitter"/>
|
||||
|
||||
<treecol id="LastModifiedDate"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection" width="1*" flex="1"
|
||||
resource="http://home.netscape.com/WEB-rdf#LastModifiedDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
|
||||
</treecolgroup>
|
||||
|
||||
<treehead>
|
||||
<treerow id="headRow">
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.name.label;"
|
||||
onclick="return TriStateColumnSort('Name');"
|
||||
observes="Name"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.url.label;"
|
||||
onclick="return TriStateColumnSort('URL');"
|
||||
observes="URL"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.shortcut.label;"
|
||||
onclick="return TriStateColumnSort('ShortcutURL');"
|
||||
observes="ShortcutURL"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.description.label;"
|
||||
onclick="return TriStateColumnSort('Description');"
|
||||
observes="Description"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.lastvisit.label;"
|
||||
onclick="return TriStateColumnSort('LastVisitDate');"
|
||||
observes="LastVisitDate"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.addedon.label;"
|
||||
onclick="return TriStateColumnSort('BookmarkAddDate');"
|
||||
observes="BookmarkAddDate"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
value="&tree.header.lastmod.label;"
|
||||
onclick="return TriStateColumnSort('LastModifiedDate');"
|
||||
observes="LastModifiedDate"/>
|
||||
<treecell class="treecell-header" allowevents="true" id="popupCell">
|
||||
<menu>
|
||||
<image class="treecell-popup-icon"/>
|
||||
<menupopup popupanchor="bottomright"
|
||||
popupalign="topright"
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<treechildren flex="1" id="treechildren-bookmarks"
|
||||
onclick="return OpenURL(event, event.target.parentNode.parentNode,
|
||||
'bookmarksTree');"/>
|
||||
</tree>
|
||||
|
||||
<statusbar id="status-bar">
|
||||
<statusbarpanel class="statusbarpanel-icononly" id="offline-status"/>
|
||||
<statusbarpanel id="statusbar-text" flex="1"/>
|
||||
</statusbar>
|
||||
</window>
|
||||
|
||||
|
|
|
@ -0,0 +1,493 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the old bookmarks code, included here for the sake of the bookmarks sidebar panel,
|
||||
which will be fixed to use my new code in .9. In the mean time, this file provides a
|
||||
life line to various functionality.
|
||||
*/
|
||||
|
||||
|
||||
var NC_NS = "http://home.netscape.com/NC-rdf#";
|
||||
var RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
|
||||
|
||||
|
||||
function TopLevelDrag ( event )
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
function BeginDragTree ( event )
|
||||
{
|
||||
//XXX we rely on a capturer to already have determined which item the mouse was over
|
||||
//XXX and have set an attribute.
|
||||
|
||||
// if the click is on the tree proper, ignore it. We only care about clicks on items.
|
||||
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
if ( event.target == tree || event.target.localName == "treechildren" )
|
||||
return(true); // continue propagating the event
|
||||
|
||||
var childWithDatabase = tree;
|
||||
if ( ! childWithDatabase )
|
||||
return(false);
|
||||
|
||||
var dragStarted = false;
|
||||
|
||||
var trans =
|
||||
Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
|
||||
if ( !trans ) return(false);
|
||||
|
||||
var genData =
|
||||
Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
|
||||
if (!genData) return(false);
|
||||
|
||||
var genDataURL =
|
||||
Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
|
||||
if (!genDataURL) return(false);
|
||||
|
||||
trans.addDataFlavor("text/unicode");
|
||||
trans.addDataFlavor("moz/rdfitem");
|
||||
|
||||
// ref/id (url) is on the <treeitem> which is two levels above the <treecell> which is
|
||||
// the target of the event.
|
||||
var id = event.target.parentNode.parentNode.getAttribute("ref");
|
||||
if (!id || id=="")
|
||||
{
|
||||
id = event.target.parentNode.parentNode.getAttribute("id");
|
||||
}
|
||||
|
||||
var parentID = event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("ref");
|
||||
if (!parentID || parentID == "")
|
||||
{
|
||||
parentID = event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("id");
|
||||
}
|
||||
|
||||
var trueID = id;
|
||||
if (parentID != null)
|
||||
{
|
||||
trueID += "\n" + parentID;
|
||||
}
|
||||
genData.data = trueID;
|
||||
genDataURL.data = id;
|
||||
|
||||
var database = childWithDatabase.database;
|
||||
var rdf =
|
||||
Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
if ((!rdf) || (!database)) { dump("CAN'T GET DATABASE\n"); return(false); }
|
||||
|
||||
// make sure its a bookmark, bookmark separator, or bookmark folder
|
||||
var src = rdf.GetResource(id, true);
|
||||
var prop = rdf.GetResource(RDF_NS + "type", true);
|
||||
var target = database.GetTarget(src, prop, true);
|
||||
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (target) target = target.Value;
|
||||
if ((!target) || (target == "")) {dump("BAD\n"); return(false);}
|
||||
|
||||
if ((target != NC_NS + "BookmarkSeparator") &&
|
||||
(target != NC_NS + "Bookmark") &&
|
||||
(target != NC_NS + "Folder")) return(false);
|
||||
|
||||
trans.setTransferData ( "moz/rdfitem", genData, genData.data.length * 2); // double byte data
|
||||
trans.setTransferData ( "text/unicode", genDataURL, genDataURL.data.length * 2); // double byte data
|
||||
|
||||
var transArray =
|
||||
Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
if ( !transArray ) return(false);
|
||||
|
||||
// put it into the transferable as an |nsISupports|
|
||||
var genTrans = trans.QueryInterface(Components.interfaces.nsISupports);
|
||||
transArray.AppendElement(genTrans);
|
||||
|
||||
var dragService =
|
||||
Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
|
||||
if ( !dragService ) return(false);
|
||||
|
||||
var nsIDragService = Components.interfaces.nsIDragService;
|
||||
dragService.invokeDragSession ( event.target, transArray, null, nsIDragService.DRAGDROP_ACTION_COPY +
|
||||
nsIDragService.DRAGDROP_ACTION_MOVE );
|
||||
dragStarted = true;
|
||||
|
||||
return(!dragStarted);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DragOverTree ( event )
|
||||
{
|
||||
var validFlavor = false;
|
||||
var dragSession = null;
|
||||
var retVal = true;
|
||||
|
||||
var dragService =
|
||||
Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
|
||||
if ( !dragService ) return(false);
|
||||
|
||||
dragSession = dragService.getCurrentSession();
|
||||
if ( !dragSession ) return(false);
|
||||
|
||||
if ( dragSession.isDataFlavorSupported("moz/rdfitem") ) validFlavor = true;
|
||||
else if ( dragSession.isDataFlavorSupported("text/unicode") ) validFlavor = true;
|
||||
//XXX other flavors here...
|
||||
|
||||
// touch the attribute on the rowgroup to trigger the repaint with the drop feedback.
|
||||
if ( validFlavor )
|
||||
{
|
||||
var treeRoot = document.getElementById("bookmarksTree");
|
||||
if (!treeRoot) return(false);
|
||||
var treeDatabase = treeRoot.database;
|
||||
if (!treeDatabase) return(false);
|
||||
|
||||
//XXX this is really slow and likes to refresh N times per second.
|
||||
var rowGroup = event.target.parentNode.parentNode;
|
||||
var sortActive = treeRoot.getAttribute("sortActive");
|
||||
if (sortActive == "true")
|
||||
rowGroup.setAttribute ( "dd-triggerrepaintsorted", 0 );
|
||||
else
|
||||
rowGroup.setAttribute ( "dd-triggerrepaint", 0 );
|
||||
|
||||
dragSession.canDrop = true;
|
||||
// necessary??
|
||||
retVal = false;
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DropOnTree ( event )
|
||||
{
|
||||
var treeRoot = document.getElementById("bookmarksTree");
|
||||
if (!treeRoot) return(false);
|
||||
var treeDatabase = treeRoot.database;
|
||||
if (!treeDatabase) return(false);
|
||||
|
||||
// for beta1, don't allow D&D if sorting is active
|
||||
var sortActive = treeRoot.getAttribute("sortActive");
|
||||
if (sortActive == "true")
|
||||
{
|
||||
dump("Sorry, drag&drop is currently disabled when sorting is active.\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
var RDF =
|
||||
Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
if (!RDF) return(false);
|
||||
var RDFC =
|
||||
Components.classes["@mozilla.org/rdf/container;1"].getService(Components.interfaces.nsIRDFContainer);
|
||||
if (!RDFC) return(false);
|
||||
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
if (!Bookmarks) return(false);
|
||||
|
||||
// target is the <treecell>, and "ref/id" is on the <treeitem> two levels above
|
||||
var treeItem = event.target.parentNode.parentNode;
|
||||
if (!treeItem) return(false);
|
||||
|
||||
// get drop hint attributes
|
||||
var dropBefore = treeItem.getAttribute("dd-droplocation");
|
||||
var dropOn = treeItem.getAttribute("dd-dropon");
|
||||
|
||||
// calculate drop action
|
||||
var dropAction;
|
||||
if (dropBefore == "true") dropAction = "before";
|
||||
else if (dropOn == "true") dropAction = "on";
|
||||
else dropAction = "after";
|
||||
|
||||
// calculate parent container node
|
||||
var containerItem = treeItem;
|
||||
if (dropAction != "on")
|
||||
{
|
||||
containerItem = treeItem.parentNode.parentNode;
|
||||
}
|
||||
|
||||
// magical fix for bug # 33546: handle dropping after open container
|
||||
if (treeItem.getAttribute("container") == "true")
|
||||
{
|
||||
if (treeItem.getAttribute("open") == "true")
|
||||
{
|
||||
if (dropAction == "after")
|
||||
{
|
||||
dropAction = "before";
|
||||
containerItem = treeItem;
|
||||
|
||||
// find <treechildren>, drop before first child
|
||||
var treeChildren = treeItem;
|
||||
treeItem = null;
|
||||
for (var x = 0; x < treeChildren.childNodes.length; x++)
|
||||
{
|
||||
if (treeChildren.childNodes[x].tagName == "treechildren")
|
||||
{
|
||||
treeItem = treeChildren.childNodes[x].childNodes[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!treeItem)
|
||||
{
|
||||
dropAction = "on";
|
||||
containerItem = treeItem.parentNode.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var targetID = getAbsoluteID("bookmarksTree", treeItem);
|
||||
if (!targetID) return(false);
|
||||
var targetNode = RDF.GetResource(targetID, true);
|
||||
if (!targetNode) return(false);
|
||||
|
||||
var containerID = getAbsoluteID("bookmarksTree", containerItem);
|
||||
if (!containerID) return(false);
|
||||
var containerNode = RDF.GetResource(containerID);
|
||||
if (!containerNode) return(false);
|
||||
|
||||
var dragService =
|
||||
Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
|
||||
if ( !dragService ) return(false);
|
||||
|
||||
var dragSession = dragService.getCurrentSession();
|
||||
if ( !dragSession ) return(false);
|
||||
|
||||
var trans =
|
||||
Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
|
||||
if ( !trans ) return(false);
|
||||
trans.addDataFlavor("moz/rdfitem");
|
||||
trans.addDataFlavor("text/x-moz-url");
|
||||
trans.addDataFlavor("text/unicode");
|
||||
|
||||
var typeRes = RDF.GetResource(RDF_NS + "type");
|
||||
if (!typeRes) return false;
|
||||
var bmTypeRes = RDF.GetResource(NC_NS + "Bookmark");
|
||||
if (!bmTypeRes) return false;
|
||||
|
||||
var dirty = false;
|
||||
|
||||
for ( var i = 0; i < dragSession.numDropItems; ++i )
|
||||
{
|
||||
dragSession.getData ( trans, i );
|
||||
var dataObj = new Object();
|
||||
var bestFlavor = new Object();
|
||||
var len = new Object();
|
||||
trans.getAnyTransferData ( bestFlavor, dataObj, len );
|
||||
if ( dataObj ) dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsWString);
|
||||
if ( !dataObj ) continue;
|
||||
|
||||
var sourceID = null;
|
||||
var parentID = null;
|
||||
var checkNameHack = false;
|
||||
var name=null;
|
||||
|
||||
if (bestFlavor.value == "moz/rdfitem")
|
||||
{
|
||||
// pull the URL out of the data object
|
||||
var data = dataObj.data.substring(0, len.value / 2);
|
||||
|
||||
// moz/rdfitem allows parent ID specified on next line; check for it
|
||||
var cr = data.indexOf("\n");
|
||||
if (cr >= 0)
|
||||
{
|
||||
sourceID = data.substr(0, cr);
|
||||
parentID = data.substr(cr+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceID = data;
|
||||
}
|
||||
}
|
||||
else if (bestFlavor.value == "text/x-moz-url")
|
||||
{
|
||||
// pull the URL out of the data object
|
||||
data = dataObj.data.substring(0, len.value / 2);
|
||||
sourceID = data;
|
||||
|
||||
// we may need to synthesize a name (just use the URL)
|
||||
checkNameHack = true;
|
||||
}
|
||||
else if (bestFlavor.value == "text/unicode")
|
||||
{
|
||||
sourceID = dataObj.data;
|
||||
|
||||
// we may need to synthesize a name (just use the URL)
|
||||
checkNameHack = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown flavor, skip
|
||||
continue;
|
||||
}
|
||||
|
||||
// pull the (optional) name out of the URL
|
||||
var separator = sourceID.indexOf("\n");
|
||||
if (separator >= 0)
|
||||
{
|
||||
name = sourceID.substr(separator+1);
|
||||
sourceID = sourceID.substr(0, separator);
|
||||
}
|
||||
|
||||
var sourceNode = RDF.GetResource(sourceID, true);
|
||||
if (!sourceNode) continue;
|
||||
|
||||
var parentNode = null;
|
||||
if (parentID != null)
|
||||
{
|
||||
parentNode = RDF.GetResource(parentID, true);
|
||||
}
|
||||
|
||||
// Prevent dropping of a node before, after, or on itself
|
||||
if (sourceNode == targetNode) continue;
|
||||
// Prevent dropping of a node onto its parent container
|
||||
if ((dropAction == "on") && (containerID) && (containerID == parentID)) continue;
|
||||
|
||||
RDFC.Init(Bookmarks, containerNode);
|
||||
|
||||
// make sure appropriate bookmark type is set
|
||||
var bmTypeNode = Bookmarks.GetTarget( sourceNode, typeRes, true );
|
||||
if (!bmTypeNode)
|
||||
{
|
||||
// set default bookmark type
|
||||
Bookmarks.Assert(sourceNode, typeRes, bmTypeRes, true);
|
||||
}
|
||||
|
||||
if ((dropAction == "before") || (dropAction == "after"))
|
||||
{
|
||||
// drop before or after
|
||||
var nodeIndex;
|
||||
|
||||
nodeIndex = RDFC.IndexOf(sourceNode);
|
||||
|
||||
if (nodeIndex >= 1)
|
||||
{
|
||||
// moving a node around inside of the container
|
||||
// so remove, then re-add the node
|
||||
RDFC.RemoveElementAt(nodeIndex, true, sourceNode);
|
||||
}
|
||||
|
||||
nodeIndex = RDFC.IndexOf(targetNode);
|
||||
|
||||
if (nodeIndex < 1) return(false);
|
||||
if (dropAction == "after") ++nodeIndex;
|
||||
|
||||
RDFC.InsertElementAt(sourceNode, nodeIndex, true);
|
||||
|
||||
// select the newly added node
|
||||
if (parentID)
|
||||
{
|
||||
selectDroppedItems(treeRoot, containerID, sourceID);
|
||||
}
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// drop on
|
||||
RDFC.AppendElement(sourceNode);
|
||||
|
||||
// select the newly added node
|
||||
if (parentID)
|
||||
{
|
||||
selectDroppedItems(treeRoot, containerID, sourceID);
|
||||
}
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if ((checkNameHack == true) || (name != null))
|
||||
{
|
||||
var srcArc = RDF.GetResource(sourceID, true);
|
||||
var propArc = RDF.GetResource(NC_NS + "Name", true);
|
||||
if (srcArc && propArc && Bookmarks)
|
||||
{
|
||||
var targetArc = Bookmarks.GetTarget(srcArc, propArc, true);
|
||||
if (!targetArc)
|
||||
{
|
||||
// if no name, fallback to using the URL as the name
|
||||
var defaultNameArc = RDF.GetLiteral((name != null && name != "") ? name : sourceID);
|
||||
if (defaultNameArc)
|
||||
{
|
||||
Bookmarks.Assert(srcArc, propArc, defaultNameArc, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// should we move the node? (i.e. take it out of the source container?)
|
||||
if ((parentNode != null) && (containerNode != parentNode))
|
||||
{
|
||||
try
|
||||
{
|
||||
RDFC.Init(Bookmarks, parentNode);
|
||||
nodeIndex = RDFC.IndexOf(sourceNode);
|
||||
|
||||
if (nodeIndex >= 1)
|
||||
{
|
||||
RDFC.RemoveElementAt(nodeIndex, true, sourceNode);
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty == true)
|
||||
{
|
||||
var remote = Bookmarks.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
if (remote)
|
||||
{
|
||||
remote.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function selectDroppedItems(treeRoot, containerID, targetID)
|
||||
{
|
||||
var select_list = treeRoot.getElementsByAttribute("id", targetID);
|
||||
for (var x=0; x<select_list.length; x++)
|
||||
{
|
||||
var node = select_list[x];
|
||||
if (!node) continue;
|
||||
|
||||
var parent = node.parentNode.parentNode;
|
||||
if (!parent) continue;
|
||||
|
||||
var id = parent.getAttribute("ref");
|
||||
if (!id || id=="")
|
||||
{
|
||||
id = parent.getAttribute("id");
|
||||
}
|
||||
if (!id || id=="") continue;
|
||||
|
||||
if (id == containerID)
|
||||
{
|
||||
treeRoot.selectItem(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author, v2.0)
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -30,464 +31,267 @@
|
|||
var NC_NS = "http://home.netscape.com/NC-rdf#";
|
||||
var RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
|
||||
|
||||
|
||||
function TopLevelDrag ( event )
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
function BeginDragTree ( event )
|
||||
{
|
||||
//XXX we rely on a capturer to already have determined which item the mouse was over
|
||||
//XXX and have set an attribute.
|
||||
|
||||
// if the click is on the tree proper, ignore it. We only care about clicks on items.
|
||||
|
||||
var tree = document.getElementById("bookmarksTree");
|
||||
if ( event.target == tree || event.target.localName == "treechildren" )
|
||||
return(true); // continue propagating the event
|
||||
|
||||
var childWithDatabase = tree;
|
||||
if ( ! childWithDatabase )
|
||||
return(false);
|
||||
|
||||
var dragStarted = false;
|
||||
|
||||
var trans =
|
||||
Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
|
||||
if ( !trans ) return(false);
|
||||
|
||||
var genData =
|
||||
Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
|
||||
if (!genData) return(false);
|
||||
|
||||
var genDataURL =
|
||||
Components.classes["@mozilla.org/supports-wstring;1"].createInstance(Components.interfaces.nsISupportsWString);
|
||||
if (!genDataURL) return(false);
|
||||
|
||||
trans.addDataFlavor("text/unicode");
|
||||
trans.addDataFlavor("moz/rdfitem");
|
||||
|
||||
// ref/id (url) is on the <treeitem> which is two levels above the <treecell> which is
|
||||
// the target of the event.
|
||||
var id = event.target.parentNode.parentNode.getAttribute("ref");
|
||||
if (!id || id=="")
|
||||
var bookmarksDNDObserver = {
|
||||
_RDF: null,
|
||||
get RDF ()
|
||||
{
|
||||
id = event.target.parentNode.parentNode.getAttribute("id");
|
||||
}
|
||||
if (!this._RDF) {
|
||||
const kRDFContractID = "@mozilla.org/rdf/rdf-service;1";
|
||||
const kRDFIID = Components.interfaces.nsIRDFService;
|
||||
this._RDF = Components.classes[kRDFContractID].getService(kRDFIID);
|
||||
}
|
||||
return this._RDF;
|
||||
},
|
||||
|
||||
var parentID = event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("ref");
|
||||
if (!parentID || parentID == "")
|
||||
// XXX I belong somewhere shared.
|
||||
getResource: function(aString)
|
||||
{
|
||||
parentID = event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("id");
|
||||
}
|
||||
|
||||
var trueID = id;
|
||||
if (parentID != null)
|
||||
{
|
||||
trueID += "\n" + parentID;
|
||||
}
|
||||
genData.data = trueID;
|
||||
genDataURL.data = id;
|
||||
|
||||
var database = childWithDatabase.database;
|
||||
var rdf =
|
||||
Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
if ((!rdf) || (!database)) { dump("CAN'T GET DATABASE\n"); return(false); }
|
||||
|
||||
// make sure its a bookmark, bookmark separator, or bookmark folder
|
||||
var src = rdf.GetResource(id, true);
|
||||
var prop = rdf.GetResource(RDF_NS + "type", true);
|
||||
var target = database.GetTarget(src, prop, true);
|
||||
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (target) target = target.Value;
|
||||
if ((!target) || (target == "")) {dump("BAD\n"); return(false);}
|
||||
|
||||
if ((target != NC_NS + "BookmarkSeparator") &&
|
||||
(target != NC_NS + "Bookmark") &&
|
||||
(target != NC_NS + "Folder")) return(false);
|
||||
|
||||
trans.setTransferData ( "moz/rdfitem", genData, genData.data.length * 2); // double byte data
|
||||
trans.setTransferData ( "text/unicode", genDataURL, genDataURL.data.length * 2); // double byte data
|
||||
|
||||
var transArray =
|
||||
Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
if ( !transArray ) return(false);
|
||||
|
||||
// put it into the transferable as an |nsISupports|
|
||||
var genTrans = trans.QueryInterface(Components.interfaces.nsISupports);
|
||||
transArray.AppendElement(genTrans);
|
||||
return this.RDF.GetResource(aString, true);
|
||||
},
|
||||
|
||||
var dragService =
|
||||
Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
|
||||
if ( !dragService ) return(false);
|
||||
|
||||
var nsIDragService = Components.interfaces.nsIDragService;
|
||||
dragService.invokeDragSession ( event.target, transArray, null, nsIDragService.DRAGDROP_ACTION_COPY +
|
||||
nsIDragService.DRAGDROP_ACTION_MOVE );
|
||||
dragStarted = true;
|
||||
|
||||
return(!dragStarted);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DragOverTree ( event )
|
||||
{
|
||||
var validFlavor = false;
|
||||
var dragSession = null;
|
||||
var retVal = true;
|
||||
|
||||
var dragService =
|
||||
Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
|
||||
if ( !dragService ) return(false);
|
||||
|
||||
dragSession = dragService.getCurrentSession();
|
||||
if ( !dragSession ) return(false);
|
||||
|
||||
if ( dragSession.isDataFlavorSupported("moz/rdfitem") ) validFlavor = true;
|
||||
else if ( dragSession.isDataFlavorSupported("text/unicode") ) validFlavor = true;
|
||||
//XXX other flavors here...
|
||||
|
||||
// touch the attribute on the rowgroup to trigger the repaint with the drop feedback.
|
||||
if ( validFlavor )
|
||||
getTarget: function(aDS, aSourceID, aPropertyID)
|
||||
{
|
||||
var treeRoot = document.getElementById("bookmarksTree");
|
||||
if (!treeRoot) return(false);
|
||||
var treeDatabase = treeRoot.database;
|
||||
if (!treeDatabase) return(false);
|
||||
|
||||
//XXX this is really slow and likes to refresh N times per second.
|
||||
var rowGroup = event.target.parentNode.parentNode;
|
||||
var sortActive = treeRoot.getAttribute("sortActive");
|
||||
if (sortActive == "true")
|
||||
rowGroup.setAttribute ( "dd-triggerrepaintsorted", 0 );
|
||||
else
|
||||
rowGroup.setAttribute ( "dd-triggerrepaint", 0 );
|
||||
|
||||
dragSession.canDrop = true;
|
||||
// necessary??
|
||||
retVal = false;
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DropOnTree ( event )
|
||||
{
|
||||
var treeRoot = document.getElementById("bookmarksTree");
|
||||
if (!treeRoot) return(false);
|
||||
var treeDatabase = treeRoot.database;
|
||||
if (!treeDatabase) return(false);
|
||||
|
||||
// for beta1, don't allow D&D if sorting is active
|
||||
var sortActive = treeRoot.getAttribute("sortActive");
|
||||
if (sortActive == "true")
|
||||
{
|
||||
dump("Sorry, drag&drop is currently disabled when sorting is active.\n");
|
||||
return(false);
|
||||
}
|
||||
|
||||
var RDF =
|
||||
Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
if (!RDF) return(false);
|
||||
var RDFC =
|
||||
Components.classes["@mozilla.org/rdf/container;1"].getService(Components.interfaces.nsIRDFContainer);
|
||||
if (!RDFC) return(false);
|
||||
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
if (!Bookmarks) return(false);
|
||||
|
||||
// target is the <treecell>, and "ref/id" is on the <treeitem> two levels above
|
||||
var treeItem = event.target.parentNode.parentNode;
|
||||
if (!treeItem) return(false);
|
||||
|
||||
// get drop hint attributes
|
||||
var dropBefore = treeItem.getAttribute("dd-droplocation");
|
||||
var dropOn = treeItem.getAttribute("dd-dropon");
|
||||
|
||||
// calculate drop action
|
||||
var dropAction;
|
||||
if (dropBefore == "true") dropAction = "before";
|
||||
else if (dropOn == "true") dropAction = "on";
|
||||
else dropAction = "after";
|
||||
|
||||
// calculate parent container node
|
||||
var containerItem = treeItem;
|
||||
if (dropAction != "on")
|
||||
{
|
||||
containerItem = treeItem.parentNode.parentNode;
|
||||
}
|
||||
|
||||
// magical fix for bug # 33546: handle dropping after open container
|
||||
if (treeItem.getAttribute("container") == "true")
|
||||
{
|
||||
if (treeItem.getAttribute("open") == "true")
|
||||
{
|
||||
if (dropAction == "after")
|
||||
{
|
||||
dropAction = "before";
|
||||
containerItem = treeItem;
|
||||
|
||||
// find <treechildren>, drop before first child
|
||||
var treeChildren = treeItem;
|
||||
treeItem = null;
|
||||
for (var x = 0; x < treeChildren.childNodes.length; x++)
|
||||
{
|
||||
if (treeChildren.childNodes[x].tagName == "treechildren")
|
||||
{
|
||||
treeItem = treeChildren.childNodes[x].childNodes[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!treeItem)
|
||||
{
|
||||
dropAction = "on";
|
||||
containerItem = treeItem.parentNode.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var targetID = getAbsoluteID("bookmarksTree", treeItem);
|
||||
if (!targetID) return(false);
|
||||
var targetNode = RDF.GetResource(targetID, true);
|
||||
if (!targetNode) return(false);
|
||||
|
||||
var containerID = getAbsoluteID("bookmarksTree", containerItem);
|
||||
if (!containerID) return(false);
|
||||
var containerNode = RDF.GetResource(containerID);
|
||||
if (!containerNode) return(false);
|
||||
|
||||
var dragService =
|
||||
Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
|
||||
if ( !dragService ) return(false);
|
||||
var source = this.getResource(aSourceID);
|
||||
var property = this.getResource(aPropertyID);
|
||||
return aDS.GetTarget(source, property, true);
|
||||
},
|
||||
|
||||
var dragSession = dragService.getCurrentSession();
|
||||
if ( !dragSession ) return(false);
|
||||
|
||||
var trans =
|
||||
Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
|
||||
if ( !trans ) return(false);
|
||||
trans.addDataFlavor("moz/rdfitem");
|
||||
trans.addDataFlavor("text/x-moz-url");
|
||||
trans.addDataFlavor("text/unicode");
|
||||
|
||||
var typeRes = RDF.GetResource(RDF_NS + "type");
|
||||
if (!typeRes) return false;
|
||||
var bmTypeRes = RDF.GetResource(NC_NS + "Bookmark");
|
||||
if (!bmTypeRes) return false;
|
||||
|
||||
var dirty = false;
|
||||
|
||||
for ( var i = 0; i < dragSession.numDropItems; ++i )
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
dragSession.getData ( trans, i );
|
||||
var dataObj = new Object();
|
||||
var bestFlavor = new Object();
|
||||
var len = new Object();
|
||||
trans.getAnyTransferData ( bestFlavor, dataObj, len );
|
||||
if ( dataObj ) dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsWString);
|
||||
if ( !dataObj ) continue;
|
||||
var bookmarksTree = document.getElementById("bookmarksTree");
|
||||
if (aEvent.target == bookmarksTree || aEvent.target.localName == "treechildren" ||
|
||||
aEvent.target.localName == "splitter" || aEvent.target.localName == "menu")
|
||||
throw Components.results.NS_OK; // not a draggable item.
|
||||
if (aEvent.target.parentNode && aEvent.target.parentNode.parentNode &&
|
||||
aEvent.target.parentNode.parentNode.localName == "treehead")
|
||||
throw Components.results.NS_OK; // don't drag treehead cells.
|
||||
if (bookmarksTree.getAttribute("sortActive") == "true")
|
||||
throw Components.results.NS_OK;
|
||||
|
||||
var selItems = null;
|
||||
if (bookmarksTree.selectedItems.length <= 0)
|
||||
selItems = [aEvent.target.parentNode.parentNode];
|
||||
else
|
||||
selItems = bookmarksTree.selectedItems;
|
||||
|
||||
aXferData.data = new TransferDataSet();
|
||||
for (var i = 0; i < selItems.length; ++i) {
|
||||
var currItem = selItems[i];
|
||||
var currURI = NODE_ID(currItem);
|
||||
|
||||
var parentItem = currItem.parentNode.parentNode;
|
||||
var parentURI = NODE_ID(parentItem);
|
||||
|
||||
var type = this.getTarget(bookmarksTree.database, currURI, RDF_NS + "type");
|
||||
type = type.QueryInterface(Components.interfaces.nsIRDFResource).Value;
|
||||
if (!type || (type != (NC_NS + "BookmarkSeparator") &&
|
||||
type != (NC_NS + "Bookmark") &&
|
||||
type != (NC_NS + "Folder")))
|
||||
throw Components.results.NS_OK;
|
||||
var name = this.getTarget(bookmarksTree.database, currURI, NC_NS + "Name");
|
||||
name = name.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
|
||||
var sourceID = null;
|
||||
var parentID = null;
|
||||
var checkNameHack = false;
|
||||
var name=null;
|
||||
|
||||
if (bestFlavor.value == "moz/rdfitem")
|
||||
{
|
||||
// pull the URL out of the data object
|
||||
var data = dataObj.data.substring(0, len.value / 2);
|
||||
|
||||
// moz/rdfitem allows parent ID specified on next line; check for it
|
||||
var cr = data.indexOf("\n");
|
||||
if (cr >= 0)
|
||||
{
|
||||
sourceID = data.substr(0, cr);
|
||||
parentID = data.substr(cr+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceID = data;
|
||||
}
|
||||
var data = new TransferData();
|
||||
data.addDataForFlavour("moz/rdfitem", currURI + "\n" + parentURI);
|
||||
data.addDataForFlavour("text/x-moz-url", currURI + "\n" + name);
|
||||
data.addDataForFlavour("text/unicode", currURI);
|
||||
aXferData.data.push(data);
|
||||
}
|
||||
else if (bestFlavor.value == "text/x-moz-url")
|
||||
{
|
||||
// pull the URL out of the data object
|
||||
data = dataObj.data.substring(0, len.value / 2);
|
||||
sourceID = data;
|
||||
|
||||
// we may need to synthesize a name (just use the URL)
|
||||
checkNameHack = true;
|
||||
if (aEvent.ctrlKey) {
|
||||
const kDSIID = Components.interfaces.nsIDragService;
|
||||
aDragAction.action = kDSIID.DRAGDROP_ACTION_COPY + kDSIID.DRAGDROP_ACTION_LINK;
|
||||
}
|
||||
else if (bestFlavor.value == "text/unicode")
|
||||
{
|
||||
sourceID = dataObj.data;
|
||||
},
|
||||
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
var bookmarksTree = document.getElementById("bookmarksTree");
|
||||
var rowGroup = aEvent.target.parentNode.parentNode;
|
||||
if (rowGroup)
|
||||
rowGroup.setAttribute("dd-triggerrepaint" +
|
||||
(bookmarksTree.getAttribute("sortActive") == "true" ? "sorted" : ""), 0);
|
||||
},
|
||||
|
||||
// we may need to synthesize a name (just use the URL)
|
||||
checkNameHack = true;
|
||||
_flavourSet: null,
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
this._flavourSet.appendFlavour("moz/rdfitem");
|
||||
this._flavourSet.appendFlavour("text/x-moz-url");
|
||||
this._flavourSet.appendFlavour("text/unicode");
|
||||
}
|
||||
else
|
||||
{
|
||||
// unknown flavor, skip
|
||||
return this._flavourSet;
|
||||
},
|
||||
|
||||
canHandleMultipleItems: true,
|
||||
|
||||
onDrop: function (aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var bookmarksTree = document.getElementById("bookmarksTree");
|
||||
// XXX lame
|
||||
if (bookmarksTree.getAttribute("sortActive") == "true") return;
|
||||
|
||||
const kRDFCContractID = "@mozilla.org/rdf/container;1";
|
||||
const kRDFIID = Components.interfaces.nsIRDFContainer;
|
||||
var RDFC = Components.classes[kRDFCContractID].getService(kRDFIID);
|
||||
|
||||
const kBMDS = this.RDF.GetDataSource("rdf:bookmarks");
|
||||
|
||||
var dropItem = aEvent.target.parentNode.parentNode;
|
||||
if (aEvent.target.localName == "treechildren")
|
||||
dropItem = aEvent.target.parentNode; // handle drop on blank space.
|
||||
|
||||
// XXX we could probably compute this ourselves, but let the tree do this
|
||||
// automagically for now.
|
||||
var dropBefore = dropItem.getAttribute("dd-droplocation");
|
||||
var dropOn = dropItem.getAttribute("dd-dropon");
|
||||
|
||||
var dropAction = dropBefore == "true" ? "before" : dropOn == "true" ? "on" : "after";
|
||||
if (aEvent.target.localName == "treechildren")
|
||||
dropAction = "on"; // handle drop on blank space.
|
||||
var containerItem = dropAction == "on" ? dropItem : dropItem.parentNode.parentNode;
|
||||
var rContainer = this.getResource(NODE_ID(containerItem));
|
||||
|
||||
// XXX magical fix for bug # 33546: handle dropping after open container
|
||||
if (dropItem.getAttribute("container") && dropItem.getAttribute("open") &&
|
||||
dropAction == "after") {
|
||||
dropAction = "before";
|
||||
containerItem = dropItem;
|
||||
|
||||
dropItem = null;
|
||||
for (var i = 0; i < containerItem.childNodes.length; ++i) {
|
||||
if (containerItem.childNodes[i].localName == "treechildren") {
|
||||
dropItem = containerItem.childNodes[i].firstChild;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dropItem) {
|
||||
dropAction = "on";
|
||||
dropItem = containerItem.parentNode.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
var rTarget = this.getResource(NODE_ID(dropItem));
|
||||
|
||||
// XXX
|
||||
var rType = this.getResource(RDF_NS + "type");
|
||||
var rBookmark = this.getResource(NC_NS + "Bookmark");
|
||||
|
||||
var dirty = false;
|
||||
var additiveFlag = false;
|
||||
var numObjects = aXferData.dataList.length;
|
||||
/*
|
||||
if (numObjects > 1) {
|
||||
var bo = bookmarksTree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);
|
||||
bo.beginBatch();
|
||||
}
|
||||
*/
|
||||
for (i = 0; i < numObjects; ++i) {
|
||||
var flavourData = aXferData.dataList[i].first;
|
||||
|
||||
var sourceID, parentID, name;
|
||||
var nameRequired = false;
|
||||
var data = flavourData.data;
|
||||
switch (flavourData.flavour.contentType) {
|
||||
case "moz/rdfitem":
|
||||
var ix = data.indexOf("\n");
|
||||
sourceID = ix >= 0 ? (parentID = data.substr(ix+1), data.substr(0, ix)) : data;
|
||||
break;
|
||||
case "text/x-moz-url":
|
||||
ix = data.indexOf("\n");
|
||||
sourceID = ix >= 0 ? (name = data.substr(ix+1), data.substr(0, ix)) : data;
|
||||
break;
|
||||
case "text/unicode":
|
||||
sourceID = data;
|
||||
nameRequired = true;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
// pull the (optional) name out of the URL
|
||||
var separator = sourceID.indexOf("\n");
|
||||
if (separator >= 0)
|
||||
{
|
||||
name = sourceID.substr(separator+1);
|
||||
sourceID = sourceID.substr(0, separator);
|
||||
}
|
||||
|
||||
var sourceNode = RDF.GetResource(sourceID, true);
|
||||
if (!sourceNode) continue;
|
||||
|
||||
var parentNode = null;
|
||||
if (parentID != null)
|
||||
{
|
||||
parentNode = RDF.GetResource(parentID, true);
|
||||
}
|
||||
|
||||
// Prevent dropping of a node before, after, or on itself
|
||||
if (sourceNode == targetNode) continue;
|
||||
// Prevent dropping of a node onto its parent container
|
||||
if ((dropAction == "on") && (containerID) && (containerID == parentID)) continue;
|
||||
|
||||
RDFC.Init(Bookmarks, containerNode);
|
||||
|
||||
// make sure appropriate bookmark type is set
|
||||
var bmTypeNode = Bookmarks.GetTarget( sourceNode, typeRes, true );
|
||||
if (!bmTypeNode)
|
||||
{
|
||||
// set default bookmark type
|
||||
Bookmarks.Assert(sourceNode, typeRes, bmTypeRes, true);
|
||||
}
|
||||
|
||||
if ((dropAction == "before") || (dropAction == "after"))
|
||||
{
|
||||
// drop before or after
|
||||
var nodeIndex;
|
||||
|
||||
nodeIndex = RDFC.IndexOf(sourceNode);
|
||||
|
||||
if (nodeIndex >= 1)
|
||||
{
|
||||
// moving a node around inside of the container
|
||||
// so remove, then re-add the node
|
||||
RDFC.RemoveElementAt(nodeIndex, true, sourceNode);
|
||||
}
|
||||
|
||||
nodeIndex = RDFC.IndexOf(targetNode);
|
||||
var rSource = this.getResource(sourceID);
|
||||
var rParent = parentID ? this.getResource(parentID) : null;
|
||||
|
||||
if (nodeIndex < 1) return(false);
|
||||
if (dropAction == "after") ++nodeIndex;
|
||||
// Prevent dropping node on itself, before or after itself, on its parent
|
||||
// container, or a weird situation when an open container is dropped into
|
||||
// itself (which results in data loss!).
|
||||
if (rSource == rTarget || (dropAction == "on" && rContainer == rParent) ||
|
||||
rContainer == rSource)
|
||||
continue;
|
||||
|
||||
RDFC.InsertElementAt(sourceNode, nodeIndex, true);
|
||||
// XXX if any of the following fails, the nodes are gone for good!
|
||||
const kDSIID = Components.interfaces.nsIDragService;
|
||||
const kCopyAction = kDSIID.DRAGDROP_ACTION_COPY + kDSIID.DRAGDROP_ACTION_LINK;
|
||||
if (rParent) {
|
||||
if (!(aDragSession.dragAction & kCopyAction)) {
|
||||
try {
|
||||
RDFC.Init(kBMDS, rParent);
|
||||
ix = RDFC.IndexOf(rSource);
|
||||
if (ix >= 1)
|
||||
RDFC.RemoveElementAt(ix, true);
|
||||
}
|
||||
catch (ex) { }
|
||||
}
|
||||
else {
|
||||
dump("*** copy!\n");
|
||||
}
|
||||
}
|
||||
|
||||
// select the newly added node
|
||||
if (parentID)
|
||||
{
|
||||
selectDroppedItems(treeRoot, containerID, sourceID);
|
||||
}
|
||||
RDFC.Init(kBMDS, rContainer);
|
||||
|
||||
var bmType = this.getTarget(bookmarksTree.database, sourceID, RDF_NS + "type");
|
||||
if (!bmType)
|
||||
kBMDS.Assert(rSource, rType, rBookmark, true);
|
||||
if (bmType == NC_NS + "Folder") {
|
||||
// If we're going to copy a folder type, we need to clone the folder
|
||||
// rather than just asserting the new node as a child of the drop folder.
|
||||
if (aDragSession.dragAction & kCopyAction)
|
||||
rSource = this.cloneFolder(rSource, rContainer, rTarget);
|
||||
}
|
||||
|
||||
if (dropAction == "before" || dropAction == "after") {
|
||||
var dropIx = RDFC.IndexOf(rTarget);
|
||||
RDFC.InsertElementAt(rSource, dropAction == "after" ? ++dropIx : dropIx, true);
|
||||
}
|
||||
else
|
||||
RDFC.AppendElement(rSource); // drop on
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// drop on
|
||||
RDFC.AppendElement(sourceNode);
|
||||
|
||||
// select the newly added node
|
||||
if (parentID)
|
||||
{
|
||||
selectDroppedItems(treeRoot, containerID, sourceID);
|
||||
}
|
||||
if (rParent) {
|
||||
gBookmarksShell.selectFolderItem(rContainer.Value, sourceID, additiveFlag);
|
||||
if (!additiveFlag) additiveFlag = true;
|
||||
}
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if ((checkNameHack == true) || (name != null))
|
||||
{
|
||||
var srcArc = RDF.GetResource(sourceID, true);
|
||||
var propArc = RDF.GetResource(NC_NS + "Name", true);
|
||||
if (srcArc && propArc && Bookmarks)
|
||||
{
|
||||
var targetArc = Bookmarks.GetTarget(srcArc, propArc, true);
|
||||
if (!targetArc)
|
||||
{
|
||||
// if no name, fallback to using the URL as the name
|
||||
var defaultNameArc = RDF.GetLiteral((name != null && name != "") ? name : sourceID);
|
||||
if (defaultNameArc)
|
||||
{
|
||||
Bookmarks.Assert(srcArc, propArc, defaultNameArc, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// should we move the node? (i.e. take it out of the source container?)
|
||||
if ((parentNode != null) && (containerNode != parentNode))
|
||||
{
|
||||
try
|
||||
{
|
||||
RDFC.Init(Bookmarks, parentNode);
|
||||
nodeIndex = RDFC.IndexOf(sourceNode);
|
||||
|
||||
if (nodeIndex >= 1)
|
||||
{
|
||||
RDFC.RemoveElementAt(nodeIndex, true, sourceNode);
|
||||
}
|
||||
// If a name is supplied, we want to assert this information into the
|
||||
// graph. E.g. user drags an internet shortcut to the app, we want to
|
||||
// preserve not only the URL but the name of the shortcut. The other case
|
||||
// where we need to assert a name is when the node does not already exist
|
||||
// in the graph, in this case we'll just use the URL as the name.
|
||||
if (name || nameRequired) {
|
||||
var currentName = this.getTarget(bookmarksTree.database, sourceID, NC_NS + "Name");
|
||||
if (!currentName) {
|
||||
var rDefaultName = this.RDF.GetLiteral(name || sourceID);
|
||||
if (rDefaultName) {
|
||||
var rName = this.RDF.GetResource(NC_NS + "Name");
|
||||
kBMDS.Assert(rSource, rName, rDefaultName, true);
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty == true)
|
||||
{
|
||||
var remote = Bookmarks.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
if (remote)
|
||||
{
|
||||
remote.Flush();
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (numObjects > 1) {
|
||||
var bo = bookmarksTree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);
|
||||
bo.endBatch();
|
||||
}
|
||||
*/
|
||||
|
||||
if (dirty) {
|
||||
var remoteDS = kBMDS.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remoteDS.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function selectDroppedItems(treeRoot, containerID, targetID)
|
||||
{
|
||||
var select_list = treeRoot.getElementsByAttribute("id", targetID);
|
||||
for (var x=0; x<select_list.length; x++)
|
||||
{
|
||||
var node = select_list[x];
|
||||
if (!node) continue;
|
||||
|
||||
var parent = node.parentNode.parentNode;
|
||||
if (!parent) continue;
|
||||
|
||||
var id = parent.getAttribute("ref");
|
||||
if (!id || id=="")
|
||||
{
|
||||
id = parent.getAttribute("id");
|
||||
}
|
||||
if (!id || id=="") continue;
|
||||
|
||||
if (id == containerID)
|
||||
{
|
||||
treeRoot.selectItem(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,14 @@ var NC_NS = "http://home.netscape.com/NC-rdf#";
|
|||
var RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
const NC_NS_CMD = NC_NS + "command?cmd=";
|
||||
|
||||
/**
|
||||
* XXX - 02/03/2001 - Work In Progress
|
||||
* - some of the methods here and in the derived classes in bookmarksTree.js
|
||||
* and bookmarks.js can probably be broken out into a shared library for RDF
|
||||
* utilities. So far the focus has been on getting this stuff to work, once
|
||||
* I'm done with that I'll look at what can be reorganized.
|
||||
*/
|
||||
|
||||
function NODE_ID (aElement)
|
||||
{
|
||||
return aElement.getAttribute("ref") || aElement.id;
|
||||
|
@ -471,7 +479,12 @@ BookmarksUIElement.prototype = {
|
|||
var rCurrent = this.RDF.GetResource(nodes[i]);
|
||||
const krTypeProperty = this.RDF.GetResource(RDF_NS + "type");
|
||||
var rType = this.db.GetTarget(rCurrent, krTypeProperty, true);
|
||||
rType = rType.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
try {
|
||||
rType = rType.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
}
|
||||
catch (e) {
|
||||
rType = rType.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
}
|
||||
|
||||
// If the node is a folder, then we need to create a new anonymous
|
||||
// resource and copy all the arcs over.
|
||||
|
@ -638,9 +651,10 @@ BookmarksUIElement.prototype = {
|
|||
|
||||
showPropertiesForNode: function (aBookmarkItem)
|
||||
{
|
||||
openDialog("chrome://communicator/content/bookmarks/bm-props.xul",
|
||||
"", "centerscreen,chrome,dialog=no,resizable=no",
|
||||
NODE_ID(aBookmarkItem));
|
||||
if (aBookmarkItem.getAttribute("type") != NC_NS + "BookmarkSeparator")
|
||||
openDialog("chrome://communicator/content/bookmarks/bm-props.xul",
|
||||
"", "centerscreen,chrome,dialog=no,resizable=no",
|
||||
NODE_ID(aBookmarkItem));
|
||||
},
|
||||
|
||||
findInBookmarks: function ()
|
||||
|
|
|
@ -119,6 +119,8 @@ BookmarksTree.prototype = {
|
|||
var property = "";
|
||||
for (var i = 0; i < editColGroup.childNodes.length; ++i) {
|
||||
var currCol = editColGroup.childNodes[i];
|
||||
if (currCol.getAttribute("hidden") == "true")
|
||||
return;
|
||||
if (count == aCell) {
|
||||
property = currCol.getAttribute("resource");
|
||||
break;
|
||||
|
@ -132,7 +134,7 @@ BookmarksTree.prototype = {
|
|||
if (property) {
|
||||
editCell.setMode("edit");
|
||||
editCell.addObserver(this.postModifyCallback, "accept",
|
||||
[gBookmarksShell, NODE_ID(aSelectedItem), property]);
|
||||
[gBookmarksShell, aSelectedItem, property]);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -142,9 +144,11 @@ BookmarksTree.prototype = {
|
|||
postModifyCallback: function (aParams)
|
||||
{
|
||||
var aShell = aParams[0];
|
||||
aShell.propertySet(aParams[1], aParams[2], aParams[3]);
|
||||
var selItemURI = NODE_ID(aParams[1]);
|
||||
aShell.propertySet(selItemURI, aParams[2], aParams[3]);
|
||||
gBookmarksShell.tree.focus();
|
||||
gBookmarksShell.tree.selectItem(document.getElementById(aParams[2]));
|
||||
gBookmarksShell.selectFolderItem(NODE_ID(gBookmarksShell.findRDFNode(aParams[1], false)),
|
||||
selItemURI, false);
|
||||
gSelectionTracker.clickCount = 0;
|
||||
},
|
||||
|
||||
|
|
|
@ -35,4 +35,10 @@
|
|||
<!ENTITY button.newfolder.accesskey "w">
|
||||
<!ENTITY alwayscreateinfolder.label "Don't show this dialog again">
|
||||
<!ENTITY alwayscreateinfolder.accesskey "a">
|
||||
<!ENTITY dontshowmessage.tooltip "When this option is selected, new Bookmarks will be added using the title provided by the page.">
|
||||
<!ENTITY dontshowmessage.tooltip "When this option is selected, new Bookmarks will be added using the title provided by the page.">
|
||||
<!ENTITY button.defaultfolder.label "Use Default">
|
||||
<!ENTITY button.defaultfolder.accesskey "d">
|
||||
<!ENTITY selectFolder.label "Choose Folder">
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,22 +18,30 @@
|
|||
-
|
||||
- Contributor(s): Stephen Lamm <slamm@netscape.com>
|
||||
- Robert John Churchill <rjc@netscape.com>
|
||||
- Ben Goodger <ben@netscape.com>
|
||||
-->
|
||||
|
||||
<!ENTITY bookmarks.windowtitle.label "Properties">
|
||||
<!ENTITY bookmarks.windowtitle.label "Properties for "**bm_title**"">
|
||||
|
||||
<!ENTITY generalInfo.label "Info">
|
||||
<!ENTITY generalInfo.accesskey "i">
|
||||
<!ENTITY generaldesc.label "&brandShortName; can remember the locations of sites on the Internet for you. Enter the site's name and location in the fields below, then select the site from the Bookmarks menu or your Bookmarks My Sidebar tab to visit the site.">
|
||||
|
||||
<!ENTITY generalInfo.label "General Information">
|
||||
<!ENTITY generalInfo.accesskey "g">
|
||||
<!ENTITY schedule.label "Schedule">
|
||||
<!ENTITY schedule.accesskey "s">
|
||||
<!ENTITY schedule.description "&brandShortName; can check this site for updates and notify you when one occurs. Use these settings to customize the schedule for this Bookmark.">
|
||||
<!ENTITY notification.label "Notify">
|
||||
<!ENTITY notification.accesskey "n">
|
||||
<!-- ICK. fix me -->
|
||||
<!ENTITY notification.description "&brandShortName; will notify you when this site changes. Use these settings to customize notification.">
|
||||
|
||||
<!ENTITY bookmarks.information.label "Information:">
|
||||
<!ENTITY bookmarks.name.label "Name:">
|
||||
<!ENTITY bookmarks.location.label "Location:">
|
||||
<!ENTITY bookmarks.shortcut.label "Custom Keyword:">
|
||||
<!ENTITY bookmarks.description.label "Description:">
|
||||
<!ENTITY bookmarks.shortcut.label "Keyword:">
|
||||
<!ENTITY bookmarks.description.label "Comments:">
|
||||
|
||||
<!ENTITY checkforupdates.legend.label "Check URL for updates:">
|
||||
<!ENTITY checkforupdates.legend.label "Check this location for updates:">
|
||||
<!ENTITY when.label "When:">
|
||||
<!ENTITY from.label "from:">
|
||||
<!ENTITY to.label "to: ">
|
||||
|
|
|
@ -18,40 +18,36 @@
|
|||
# Contributor(s):
|
||||
#
|
||||
|
||||
NewBookmark = New Bookmark
|
||||
DeleteBookmark = Delete Bookmark
|
||||
cmd_open = Open
|
||||
cmd_openfolder = Expand
|
||||
cmd_openfolder2 = Collapse
|
||||
cmd_find = Find a Bookmark...
|
||||
cmd_cut = Cut
|
||||
cmd_copy = Copy
|
||||
cmd_paste = Paste
|
||||
cmd_delete = Delete
|
||||
cmd_rename = Rename...
|
||||
cmd_renamebookmark2 = Change Location...
|
||||
cmd_properties = Properties
|
||||
|
||||
NewFolder = New Folder
|
||||
DeleteFolder = Delete Folder
|
||||
cmd_openfolderinnewwindow = Open in New Window
|
||||
cmd_newfolder = New Folder...
|
||||
cmd_newbookmark = New Bookmark...
|
||||
cmd_newseparator = New Separator
|
||||
cmd_setnewbookmarkfolder = Set as New Bookmark folder
|
||||
cmd_setpersonaltoolbarfolder = Set as Personal Toolbar folder
|
||||
cmd_setnewsearchfolder = Set as Saved Search Results folder
|
||||
cmd_rename = Rename...
|
||||
|
||||
NewSeparator = New Separator
|
||||
DeleteSeparator = Delete Separator
|
||||
ile_newfolder = New Folder
|
||||
ile_newbookmark = New Bookmark
|
||||
|
||||
SetNewBookmarkFolder = Set as New Bookmark Folder
|
||||
SetPersonalToolbarFolder = Set as Personal Toolbar Folder
|
||||
SetNewSearchFolder = Set as New Internet Search Folder
|
||||
window_title = %folder_name% - Bookmarks
|
||||
|
||||
BookmarkProperties = Properties...
|
||||
file_in = File in "%folder_name%"
|
||||
|
||||
Import = Import...
|
||||
Export = Export...
|
||||
|
||||
ImportedIEFavorites = Imported IE Favorites
|
||||
ImportedNetPositiveBookmarks = Imported NetPositive Bookmarks
|
||||
|
||||
DefaultPersonalToolbarFolder = Personal Toolbar Folder
|
||||
|
||||
NewBookmarkURLPrompt = Enter a URL for the new bookmark:
|
||||
NewBookmarkNamePrompt = Enter a name for the new bookmark:
|
||||
NewFolderNamePrompt = Enter a name for the new folder:
|
||||
|
||||
NeedValidURL = Please enter a valid, fully qualified URL.
|
||||
|
||||
SelectImport = Import bookmark file:
|
||||
EnterExport = Export bookmark file:
|
||||
|
||||
DeleteItem = Delete the selected item?
|
||||
DeleteItems = Delete the selected items?
|
||||
bookmarks_root = Bookmarks for %user_name%
|
||||
status_foldercount = %num_items% object(s)
|
||||
|
||||
WebPageUpdated = The following web page has been updated:
|
||||
WebPageTitle = Title:
|
||||
|
|
|
@ -23,19 +23,27 @@
|
|||
|
||||
<!-- extracted from ./bookmarks.xul -->
|
||||
|
||||
<!ENTITY menuitem.newBookmark.label "New Bookmark">
|
||||
<!ENTITY menuitem.newBookmark.accesskey "n">
|
||||
<!ENTITY menuitem.newFolder.label "New Folder">
|
||||
<!ENTITY menuitem.newSeparator.label "New Separator">
|
||||
<!ENTITY menuitem.import.label "Import Bookmarks...">
|
||||
<!ENTITY menuitem.export.label "Export Bookmarks...">
|
||||
<!ENTITY menuitem.find.label "Find in Bookmarks...">
|
||||
<!ENTITY menuitem.find.accesskey "f">
|
||||
<!ENTITY edit.find.keybinding "f">
|
||||
<!ENTITY menuitem.properties.label "Properties...">
|
||||
<!ENTITY menuitem.properties.accesskey "i">
|
||||
<!ENTITY edit.properties.keybinding "i">
|
||||
<!ENTITY command.newBookmark.label "New Bookmark">
|
||||
<!ENTITY command.newBookmark.accesskey "n">
|
||||
<!ENTITY command.newFolder.label "New Folder">
|
||||
<!ENTITY command.newFolder.accesskey "f">
|
||||
<!ENTITY command.newSeparator.label "New Separator">
|
||||
<!ENTITY command.newSeparator.accesskey "s">
|
||||
<!ENTITY menuitem.import.label "Import Bookmarks...">
|
||||
<!ENTITY menuitem.export.label "Export Bookmarks...">
|
||||
<!ENTITY menuitem.find.label "Find in Bookmarks...">
|
||||
<!ENTITY menuitem.find.accesskey "f">
|
||||
<!ENTITY edit.find.keybinding "f">
|
||||
<!ENTITY command.properties.label "Properties">
|
||||
<!ENTITY command.properties.accesskey "i">
|
||||
<!ENTITY edit.properties.keybinding "i">
|
||||
<!ENTITY command.rename.label "Rename...">
|
||||
<!ENTITY command.delete.label "Delete">
|
||||
<!ENTITY command.fileBookmark.label "File Bookmark">
|
||||
<!ENTITY command.fileBookmark.accesskey "l">
|
||||
|
||||
<!ENTITY menuitem.view.command.toolbar.label "Toolbar">
|
||||
<!ENTITY menuitem.view.command.toolbar.accesskey "t">
|
||||
<!ENTITY menuitem.view.unsorted.label "Unsorted">
|
||||
<!ENTITY menuitem.view.unsorted.accesskey "u">
|
||||
<!ENTITY menuitem.view.ascending.label "A > Z Sort Order">
|
||||
|
@ -52,11 +60,15 @@
|
|||
<!ENTITY menuitem.personaltoolbarfolder.accesskey "p">
|
||||
|
||||
<!ENTITY tree.header.name.label "Name">
|
||||
<!-- LOCALIZATION NOTE (tree.header.url.label) : DONT_TRANSLATE -->
|
||||
<!ENTITY tree.header.url.label "URL">
|
||||
<!ENTITY tree.header.shortcut.label "Custom Keyword">
|
||||
<!ENTITY tree.header.url.label "Location">
|
||||
<!ENTITY tree.header.shortcut.label "Keyword">
|
||||
<!ENTITY tree.header.addedon.label "Added On">
|
||||
<!ENTITY tree.header.lastmod.label "Last Modified">
|
||||
<!ENTITY tree.header.lastvisit.label "Last Visit">
|
||||
<!ENTITY tree.header.description.label "Description">
|
||||
<!ENTITY bookmarksWindowTitle.label "Manage Bookmarks">
|
||||
<!ENTITY bookmarksWindowTitle.label "Bookmarks">
|
||||
|
||||
|
||||
<!ENTITY search.name.label "name">
|
||||
<!ENTITY search.contains.label "contains">
|
||||
|
||||
|
|
|
@ -89,10 +89,10 @@
|
|||
<titledbox orient="vertical">
|
||||
<title value="&filingBookmarks.label;"/>
|
||||
<html flex="1">&autoFile.label;</html>
|
||||
<box autostretch="never">
|
||||
<box autostretch="never" flex="1">
|
||||
<checkbox id="disableAutoFile" value="&disableAutoFile.label;"
|
||||
pref="true" preftype="bool" prefstring="browser.bookmarks.add_without_dialog"
|
||||
prefattribute="checked"/>
|
||||
prefattribute="checked" flex="1" valign="top"/>
|
||||
</box>
|
||||
<separator/>
|
||||
<html flex="1">&defaultFolder.label;</html>
|
||||
|
|
|
@ -2550,13 +2550,69 @@ NS_IMPL_QUERY_INTERFACE8(nsBookmarksService,
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIBookmarksService
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::CreateFolder(const PRUnichar* aTitle,
|
||||
nsIRDFResource* aRelativeItem,
|
||||
nsIRDFResource* aParentFolder,
|
||||
nsIRDFResource** aNewFolder)
|
||||
{
|
||||
nsresult rv;
|
||||
*aNewFolder = nsnull;
|
||||
|
||||
// Init parent container
|
||||
nsCOMPtr<nsIRDFContainer> container (do_CreateInstance("@mozilla.org/rdf/container;1", &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = container->Init(this, aParentFolder);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Create Item
|
||||
nsCOMPtr<nsIRDFResource> folder;
|
||||
rv = BookmarkParser::CreateAnonymousResource(address_of(folder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gRDFC->MakeSeq(mInner, folder, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Item Name
|
||||
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
||||
rv = gRDF->GetLiteral(aTitle, getter_AddRefs(nameLiteral));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mInner->Assert(folder, kNC_Name, nameLiteral, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Item Type
|
||||
rv = mInner->Assert(folder, kRDF_type, kNC_Folder, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Add Date
|
||||
nsCOMPtr<nsIRDFDate> dateLiteral;
|
||||
rv = gRDF->GetDateLiteral(PR_Now(), getter_AddRefs(dateLiteral));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mInner->Assert(folder, kNC_BookmarkAddDate, dateLiteral, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Look up the index of aRelativeItem, if it exists we want to insert after
|
||||
// it, otherwise we want to add this item as the first child of the container.
|
||||
PRInt32 idx;
|
||||
rv = container->IndexOf(aRelativeItem, &idx);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = container->InsertElementAt(folder, idx > 0 ? idx : 1, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aNewFolder = folder;
|
||||
NS_ADDREF(*aNewFolder);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::AddBookmark(const char *aURI,
|
||||
const PRUnichar *aOptionalTitle,
|
||||
PRInt32 bmType,
|
||||
const PRUnichar *aCharset)
|
||||
nsBookmarksService::AddBookmarkToFolder(const char *aURI,
|
||||
nsIRDFResource *aFolder,
|
||||
const PRUnichar* aTitle,
|
||||
const PRUnichar *aCharset)
|
||||
{
|
||||
// XXX Constructing a parser object to do this is bad.
|
||||
// We need to factor AddBookmark() into its own little
|
||||
|
@ -2575,24 +2631,8 @@ nsBookmarksService::AddBookmark(const char *aURI,
|
|||
getter_AddRefs(container));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// figure out where to add the new bookmark
|
||||
nsCOMPtr<nsIRDFResource> bookmarkType = kNC_NewBookmarkFolder;
|
||||
|
||||
switch(bmType)
|
||||
{
|
||||
case BOOKMARK_SEARCH_TYPE:
|
||||
case BOOKMARK_FIND_TYPE:
|
||||
bookmarkType = kNC_NewSearchFolder;
|
||||
break;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> newBookmarkFolder;
|
||||
if (NS_FAILED(rv = getFolderViaHint(bookmarkType, PR_TRUE,
|
||||
getter_AddRefs(newBookmarkFolder))))
|
||||
return(rv);
|
||||
|
||||
rv = container->Init(this, newBookmarkFolder);
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
rv = container->Init(this, aFolder);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// convert the current date/time from microseconds (PRTime) to seconds
|
||||
PRTime now64 = PR_Now(), million;
|
||||
|
@ -2601,16 +2641,42 @@ nsBookmarksService::AddBookmark(const char *aURI,
|
|||
PRInt32 now32;
|
||||
LL_L2I(now32, now64);
|
||||
|
||||
rv = parser.AddBookmark(container, aURI, aOptionalTitle, now32,
|
||||
rv = parser.AddBookmark(container, aURI, aTitle, now32,
|
||||
0L, 0L, nsnull, kNC_Bookmark, nsnull, aCharset);
|
||||
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDirty = PR_TRUE;
|
||||
Flush();
|
||||
|
||||
return(NS_OK);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBookmarksService::AddBookmark(const char *aURI,
|
||||
const PRUnichar *aTitle,
|
||||
PRInt32 aBookmarkType,
|
||||
const PRUnichar *aCharset)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// figure out where to add the new bookmark
|
||||
nsCOMPtr<nsIRDFResource> bookmarkFolder = kNC_NewBookmarkFolder;
|
||||
|
||||
switch(aBookmarkType)
|
||||
{
|
||||
case BOOKMARK_SEARCH_TYPE:
|
||||
case BOOKMARK_FIND_TYPE:
|
||||
bookmarkFolder = kNC_NewSearchFolder;
|
||||
break;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> destinationFolder;
|
||||
rv = getFolderViaHint(bookmarkFolder, PR_TRUE, getter_AddRefs(destinationFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return AddBookmarkToFolder(aURI, destinationFolder, aTitle, aCharset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3508,7 +3574,12 @@ nsBookmarksService::insertBookmarkItem(nsIRDFResource *src, nsISupportsArray *aA
|
|||
{
|
||||
if (NS_FAILED(rv = container->IndexOf(src, &srcIndex)))
|
||||
return(rv);
|
||||
}
|
||||
// If not in the container, add at the end
|
||||
if (srcIndex == -1) {
|
||||
if (NS_FAILED(rv = container->GetCount(&srcIndex)))
|
||||
return(rv);
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString newName;
|
||||
|
||||
|
@ -3586,7 +3657,7 @@ nsBookmarksService::insertBookmarkItem(nsIRDFResource *src, nsISupportsArray *aA
|
|||
if (NS_FAILED(rv = mInner->Assert(newElement, kNC_BookmarkAddDate, dateLiteral, PR_TRUE)))
|
||||
return(rv);
|
||||
|
||||
if (NS_FAILED(rv = container->InsertElementAt(newElement, ((srcIndex == 0) ? 1 : srcIndex), PR_TRUE)))
|
||||
if (NS_FAILED(rv = container->InsertElementAt(newElement, ((srcIndex == 0) ? 1 : srcIndex+1), PR_TRUE)))
|
||||
return(rv);
|
||||
return(rv);
|
||||
}
|
||||
|
|
|
@ -1 +1,78 @@
|
|||
Makefile
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/pref/pref-smartupdate.dtd" >
|
||||
|
||||
<window xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
class="color-dialog"
|
||||
align="vertical"
|
||||
title="&title.label;"
|
||||
onload="parent.initPanel('chrome://communicator/content/pref/pref-smartupdate.xul');">
|
||||
|
||||
<script language="JavaScript">
|
||||
var _elementIDs;
|
||||
<![CDATA[
|
||||
_elementIDs = ["XPInstallEnabled"];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
||||
<box class="box-smallheader" title="&lHeader;"/>
|
||||
|
||||
<titledbox orient="vertical" autostretch="never">
|
||||
<title><text value="&smartTitle.label;"/></title>
|
||||
<checkbox id="XPInstallEnabled" value="&enableSU.label;" accesskey="&enableSU.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="xpinstall.enabled"
|
||||
prefattribute="checked"/>
|
||||
</titledbox>
|
||||
|
||||
<!--
|
||||
<titledbox orient="vertical" autostretch="never">
|
||||
<title><text value="Installed Packages"/></title>
|
||||
|
||||
<script>
|
||||
<![CDATA[
|
||||
function InstallPackage()
|
||||
{
|
||||
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
|
||||
if ( chromeRegistry )
|
||||
chromeRegistry = chromeRegistry.QueryInterface( Components.interfaces.nsIChromeRegistry );
|
||||
var packageURI = prompt('give the resource uri of the package to install','');
|
||||
if (packageURI)
|
||||
chromeRegistry.installPackage(packageURI, false);
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
<button value="Install Package" oncommand="InstallPackage();"/>
|
||||
</titledbox>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<html:fieldset style="width: 100%; height: 100%">
|
||||
<html:div class="hspace-both">&selectUninstall.label;</html:div>
|
||||
<box class="hspace-both vspace" align="horizontal" flex="100%" style="width: 93%; height: 100%">
|
||||
<tree id="smartUpdatePackages" class="inset" flex="100%" style="height: 40%;">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
<treechildren flex="1">
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treeitem/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</tree>
|
||||
<spring flex="5%"/>
|
||||
<box align="vertical">
|
||||
<button class="dialog push" id="pref:0:bool:smartupdate" value="&uninstallButton.label;" accesskey="&uninstallButton.accesskey;"/>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
</box>
|
||||
<spring style="height: 28px;"/>
|
||||
</html:fieldset>
|
||||
-->
|
||||
</window>
|
||||
|
||||
|
|
|
@ -26,13 +26,14 @@ const _DEBUG = false;
|
|||
* This is a general page switcher and pref loader.
|
||||
* =>> CHANGES MUST BE REVIEWED BY ben@netscape.com!! <<=
|
||||
**/
|
||||
|
||||
|
||||
var queuedTag;
|
||||
function initPanel ( aPrefTag )
|
||||
{
|
||||
if( hPrefWindow )
|
||||
hPrefWindow.onpageload( aPrefTag );
|
||||
hPrefWindow.onpageload( aPrefTag )
|
||||
else
|
||||
window.queuedTag = aPrefTag;
|
||||
queuedTag = aPrefTag;
|
||||
}
|
||||
|
||||
window.doneLoading = false;
|
||||
|
@ -62,11 +63,7 @@ nsPrefWindow.prototype =
|
|||
doSetOKCancel( this.onOK, this.onCancel );
|
||||
try
|
||||
{
|
||||
this.pref = Components.classes["@mozilla.org/preferences;1"].getService();
|
||||
if( this.pref )
|
||||
{
|
||||
this.pref = this.pref.QueryInterface( Components.interfaces.nsIPref );
|
||||
}
|
||||
this.pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
|
@ -84,7 +81,7 @@ nsPrefWindow.prototype =
|
|||
}
|
||||
|
||||
if( window.arguments[1] )
|
||||
this.closeBranches( window.arguments[1] );
|
||||
this.closeBranches( window.arguments[1], window.arguments[2] );
|
||||
},
|
||||
|
||||
onOK:
|
||||
|
@ -318,7 +315,7 @@ nsPrefWindow.prototype =
|
|||
},
|
||||
|
||||
closeBranches:
|
||||
function ( aComponentName )
|
||||
function ( aComponentName, aSelectItem )
|
||||
{
|
||||
var panelChildren = document.getElementById( "panelChildren" );
|
||||
var panelTree = document.getElementById( "prefsTree" );
|
||||
|
@ -328,7 +325,7 @@ nsPrefWindow.prototype =
|
|||
if( currentItem.id != aComponentName && currentItem.id != "appearance" )
|
||||
currentItem.removeAttribute( "open" );
|
||||
}
|
||||
var openItem = document.getElementById( aComponentName );
|
||||
var openItem = document.getElementById( aSelectItem );
|
||||
panelTree.selectItem( openItem );
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,11 @@
|
|||
<treecell class="treecell-indent" url="chrome://communicator/content/pref/pref-history.xul" value="&history.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem id="bookmarks">
|
||||
<treerow>
|
||||
<treecell class="treecell-indent" url="chrome://communicator/content/bookmarks/pref-bookmarks.xul" value="&bookmarks.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell class="treecell-indent" url="chrome://communicator/content/pref/pref-languages.xul" value="&languages.label;"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<!--LOCALIZATION NOTE (navigator.label): DONT_TRANSLATE -->
|
||||
<!ENTITY navigator.label "Navigator">
|
||||
<!ENTITY history.label "History">
|
||||
<!ENTITY bookmarks.label "Bookmarks">
|
||||
<!ENTITY languages.label "Languages">
|
||||
<!ENTITY applications.label "Helper Applications">
|
||||
<!--LOCALIZATION NOTE (smartBrowse.label): DONT_TRANSLATE -->
|
||||
|
|
|
@ -32,7 +32,8 @@ toolkit.jar:
|
|||
content/global/radioBindings.xml (resources/content/radioBindings.xml)
|
||||
content/global/scrollbarBindings.xml (resources/content/scrollbarBindings.xml)
|
||||
content/global/tabBindings.xml (resources/content/tabBindings.xml)
|
||||
content/global/treeBindings.xml (resources/content/treeBindings.xml)
|
||||
content/global/treeBindings.xml (resources/content/treeBindings.xml)
|
||||
content/global/popupBindings.xml (resources/content/popupBindings.xml)
|
||||
content/global/colorpickerBindings.xml (resources/content/colorpickerBindings.xml)
|
||||
content/global/nsClipboard.js (resources/content/nsClipboard.js)
|
||||
content/global/nsDragAndDrop.js (resources/content/nsDragAndDrop.js)
|
||||
|
@ -66,3 +67,4 @@ en-US.jar:
|
|||
locale/en-US/global/regionNames.properties (resources/locale/en-US/regionNames.properties)
|
||||
locale/en-US/global/about.html (resources/locale/en-US/about.html)
|
||||
locale/en-US/global/commonDialogs.properties (resources/locale/en-US/commonDialogs.properties)
|
||||
locale/en-US/global/textcontext.dtd (resources/locale/en-US/textcontext.dtd)
|
||||
|
|
|
@ -65,10 +65,8 @@ function goUpdateCommand(command)
|
|||
|
||||
function goDoCommand(command)
|
||||
{
|
||||
|
||||
try {
|
||||
var controller = top.document.commandDispatcher.getControllerForCommand(command);
|
||||
|
||||
if ( controller && controller.isCommandEnabled(command))
|
||||
controller.doCommand(command);
|
||||
}
|
||||
|
@ -128,17 +126,16 @@ function setTooltipText(aID, aTooltipText)
|
|||
function FillInTooltip ( tipElement )
|
||||
{
|
||||
var retVal = false;
|
||||
var textNode = document.getElementById("TOOLTIP_tooltipText");
|
||||
if ( textNode ) {
|
||||
try {
|
||||
var tipText = tipElement.getAttribute("tooltiptext");
|
||||
if ( tipText != "" ) {
|
||||
textNode.setAttribute('value', tipText);
|
||||
retVal = true;
|
||||
}
|
||||
var textNode = document.getElementById("TOOLTIP-tooltipText");
|
||||
while (textNode.hasChildNodes())
|
||||
textNode.removeChild(textNode.firstChild);
|
||||
if (textNode) {
|
||||
var tipText = tipElement.getAttribute("tooltiptext");
|
||||
if (tipText) {
|
||||
var node = document.createTextNode(tipText);
|
||||
textNode.appendChild(node);
|
||||
retVal = true;
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<popupset id="aTooltipSet">
|
||||
<popup id="aTooltip" class="tooltip" oncreate="return FillInTooltip(document.tooltipNode);" >
|
||||
<text id="TOOLTIP_tooltipText"/>
|
||||
<html id="TOOLTIP-tooltipText" flex="1"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
|
|
|
@ -24,6 +24,57 @@ DEPTH=..\..\..\..
|
|||
|
||||
DIRS=win
|
||||
|
||||
CHROME_DIR=packages\widget-toolkit
|
||||
CHROME_CONTENT_DIR=global\content
|
||||
CHROME_MISC_DIR=.
|
||||
CHROME_TYPE=content
|
||||
|
||||
CHROME_MISC= \
|
||||
.\manifest.rdf \
|
||||
$(NULL)
|
||||
|
||||
CHROME_CONTENT= \
|
||||
.\hiddenWindow.xul \
|
||||
.\globalOverlay.xul \
|
||||
.\globalOverlay.js \
|
||||
.\dialogOverlay.xul \
|
||||
.\dialogOverlay.js \
|
||||
.\commonDialog.xul \
|
||||
.\commonDialog.js \
|
||||
.\strres.js \
|
||||
.\logo.gif \
|
||||
.\about.xul \
|
||||
.\mozilla.html \
|
||||
.\credits.html \
|
||||
.\charsetOverlay.xul \
|
||||
.\charsetOverlay.js \
|
||||
.\charsetDetectorsOverlay.js \
|
||||
.\charsetDetectorsOverlay.xul \
|
||||
.\selectDialog.js \
|
||||
.\selectDialog.xul \
|
||||
.\nsWidgetStateManager.js \
|
||||
.\widgetStateManager.js \
|
||||
.\wizardHandlerSet.js \
|
||||
.\wizardManager.js \
|
||||
.\wizardOverlay.js \
|
||||
.\wizardOverlay.xul \
|
||||
.\treePopups.js \
|
||||
.\xulBindings.xml \
|
||||
.\htmlBindings.xml \
|
||||
.\menulistBindings.xml \
|
||||
.\radioBindings.xml \
|
||||
.\tabBindings.xml \
|
||||
.\treeBindings.xml \
|
||||
.\toolbarBindings.xml \
|
||||
.\nsClipboard.js \
|
||||
.\nsDragAndDrop.js \
|
||||
.\nsJSSupportsUtils.js \
|
||||
.\nsTransferable.js \
|
||||
.\nsJSComponentManager.js \
|
||||
.\nsUserSettings.js \
|
||||
.\xul.css \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
chrome::
|
||||
|
|
|
@ -185,21 +185,23 @@
|
|||
BINDING : menubutton-single
|
||||
XUL REPRESENTATION : <menubutton>
|
||||
-->
|
||||
<binding id="menubutton-single-right">
|
||||
<content includes="menupopup">
|
||||
<binding id="menubutton-single-right" extends="xul:menu">
|
||||
<content>
|
||||
<xul:box class="menubutton-internal-box" autostretch="never">
|
||||
<xul:text class="menubutton-single-text" inherits="value,crop,accesskey"/>
|
||||
<xul:image class="menubutton-single-icon"/>
|
||||
</xul:box>
|
||||
<children includes="menupopup,template"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menubutton-single-left">
|
||||
<content includes="menupopup">
|
||||
<content>
|
||||
<xul:box class="menubutton-internal-box" autostretch="never">
|
||||
<xul:image class="menubutton-single-icon"/>
|
||||
<xul:text class="menubutton-single-text" inherits="value,crop,accesskey"/>
|
||||
</xul:box>
|
||||
<children includes="menupopup,template"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
|
|
|
@ -28,19 +28,25 @@
|
|||
* that simplifies access to the clipboard.
|
||||
**/
|
||||
var nsClipboard = {
|
||||
_CB: null,
|
||||
get mClipboard()
|
||||
{
|
||||
return nsJSComponentManager.getService("@mozilla.org/widget/clipboard;1",
|
||||
"nsIClipboard");
|
||||
if (!this._CB)
|
||||
{
|
||||
const kCBContractID = "@mozilla.org/widget/clipboard;1";
|
||||
const kCBIID = Components.interfaces.nsIClipboard;
|
||||
this._CB = Components.classes[kCBContractID].getService(kCBIID);
|
||||
}
|
||||
return this._CB;
|
||||
},
|
||||
|
||||
mCurrentClipboard: null,
|
||||
currentClipboard: null,
|
||||
/**
|
||||
* Array/Object read (Object aFlavourList, long aClipboard, Bool aAnyFlag) ;
|
||||
*
|
||||
* returns the data in the clipboard
|
||||
*
|
||||
* @param Object aFlavourList
|
||||
* @param FlavourSet aFlavourSet
|
||||
* formatted list of desired flavours
|
||||
* @param long aClipboard
|
||||
* the clipboard to read data from (kSelectionClipboard/kGlobalClipboard)
|
||||
|
@ -49,9 +55,9 @@ var nsClipboard = {
|
|||
**/
|
||||
read: function (aFlavourList, aClipboard, aAnyFlag)
|
||||
{
|
||||
this.mCurrentClipboard = aClipboard;
|
||||
this.currentClipboard = aClipboard;
|
||||
var data = nsTransferable.get(aFlavourList, this.getClipboardTransferable, aAnyFlag);
|
||||
return data;
|
||||
return data.first.first; // only support one item
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -68,7 +74,7 @@ var nsClipboard = {
|
|||
var trans = nsTransferable.createTransferable();
|
||||
for (var flavour in aFlavourList)
|
||||
trans.addDataFlavor(flavour);
|
||||
nsClipboard.mClipboard.getData(trans, nsClipboard.mCurrentClipboard)
|
||||
nsClipboard.mClipboard.getData(trans, nsClipboard.currentClipboard)
|
||||
supportsArray.AppendElement(trans);
|
||||
return supportsArray;
|
||||
}
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author:
|
||||
* Ben Matthew Goodger <ben@netscape.com>
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,33 +41,22 @@
|
|||
* nsDragAndDrop - a convenience wrapper for nsTransferable, nsITransferable
|
||||
* and nsIDragService/nsIDragSession.
|
||||
*
|
||||
* Use: map the handler functions to the 'ondraggesture', 'ondragover' and
|
||||
* 'ondragdrop' event handlers on your XML element, e.g.
|
||||
* <xmlelement ondraggesture="nsDragAndDrop.startDrag(event, observer);"
|
||||
* ondragover="nsDragAndDrop.startDrag(event, observer);"
|
||||
* ondragdrop="nsDragAndDrop.drop(event, observer);"/>
|
||||
*
|
||||
* You need to create an observer js object with the following member
|
||||
* functions:
|
||||
* Object onDragStart (event) // called when drag initiated,
|
||||
* // returns flavour list with data
|
||||
* // to stuff into transferable
|
||||
* void onDragOver (Object flavour) // called when element is dragged
|
||||
* // over, so that it can perform
|
||||
* // any drag-over feedback for provided
|
||||
* // flavour
|
||||
* void onDrop (Object data) // formatted data object dropped.
|
||||
* Object getSupportedFlavours () // returns a flavour list so that
|
||||
* // nsTransferable can determine whether
|
||||
* // or not to accept drop.
|
||||
**/
|
||||
* USAGE INFORMATION: see 'README-nsDragAndDrop.html' in the same source directory
|
||||
* as this file (typically xpfe/global/resources/content)
|
||||
*/
|
||||
|
||||
var nsDragAndDrop = {
|
||||
|
||||
|
||||
_mDS: null,
|
||||
get mDragService()
|
||||
{
|
||||
return nsJSComponentManager.getService("@mozilla.org/widget/dragservice;1",
|
||||
"nsIDragService");
|
||||
if (!this._mDS)
|
||||
{
|
||||
const kDSContractID = "@mozilla.org/widget/dragservice;1";
|
||||
const kDSIID = Components.interfaces.nsIDragService;
|
||||
this._mDS = Components.classes[kDSContractID].getService(kDSIID);
|
||||
}
|
||||
return this._mDS;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -85,31 +72,38 @@ var nsDragAndDrop = {
|
|||
**/
|
||||
startDrag: function (aEvent, aDragDropObserver)
|
||||
{
|
||||
var flavourList = null;
|
||||
|
||||
if (aDragDropObserver.onDragStart)
|
||||
{
|
||||
try
|
||||
{
|
||||
flavourList = aDragDropObserver.onDragStart(aEvent);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
return; // not a draggable item, bail!
|
||||
}
|
||||
}
|
||||
|
||||
if (! flavourList || flavourList.length < 1)
|
||||
if (!("onDragStart" in aDragDropObserver))
|
||||
return;
|
||||
|
||||
var trans = nsTransferable.set(flavourList);
|
||||
trans = trans ? trans.QueryInterface(Components.interfaces.nsISupports) : trans;
|
||||
var transArray = nsJSSupportsUtils.createSupportsArray();
|
||||
transArray.AppendElement(trans);
|
||||
const kDSIID = Components.interfaces.nsIDragService;
|
||||
var dragAction = { action: kDSIID.DRAGDROP_ACTION_COPY + kDSIID.DRAGDROP_ACTION_MOVE + kDSIID.DRAGDROP_ACTION_LINK };
|
||||
|
||||
var transferData = { data: null };
|
||||
try
|
||||
{
|
||||
aDragDropObserver.onDragStart(aEvent, transferData, dragAction);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
return; // not a draggable item, bail!
|
||||
}
|
||||
|
||||
if (!transferData.data) return;
|
||||
transferData = transferData.data;
|
||||
|
||||
var dragServiceIID = Components.interfaces.nsIDragService;
|
||||
this.mDragService.invokeDragSession(aEvent.target, transArray, null,
|
||||
dragServiceIID.DRAGDROP_ACTION_COPY + dragServiceIID.DRAGDROP_ACTION_MOVE + dragServiceIID.DRAGDROP_ACTION_LINK);
|
||||
var transArray = nsJSSupportsUtils.createSupportsArray();
|
||||
var count = 0;
|
||||
do
|
||||
{
|
||||
var trans = nsTransferable.set(transferData._XferID == "TransferData"
|
||||
? transferData
|
||||
: transferData.dataList[count++]);
|
||||
transArray.AppendElement(trans.QueryInterface(Components.interfaces.nsISupports));
|
||||
}
|
||||
while (transferData._XferID == "TransferDataSet" &&
|
||||
count < transferData.dataList.length);
|
||||
|
||||
this.mDragService.invokeDragSession(aEvent.target, transArray, null, dragAction.action);
|
||||
aEvent.preventBubble();
|
||||
},
|
||||
|
||||
|
@ -126,18 +120,21 @@ var nsDragAndDrop = {
|
|||
**/
|
||||
dragOver: function (aEvent, aDragDropObserver)
|
||||
{
|
||||
if (!("onDragOver" in aDragDropObserver))
|
||||
return;
|
||||
if (!this.mDragSession)
|
||||
this.mDragSession = this.mDragService.getCurrentSession();
|
||||
if (this.mDragSession)
|
||||
{
|
||||
var flavourList = aDragDropObserver.getSupportedFlavours();
|
||||
for (var flavour in flavourList)
|
||||
var flavourSet = aDragDropObserver.getSupportedFlavours();
|
||||
for (var flavour in flavourSet.flavourTable)
|
||||
{
|
||||
if (this.mDragSession.isDataFlavorSupported(flavour))
|
||||
{
|
||||
this.mDragSession.canDrop = true;
|
||||
if (aDragDropObserver.onDragOver)
|
||||
aDragDropObserver.onDragOver(aEvent, flavour, this.mDragSession);
|
||||
aDragDropObserver.onDragOver(aEvent,
|
||||
flavourSet.flavourTable[flavour],
|
||||
this.mDragSession);
|
||||
aEvent.preventBubble();
|
||||
break;
|
||||
}
|
||||
|
@ -160,22 +157,26 @@ var nsDragAndDrop = {
|
|||
**/
|
||||
drop: function (aEvent, aDragDropObserver)
|
||||
{
|
||||
if (!("onDrop" in aDragDropObserver))
|
||||
return;
|
||||
|
||||
if (!this.mDragSession)
|
||||
this.mDragSession = this.mDragService.getCurrentSession();
|
||||
if (this.mDragSession)
|
||||
{
|
||||
var flavourList = aDragDropObserver.getSupportedFlavours();
|
||||
var dragData = nsTransferable.get(flavourList, this.getDragData, true);
|
||||
var flavourSet = aDragDropObserver.getSupportedFlavours();
|
||||
var transferData = nsTransferable.get(flavourSet, this.getDragData, true);
|
||||
aEvent.preventBubble();
|
||||
// hand over to the client to respond to dropped data
|
||||
if (aDragDropObserver.onDrop)
|
||||
aDragDropObserver.onDrop(aEvent, dragData, this.mDragSession);
|
||||
var multiple = "canHandleMultipleItems" in aDragDropObserver && aDragDropObserver.canHandleMultipleItems;
|
||||
var dropData = multiple ? transferData : transferData.first.first;
|
||||
aDragDropObserver.onDrop(aEvent, dropData, this.mDragSession);
|
||||
}
|
||||
},
|
||||
|
||||
dragExit: function (aEvent, aDragDropObserver)
|
||||
{
|
||||
if (aDragDropObserver.onDragExit)
|
||||
if ("onDragExit" in aDragDropObserver)
|
||||
aDragDropObserver.onDragExit(aEvent, this.mDragSession);
|
||||
},
|
||||
|
||||
|
@ -185,17 +186,17 @@ var nsDragAndDrop = {
|
|||
* Creates a nsISupportsArray of all droppable items for the given
|
||||
* set of supported flavours.
|
||||
*
|
||||
* @param Object aFlavourList
|
||||
* @param FlavourSet aFlavourSet
|
||||
* formatted flavour list.
|
||||
**/
|
||||
getDragData: function (aFlavourList)
|
||||
getDragData: function (aFlavourSet)
|
||||
{
|
||||
var supportsArray = nsJSSupportsUtils.createSupportsArray();
|
||||
for (var i = 0; i < nsDragAndDrop.mDragSession.numDropItems; ++i)
|
||||
{
|
||||
var trans = nsTransferable.createTransferable();
|
||||
for (var flavour in aFlavourList)
|
||||
trans.addDataFlavor(flavour);
|
||||
for (var j = 0; j < aFlavourSet.flavours.length; ++j)
|
||||
trans.addDataFlavor(aFlavourSet.flavours[j].contentType);
|
||||
nsDragAndDrop.mDragSession.getData(trans, i);
|
||||
supportsArray.AppendElement(trans);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author:
|
||||
* Ben Matthew Goodger <ben@netscape.com>
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -37,47 +35,48 @@
|
|||
**/
|
||||
|
||||
var nsTransferable = {
|
||||
|
||||
/**
|
||||
* Flavour List Format:
|
||||
* flavourList["text/unicode"].width // width of data
|
||||
* flavourList["text/unicode"].iid // iid of data type
|
||||
* flavourList["text/unicode"].data // data to be stored (if any)
|
||||
**/
|
||||
|
||||
/**
|
||||
* nsITransferable set (Object aFlavourList) ;
|
||||
* nsITransferable set (TransferData aTransferData) ;
|
||||
*
|
||||
* Creates a transferable with data for a list of supported types ("flavours")
|
||||
*
|
||||
* @param Object aFlavourList
|
||||
* @param TransferData aTransferData
|
||||
* a javascript object in the format described above
|
||||
**/
|
||||
set: function (aFlavourList)
|
||||
set: function (aTransferDataSet)
|
||||
{
|
||||
var trans = this.createTransferable();
|
||||
for (var flavour in aFlavourList)
|
||||
for (var i = 0; i < aTransferDataSet.dataList.length; ++i)
|
||||
{
|
||||
trans.addDataFlavor(flavour);
|
||||
var width = aFlavourList[flavour].width;
|
||||
var wrapper = this.createEmptyWrapper(width);
|
||||
if (wrapper)
|
||||
var currData = aTransferDataSet.dataList[i];
|
||||
var currFlavour = currData.flavour.contentType;
|
||||
trans.addDataFlavor(currFlavour);
|
||||
var supports = null; // nsISupports data
|
||||
var length = 0;
|
||||
if (currData.flavour.dataIIDKey == "nsISupportsWString")
|
||||
{
|
||||
wrapper.data = aFlavourList[flavour].data;
|
||||
trans.setTransferData(flavour, wrapper, wrapper.data.length * width);
|
||||
supports = nsJSSupportsUtils.createSupportsWString();
|
||||
supports.data = currData.supports;
|
||||
length = supports.data.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-string data. TBD!
|
||||
}
|
||||
trans.setTransferData(currFlavour, supports, length * 2);
|
||||
}
|
||||
return trans;
|
||||
},
|
||||
|
||||
/**
|
||||
* Array/Object get (Object aFlavourList, Function aRetrievalFunc, Boolean aAnyFlag) ;
|
||||
* TransferData/TransferDataSet get (FlavourSet aFlavourSet,
|
||||
* Function aRetrievalFunc, Boolean aAnyFlag) ;
|
||||
*
|
||||
* Retrieves data from the transferable provided in aRetrievalFunc, formatted
|
||||
* for more convenient access.
|
||||
*
|
||||
* @param Object aFlavourList
|
||||
* a javascript object in the format described above
|
||||
* @param FlavourSet aFlavourSet
|
||||
* a FlavourSet object that contains a list of supported flavours.
|
||||
* @param Function aRetrievalFunc
|
||||
* a reference to a function that returns a nsISupportsArray of nsITransferables
|
||||
* for each item from the specified source (clipboard/drag&drop etc)
|
||||
|
@ -86,67 +85,48 @@ var nsTransferable = {
|
|||
* data of the type of the first flavour in the flavourlist parameter is returned,
|
||||
* otherwise the best flavour supported will be returned.
|
||||
**/
|
||||
get: function (aFlavourList, aRetrievalFunc, aAnyFlag)
|
||||
get: function (aFlavourSet, aRetrievalFunc, aAnyFlag)
|
||||
{
|
||||
var firstFlavour = null;
|
||||
for (var flav in aFlavourList)
|
||||
{
|
||||
firstFlavour = flav;
|
||||
break;
|
||||
}
|
||||
if (!aRetrievalFunc)
|
||||
throw "No data retrieval handler provided!";
|
||||
|
||||
if (aRetrievalFunc)
|
||||
{
|
||||
var supportsArray = aRetrievalFunc(aFlavourList);
|
||||
var dataArray = [];
|
||||
for (var i = 0; i < supportsArray.Count(); i++)
|
||||
{
|
||||
trans = supportsArray.GetElementAt(i);
|
||||
if (trans)
|
||||
trans = trans.QueryInterface(Components.interfaces.nsITransferable);
|
||||
|
||||
var data = { };
|
||||
var supportsArray = aRetrievalFunc(aFlavourSet);
|
||||
var dataArray = [];
|
||||
var count = supportsArray.Count();
|
||||
|
||||
// Iterate over the number of items returned from aRetrievalFunc. For
|
||||
// clipboard operations, this is 1, for drag and drop (where multiple
|
||||
// items may have been dragged) this could be >1.
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var trans = supportsArray.GetElementAt(i);
|
||||
if (!trans) continue;
|
||||
trans = trans.QueryInterface(Components.interfaces.nsITransferable);
|
||||
|
||||
var data = { };
|
||||
var length = { };
|
||||
|
||||
var currData = null;
|
||||
if (aAnyFlag)
|
||||
{
|
||||
var flavour = { };
|
||||
var length = { };
|
||||
|
||||
if (aAnyFlag)
|
||||
{
|
||||
trans.getAnyTransferData(flavour, data, length);
|
||||
if (data && flavour)
|
||||
{
|
||||
var selectedFlavour = aFlavourList[flavour.value];
|
||||
if (selectedFlavour)
|
||||
{
|
||||
data = data.value.QueryInterface(Components.interfaces[selectedFlavour.iid]);
|
||||
var currData =
|
||||
{
|
||||
data: { data: data, length: length.value, width: selectedFlavour.width }, // this.wrapData(data.value, length.value, selectedFlavour.width),
|
||||
flavour: flavour.value
|
||||
};
|
||||
if (supportsArray.Count() == 1)
|
||||
return currData;
|
||||
else
|
||||
dataArray[i] = currData;
|
||||
}
|
||||
}
|
||||
dataArray[i] = null;
|
||||
}
|
||||
else
|
||||
trans.getAnyTransferData(flavour, data, length);
|
||||
if (data && flavour)
|
||||
{
|
||||
trans.getTransferData(firstFlavour, data, length);
|
||||
var curData = data ? this.wrapData(data.value, length.value, aFlavourList[firstFlavour].width) : null;
|
||||
if (supportsArray.Count() == 1)
|
||||
return curData;
|
||||
else
|
||||
dataArray[i] = curData;
|
||||
var selectedFlavour = aFlavourSet.flavourTable[flavour.value];
|
||||
if (selectedFlavour)
|
||||
dataArray[i] = FlavourToXfer(data.value, length.value, selectedFlavour);
|
||||
}
|
||||
}
|
||||
return dataArray;
|
||||
else
|
||||
{
|
||||
var firstFlavour = aFlavourSet.flavours[0];
|
||||
trans.getTransferData(firstFlavour, data, length);
|
||||
if (data && firstFlavour)
|
||||
dataArray[i] = FlavourToXfer(data.value, length.value, firstFlavour);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw "No data retrieval handler provided!";
|
||||
|
||||
return null; // quiet warnings
|
||||
return new TransferDataSet(dataArray);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -156,47 +136,151 @@ var nsTransferable = {
|
|||
**/
|
||||
createTransferable: function ()
|
||||
{
|
||||
return nsJSComponentManager.createInstance("@mozilla.org/widget/transferable;1",
|
||||
"nsITransferable");
|
||||
},
|
||||
|
||||
/**
|
||||
* nsISupports createEmptyWrapper (int aWidth) ;
|
||||
*
|
||||
* Creates a wrapper for string data. XXX - this is bad, we're assuming the data we're
|
||||
* dragging is string.
|
||||
*
|
||||
* @param int aWidth
|
||||
* the width of the data (single or double byte)
|
||||
**/
|
||||
createEmptyWrapper: function (aWidth)
|
||||
{
|
||||
return aWidth == 2 ? nsJSSupportsUtils.createSupportsWString() :
|
||||
nsJSSupportsUtils.createSupportsString();
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* String wrapData (Object aDataObject, int aLength, int aWidth)
|
||||
*
|
||||
* Returns the actual string representation of nsISupports[W]String wrapped
|
||||
* data.
|
||||
*
|
||||
* @param Object aDataObject
|
||||
* the data to be unwrapped
|
||||
* @param int aLength
|
||||
* the integer length of the data
|
||||
* @param int aWidth
|
||||
* the unit size
|
||||
**/
|
||||
wrapData: function (aDataObject, aLength, aWidth)
|
||||
{
|
||||
const IID = aWidth == 2 ? Components.interfaces.nsISupportsWString :
|
||||
Components.interfaces.nsISupportsString;
|
||||
var data = aDataObject.QueryInterface(IID);
|
||||
if (data)
|
||||
return data.data.substring(0, aLength / aWidth);
|
||||
|
||||
return null;
|
||||
const kXferableContractID = "@mozilla.org/widget/transferable;1";
|
||||
const kXferableIID = Components.interfaces.nsITransferable;
|
||||
return Components.classes[kXferableContractID].createInstance(kXferableIID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A FlavourSet is a simple type that represents a collection of Flavour objects.
|
||||
* FlavourSet is constructed from an array of Flavours, and stores this list as
|
||||
* an array and a hashtable. The rationale for the dual storage is as follows:
|
||||
*
|
||||
* Array: Ordering is important when adding data flavours to a transferable.
|
||||
* Flavours added first are deemed to be 'preferred' by the client.
|
||||
* Hash: Convenient lookup of flavour data using the content type (MIME type)
|
||||
* of data as a key.
|
||||
*/
|
||||
function FlavourSet(aFlavourList)
|
||||
{
|
||||
this.flavours = aFlavourList || [];
|
||||
this.flavourTable = { };
|
||||
|
||||
this._XferID = "FlavourSet";
|
||||
|
||||
for (var i = 0; i < this.flavours.length; ++i)
|
||||
this.flavourTable[this.flavours[i].contentType] = this.flavours[i];
|
||||
}
|
||||
|
||||
FlavourSet.prototype = {
|
||||
appendFlavour: function (aFlavour, aFlavourIIDKey)
|
||||
{
|
||||
var flavour = new Flavour (aFlavour, aFlavourIIDKey);
|
||||
this.flavours.push(flavour);
|
||||
this.flavourTable[flavour.contentType] = flavour;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A Flavour is a simple type that represents a data type that can be handled.
|
||||
* It takes a content type (MIME type) which is used when storing data on the
|
||||
* system clipboard/drag and drop, and an IIDKey (string interface name
|
||||
* which is used to QI data to an appropriate form. The default interface is
|
||||
* assumed to be wide-string.
|
||||
*/
|
||||
function Flavour(aContentType, aDataIIDKey)
|
||||
{
|
||||
this.contentType = aContentType;
|
||||
this.dataIIDKey = aDataIIDKey || "nsISupportsWString";
|
||||
|
||||
this._XferID = "Flavour";
|
||||
}
|
||||
|
||||
function TransferDataBase() {}
|
||||
TransferDataBase.prototype = {
|
||||
push: function (aItems)
|
||||
{
|
||||
this.dataList.push(aItems);
|
||||
},
|
||||
|
||||
get first ()
|
||||
{
|
||||
return "dataList" in this && this.dataList.length ? this.dataList[0] : null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* TransferDataSet is a list (array) of TransferData objects, which represents
|
||||
* data dragged from one or more elements.
|
||||
*/
|
||||
function TransferDataSet(aTransferDataList)
|
||||
{
|
||||
this.dataList = aTransferDataList || [];
|
||||
|
||||
this._XferID = "TransferDataSet";
|
||||
}
|
||||
TransferDataSet.prototype = TransferDataBase.prototype;
|
||||
|
||||
/**
|
||||
* TransferData is a list (array) of FlavourData for all the applicable content
|
||||
* types associated with a drag from a single item.
|
||||
*/
|
||||
function TransferData(aFlavourDataList)
|
||||
{
|
||||
this.dataList = aFlavourDataList || [];
|
||||
|
||||
this._XferID = "TransferData";
|
||||
}
|
||||
TransferData.prototype = {
|
||||
__proto__: TransferDataBase.prototype,
|
||||
|
||||
addDataForFlavour: function (aFlavourString, aData, aLength, aDataIIDKey)
|
||||
{
|
||||
this.dataList.push(new FlavourData(aData, aLength,
|
||||
new Flavour(aFlavourString, aDataIIDKey)));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* FlavourData is a type that represents data retrieved from the system
|
||||
* clipboard or drag and drop. It is constructed internally by the Transferable
|
||||
* using the raw (nsISupports) data from the clipboard, the length of the data,
|
||||
* and an object of type Flavour representing the type. Clients implementing
|
||||
* IDragDropObserver receive an object of this type in their implementation of
|
||||
* onDrop. They access the 'data' property to retrieve data, which is either data
|
||||
* QI'ed to a usable form, or unicode string.
|
||||
*/
|
||||
function FlavourData(aData, aLength, aFlavour)
|
||||
{
|
||||
this.supports = aData;
|
||||
this.contentLength = aLength;
|
||||
this.flavour = aFlavour || null;
|
||||
|
||||
this._XferID = "FlavourData";
|
||||
}
|
||||
|
||||
FlavourData.prototype = {
|
||||
get data ()
|
||||
{
|
||||
if (this.flavour &&
|
||||
this.flavour.dataIIDKey != "nsISupportsWString" )
|
||||
return this.supports.QueryInterface(Components.interfaces[this.flavour.dataIIDKey]);
|
||||
else {
|
||||
var unicode = this.supports.QueryInterface(Components.interfaces.nsISupportsWString);
|
||||
if (unicode)
|
||||
return unicode.data.substring(0, this.contentLength/2);
|
||||
|
||||
return this.supports;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TransferData object with a single FlavourData entry. Used when
|
||||
* unwrapping data of a specific flavour from the drag service.
|
||||
*/
|
||||
function FlavourToXfer(aData, aLength, aFlavour)
|
||||
{
|
||||
return new TransferData([new FlavourData(aData, aLength, aFlavour)]);
|
||||
}
|
||||
|
||||
/*
|
||||
function DUMP_obj (aObj)
|
||||
{
|
||||
for (var i in aObj)
|
||||
dump("*** aObj[" + i + "] = " + aObj[i] + "\n");
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* Peter Annema <disttsc@bart.nl>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
* Ben Goodger <ben@netscape.com>
|
||||
*/
|
||||
|
||||
// helper routines, for doing rdf-based cut/copy/paste/etc
|
||||
|
@ -50,28 +51,105 @@ var bmTypeRes = RDF.GetResource(NC_NS + "Bookmark");
|
|||
// this is a hack for now - just assume containment
|
||||
var containment = RDF.GetResource(NC_NS + "child");
|
||||
|
||||
<<<<<<< nsTreeController.js
|
||||
function nsTreeController (aTreeID, aParent)
|
||||
=======
|
||||
function isContainer(node)
|
||||
>>>>>>> 1.3
|
||||
{
|
||||
return node.getAttribute("container") == "true";
|
||||
this._treeID = aTreeID;
|
||||
this.parent = aParent;
|
||||
}
|
||||
|
||||
function getWStringData(wstring, len)
|
||||
nsTreeController.prototype =
|
||||
{
|
||||
wstring = wstring.QueryInterface(nsISupportsWString);
|
||||
var result = wstring.data.substring(0, len/2);
|
||||
return result;
|
||||
}
|
||||
|
||||
function nsTreeController_SetTransferData(transferable, flavor, text)
|
||||
{
|
||||
if (!text) return;
|
||||
var textData = Components.classes[supportswstring_contractid].createInstance(nsISupportsWString);
|
||||
textData.data = text;
|
||||
|
||||
transferable.addDataFlavor(flavor);
|
||||
transferable.setTransferData(flavor, textData, text.length*2);
|
||||
// store the tree's Id, rather than the tree, to avoid holding a strong ref
|
||||
_treeID: null,
|
||||
get tree ()
|
||||
{
|
||||
return document.getElementById(this.treeId);
|
||||
},
|
||||
|
||||
supportsCommand: function(command)
|
||||
{
|
||||
switch(command) {
|
||||
case "cmd_undo":
|
||||
case "cmd_redo":
|
||||
return false;
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_paste":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
isCommandEnabled: function(command)
|
||||
{
|
||||
switch (command) {
|
||||
case "cmd_undo":
|
||||
case "cmd_redo":
|
||||
return false;
|
||||
case "cmd_paste":
|
||||
return gBookmarksShell.canPaste();
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_delete":
|
||||
return this.tree.selectedItems.length >= 1;
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
doCommand: function(command)
|
||||
{
|
||||
switch(command) {
|
||||
case "cmd_undo":
|
||||
case "cmd_redo":
|
||||
return;
|
||||
case "cmd_cut":
|
||||
this.cut(this.getTree());
|
||||
case "cmd_copy":
|
||||
this.copy(this.getTree());
|
||||
case "cmd_paste":
|
||||
this.paste(this.getTree());
|
||||
case "cmd_delete":
|
||||
this.doDelete(this.getTree());
|
||||
case "cmd_selectAll":
|
||||
this.tree.selectAll();
|
||||
}
|
||||
},
|
||||
|
||||
onEvent: function (aEvent)
|
||||
{
|
||||
switch (aEvent) {
|
||||
case "tree-select":
|
||||
this.onCommandUpdate();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
{
|
||||
var commands = ["cmd_cut", "cmd_copy", "cmd_paste",
|
||||
"cmd_delete", "cmd_selectAll"];
|
||||
for (var i = 0; i < commands.length; ++i)
|
||||
goUpdateCommand(commands[i]);
|
||||
}
|
||||
|
||||
SetTransferData : nsTreeController_SetTransferData,
|
||||
copy: nsTreeController_copy,
|
||||
cut: nsTreeController_cut,
|
||||
paste: nsTreeController_paste,
|
||||
doDelete: nsTreeController_delete
|
||||
}
|
||||
|
||||
<<<<<<< nsTreeController.js
|
||||
=======
|
||||
function nsTreeController_copy(tree)
|
||||
{
|
||||
var select_list = tree.selectedItems;
|
||||
|
@ -131,17 +209,11 @@ function nsTreeController_copy(tree)
|
|||
|
||||
// get some useful components
|
||||
var trans = Components.classes[nsTransferable_contractid].createInstance(nsITransferable);
|
||||
>>>>>>> 1.3
|
||||
|
||||
Clipboard.emptyClipboard(nsIClipboard.kGlobalClipboard);
|
||||
|
||||
this.SetTransferData(trans, "moz/bookmarkclipboarditem", url);
|
||||
this.SetTransferData(trans, "text/unicode", text);
|
||||
this.SetTransferData(trans, "text/html", html);
|
||||
|
||||
Clipboard.setData(trans, null, nsIClipboard.kGlobalClipboard);
|
||||
return true;
|
||||
}
|
||||
|
||||
<<<<<<< nsTreeController.js
|
||||
=======
|
||||
function nsTreeController_cut(tree)
|
||||
{
|
||||
if (this.copy(tree)) {
|
||||
|
@ -439,4 +511,5 @@ nsTreeController.prototype =
|
|||
paste: nsTreeController_paste,
|
||||
doDelete: nsTreeController_delete
|
||||
}
|
||||
>>>>>>> 1.3
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
dump("<StringBundle> Error: Failed to get string from bundle. Are you using the right key?\n");
|
||||
dump("The key you provided was: " + aStringKey + "\n");
|
||||
dump("The exception thrown was:\n" + e + "\n");
|
||||
throw e;
|
||||
return null;
|
||||
}
|
||||
]]>
|
||||
|
@ -74,7 +75,6 @@
|
|||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<property name="_bundle"/>
|
||||
<property name="_src"/>
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<content>
|
||||
<xul:box class="tab-box" flex="1" autostretch="never" orient="horizontal">
|
||||
<xul:image class="tab-image" inherits="src"/>
|
||||
<xul:text class="tab-text" inherits="value,accesskey,crop"/>
|
||||
<xul:text class="tab-text" inherits="value,accesskey,crop,disabled"/>
|
||||
</xul:box>
|
||||
</content>
|
||||
<implementation>
|
||||
|
|
|
@ -47,12 +47,152 @@
|
|||
<binding id="treecell-indented-folder">
|
||||
<content autostretch="never">
|
||||
<xul:treeindentation/>
|
||||
<xul:image class="tree-cell-twisty" twisty="true" allowevents="true"/>
|
||||
<xul:image class="tree-cell-twisty" twisty="true" inherits="hidden=notwisty" allowevents="true"/>
|
||||
<xul:image class="tree-cell-primary-icon" inherits="src"/>
|
||||
<xul:text class="tree-cell-text" inherits="crop,value,align" flex="1" crop="right"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<!-- Inline Editable Treecell -->
|
||||
<!--
|
||||
This same base-binding will probably become the foundation of inline-editable
|
||||
buttons, but at the moment it's kinda specific to the anonymous treecell
|
||||
content in the bindings that derive from it. In the next milestone this binding
|
||||
will become more generic to support any anonymous content.
|
||||
-->
|
||||
<binding id="treecell-indented-folder-inline-edit-base">
|
||||
<implementation>
|
||||
<property name="_mode">0</property>
|
||||
<method name="setMode">
|
||||
<parameter name="val"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var row = this.parentNode;
|
||||
if (val == "edit") {
|
||||
var nodes = document.getAnonymousNodes(this);
|
||||
var box = nodes[nodes.length-1];
|
||||
if (box.firstChild.getAttribute("hidden") != "true") {
|
||||
row.setAttribute("mode", "inline-edit");
|
||||
box.setAttribute("mode", "edit");
|
||||
box.firstChild.setAttribute("hidden", "true");
|
||||
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
var field = document.createElementNS(kXULNS, "textfield");
|
||||
field.className = "textfield-inline-edit";
|
||||
field.setAttribute("flex", "1");
|
||||
field.setAttribute("value", box.firstChild.getAttribute("value"));
|
||||
box.appendChild(field);
|
||||
field.addEventListener("keydown", this.fieldKeyDown, false);
|
||||
field.addEventListener("change", this.fieldChange, false);
|
||||
field.select();
|
||||
}
|
||||
}
|
||||
else {
|
||||
nodes = document.getAnonymousNodes(this);
|
||||
box = nodes[nodes.length-1];
|
||||
if (box.firstChild.getAttribute("hidden") == "true") {
|
||||
row.removeAttribute("mode");
|
||||
box.removeAttribute("mode");
|
||||
box.lastChild.blur();
|
||||
box.removeChild(box.lastChild);
|
||||
box.firstChild.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<property name="_observers">
|
||||
<![CDATA[
|
||||
({
|
||||
reject: [],
|
||||
accept: []
|
||||
})
|
||||
]]>
|
||||
</property>
|
||||
<method name="addObserver">
|
||||
<parameter name="aObserver"/>
|
||||
<parameter name="aTopic"/>
|
||||
<parameter name="aParams"/>
|
||||
<body>
|
||||
this._observers[aTopic].push({ callback: aObserver, params: aParams });
|
||||
</body>
|
||||
</method>
|
||||
<method name="fieldKeyDown">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var cell = aEvent.target.parentNode.parentNode;
|
||||
var nodes = document.getAnonymousNodes(cell);
|
||||
var box = nodes[nodes.length-1];
|
||||
if (aEvent.keyCode == 13) {
|
||||
cell.valueIsAccepted = true;
|
||||
for (var i = 0; i < cell._observers["accept"].length; ++i)
|
||||
cell._observers["accept"][i].callback(cell._observers["accept"][i].params.concat(box.lastChild.value), "accept");
|
||||
}
|
||||
else if (aEvent.keyCode == 27) {
|
||||
for (i = 0; i < cell._observers["reject"].length; ++i)
|
||||
cell._observers["reject"][i].callback(cell._observers["reject"][i].params.concat(box.lastChild.value), "reject");
|
||||
if ("setMode" in cell)
|
||||
cell.setMode("normal");
|
||||
}
|
||||
aEvent.preventBubble();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<property name="valueIsAccepted">false</property>
|
||||
<method name="fieldChange">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var cell = aEvent.target.parentNode.parentNode;
|
||||
var nodes = document.getAnonymousNodes(cell);
|
||||
var box = nodes[nodes.length-1];
|
||||
var newValue = box.lastChild.value;
|
||||
var topic = "reject"; // cell.valueIsAccepted ? "accept" : "reject";
|
||||
for (var i = 0; i < cell._observers[topic].length; ++i)
|
||||
cell._observers[topic][i].callback(cell._observers[topic][i].params.concat(box.lastChild.value), topic);
|
||||
if ("setMode" in cell)
|
||||
cell.setMode("normal");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="treecell-indented-folder-inline-edit"
|
||||
extends="chrome://global/content/treeBindings.xml#treecell-indented-folder-inline-edit-base">
|
||||
<content autostretch="never">
|
||||
<xul:treeindentation/>
|
||||
<xul:image class="tree-cell-twisty" twisty="true" inherits="hidden=notwisty" allowevents="true"/>
|
||||
<xul:image class="tree-cell-primary-icon-inline-edit-folder" inherits="src"/>
|
||||
<xul:box class="inline-edit-cell-box" flex="1">
|
||||
<xul:text class="inline-edit-cell-text"
|
||||
inherits="crop,value,align,mode" flex="1" crop="right"/>
|
||||
</xul:box>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="treecell-indented-leaf-inline-edit"
|
||||
extends="chrome://global/content/treeBindings.xml#treecell-indented-folder-inline-edit-base">
|
||||
<content autostretch="never">
|
||||
<xul:treeindentation/>
|
||||
<xul:image class="tree-cell-primary-icon-inline-edit-leaf" inherits="src"/>
|
||||
<xul:box class="inline-edit-cell-box" flex="1">
|
||||
<xul:text class="inline-edit-cell-text"
|
||||
inherits="crop,value,align,mode" flex="1" crop="right"/>
|
||||
</xul:box>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="treecell-inline-edit"
|
||||
extends="chrome://global/content/treeBindings.xml#treecell-indented-folder-inline-edit-base">
|
||||
<content autostretch="never">
|
||||
<xul:box class="inline-edit-cell-box" flex="1">
|
||||
<xul:text class="inline-edit-cell-text"
|
||||
inherits="crop,value,align,mode" flex="1" crop="right"/>
|
||||
</xul:box>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="treecell-indented-leaf">
|
||||
<content autostretch="never">
|
||||
<xul:treeindentation/>
|
||||
|
@ -95,7 +235,7 @@
|
|||
<content>
|
||||
<xul:box class="treecell-header-box" flex="1" autostretch="never">
|
||||
<xul:image class="tree-header-image" inherits="src"/>
|
||||
<xul:text class="tree-header-text" inherits="crop,value" flex="1" crop="right"/>
|
||||
<xul:text class="tree-header-text" inherits="crop,value,disabled" flex="1" crop="right"/>
|
||||
<xul:image class="tree-header-sortdirection"/>
|
||||
</xul:box>
|
||||
</content>
|
||||
|
@ -214,7 +354,7 @@
|
|||
if ( el && (el.tagName != "tree") ) this.selectItem(el);
|
||||
}
|
||||
else {
|
||||
var el = this.selectedItems[0];
|
||||
el = this.selectedItems[0];
|
||||
el.close();
|
||||
}
|
||||
]]>
|
||||
|
@ -398,6 +538,7 @@
|
|||
except this item. -->
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (event.button != 1) return;
|
||||
var t = event.originalTarget;
|
||||
if (t.localName == 'treecell') {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
|
|
|
@ -28,8 +28,9 @@ function BuildTreePopup( treeColGroup, treeHeadRow, popup, skipCell )
|
|||
|
||||
var currTreeCol = treeHeadRow.firstChild;
|
||||
var currColNode = treeColGroup.firstChild;
|
||||
var count = 0;
|
||||
while (currTreeCol) {
|
||||
if (currColNode.tagName == "splitter")
|
||||
if (currColNode.localName == "splitter")
|
||||
currColNode = currColNode.nextSibling;
|
||||
|
||||
if (skipCell != currTreeCol) {
|
||||
|
@ -40,6 +41,7 @@ function BuildTreePopup( treeColGroup, treeHeadRow, popup, skipCell )
|
|||
popupChild = document.createElement("menuitem");
|
||||
popupChild.setAttribute("type", "checkbox");
|
||||
popupChild.setAttribute("value", columnName);
|
||||
if (!count++) popupChild.setAttribute("disabled", "true");
|
||||
if (columnName == "") {
|
||||
var display = currTreeCol.getAttribute("display");
|
||||
popupChild.setAttribute("value", display);
|
||||
|
@ -87,7 +89,6 @@ function ToggleColumnState(popupElement, doc)
|
|||
var colid = popupElement.getAttribute("colid");
|
||||
var colNode = doc.getElementById(colid);
|
||||
if (colNode) {
|
||||
dump(colNode.id + "\n");
|
||||
var checkedState = popupElement.getAttribute("checked");
|
||||
if (checkedState == "true")
|
||||
colNode.removeAttribute("hidden");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/** this should only contain XUL dialog and document window widget defaults. Defaults for widgets of
|
||||
/** this should only contain XUL dialog and document window widget defaults. Defaults for widgets of
|
||||
a particular application should be in that application's style sheet.
|
||||
For example style definitions for navigator can be found in navigator.css
|
||||
|
||||
|
@ -76,6 +76,12 @@ keyset, key {
|
|||
display: none;
|
||||
}
|
||||
|
||||
/* templates */
|
||||
rule, conditions, action, bindings, binding, content, member, triple
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* Window
|
||||
**********************************/
|
||||
|
@ -238,7 +244,7 @@ popup {
|
|||
display: none;
|
||||
}
|
||||
|
||||
popup.tooltip {
|
||||
popup.tooltip, .popup-infopopup {
|
||||
-moz-binding: url("chrome://global/content/xulBindings.xml#tooltips");
|
||||
}
|
||||
|
||||
|
@ -280,6 +286,19 @@ treeitem {
|
|||
-moz-binding: url("chrome://global/content/treeBindings.xml#treeitem");
|
||||
}
|
||||
|
||||
/* Inline Editable Treecell */
|
||||
.treecell-indent-editable {
|
||||
-moz-binding: url("chrome://global/content/treeBindings.xml#treecell-indented-leaf-inline-edit");
|
||||
}
|
||||
|
||||
treeitem[container="true"] > treerow > .treecell-indent-editable {
|
||||
-moz-binding: url("chrome://global/content/treeBindings.xml#treecell-indented-folder-inline-edit");
|
||||
}
|
||||
|
||||
.treecell-inline-edit {
|
||||
-moz-binding: url("chrome://global/content/treeBindings.xml#treecell-inline-edit");
|
||||
}
|
||||
|
||||
treecell {
|
||||
vertical-align: middle;
|
||||
-moz-binding: url("chrome://global/content/treeBindings.xml#treecell");
|
||||
|
@ -666,6 +685,41 @@ stringbundle
|
|||
visibility : collapse;
|
||||
}
|
||||
|
||||
resizer[direction="right"]
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#r-resizer");
|
||||
}
|
||||
|
||||
resizer[direction="bottom"]
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#b-resizer");
|
||||
}
|
||||
|
||||
resizer[direction="bottomright"]
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#rb-resizer");
|
||||
}
|
||||
|
||||
titlebar
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#titlebar");
|
||||
}
|
||||
|
||||
popup[type="floater"]
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#floater-normal");
|
||||
}
|
||||
|
||||
popup[type="floater"][docked="left"]
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#floater-dock-left");
|
||||
}
|
||||
|
||||
button.popupClose
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/popupBindings.xml#close-button") !important;
|
||||
}
|
||||
|
||||
stringbundleset
|
||||
{
|
||||
-moz-binding : url("chrome://global/content/stringbundleBindings.xml#stringbundleset");
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
|
||||
%textcontextDTD;
|
||||
|
@ -44,25 +45,28 @@
|
|||
|
||||
|
||||
<binding id="menu-menubar">
|
||||
<content includes="menupopup">
|
||||
<content>
|
||||
<xul:text class="menubar-text" inherits="value,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup,template"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu-menubar-iconic">
|
||||
<content includes="menupopup">
|
||||
<content>
|
||||
<xul:image class="menubar-left"/>
|
||||
<xul:text class="menubar-text" inherits="value,accesskey,crop" crop="right"/>
|
||||
<children includes="menupopup,template"/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="menu">
|
||||
<content autostretch="never" includes="menupopup">
|
||||
<content autostretch="never">
|
||||
<xul:text class="menu-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
|
||||
<xul:text class="menu-accel" inherits="acceltext:value"/>
|
||||
<xul:box autostretch="never" class="menu-right" inherits="menuactive,disabled">
|
||||
<xul:image/>
|
||||
</xul:box>
|
||||
<children includes="menupopup,template"/>
|
||||
</content>
|
||||
<implementation>
|
||||
<property name="data" onset="this.setAttribute('data',val); return val;"
|
||||
|
@ -84,7 +88,7 @@
|
|||
<binding id="menuitem-iconic">
|
||||
<content includes="menupopup">
|
||||
<xul:box class="menu-iconic-left" orient="vertical" autostretch="never" inherits="selected,menuactive,disabled,checked">
|
||||
<xul:image/>
|
||||
<xul:image inherits="src"/>
|
||||
</xul:box>
|
||||
<xul:text class="menu-iconic-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
|
||||
<xul:text class="menu-iconic-accel" inherits="value=acceltext"/>
|
||||
|
@ -96,15 +100,16 @@
|
|||
</binding>
|
||||
|
||||
<binding id="menu-iconic">
|
||||
<content autostretch="never" includes="menupopup">
|
||||
<content autostretch="never">
|
||||
<xul:box class="menu-iconic-left" orient="vertical" autostretch="never">
|
||||
<xul:image/>
|
||||
<xul:image inherits="src"/>
|
||||
</xul:box>
|
||||
<xul:text class="menu-iconic-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
|
||||
<xul:text class="menu-iconic-accel" inherits="value=acceltext"/>
|
||||
<xul:box orient="vertical" autostretch="never" class="menu-right" inherits="menuactive,disabled">
|
||||
<xul:image/>
|
||||
</xul:box>
|
||||
<children includes="menupopup,template"/>
|
||||
</content>
|
||||
<implementation>
|
||||
<property name="data" onset="this.setAttribute('data',val); return val;"
|
||||
|
|
Загрузка…
Ссылка в новой задаче