Bug 419343 - allow drag & drop of events from today pane;r=daniel
This commit is contained in:
Родитель
9753a4b578
Коммит
0e35e0d7b1
|
@ -147,6 +147,13 @@
|
|||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="draggesture" phase="capturing"><![CDATA[
|
||||
invokeEventDragSession(this.mAllDayItem.occurrence.clone(), this);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="agenda-richlist-item"
|
||||
|
@ -200,5 +207,10 @@
|
|||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="draggesture"><![CDATA[
|
||||
invokeEventDragSession(this.mOccurrence.clone(), this);
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
|
@ -570,7 +570,7 @@ function invokeEventDragSession(aItem, aXULBox) {
|
|||
let supArray = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
supArray.AppendElement(transfer);
|
||||
|
||||
aXULBox.sourceObject = aItem;
|
||||
cal.getDragService().invokeDragSession(aXULBox, supArray, null, action);
|
||||
}
|
||||
|
||||
|
|
|
@ -1125,29 +1125,7 @@
|
|||
ASSERT(false, "Error while building selection region: " + ex + "\n");
|
||||
region = null;
|
||||
}
|
||||
|
||||
var dragService = Components.classes["@mozilla.org/widget/dragservice;1"].
|
||||
getService(Components.interfaces.nsIDragService);
|
||||
var transfer = Components.classes["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Components.interfaces.nsITransferable);
|
||||
transfer.addDataFlavor("text/calendar");
|
||||
|
||||
var serializer = Components.classes["@mozilla.org/calendar/ics-serializer;1"].
|
||||
createInstance(Components.interfaces.calIIcsSerializer);
|
||||
serializer.addItems([item], 1);
|
||||
|
||||
var supportsString = Components.classes["@mozilla.org/supports-string;1"].
|
||||
createInstance(Components.interfaces.nsISupportsString);
|
||||
supportsString.data = serializer.serializeToString();
|
||||
transfer.setTransferData("text/calendar", supportsString, supportsString.data.length*2);
|
||||
transfer.setTransferData("text/unicode", supportsString, supportsString.data.length*2);
|
||||
|
||||
var action = dragService.DRAGDROP_ACTION_MOVE;
|
||||
var supArray = Components.classes["@mozilla.org/supports-array;1"].
|
||||
createInstance(Components.interfaces.nsISupportsArray);
|
||||
supArray.AppendElement(transfer);
|
||||
|
||||
dragService.invokeDragSession(event.target, supArray, region, action);
|
||||
invokeEventDragSession(item, event.target);
|
||||
]]></handler>
|
||||
</handlers>
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@
|
|||
if (session) {
|
||||
session.canDrop = true;
|
||||
if (aVal == "true") {
|
||||
this.mDropShadows = [session.sourceNode.occurrence];
|
||||
this.mDropShadows = [session.sourceNode.sourceObject];
|
||||
this.addDropShadows();
|
||||
} else {
|
||||
this.removeDropShadows();
|
||||
|
@ -387,7 +387,7 @@
|
|||
<handler event="dragdrop"><![CDATA[
|
||||
event.stopPropagation();
|
||||
let session = cal.getDragService().getCurrentSession();
|
||||
let item = session.sourceNode.occurrence.clone();
|
||||
let item = session.sourceNode.sourceObject.clone();
|
||||
this.setAttribute("dropbox", "false");
|
||||
let transfer = Components.classes["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Components.interfaces.nsITransferable);
|
||||
|
@ -404,10 +404,10 @@
|
|||
// sourceNode property and get the event that way
|
||||
//transfer.getAnyTransferData(flavor, data, {});
|
||||
|
||||
if (!session.sourceNode || !session.sourceNode.occurrence) {
|
||||
if (!session.sourceNode || !session.sourceNode.sourceObject) {
|
||||
return;
|
||||
}
|
||||
let item = session.sourceNode.occurrence;
|
||||
let item = session.sourceNode.sourceObject;
|
||||
let newItem = this.onDropItem(item, session).clone();
|
||||
let newStart = newItem.startDate || newItem.entryDate;
|
||||
let newEnd = newItem.endDate || newItem.dueDate;
|
||||
|
|
Загрузка…
Ссылка в новой задаче