mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
more d&d feedback... select dropped items NPOB
This commit is contained in:
parent
86283b16ab
commit
d02abb7b32
@ -908,15 +908,16 @@ var PlacesController = {
|
||||
}
|
||||
},
|
||||
|
||||
willReloadView: function PC_willReloadView(action, view, insertionPoint, insertCount) {
|
||||
willReloadView: function PC_willReloadView(action, targetView,
|
||||
insertionPoint, insertCount) {
|
||||
for (var i = 0; i < this._viewObservers.length; ++i)
|
||||
this._viewObservers[i].willReloadView(action, this._activeView,
|
||||
this._viewObservers[i].willReloadView(action, targetView,
|
||||
insertionPoint, insertCount);
|
||||
},
|
||||
|
||||
didReloadView: function PC_didReloadView(view) {
|
||||
didReloadView: function PC_didReloadView(targetView) {
|
||||
for (var i = 0; i < this._viewObservers.length; ++i)
|
||||
this._viewObservers[i].didReloadView(view);
|
||||
this._viewObservers[i].didReloadView(targetView);
|
||||
},
|
||||
};
|
||||
|
||||
@ -992,21 +993,24 @@ var PlacesControllerDragHelper = {
|
||||
|
||||
/**
|
||||
* Handles the drop of one or more items onto a view.
|
||||
* @param view
|
||||
* @param sourceView
|
||||
* The AVI-implementing object that started the drop.
|
||||
* @param targetView
|
||||
* The AVI-implementing object that received the drop.
|
||||
* @param insertionPoint
|
||||
* The insertion point where the items should be dropped
|
||||
* @param orientation
|
||||
* The orientation of the drop
|
||||
*/
|
||||
onDrop: function PCDH_onDrop(view, insertionPoint, orientation) {
|
||||
onDrop: function PCDH_onDrop(sourceView, targetView, insertionPoint,
|
||||
orientation) {
|
||||
var session = this._getSession();
|
||||
if (!session)
|
||||
return;
|
||||
|
||||
var copy = session.dragAction & Ci.nsIDragService.DRAGDROP_ACTION_COPY;
|
||||
var transactions = [];
|
||||
var xferable = this._initTransferable(view, orientation);
|
||||
var xferable = this._initTransferable(targetView, orientation);
|
||||
for (var i = 0; i < session.numDropItems; ++i) {
|
||||
session.getData(xferable, i);
|
||||
|
||||
@ -1021,11 +1025,16 @@ var PlacesControllerDragHelper = {
|
||||
flavor.value, insertionPoint.folderId,
|
||||
insertionPoint.index, copy));
|
||||
}
|
||||
PlacesController.willReloadView(RELOAD_ACTION_INSERT, view,
|
||||
|
||||
if (sourceView)
|
||||
sourceView.willReloadView(RELOAD_ACTION_REMOVE, sourceView, null, 0);
|
||||
PlacesController.willReloadView(RELOAD_ACTION_INSERT, targetView,
|
||||
insertionPoint, session.numDropItems);
|
||||
var txn = new PlacesAggregateTransaction("DropItems", transactions);
|
||||
PlacesController._hist.transactionManager.doTransaction(txn);
|
||||
PlacesController.didReloadView(view);
|
||||
if (sourceView)
|
||||
sourceView.didReloadView(sourceView);
|
||||
PlacesController.didReloadView(targetView);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -359,11 +359,20 @@
|
||||
if (!this.canDrop(index, orientation))
|
||||
return;
|
||||
|
||||
var dragService =
|
||||
Cc["@mozilla.org/widget/dragservice;1"].
|
||||
getService(Ci.nsIDragService);
|
||||
var session = dragService.getCurrentSession();
|
||||
var sourceView = session.sourceNode.wrappedJSObject;
|
||||
while (sourceView && sourceView.localName != "tree")
|
||||
sourceView = sourceView.parentNode;
|
||||
|
||||
// We are responsible for translating the |index| and |orientation|
|
||||
// parameters into a container id and index within the container,
|
||||
// since this information is specific to the tree view.
|
||||
var ip = this._self._getInsertionPoint(index, orientation);
|
||||
PlacesControllerDragHelper.onDrop(this._self, ip, orientation);
|
||||
PlacesControllerDragHelper.onDrop(sourceView, this._self, ip,
|
||||
orientation);
|
||||
},
|
||||
|
||||
_states: { },
|
||||
@ -455,8 +464,6 @@
|
||||
if (view != this)
|
||||
action = RELOAD_ACTION_NOTHING;
|
||||
|
||||
LOG("VIEW = " + view.id + ", THIS = " + this.id + " ACTION: " + action);
|
||||
|
||||
switch (action) {
|
||||
case RELOAD_ACTION_NOTHING:
|
||||
for (var i = 0; i < rc; ++i) {
|
||||
@ -474,8 +481,6 @@
|
||||
options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1);
|
||||
var result = this._places.executeQuery(query, options);
|
||||
if (insertionPoint.index > -1) {
|
||||
LOG("IP: " + insertionPoint.toSource())
|
||||
LOG("CC: " + result.childCount + ", result.itemTypes = " + this.filterOptions + " ID : " + this.id);
|
||||
var node = result.getChild(insertionPoint.index - 1);
|
||||
var index = this.getResult().treeIndexForNode(node);
|
||||
if (insertionPoint.index == result.childCount)
|
||||
|
Loading…
Reference in New Issue
Block a user