зеркало из https://github.com/mozilla/pjs.git
bug 210196 Fix use of bookmarks root / top root as a target and correct caller of CanDropBeforeAfter
r=varga, sr=jag
This commit is contained in:
Родитель
06c602fd58
Коммит
c057ca60fd
|
@ -2095,7 +2095,7 @@ nsXULTreeBuilder::Drop(PRInt32 row, PRInt32 orient)
|
||||||
if (orient == nsITreeView::inDropOn)
|
if (orient == nsITreeView::inDropOn)
|
||||||
observer->CanDropOn(row, &canDrop);
|
observer->CanDropOn(row, &canDrop);
|
||||||
else
|
else
|
||||||
observer->CanDropBeforeAfter(row, orient, &canDrop);
|
observer->CanDropBeforeAfter(row, orient == nsITreeView::inDropBefore, &canDrop);
|
||||||
if (canDrop)
|
if (canDrop)
|
||||||
observer->OnDrop(row, orient);
|
observer->OnDrop(row, orient);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3687,7 +3687,7 @@ nsTreeBodyFrame::OnDragOver(nsIDOMEvent* aEvent)
|
||||||
if (mDropOrient == nsITreeView::inDropOn)
|
if (mDropOrient == nsITreeView::inDropOn)
|
||||||
mView->CanDropOn(mDropRow, &canDropAtNewLocation);
|
mView->CanDropOn(mDropRow, &canDropAtNewLocation);
|
||||||
else
|
else
|
||||||
mView->CanDropBeforeAfter (mDropRow, mDropOrient == nsITreeView::inDropBefore ? PR_TRUE : PR_FALSE, &canDropAtNewLocation);
|
mView->CanDropBeforeAfter(mDropRow, mDropOrient == nsITreeView::inDropBefore, &canDropAtNewLocation);
|
||||||
|
|
||||||
if (canDropAtNewLocation) {
|
if (canDropAtNewLocation) {
|
||||||
// Invalidate row at the new location.
|
// Invalidate row at the new location.
|
||||||
|
|
|
@ -29,7 +29,6 @@ function Startup()
|
||||||
const windowNode = document.getElementById("bookmark-window");
|
const windowNode = document.getElementById("bookmark-window");
|
||||||
const bookmarksView = document.getElementById("bookmarks-view");
|
const bookmarksView = document.getElementById("bookmarks-view");
|
||||||
|
|
||||||
var rowIndex = 0;
|
|
||||||
var titleString;
|
var titleString;
|
||||||
|
|
||||||
// If we've been opened with a parameter, root the tree on it.
|
// If we've been opened with a parameter, root the tree on it.
|
||||||
|
@ -54,12 +53,9 @@ function Startup()
|
||||||
// always open the bookmark top root folder
|
// always open the bookmark top root folder
|
||||||
if (!bookmarksView.treeBoxObject.view.isContainerOpen(0))
|
if (!bookmarksView.treeBoxObject.view.isContainerOpen(0))
|
||||||
bookmarksView.treeBoxObject.view.toggleOpenState(0);
|
bookmarksView.treeBoxObject.view.toggleOpenState(0);
|
||||||
// XXXvarga this should go away once bug 200067 is fixed.
|
|
||||||
if (!bookmarksView.treeBoxObject.view.isContainerEmpty(0))
|
|
||||||
rowIndex = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bookmarksView.treeBoxObject.selection.select(rowIndex);
|
bookmarksView.treeBoxObject.selection.select(0);
|
||||||
|
|
||||||
windowNode.setAttribute("title", titleString);
|
windowNode.setAttribute("title", titleString);
|
||||||
|
|
||||||
|
|
|
@ -275,12 +275,12 @@
|
||||||
<parameter name="aParent"/>
|
<parameter name="aParent"/>
|
||||||
<parameter name="aOrientation"/>
|
<parameter name="aOrientation"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (aItem === undefined)
|
|
||||||
return BookmarksUtils.getTargetFromFolder(this.getRootResource());
|
|
||||||
|
|
||||||
if (aOrientation == BookmarksUtils.DROP_ON) {
|
if (!aParent || aParent.Value == "NC:BookmarksTopRoot")
|
||||||
|
return BookmarksUtils.getTargetFromFolder(RDF.GetResource("NC:BookmarksRoot"))
|
||||||
|
|
||||||
|
if (aOrientation == BookmarksUtils.DROP_ON)
|
||||||
return BookmarksUtils.getTargetFromFolder(aItem);
|
return BookmarksUtils.getTargetFromFolder(aItem);
|
||||||
}
|
|
||||||
|
|
||||||
RDFC.Init(this.db, aParent);
|
RDFC.Init(this.db, aParent);
|
||||||
var index = RDFC.IndexOf(aItem);
|
var index = RDFC.IndexOf(aItem);
|
||||||
|
@ -483,7 +483,7 @@
|
||||||
var selection = this.mOuter._selection;
|
var selection = this.mOuter._selection;
|
||||||
aXferData.data = BookmarksUtils.getXferDataFromSelection(selection);
|
aXferData.data = BookmarksUtils.getXferDataFromSelection(selection);
|
||||||
const kDSIID = Components.interfaces.nsIDragService;
|
const kDSIID = Components.interfaces.nsIDragService;
|
||||||
if (aEvent.ctrlKey || !selection.containsMutable)
|
if (aEvent.ctrlKey)
|
||||||
aDragAction.action = kDSIID.DRAGDROP_ACTION_COPY;
|
aDragAction.action = kDSIID.DRAGDROP_ACTION_COPY;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Загрузка…
Ссылка в новой задаче